Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The db_prefix_tables() function in includes/database.inc generates notices if $db_prefix['default'] is not set. This patch fixes that problem. This has a side benefit of making $db_prefix easier to use.
Comment | File | Size | Author |
---|---|---|---|
#2 | database2.diff | 1.17 KB | danielc |
database.diff | 720 bytes | danielc | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentednice ... this has been a bit a pimple for a while.
Comment #2
danielc CreditAttribution: danielc commentedI've come up with a new version of the patch that optimizes the speed of the whole function.
Comment #3
danielc CreditAttribution: danielc commentedChange Version from "4.5.2" to "cvs".
Comment #4
danielc CreditAttribution: danielc commentedPardon me, I'm testing if this goes the drupal-dev list now that the version is "cvs."
Comment #5
danielc CreditAttribution: danielc commentedComment #6
Dries CreditAttribution: Dries commentedAny idea of how much faster the second patch is? I don't think it makes a real difference in which case I'd favor the first patch.
Comment #7
danielc CreditAttribution: danielc commentedThe speed increase is 5%.
Comment #8
Dries CreditAttribution: Dries commented5% compared to what? What did you measure?
Comment #9
danielc CreditAttribution: danielc commentedI tested the db_prefix_tables() function in two configurations. With my first patch applied and with my second patch applied. The second patch is 5% faster than the first. This improvement is the same for both the string and array formats of $db_url.
Comment #10
danielc CreditAttribution: danielc commentedCan this please be applied to 4-6 and HEAD?
Comment #11
Dries CreditAttribution: Dries commentedI was checking settings.php to read up on how to use $db_prefix but noticed that only the 'simple' case was documented. The fact that $db_prefix can be an array isn't explained anywhere (not in the phpdoc of db_prefix_tables() and not in settings.php). Where did that go? I wanted to check what the documentation had to say on the availability of a 'default' entry ...
Comment #12
moshe weitzman CreditAttribution: moshe weitzman commenteddocs in the administrators guide - http://drupal.org/node/2622
Comment #13
danielc CreditAttribution: danielc commentedAnd the patch to issue 19474 (http://drupal.org/node/19474) contains a patch to provide such information to settings.php.
Comment #14
Dries CreditAttribution: Dries commentedCommitted to HEAD and DRUPAL-4-6. Thanks.
Comment #15
(not verified) CreditAttribution: commented