To my surprise, I learned that my own site was also hit by that same issue, although it did not suffer any latency like my client’s site did. Or maybe it did, now that I think of it.
Anyway, here’s what I ran to clean up all files in one sweep. Note that you need SSH access to the server (on a *nix server):
find . -name "*.php" | xargs grep -l 'Speedup php function cache by optimizing buffer output' | xargs perl -pi -e 'BEGIN{undef $/;} s,/\*\*\s+\*\s+Speedup php function cache by optimizing buffer output.*?register_shutdown_function\(.?ob_end_flush.?\); \}\n,,gms;'
Breaking it up to help people understand:
1. find . -name "*.php"
– finds all files ending in .php. Starting point is the current directory. Change the “.” to your wp-content/plugins directory if you wish.
2. | xargs grep -l 'Speedup...'
– Feeds the output of the find command to xargs which transforms that output into the input of the grep command. The grep reads each file and spits out the files which have the ‘Speedup’ string in them
3. | xargs perl -pi -e...
– This does the actual cleaning. For each file found by the previous grep call, look for and strip out the offending block of code. The -pi parameters make it update the file in place. If you want a back up, add .bak (or whatever extension you want) right after the i:
... | xargs perl -pi.bak -e '...
But to be on the safe side, back up your files before running this! And make sure you follow Mel’s links to harden your WP install.
Also, if you just want to see which files are affected, run the above command up to the second ‘|’ symbol:
find . -name "*.php" | xargs grep -l 'Speedup php function cache by optimizing buffer output'
I hope this helps other people.