Ticket #38946: 38946.patch
File 38946.patch, 4.9 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader.php
397 397 /** 398 398 * Install a package. 399 399 * 400 * Copies the contents of a package f orm a source directory, and installs them in400 * Copies the contents of a package from a source directory, and installs them in 401 401 * a destination directory. Optionally removes the source. It can also optionally 402 402 * clear out the destination folder if it already exists. 403 403 * … … 415 415 * Default empty. 416 416 * @type bool $clear_destination Whether to delete any files already in the destination 417 417 * folder. Default false. 418 * @type bool $clear_working Whether to delete the files f orm the working directory418 * @type bool $clear_working Whether to delete the files from the working directory 419 419 * after copying to the destination. Default false. 420 * @type bool $protect_destination Whether to protect against deleting any files already 421 * in the destination folder. Default false. 420 422 * @type bool $abort_if_destination_exists Whether to abort the installation if 421 423 * the destination folder already exists. Default true. 422 424 * @type array $hook_extra Extra arguments to pass to the filter hooks called by … … 433 435 'destination' => '', // and this 434 436 'clear_destination' => false, 435 437 'clear_working' => false, 438 'protect_destination' => false, 436 439 'abort_if_destination_exists' => true, 437 440 'hook_extra' => array() 438 441 ); … … 520 523 $protected_directories = array_merge( $protected_directories, $wp_theme_directories ); 521 524 } 522 525 523 if ( in_array( $destination, $protected_directories ) ) {526 if ( in_array( $destination, $protected_directories ) || $args['protect_destination'] ) { 524 527 $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) ); 525 528 $destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) ); 526 529 } … … 621 624 * Default empty. 622 625 * @type bool $clear_destination Whether to delete any files already in the 623 626 * destination folder. Default false. 624 * @type bool $clear_working Whether to delete the files f orm the working627 * @type bool $clear_working Whether to delete the files from the working 625 628 * directory after copying to the destination. 626 629 * Default false. 630 * @type bool $protect_destination Whether to protect against deleting any files already 631 * in the destination folder. Default false. 627 632 * @type bool $abort_if_destination_exists Whether to abort the installation if the destination 628 633 * folder already exists. When true, `$clear_destination` 629 634 * should be false. Default true. … … 643 648 'package' => '', // Please always pass this. 644 649 'destination' => '', // And this 645 650 'clear_destination' => false, 651 'clear_working' => true, 652 'protect_destination' => false, 646 653 'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please 647 'clear_working' => true,648 654 'is_multi' => false, 649 655 'hook_extra' => array() // Pass any extra $hook_extra args here, this will be passed to any hooked filters. 650 656 ); … … 665 671 * @type string $destination Update location. 666 672 * @type bool $clear_destination Clear the destination resource. 667 673 * @type bool $clear_working Clear the working resource. 674 * @type bool $protect_destination Protect the destination resource. 668 675 * @type bool $abort_if_destination_exists Abort if the Destination directory exists. 669 676 * @type bool $is_multi Whether the upgrader is running multiple times. 670 677 * @type array $hook_extra { … … 740 747 'source' => $working_dir, 741 748 'destination' => $options['destination'], 742 749 'clear_destination' => $options['clear_destination'], 750 'clear_working' => $options['clear_working'], 751 'protect_destination' => $options['protect_destination'], 743 752 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 744 'clear_working' => $options['clear_working'],745 753 'hook_extra' => $options['hook_extra'] 746 754 ) ); 747 755