Make WordPress Core


Ignore:
Timestamp:
11/13/2008 06:48:54 PM (18 years ago)
Author:
ryan
Message:

Revert [9523]. fixes #8195 see #7395

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r9663 r9664  
    486486                return new WP_Error('empty_archive', __('Empty archive'));
    487487
    488         //Prepend another directory level if there are files in the root directory of the zip
    489         foreach ( $archive_files as $archive_file ) {
    490                 if ( false === strpos($archive_file['filename'], '/') ) {
    491                         $to = trailingslashit($to) . basename($file, '.zip');
    492                         break;
    493                 }
    494         }
    495 
    496488        $path = explode('/', untrailingslashit($to));
    497489        for ( $i = count($path); $i > 0; $i-- ) { //>0 = first element is empty allways for paths starting with '/'
    … …  
    571563                }
    572564        }
    573 }
    574 
    575 /**
    576  * Locates the lowest safe directory in a Plugin folder to copy to the plugins directory.
    577  *
    578  * Note: Desination directory will allways be unique.
    579  *
    580  * @since 2.7.0
    581  *
    582  * @param string $from the Working directory of the plugin files
    583  * @param string $to the proposed destination for the for the plugin files
    584  * @return array an array of the keys 'from' and 'to' for the actual copy.
    585  */
    586 function update_pluginfiles_base_dir($from, $to) {
    587         $files = list_files($from);
    588 
    589         //Remove non-php files
    590         foreach ( (array)$files as $key => $file )
    591                 if ( ! preg_match('!.php$!i', $file) )
    592                         unset($files[$key]);
    593 
    594         //remove non-plugin files
    595         foreach ( (array)$files as $key => $file ) {
    596                 $details = get_plugin_data($file, false, false);
    597                 if ( empty($details['Name']) )
    598                         unset($files[$key]);
    599         }
    600 
    601         if ( empty($files) )
    602                 return false;
    603 
    604         //Left with paths to files which ARE plugins.
    605         $min_num = 100; //assume no zips with deeper paths will come along
    606         $min_file = '';
    607         foreach ( (array)$files as $key => $file ) {
    608                 $this_num = substr_count($file, '/');
    609                 if ( $this_num < $min_num ) {
    610                         $min_file = $file;
    611                         $min_num = $this_num;
    612                 }
    613         }
    614         unset($min_num);
    615 
    616         $from = dirname($min_file);
    617         //Ensure its a unique install folder, Upgrades delete the folder prior to this.
    618         $to = dirname($to) . '/' . wp_unique_filename(dirname($to), basename($to));
    619 
    620         return compact('from', 'to');
    621565}
    622566
Note: See TracChangeset for help on using the changeset viewer.