Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dba::selectFirst calls #4206

Merged
merged 3 commits into from
Jan 11, 2018

Conversation

MrPetovan
Copy link
Collaborator

Part of #4176

While doing #4205, I realized that some calls to dba::selectFirst weren't cleanly done. I was able to find some remaining references to the previous $r[0] record.

I decided to go on a mgical journey, and visit all current dba::selectFirst() calls and either improve the legibility by renaming the return variable or fixing an eventual forgotten reference.

Hypolite Petovan added 2 commits January 11, 2018 03:43
- Fix remaining $r[0] references
- Rename $r to meaningful names
@annando
Copy link
Collaborator

annando commented Jan 11, 2018

Is it some urgent bugfix or has it time to be reviewed this evening (European time)?

@MrPetovan
Copy link
Collaborator Author

It has some bug fixes but nobody complained so far, so we're good on the time frame.

Copy link
Collaborator

@annando annando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are small issues, but nothing important.

@@ -185,11 +184,11 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0)
INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = ? AND `profile`.`id` = ? LIMIT 1",
$nickname,
$profile_int
intval($profile_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intval is superfluous.

if (DBM::is_result($r)) {
$convid = $r['id'];
if (dba::insert('conv', $fields)) {
$convid = dba::lastInsertId();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's much too easy using that function ;-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know right! Programming should only about pain and suffering!

@@ -596,12 +596,12 @@ function networkThreadedView(App $a, $update = 0) {
'allow_location' => $a->user['allow_location'],
'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'],
'lockstate'=> ((($group) || ($cid) || ($nets) || (is_array($a->user) &&
'lockstate'=> ((($gid) || ($cid) || ($nets) || (is_array($a->user) &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have removed some of the brackets :-)

@annando annando merged commit 91198cb into friendica:develop Jan 11, 2018
@MrPetovan MrPetovan added this to the 3.6 milestone Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants