-
Notifications
You must be signed in to change notification settings - Fork 333
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
Improve dba::selectFirst calls #4206
Conversation
- Fix remaining $r[0] references - Rename $r to meaningful names
155c473
to
ed2ac8d
Compare
Is it some urgent bugfix or has it time to be reviewed this evening (European time)? |
It has some bug fixes but nobody complained so far, so we're good on the time frame. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 ;-)
There was a problem hiding this comment.
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) && |
There was a problem hiding this comment.
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 :-)
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.