Changeset 12789 for trunk/wp-admin/includes/file.php
- Timestamp:
- 01/21/2010 09:37:43 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/file.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r12752 r12789 453 453 //WARNING: The file is not automatically deleted, The script must unlink() the file. 454 454 if ( ! $url ) 455 return new WP_Error('http_no_url', __('Invalid URL Provided '));455 return new WP_Error('http_no_url', __('Invalid URL Provided.')); 456 456 457 457 $tmpfname = wp_tempnam($url); 458 458 if ( ! $tmpfname ) 459 return new WP_Error('http_no_file', __('Could not create Temporary file '));459 return new WP_Error('http_no_file', __('Could not create Temporary file.')); 460 460 461 461 $handle = @fopen($tmpfname, 'wb'); 462 462 if ( ! $handle ) 463 return new WP_Error('http_no_file', __('Could not create Temporary file '));463 return new WP_Error('http_no_file', __('Could not create Temporary file.')); 464 464 465 465 $response = wp_remote_get($url, array('timeout' => 300)); … … 513 513 // Is the archive valid? 514 514 if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) ) 515 return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true));515 return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true)); 516 516 517 517 if ( 0 == count($archive_files) ) 518 return new WP_Error('empty_archive', __('Empty archive '));518 return new WP_Error('empty_archive', __('Empty archive.')); 519 519 520 520 $path = explode('/', untrailingslashit($to)); … … 525 525 $tmppath = implode('/', array_slice($path, 0, $i) ); 526 526 if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) 527 return new WP_Error('mkdir_failed', __('Could not create directory '), $tmppath);527 return new WP_Error('mkdir_failed', __('Could not create directory.'), $tmppath); 528 528 } 529 529 break; //Exit main for loop … … 543 543 $tmppath = $to . implode('/', array_slice($path, 0, $i) ); 544 544 if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) 545 return new WP_Error('mkdir_failed', __('Could not create directory '), $tmppath);545 return new WP_Error('mkdir_failed', __('Could not create directory.'), $tmppath); 546 546 } 547 547 break; //Exit main for loop … … 552 552 if ( ! $file['folder'] ) { 553 553 if ( !$fs->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) 554 return new WP_Error('copy_failed', __('Could not copy file '), $to . $file['filename']);554 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); 555 555 } 556 556 } … … 582 582 $wp_filesystem->chmod($to . $filename, 0644); 583 583 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) 584 return new WP_Error('copy_failed', __('Could not copy file '), $to . $filename);584 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename); 585 585 } 586 586 $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE); … … 588 588 if ( !$wp_filesystem->is_dir($to . $filename) ) { 589 589 if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) 590 return new WP_Error('mkdir_failed', __('Could not create directory '), $to . $filename);590 return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename); 591 591 } 592 592 $result = copy_dir($from . $filename, $to . $filename);
Note: See TracChangeset
for help on using the changeset viewer.