Changeset 9664 for trunk/wp-admin/includes/update.php
- Timestamp:
- 11/13/2008 06:48:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/update.php
r9593 r9664 247 247 248 248 apply_filters('update_feedback', __('Installing the latest version')); 249 249 // Copy new version of plugin into place. 250 $result = copy_dir($working_dir, $plugins_dir); 251 if ( is_wp_error($result) ) { 252 $wp_filesystem->delete($working_dir, true); 253 return $result; 254 } 255 256 //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin 250 257 $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); 251 252 //find base plugin directory253 $res = update_pluginfiles_base_dir($working_dir . '/' . $filelist[0], $plugins_dir . $filelist[0]);254 255 //Create folder if not exists.256 if( ! $wp_filesystem->exists( $res['to'] ) )257 if ( ! $wp_filesystem->mkdir( $res['to'], 0755 ) )258 return new WP_Error('mkdir_failed', __('Could not create directory'), $res['to']);259 260 // Copy new version of plugin into place.261 $result = copy_dir($res['from'], $res['to']);262 if ( is_wp_error($result) ) {263 $wp_filesystem->delete($working_dir, true);264 return $result;265 }266 258 267 259 // Remove working directory … … 271 263 delete_option('update_plugins'); 272 264 273 $folder = trailingslashit(str_replace($plugins_dir, '', $res['to'])); 265 if( empty($filelist) ) 266 return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup. 267 268 $folder = $filelist[0]; 274 269 $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash 275 270 $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list 276 271 277 //Return the plugin files name. 278 return $folder . $pluginfiles[0]; 272 return $folder . '/' . $pluginfiles[0]; 279 273 } 280 274
Note: See TracChangeset
for help on using the changeset viewer.