Changeset 9523 for trunk/wp-admin/includes/update.php
- Timestamp:
- 11/05/2008 05:07:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/update.php
r9512 r9523 247 247 248 248 apply_filters('update_feedback', __('Installing the latest version')); 249 250 $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); 251 252 //find base plugin directory 253 $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'] ) ) 258 return new WP_Error('mkdir_failed', __('Could not create directory'), $res['to']); 259 249 260 // Copy new version of plugin into place. 250 $result = copy_dir($ working_dir, $plugins_dir);261 $result = copy_dir($res['from'], $res['to']); 251 262 if ( is_wp_error($result) ) { 252 263 $wp_filesystem->delete($working_dir, true); 253 264 return $result; 254 265 } 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 plugin257 $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );258 266 259 267 // Remove working directory … … 263 271 delete_option('update_plugins'); 264 272 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]; 273 $folder = trailingslashit(str_replace($plugins_dir, '', $res['to'])); 269 274 $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash 270 275 $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list 271 276 272 return $folder . '/' . $pluginfiles[0]; 277 //Return the plugin files name. 278 return $folder . $pluginfiles[0]; 273 279 } 274 280
Note: See TracChangeset
for help on using the changeset viewer.