_ck_
Forum Replies Created
-
Forum: Plugins
In reply to: [Auto Featured Image (Auto Post Thumbnail)] code needs some serious cleanupAre you certain this mysql query is not causing a sub-query ON EVERY POST ROW? Because this is a known mysql bug that it most likely will:
$query = "SELECT * FROM {$wpdb->posts} p where p.post_status = 'publish' AND p.ID NOT IN ( SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_key IN ('_thumbnail_id', 'skip_post_thumb') )";Most people think that means mysql will do the subquery first, then do the outer select. Except it doesn’t. It does the outer select first and then does the subquery over and over and over again for each post. Also, why are you fetching the entire row (*) when you only need the ID.
Please read up on the different $wpdb functions, get_results is not the only one, you can get_col (and get_row).
Forum: Installing WordPress
In reply to: Fatal error after upgrade to 3.1.1The reason why some legacy installs cannot upgrade beyond version 3.0 is this:
Check
wp-config.phpfor any lines that define a$wp->object setting.They will break 3.1 and above and give a
$wp->add_query_varerror.For example:
$wp->cookiedomain = '.example.com';Will work in 3.0 and below but break WP 3.1 and 3.2
You’ll have to research for the replacement
definesetting as an alternative to$wp->For example, the modern replacement for the above line is
define(COOKIE_DOMAIN,'.example.com');Forum: Installing WordPress
In reply to: Fatal error after upgradeThe reason why some legacy installs cannot upgrade beyond version 3.0 is this:
Check
wp-config.phpfor any lines that define a$wp->object setting.They will break 3.1 and above and give a $wp->add_query_var error.
For example:
$wp->cookiedomain = '.example.com';Will work in 3.0 and below but break WP 3.1 and 3.2
You’ll have to research for the replacement
definesetting as an alternative to$wp->For example, the modern replacement for the above line is
define(COOKIE_DOMAIN,'.example.com');My plugin now has it’s own page so you can always get the newest version here:
http://wordpress.org/extend/plugins/wp-cache-users/I’ve now written a plugin to cache multiple users at once in WordPress.
No template or core hacks required.It automatically tries to scan posts and comments before they are passed to the templates to pre-cache users with just two queries, regardless of the number of unique users in the posts/comments.
The data is then available to WordPress and plugins via the regular get_userdata functions without extra mysql queries.
On some blogs it should RADICALLY reduce the number of queries.
Tested only up to WP 2.5.1 so let me know if it works in newer versions or not. Watch the query count that’s sometimes hidden in the view source of your pages near the bottom.
What WordPress needs is a port of function bb_cache_users() from bbPress.
I am simply dumbfounded that WordPress is up to version 2.7, three full years after 2.0, and still does not have a caching routine to stuff multiple users into the object cache with just two queries (one for wp_users and one for the meta) like bbPress does.
(actually I’ve only checked the code up to 2.6.1 so maybe they finally put it into 2.7 but somehow I bet they didn’t)
With some clever workarounds to detect what kind of page it’s on, a replacement multi-user caching routine could be done as a plugin instead of a core hack, via function get_userdata in pluggable.php – before it does a mysql query it could check the page type and gather the list of author id’s or commenter ids and then cache them all with just two queries.
Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin arearawalex, no the browser is doing what it’s told: it’s being told to create a cookie with the same name but another path. To the browser that is a separate cookie and doesn’t overwrite the old one, though maybe some browsers handle it differently.
I don’t see how anyone successfully logs in without manually deleting the old cookie. Recycling the old cookie name for a new use was not the greatest idea. I bet thousands of people are having this problem after upgrade.
Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaKaufmannn, you can try my workaround. It really won’t harm anything.
The security issue is trivial and debatable.
(in fact it makes it no less secure than 2.5.1)Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaWhoa. Everyone take a deep breath, it’s just blog software.
People contribute in different ways.Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaYeah I had initially posted about the duplication and wondered how the browser could even store two cookies with the same name but then realized they had different paths.
The question is, does the browser send both cookies when at the deepest path? That’s a weird situation.
The upgrade process should have set some kind of flag to nuke the admin cookie on the first login by any admin. Tricky but doable.
ps. my subtitle for this thread is “WP 2.6: I made you a cookie, but I eated it” 😀
Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin arearawalex, nah that’s their login name (the admin part at the start of the content) and I just realized that the plugin path is probably from a plugin setting the cookie.
WP went from a very clean cookie setup in 2.5 to something a bit messier in 2.6 – I understand what they were trying to do, but to re-use the old cookie name as the admin cookie and then create a new one for the common login is just a bit whacky. I wonder what else it’s going to break.
I know it broke bbPress but we’ve got another release pending I guess.
Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaOMG do NOT post your full cookies (with content).
That has to be removed ASAP.
If someone knew your website they could have admin access very quickly.Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaThis bookmarklet will clear all the cookies for just the site you are on:
http://www.squarefree.com/bookmarklets/zap.html#zap_cookies
It covers all the paths for the site which some other scripts don’t do.Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaWell there’s your problem (best mythbusters voice).
WP tries to set it as /wp-admin when there’s no define.
(had to hack wp-settings.php to show me what it was doing)I now think this is because of legacy installs that have
$wp->sitecookiepath
stored in the db.So essentially SOME legacy WP installs may HAVE to insert a define.
WordPress is essentially failing to check for a valid path when calculating the new constant introduced in 2.6 – it’s an oversight I can easily forgive as I might easily make such a mistake myself.
Forum: Fixing WordPress
In reply to: Upgraded to WP 2.6 and can’t access wp-admin areaOtto, you realize that without the workaround, he might not be able to log into the admin area to see the settings->general screen?
It’s “she” btw and of course I can see the screen by just using the define.
I am investigating further, I have some other ideas…
ps. the defines also work without the trailing slash