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

refactor: MySQL strict and query fixes #5338

Merged
merged 2 commits into from Jan 13, 2017

Conversation

Projects
None yet
4 participants
@laf
Member

laf commented Jan 7, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

These now start to address STRICT_TRANS_TABLES

@LibreNMS-CI

This comment has been minimized.

LibreNMS-CI commented Jan 7, 2017

Auto-Deploy finished, Test PR at http://5338.ci.librenms.org or https://5338.ci.librenms.org

@@ -14,7 +14,7 @@
$delete_username = dbFetchCell('SELECT username FROM users WHERE user_id = ?', array($vars['id']));
if ($vars['confirm'] == 'yes') {
if (deluser($delete_username)) {
if (deluser($vars['id']) >= 0) {

This comment has been minimized.

@murrant

murrant Jan 8, 2017

Member

Why not put the >= 0 check inside the function so it just returns a boolean?

This comment has been minimized.

@laf

laf Jan 8, 2017

Member

That function is in all of the authentication modules (well 3/4) so this seemed a bit more central.

This comment has been minimized.

@murrant

murrant Jan 8, 2017

Member

I was thinking of the function. What do you want to know upon return of the function. Was it successful or not. (rather than the id that you already sent or not if if it failed).

This comment has been minimized.

@laf

laf Jan 8, 2017

Member

Are you talking about the deluser() function?

This comment has been minimized.

@murrant

This comment has been minimized.

@laf

laf Jan 8, 2017

Member

That function is in all of the auth modules so it would mean updating them all to do that same check and return true / false when we can just do it here.

This comment has been minimized.

@murrant

murrant Jan 9, 2017

Member

Yes, because when you call deluser you will never want to know the user id you deleted.
Basically, there is a hidden rule that you need to add >= 0 after this method everytime it is called.

I understand that it is only called once and there is three implementations... Can't fix everything at once.

This comment has been minimized.

@laf

laf Jan 9, 2017

Member

I'm happy to update it but it just seems a bit ott for a function that we most likely won't ever call unless someone creates a deluser.php for cli.

This comment has been minimized.

@laf

laf Jan 12, 2017

Member

Want me to update the deluser() functions to be able to merge this?

This comment has been minimized.

@murrant

murrant Jan 12, 2017

Member

It's fine, I guess I'm just trying to express a general guideline...

@laf

This comment has been minimized.

Member

laf commented Jan 10, 2017

Rebased

@LibreNMS-CI

This comment has been minimized.

LibreNMS-CI commented Jan 10, 2017

Auto-Deploy finished, Test PR at http://5338.ci.librenms.org or https://5338.ci.librenms.org

@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented Jan 10, 2017

The inspection completed: 2 new issues, 1 updated code elements

@murrant murrant merged commit d529631 into librenms:master Jan 13, 2017

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@laf laf deleted the laf:mysqlllll1111 branch Jan 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment