Plugin Directory

Changeset 695338

Timestamp:
04/10/2013 03:45:31 PM (11 years ago)
Author:
jbrinley
Message:

find correct files directory on 3.5+ created networks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • blog-copier/trunk/blog-copier.php

    r671342 r695338  
    204204         * @return string status message
    205205         */
    206         private function copy_blog($domain, $title, $from_blog_id = 0, $copy_files = true) {
     206        p function copy_blog($domain, $title, $from_blog_id = 0, $copy_files = true) {
    207207            global $wpdb, $current_site, $base;
    208208
     
    344344         */
    345345        private function copy_blog_files( $from_blog_id, $to_blog_id ) {
    346             set_time_limit( 600 ); // 60 seconds x 10 minutes
     346            set_time_limit( 00 ); // 60 seconds x 10 minutes
    347347            @ini_set('memory_limit','2048M');
    348             $base = WP_CONTENT_DIR . '/blogs.dir/';
     348
    349349            // Path to source blog files.
    350             $from = apply_filters('copy_blog_files_from', trailingslashit( $base . $from_blog_id ), $base, $from_blog_id);
     350            switch_to_blog($from_blog_id);
     351            $dir_info = wp_upload_dir();
     352            $from = str_replace(' ', "\\ ", trailingslashit($dir_info['basedir']).'*'); // * necessary with GNU cp, doesn't hurt anything with BSD cp
     353            restore_current_blog();
     354            $from = apply_filters('copy_blog_files_from', $from, $from_blog_id);
     355
    351356            // Path to destination blog files.
    352             $to = apply_filters('copy_blog_files_to', trailingslashit( $base . $to_blog_id ), $base, $to_blog_id);
     357            switch_to_blog($to_blog_id);
     358            $dir_info = wp_upload_dir();
     359            $to = str_replace(' ', "\\ ", trailingslashit($dir_info['basedir']));
     360            restore_current_blog();
     361            $to = apply_filters('copy_blog_files_to', $to, $to_blog_id);
     362
    353363            // Shell command used to copy files.
    354             $command = apply_filters('copy_blog_files_command', "cp -rfp $from $to", $from, $to );
     364            $command = apply_filters('copy_blog_files_command', , $from, $to );
    355365            exec($command);
    356366        }
Note: See TracChangeset for help on using the changeset viewer.