IT Consultant – Java, J2EE, IBM WebSphere Portal, Lotus Notes/Domino
RSS icon Home icon
  • [Solved] WordPress 2.5 One-Click Plug-in Upgrades – Could not create directory

    (6 votes) 1 Star2 Stars3 Stars4 Stars5 Stars
    Loading...
    Posted on 25 April 2008 Sebastian Thomschke*/?> 42 comments

    Some days ago I upgraded my WordPress installation to the new 2.5 release. Being a lazy guy I of course wanted to use the new one-click plug-in upgrade feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message “Could not create directory”. So I started searching the web for possible solutions. I quickly found some posts explaining this issue to be a directory permission problem. Manually creating the /wp-content/upgrade directory and chmoding it as well as the plug-in directories to 777 should solve the problem. Unfortunately not for me. Therefore I rolled up my sleeves and started to debug WordPress…

    To cut a long story short, eventually I came across this PHP bug report #42739 mkdir doesn’t like a trailing slash when safe_mode is enabled and it turned out that this was the issue I was facing with on my hosting account too. The safe_mode option is enabled and WordPress tries to create directories that end with a slash (e.g. /htdocs/wp-content/upgrade/the-plugin/).

    After knowing the reason I could develop a workaround and finally got the one-click updater running. If you are facing the same issue you can try to use my patch too.

    1. Locate and open the file <wp_root>/wp_admin/includes/class-wp-filesystem-direct.php in an editor
    2. Search for “function mkdir
    3. Add the following statements to this method
      function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
      	if( ! $chmod)
      		$chmod = $this->permission;
      
      	// workaround for http://bugs.php.net/bug.php?id=42739 starts here
      	if(ini_get('safe_mode') && substr($path, -1) == '/')
      	{
      		$path = substr($path, 0, -1);
      	}
      	// workaround for http://bugs.php.net/bug.php?id=42739 ends here
      
      	if( !@mkdir($path,$chmod) )
      		return false;
      	if( $chown )
      		$this->chown($path,$chown);
      	if( $chgrp )
      		$this->chgrp($path,$chgrp);
      	return true;
      }
    4. Start one-click updating!

    Update 1:

    1. The patch also works for WordPress 2.5.1
    2. If applying this patch does not lead to success the problem may have a second cause. Therefore also check the permissions on the /wp-content/upgrade/ folder and it’s sub folders, e.g. chmod them to 777. If the upgrade directory does not exist at all it may be sufficient to create it manually.

    Update 2:

    1. In case the patch does not work check if you have the AskApache Password Protect plug-in installed.
    2. If so, try to deactivate this plug-in before you try to upgrade any other plug-in.

  • myPodder – a mobile podcatcher

    1 Star2 Stars3 Stars4 Stars5 Stars
    Loading...
    Posted on 20 April 2008 Sebastian Thomschke*/?> 1 comment

    Two weeks ago I started trying out podcasts seriously for the first time. So far I mainly tried the ones from a German news radio station (http://www.dradio.de/podcast/). I downloaded the audio files about topics I found interesting and listened to them while traveling to and from work. I really enjoyed it – especially because of the facts that I could now listen to talks and reports I am really interested in and I didn’t had to pay attention to when they are broadcasted. However I found it quite cumbersome to navigate through the radio station’s web page, to select each podcast separately, to download them and finally to transfer them to my neat Samsung T9.

    So I started looking for some tools that could simplify this process. I finally came across a handy software called myPodder provided for free by Podcast Ready. Podcast Ready provides an online catalog of available podcasts from different sources and to my surprise they also have that German radio station listed. The interesting thing about their software is the fact that you can directly install it onto your mobile audio player and have it launched automatically the moment it is connected to a computer. This means you can easily charge your player with new podcasts from any computer having an internet connection. Simply connect the player, wait for the program to launch, select some new podcasts and download them.
    Read the rest of this entry »