fix: Alter the database to set the proper character set and collation #6189

Merged
merged 1 commit into from Mar 14, 2017

Conversation

Projects
None yet
5 participants
@murrant
Member

murrant commented Mar 13, 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.

  • Have you signed the Contributors agreement - please do NOT submit a pull request unless you have (signing the agreement in the same pull request is fine). Your commit message for signing the agreement must appear as per the docs.
  • Have you followed our code guidelines?

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Mar 13, 2017

Thank you for submitting a PR @murrant! We have found the following @f0o, @laf and @clinta based on the history of these files to review this PR.

Thank you for submitting a PR @murrant! We have found the following @f0o, @laf and @clinta based on the history of these files to review this PR.

@LibreNMS-CI

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Mar 13, 2017

The inspection completed: No new issues

The inspection completed: No new issues

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Mar 13, 2017

Member

This will run every 5 minutes as it's called from discovery.php.

Is it worth moving to validate.php and not throwing a fail just fixing it?

Member

laf commented Mar 13, 2017

This will run every 5 minutes as it's called from discovery.php.

Is it worth moving to validate.php and not throwing a fail just fixing it?

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Mar 13, 2017

Member

@laf If you look closely, it will only run if the schema is out of date.

Also, the ALTER query (assuming no change is needed) takes about the same time as the query to check what character set and collation are set to.

Member

murrant commented Mar 13, 2017

@laf If you look closely, it will only run if the schema is out of date.

Also, the ALTER query (assuming no change is needed) takes about the same time as the query to check what character set and collation are set to.

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Mar 13, 2017

Member

That's the issue when diffs only show the changes and no info is provided :)

Member

laf commented Mar 13, 2017

That's the issue when diffs only show the changes and no info is provided :)

@@ -59,6 +59,9 @@
return;
}
+// Set Database Character set and Collation
+dbQuery('ALTER DATABASE ? CHARACTER SET utf8 COLLATE utf8_unicode_ci;', array(array($config['db_name'])));

This comment has been minimized.

@laf

laf Mar 13, 2017

Member

I'm assuming the double array is needed?

@laf

laf Mar 13, 2017

Member

I'm assuming the double array is needed?

This comment has been minimized.

@murrant

murrant Mar 14, 2017

Member

Yes, the second array removes the surrounding quotes.

Otherwise, the query is ALTER DATABASE 'librenms' CHARACTER SET utf8 COLLATE utf8_unicode_ci;

@murrant

murrant Mar 14, 2017

Member

Yes, the second array removes the surrounding quotes.

Otherwise, the query is ALTER DATABASE 'librenms' CHARACTER SET utf8 COLLATE utf8_unicode_ci;

@laf laf merged commit 0f5091d into librenms:master Mar 14, 2017

2 checks passed

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

@murrant murrant deleted the murrant:db-charset-collation branch Mar 14, 2017

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