28

Dec

Fix for WordPress “Could not remove the old plugin” error

Posted by jerry as Uncategorized

I had been seeing the error “Could not remove the old plugin” any time I tried to auto upgrade a plugin.  A search of the wordpress forums revealed that this is apparently a common problem that does not appear to impact everyone, and there isn’t a known fix.  The error looked like this:

Downloading update from http://downloads.wordpress.org/plugin/related-posts.zip

Unpacking the update

Deactivating the plugin

Removing the old version of the plugin

Could not remove the old plugin

Plugin upgrade Failed

So, I spent some time last night trying to find out what the problem was.  As it turns out, some upgrade or plugin along the way created a bunch of nested wp-content directories.  It looked list this:

/home/mydir/public_html/wp-content/wp-content/wp-content/wp-content/wp-content/wp-content/plugins

The filesystem driver code in wordpress doesn’t handle this very gracefilly.

It turns out that the fix needed is to delete the extra wp-content directories.

rm -r /home/mydir/public_html/wp-content/wp-content

works quite nicely.  After deleting this directory, rerun the auto upgrade and it should complete successfully.

NOTE:  You should make a back up before you perform the above operation.  Deleting the wrong directory will result in a dead site.

29

Apr

WordPress backup script

Posted by jerry as Uncategorized

I was looking to upgrade wordpress today, and realized that there MUST be a better way.  So, I hit google up for a “wordpress upgrade script”.  Sure enough, I found a great script at http://pthree.org/2007/03/02/wordpress-upgrade-script/.  I played with it, but it still required a lot of work – looking up database usernames and whatnot.  I figured that I could pull the username, database name and password out of the wp-config.php file. And I could.

So, now the script just pauses to remind you to deactivate your plugins.  I tried to find a way to automate that, but have struck out so far.  If you know how, let me know!  I’ll give you credit.

Read the rest of this entry »