Support » Plugins » Can't upgrade plugins or themes after upgrade to 4.4

  • I just upgraded a site to WordPress version 4.4, and now whenever I try to upgrade any plugin or theme I get a message like this:

    An error occurred while updating <plugin/theme name>: Could not create directory. <plugin/theme directory>

    I have set the permission on the wp-content directory (and even all subdirectories) to 777, but I still get the above message whenever I try to upgrade a plugin or theme.

    What gives?

    Edit: I am able to install new plugins, so it doesn’t seem to be a permission issue in the plugins folder.

Viewing 5 replies - 1 through 5 (of 5 total)
  • After more research I have found the following:

    In wp-admin/includes/class-wp-uploader.php, lines 531-535:

    //Create destination if needed
    if ( ! $wp_filesystem->exists( $remote_destination ) ) {
    	if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
    		return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
    	}
    }

    The exists call is returning false when I try to update a plugin. This is wrong. I am able to see the directory referred to by $remote_destination in my OS shell, and it obviously does exist because the failure occurs on the mkdir call—it is unable to make the directory because it already exists.

    Digging deeper, in wp-admin/includes/class-wp-filesystem-ftpext.php, lines 329-338:

    public function exists( $file ) {
    	$path = dirname( $file );
    	$filename = basename( $file );
    
    	$file_list = @ftp_nlist( $this->link, '-a ' . $path );
    	if ( $file_list ) {
    		$file_list = array_map( 'basename', $file_list );
    	}
    	return $file_list && in_array( $filename, $file_list );
    }

    If I add the following line just before the return statement…

    error_log(debug_backtrace()[1]['function'] . ": \npath: $path\nfilename: $filename\nfile list:\n" . print_r($file_list, true) . "\n");

    … I see this output…

    [11-Dec-2015 18:42:19 UTC] install_package:
    path: <the expected path>
    filename: <the expected filename>
    file list:
    Array
    (
    )

    The file list is empty! It should not be. What’s going on here?

    Looks like this has been reported as a bug.

    I am having the exact same problem. Where is it reported as a bug and how do I track the fix?

    The link in my previous message goes to the bug report, but I’ll link it again here 🙂

    https://core.trac.wordpress.org/ticket/34976

    I’m getting this when trying to upgrade

    Unpacking the package…

    Installing the theme…

    Destination folder already exists. /home4/lynnenie/public_html/wanderyourway/wp-content/themes/dt-the7/

    Theme install failed.

    What is the best way to upgrade and go around this? I’m not a techie. I think I had to uninstall and re-install last time or something. It just seems as though it should be easier!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can't upgrade plugins or themes after upgrade to 4.4’ is closed to new replies.