2010
06.03

I have a quotations page in hungarian, which is a kind of a sandbox to me.
It has 2000-3000 pageviews a day, so it’s nice to test new things on it.

So today I’ve upgraded that site to WordPress 3.0 rc1. The site was running well, but some admin pages started to throw white page errors, especially page/post edit and add…

I’ve switched on the php error logging, to discover what’s going on.

1
2
3
[03-Jun-2010 12:46:19] PHP Fatal error: Call to undefined method wpdb::get_blog_prefix() in /home/www/XXX/domain.com/webroot/wp-admin/includes/user.php on line 260

[03-Jun-2010 12:46:19] PHP Fatal error: Call to undefined method wpdb::get_blog_prefix() in /home/www/XXX/domain.com/webroot/wp-admin/includes/user.php on line 445

It suddenly came to my mind, that I have DB Cache Reloaded activated which is using a custom WPDB file, to replace the original one… So I’ve switched it off, and what a suprise…

The backoffice is working again…
I was lazy, and havn’t written to Daniel Frużyński the author of the plugin, about this bug.
Maybe I’ll write a patch and send it to him, if I have time for that.

Update
For those who is not familiar with unix patching, I’m going to share the whole db.php,
to replace the one in wp-content/db.php.
Here it is:
DB Cache Reloaded db.php

It took about 2 minutes to create the patch, so it’s right here:
DB Cache Reloaded patch

27 comments so far

Add Your Comment
  1. Mini-tutorial for windows:
    1. install cygwin and choose to install “patch” from the list
    2. download your db.php from wp-content
    3. download this patch file and extract-it where db.php is placed
    4. open the commandline where db.php is placed and run:
    patch -p0 < db-cache-wp-30.patch
    5. upload the modified db.php to wp-content

    All fixed. Thanks.

  2. whats the deal with db cache reloaded and 3.0 final?

  3. Thanks! This worked for me. I’m on WordPress 3.0 final release.

  4. Didn’t work for me and I just tried WordPress 3.0 on my development server.

  5. Sounds weird. Everyone I know, and had this problem solved it, with this patch.
    Do you have Db Cache Reloaded activated?
    Thus I’ve heard that Hyper Cache could cause such errors as well…

  6. I switched to WP 3.0 yesterday but I didn’t manage to run your patch :-S
    Thank you for the patch and for sharing the db.php now ;)

  7. Does my db.php work for you? :)

  8. yes worked perfectly!
    I just replaced your db.php with the original file and everything is back to normal.
    Of course just incase any error may occur, one should first back up the original db.php
    so if anything goes wrong, you can quickly replace it :)
    thank you so much

  9. Thanks for the patch. Worked great!

  10. i cant get it working… its redirect to signup and then to infinite loop.. i did as it said, chnage db.php in wp.content… and i get redirection to: http://anduriell.es/wp-signup.php?new=anduriell.es
    Damn it cant be that difficult… if works for everyone why it doesn’t for me?? i’ve deactivated all plugins, but is the same case, i can’t use it.. :((

  11. more information.. I’m running mysql 5.0.51a and i get this error in apache:
    [Sun Jun 20 04:15:21 2010] [error] [client 192.168.1.33] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE domain = ‘anduriell.es” at line 1 for query SELECT * FROM WHERE domain = ‘anduriell.es’ made by require, require_once, require_once, require, get_blog_details, referer: http://anduriell.es/wp-admin/options-general.php?page=db-cache-reloaded/db-cache-reloaded.php

    I think maybe it’s written for another mysql??

  12. another note.. If i use warpper mode it works fine.. so the error must be in db.php (none works..)

  13. sir can you explain again for mini tutorial on point four ?
    because i can’t use cygwin command…
    thanks before.

  14. Thanks for the help!!! It saves my blog :D

  15. Yup, and this mini tutorial :

    “Mini-tutorial for windows:
    1. install cygwin and choose to install “patch” from the list
    2. download your db.php from wp-content
    3. download this patch file and extract-it where db.php is placed
    4. open the commandline where db.php is placed and run:
    patch -p0 < db-cache-wp-30.patch
    5. upload the modified db.php to wp-content

    All fixed. Thanks."

    Helped me. Thanks :D

  16. I’ve uploaded, the db.zip for those who are unfamiliar,
    with this unix style patching.

  17. The patched file worked great for me. As usual with the DB Cache Reloaded plug-in, I had some permissions issues, but the patched plugin is working great.

  18. Awesome! It worked. Thanks!

  19. Thanks Man worked for me well

  20. Here’s the problem, guys: I don’t have a file named db.php in wp-content. I have public_html/wp-includes/wp-db.php, but I’m sure that’s not the right file. And I tried placing the wp.php file in wp-content, but I got an error back from the WP admin screen. Help?

  21. [...] esta actualización de WordPress. Por ejemplo, bugs existentes con el DB Cache Reloaded, aunque en DJZone.im han creado un parche que conviene revisar y que, según asegura su autor, hace compatible este plugin con la versión [...]

  22. If you have DB Cache Reloaded installed, and activated you should have a db.php in your wp-content.

    The other thing is, that DB Cache Reloaded 2.1 released with WordPress 3.0 support, so you won’t need my solution.

  23. Wonderful thanks mate

  24. This is great, i had it installed and error are gone now… specially when creating a new post or anything under wp-includes…:)

    great work.

    Thanks.

  25. Great!
    Simply and effective.

    Congratz!

  26. Hello,

    Does this patch work with wp v 3.2.1 ?
    Please have a look at this thread:
    http://wordpress.org/support/topic/db-cache-reloaded-is-not-caching-often

    Can you please solve this ..

  27. Hi Hema,
    I guess it does not. However I saw that DB Cache reloaded has been upgraded to work with 3.2.1.