h3h
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Strange error message [fatal error: allowed memory size…]Hmm. Thanks for the heads up — directory indexes are now disabled.
That said, I dove into the wp-admin code a bit and I now feel sick to my stomach. The database interaction code for comment moderation specifically is unbelievably terrible from a performance perspective.
For every comment in the moderation queue, when moderating the queue, WordPress does the following:
wp_set_comment_status()
: 1 db querywp_update_comment_count()
: 2 db queriesget_comment
: 1 db queryget_post
: 1 db query
That’s 5 queries for every single comment in the moderation queue, so 5N queries in total, including a
COUNT(*)
— ouch, who missed that day in database class? This is embarrassing.This should be done with a worst case scenario of N + 1 queries, and that’s only without modifying how comment counts are stored. Realistically this should be reduced to 2 queries for any number of comments in the moderation queue (total, not per comment).
Forum: Fixing WordPress
In reply to: Strange error message [fatal error: allowed memory size…]The “increase PHP’s memory limit” response is definitely not a long term solution. I increased the limit up to 256MB and still got the fatal error.
I also set
output_buffering = Off
in php.ini (and verified the setting with aphpinfo()
) and the problem remains.There must be some horribly unoptimized code in WP’s admin section or some PHP setting that conflicts with how WP does things.
Forum: Fixing WordPress
In reply to: Pages Missing After 2.0.4 UpgradeApparently that was the problem, moshu.
All of my pages had post_status = ‘publish’ instead of ‘static’.
I ran the following SQL query inside of the mysql interactive client to fix everything up:
update wp_posts set post_status = 'static' where post_type = 'page';
Note of course that I didn’t have any non-public pages — someone who has private or draft pages should take care to change the above query accordingly.
It probably is worth finding out why the post_status of these pages was changed as a result of the update to 2.0.4.
Thanks.
Forum: Fixing WordPress
In reply to: Pages Missing After 2.0.4 UpgradeIt’s strange that other people are reporting “some” pages missing. All of my pages are missing. I wonder if there’s some property that’s causing them to disappear from view…
Any info or additional bug reports would be helpful.
Richard:
The patch I posted was for the second described problem (whitelisting occurred after moderation). I’m not sure if this patch is even applicable to the current 1.5 code base anymore.
Your problem stems from the first bug discussed in this thread which was evidently fixed. You should upgrade your installation to the latest version (1.5.1.3 currently) if you don’t already have it.
If you’re still having issues then chances are that something isn’t being upgraded properly, you have something configured incorrectly, or something else similar.
Good luck.
Forum: Plugins
In reply to: “Dictionary” quicktag button not cancellingAdded another patch to the bug to make the regex less restrictive.
Forum: Plugins
In reply to: “Dictionary” quicktag button not cancellingNevermind. Checked in.
Forum: Plugins
In reply to: “Dictionary” quicktag button not cancellingCan anyone assign this bug? It’s a rather simple fix that could be checked in without much worry.
Forum: Plugins
In reply to: “Dictionary” quicktag button not cancellingForum: Plugins
In reply to: “Dictionary” quicktag button not cancellingThe notion of a “die” statement is somewhat lost in JavaScript.
What needs to be happening is a check for null returned from the prompt function. Also, it would be smart to do a simple regex test on the string to make sure it’s at least a bunch of letters. Without looking at the code I can tell you it has to look something like this:
var strAnswer = '';
if ((strAnswer = prompt("Enter the word that you wish to lookup.")) !== null
&& /^\w[\w ]*$/.test(strAnswer))
{
// open new window to dictionary.com
}
// (else do nothing)
Has anyone filed a bug for this?
I was looking at the code for comment_check() and realized that the whitelisting check is AFTER the moderation keys check. Shouldn’t the whitelisting come first?
I agree with steevak here. It seems there were two separate bugs at work. The first may have been fixed, but now even with the patch applied, people that have previously approved comments cannot submit comments without being flagged for moderation.
Can we re-examine this problem? I’ll look at diving into the code a bit.
Forum: Fixing WordPress
In reply to: Calendar Dependence on ?y%I merged the changes from CVS and it’s working great now. Thanks.