Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-admin/includes
File: class-wp-upgrader.php
* the destination folder already exists. Default true.
[500] Fix | Delete
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
[501] Fix | Delete
* WP_Upgrader::install_package(). Default empty array.
[502] Fix | Delete
* }
[503] Fix | Delete
*
[504] Fix | Delete
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
[505] Fix | Delete
*/
[506] Fix | Delete
public function install_package( $args = array() ) {
[507] Fix | Delete
global $wp_filesystem, $wp_theme_directories;
[508] Fix | Delete
[509] Fix | Delete
$defaults = array(
[510] Fix | Delete
'source' => '', // Please always pass this.
[511] Fix | Delete
'destination' => '', // ...and this.
[512] Fix | Delete
'clear_destination' => false,
[513] Fix | Delete
'clear_working' => false,
[514] Fix | Delete
'abort_if_destination_exists' => true,
[515] Fix | Delete
'hook_extra' => array(),
[516] Fix | Delete
);
[517] Fix | Delete
[518] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[519] Fix | Delete
[520] Fix | Delete
// These were previously extract()'d.
[521] Fix | Delete
$source = $args['source'];
[522] Fix | Delete
$destination = $args['destination'];
[523] Fix | Delete
$clear_destination = $args['clear_destination'];
[524] Fix | Delete
[525] Fix | Delete
if ( function_exists( 'set_time_limit' ) ) {
[526] Fix | Delete
set_time_limit( 300 );
[527] Fix | Delete
}
[528] Fix | Delete
[529] Fix | Delete
if (
[530] Fix | Delete
( ! is_string( $source ) || '' === $source || trim( $source ) !== $source ) ||
[531] Fix | Delete
( ! is_string( $destination ) || '' === $destination || trim( $destination ) !== $destination )
[532] Fix | Delete
) {
[533] Fix | Delete
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
[534] Fix | Delete
}
[535] Fix | Delete
$this->skin->feedback( 'installing_package' );
[536] Fix | Delete
[537] Fix | Delete
/**
[538] Fix | Delete
* Filters the installation response before the installation has started.
[539] Fix | Delete
*
[540] Fix | Delete
* Returning a value that could be evaluated as a `WP_Error` will effectively
[541] Fix | Delete
* short-circuit the installation, returning that value instead.
[542] Fix | Delete
*
[543] Fix | Delete
* @since 2.8.0
[544] Fix | Delete
*
[545] Fix | Delete
* @param bool|WP_Error $response Installation response.
[546] Fix | Delete
* @param array $hook_extra Extra arguments passed to hooked filters.
[547] Fix | Delete
*/
[548] Fix | Delete
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
[549] Fix | Delete
[550] Fix | Delete
if ( is_wp_error( $res ) ) {
[551] Fix | Delete
return $res;
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
// Retain the original source and destinations.
[555] Fix | Delete
$remote_source = $args['source'];
[556] Fix | Delete
$local_destination = $destination;
[557] Fix | Delete
[558] Fix | Delete
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
[559] Fix | Delete
$remote_destination = $wp_filesystem->find_folder( $local_destination );
[560] Fix | Delete
[561] Fix | Delete
// Locate which directory to copy to the new folder. This is based on the actual folder holding the files.
[562] Fix | Delete
if ( 1 === count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) {
[563] Fix | Delete
// Only one folder? Then we want its contents.
[564] Fix | Delete
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
[565] Fix | Delete
} elseif ( 0 === count( $source_files ) ) {
[566] Fix | Delete
// There are no files?
[567] Fix | Delete
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] );
[568] Fix | Delete
} else {
[569] Fix | Delete
/*
[570] Fix | Delete
* It's only a single file, the upgrader will use the folder name of this file as the destination folder.
[571] Fix | Delete
* Folder name is based on zip filename.
[572] Fix | Delete
*/
[573] Fix | Delete
$source = trailingslashit( $args['source'] );
[574] Fix | Delete
}
[575] Fix | Delete
[576] Fix | Delete
/**
[577] Fix | Delete
* Filters the source file location for the upgrade package.
[578] Fix | Delete
*
[579] Fix | Delete
* @since 2.8.0
[580] Fix | Delete
* @since 4.4.0 The $hook_extra parameter became available.
[581] Fix | Delete
*
[582] Fix | Delete
* @param string $source File source location.
[583] Fix | Delete
* @param string $remote_source Remote file source location.
[584] Fix | Delete
* @param WP_Upgrader $upgrader WP_Upgrader instance.
[585] Fix | Delete
* @param array $hook_extra Extra arguments passed to hooked filters.
[586] Fix | Delete
*/
[587] Fix | Delete
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
[588] Fix | Delete
[589] Fix | Delete
if ( is_wp_error( $source ) ) {
[590] Fix | Delete
return $source;
[591] Fix | Delete
}
[592] Fix | Delete
[593] Fix | Delete
if ( ! empty( $args['hook_extra']['temp_backup'] ) ) {
[594] Fix | Delete
$temp_backup = $this->move_to_temp_backup_dir( $args['hook_extra']['temp_backup'] );
[595] Fix | Delete
[596] Fix | Delete
if ( is_wp_error( $temp_backup ) ) {
[597] Fix | Delete
return $temp_backup;
[598] Fix | Delete
}
[599] Fix | Delete
[600] Fix | Delete
$this->temp_backups[] = $args['hook_extra']['temp_backup'];
[601] Fix | Delete
}
[602] Fix | Delete
[603] Fix | Delete
// Has the source location changed? If so, we need a new source_files list.
[604] Fix | Delete
if ( $source !== $remote_source ) {
[605] Fix | Delete
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
[606] Fix | Delete
}
[607] Fix | Delete
[608] Fix | Delete
/*
[609] Fix | Delete
* Protection against deleting files in any important base directories.
[610] Fix | Delete
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
[611] Fix | Delete
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
[612] Fix | Delete
* to copy the directory into the directory, whilst they pass the source
[613] Fix | Delete
* as the actual files to copy.
[614] Fix | Delete
*/
[615] Fix | Delete
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
[616] Fix | Delete
[617] Fix | Delete
if ( is_array( $wp_theme_directories ) ) {
[618] Fix | Delete
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
[619] Fix | Delete
}
[620] Fix | Delete
[621] Fix | Delete
if ( in_array( $destination, $protected_directories, true ) ) {
[622] Fix | Delete
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
[623] Fix | Delete
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
[624] Fix | Delete
}
[625] Fix | Delete
[626] Fix | Delete
if ( $clear_destination ) {
[627] Fix | Delete
// We're going to clear the destination if there's something there.
[628] Fix | Delete
$this->skin->feedback( 'remove_old' );
[629] Fix | Delete
[630] Fix | Delete
$removed = $this->clear_destination( $remote_destination );
[631] Fix | Delete
[632] Fix | Delete
/**
[633] Fix | Delete
* Filters whether the upgrader cleared the destination.
[634] Fix | Delete
*
[635] Fix | Delete
* @since 2.8.0
[636] Fix | Delete
*
[637] Fix | Delete
* @param true|WP_Error $removed Whether the destination was cleared.
[638] Fix | Delete
* True upon success, WP_Error on failure.
[639] Fix | Delete
* @param string $local_destination The local package destination.
[640] Fix | Delete
* @param string $remote_destination The remote package destination.
[641] Fix | Delete
* @param array $hook_extra Extra arguments passed to hooked filters.
[642] Fix | Delete
*/
[643] Fix | Delete
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
[644] Fix | Delete
[645] Fix | Delete
if ( is_wp_error( $removed ) ) {
[646] Fix | Delete
return $removed;
[647] Fix | Delete
}
[648] Fix | Delete
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
[649] Fix | Delete
/*
[650] Fix | Delete
* If we're not clearing the destination folder and something exists there already, bail.
[651] Fix | Delete
* But first check to see if there are actually any files in the folder.
[652] Fix | Delete
*/
[653] Fix | Delete
$_files = $wp_filesystem->dirlist( $remote_destination );
[654] Fix | Delete
if ( ! empty( $_files ) ) {
[655] Fix | Delete
$wp_filesystem->delete( $remote_source, true ); // Clear out the source files.
[656] Fix | Delete
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
[657] Fix | Delete
}
[658] Fix | Delete
}
[659] Fix | Delete
[660] Fix | Delete
/*
[661] Fix | Delete
* If 'clear_working' is false, the source should not be removed, so use copy_dir() instead.
[662] Fix | Delete
*
[663] Fix | Delete
* Partial updates, like language packs, may want to retain the destination.
[664] Fix | Delete
* If the destination exists or has contents, this may be a partial update,
[665] Fix | Delete
* and the destination should not be removed, so use copy_dir() instead.
[666] Fix | Delete
*/
[667] Fix | Delete
if ( $args['clear_working']
[668] Fix | Delete
&& (
[669] Fix | Delete
// Destination does not exist or has no contents.
[670] Fix | Delete
! $wp_filesystem->exists( $remote_destination )
[671] Fix | Delete
|| empty( $wp_filesystem->dirlist( $remote_destination ) )
[672] Fix | Delete
)
[673] Fix | Delete
) {
[674] Fix | Delete
$result = move_dir( $source, $remote_destination, true );
[675] Fix | Delete
} else {
[676] Fix | Delete
// Create destination if needed.
[677] Fix | Delete
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
[678] Fix | Delete
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
[679] Fix | Delete
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
[680] Fix | Delete
}
[681] Fix | Delete
}
[682] Fix | Delete
$result = copy_dir( $source, $remote_destination );
[683] Fix | Delete
}
[684] Fix | Delete
[685] Fix | Delete
// Clear the working directory?
[686] Fix | Delete
if ( $args['clear_working'] ) {
[687] Fix | Delete
$wp_filesystem->delete( $remote_source, true );
[688] Fix | Delete
}
[689] Fix | Delete
[690] Fix | Delete
if ( is_wp_error( $result ) ) {
[691] Fix | Delete
return $result;
[692] Fix | Delete
}
[693] Fix | Delete
[694] Fix | Delete
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
[695] Fix | Delete
if ( '.' === $destination_name ) {
[696] Fix | Delete
$destination_name = '';
[697] Fix | Delete
}
[698] Fix | Delete
[699] Fix | Delete
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
[700] Fix | Delete
[701] Fix | Delete
/**
[702] Fix | Delete
* Filters the installation response after the installation has finished.
[703] Fix | Delete
*
[704] Fix | Delete
* @since 2.8.0
[705] Fix | Delete
*
[706] Fix | Delete
* @param bool $response Installation response.
[707] Fix | Delete
* @param array $hook_extra Extra arguments passed to hooked filters.
[708] Fix | Delete
* @param array $result Installation result data.
[709] Fix | Delete
*/
[710] Fix | Delete
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
[711] Fix | Delete
[712] Fix | Delete
if ( is_wp_error( $res ) ) {
[713] Fix | Delete
$this->result = $res;
[714] Fix | Delete
return $res;
[715] Fix | Delete
}
[716] Fix | Delete
[717] Fix | Delete
// Bombard the calling function will all the info which we've just used.
[718] Fix | Delete
return $this->result;
[719] Fix | Delete
}
[720] Fix | Delete
[721] Fix | Delete
/**
[722] Fix | Delete
* Runs an upgrade/installation.
[723] Fix | Delete
*
[724] Fix | Delete
* Attempts to download the package (if it is not a local file), unpack it, and
[725] Fix | Delete
* install it in the destination folder.
[726] Fix | Delete
*
[727] Fix | Delete
* @since 2.8.0
[728] Fix | Delete
*
[729] Fix | Delete
* @param array $options {
[730] Fix | Delete
* Array or string of arguments for upgrading/installing a package.
[731] Fix | Delete
*
[732] Fix | Delete
* @type string $package The full path or URI of the package to install.
[733] Fix | Delete
* Default empty.
[734] Fix | Delete
* @type string $destination The full path to the destination folder.
[735] Fix | Delete
* Default empty.
[736] Fix | Delete
* @type bool $clear_destination Whether to delete any files already in the
[737] Fix | Delete
* destination folder. Default false.
[738] Fix | Delete
* @type bool $clear_working Whether to delete the files from the working
[739] Fix | Delete
* directory after copying them to the destination.
[740] Fix | Delete
* Default true.
[741] Fix | Delete
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
[742] Fix | Delete
* folder already exists. When true, `$clear_destination`
[743] Fix | Delete
* should be false. Default true.
[744] Fix | Delete
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
[745] Fix | Delete
* actions being performed in bulk. When true, the skin
[746] Fix | Delete
* WP_Upgrader::header() and WP_Upgrader::footer()
[747] Fix | Delete
* aren't called. Default false.
[748] Fix | Delete
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
[749] Fix | Delete
* WP_Upgrader::run().
[750] Fix | Delete
* }
[751] Fix | Delete
* @return array|false|WP_Error The result from self::install_package() on success, otherwise a WP_Error,
[752] Fix | Delete
* or false if unable to connect to the filesystem.
[753] Fix | Delete
*/
[754] Fix | Delete
public function run( $options ) {
[755] Fix | Delete
[756] Fix | Delete
$defaults = array(
[757] Fix | Delete
'package' => '', // Please always pass this.
[758] Fix | Delete
'destination' => '', // ...and this.
[759] Fix | Delete
'clear_destination' => false,
[760] Fix | Delete
'clear_working' => true,
[761] Fix | Delete
'abort_if_destination_exists' => true, // Abort if the destination directory exists. Pass clear_destination as false please.
[762] Fix | Delete
'is_multi' => false,
[763] Fix | Delete
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
[764] Fix | Delete
);
[765] Fix | Delete
[766] Fix | Delete
$options = wp_parse_args( $options, $defaults );
[767] Fix | Delete
[768] Fix | Delete
/**
[769] Fix | Delete
* Filters the package options before running an update.
[770] Fix | Delete
*
[771] Fix | Delete
* See also {@see 'upgrader_process_complete'}.
[772] Fix | Delete
*
[773] Fix | Delete
* @since 4.3.0
[774] Fix | Delete
*
[775] Fix | Delete
* @param array $options {
[776] Fix | Delete
* Options used by the upgrader.
[777] Fix | Delete
*
[778] Fix | Delete
* @type string $package Package for update.
[779] Fix | Delete
* @type string $destination Update location.
[780] Fix | Delete
* @type bool $clear_destination Clear the destination resource.
[781] Fix | Delete
* @type bool $clear_working Clear the working resource.
[782] Fix | Delete
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
[783] Fix | Delete
* @type bool $is_multi Whether the upgrader is running multiple times.
[784] Fix | Delete
* @type array $hook_extra {
[785] Fix | Delete
* Extra hook arguments.
[786] Fix | Delete
*
[787] Fix | Delete
* @type string $action Type of action. Default 'update'.
[788] Fix | Delete
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
[789] Fix | Delete
* @type bool $bulk Whether the update process is a bulk update. Default true.
[790] Fix | Delete
* @type string $plugin Path to the plugin file relative to the plugins directory.
[791] Fix | Delete
* @type string $theme The stylesheet or template name of the theme.
[792] Fix | Delete
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
[793] Fix | Delete
* or 'core'.
[794] Fix | Delete
* @type object $language_update The language pack update offer.
[795] Fix | Delete
* }
[796] Fix | Delete
* }
[797] Fix | Delete
*/
[798] Fix | Delete
$options = apply_filters( 'upgrader_package_options', $options );
[799] Fix | Delete
[800] Fix | Delete
if ( ! $options['is_multi'] ) { // Call $this->header separately if running multiple times.
[801] Fix | Delete
$this->skin->header();
[802] Fix | Delete
}
[803] Fix | Delete
[804] Fix | Delete
// Connect to the filesystem first.
[805] Fix | Delete
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
[806] Fix | Delete
// Mainly for non-connected filesystem.
[807] Fix | Delete
if ( ! $res ) {
[808] Fix | Delete
if ( ! $options['is_multi'] ) {
[809] Fix | Delete
$this->skin->footer();
[810] Fix | Delete
}
[811] Fix | Delete
return false;
[812] Fix | Delete
}
[813] Fix | Delete
[814] Fix | Delete
$this->skin->before();
[815] Fix | Delete
[816] Fix | Delete
if ( is_wp_error( $res ) ) {
[817] Fix | Delete
$this->skin->error( $res );
[818] Fix | Delete
$this->skin->after();
[819] Fix | Delete
if ( ! $options['is_multi'] ) {
[820] Fix | Delete
$this->skin->footer();
[821] Fix | Delete
}
[822] Fix | Delete
return $res;
[823] Fix | Delete
}
[824] Fix | Delete
[825] Fix | Delete
/*
[826] Fix | Delete
* Download the package. Note: If the package is the full path
[827] Fix | Delete
* to an existing local file, it will be returned untouched.
[828] Fix | Delete
*/
[829] Fix | Delete
$download = $this->download_package( $options['package'], false, $options['hook_extra'] );
[830] Fix | Delete
[831] Fix | Delete
/*
[832] Fix | Delete
* Allow for signature soft-fail.
[833] Fix | Delete
* WARNING: This may be removed in the future.
[834] Fix | Delete
*/
[835] Fix | Delete
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
[836] Fix | Delete
[837] Fix | Delete
// Don't output the 'no signature could be found' failure message for now.
[838] Fix | Delete
if ( 'signature_verification_no_signature' !== $download->get_error_code() || WP_DEBUG ) {
[839] Fix | Delete
// Output the failure error as a normal feedback, and not as an error.
[840] Fix | Delete
$this->skin->feedback( $download->get_error_message() );
[841] Fix | Delete
[842] Fix | Delete
// Report this failure back to WordPress.org for debugging purposes.
[843] Fix | Delete
wp_version_check(
[844] Fix | Delete
array(
[845] Fix | Delete
'signature_failure_code' => $download->get_error_code(),
[846] Fix | Delete
'signature_failure_data' => $download->get_error_data(),
[847] Fix | Delete
)
[848] Fix | Delete
);
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
// Pretend this error didn't happen.
[852] Fix | Delete
$download = $download->get_error_data( 'softfail-filename' );
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
if ( is_wp_error( $download ) ) {
[856] Fix | Delete
$this->skin->error( $download );
[857] Fix | Delete
$this->skin->after();
[858] Fix | Delete
if ( ! $options['is_multi'] ) {
[859] Fix | Delete
$this->skin->footer();
[860] Fix | Delete
}
[861] Fix | Delete
return $download;
[862] Fix | Delete
}
[863] Fix | Delete
[864] Fix | Delete
$delete_package = ( $download !== $options['package'] ); // Do not delete a "local" file.
[865] Fix | Delete
[866] Fix | Delete
// Unzips the file into a temporary directory.
[867] Fix | Delete
$working_dir = $this->unpack_package( $download, $delete_package );
[868] Fix | Delete
if ( is_wp_error( $working_dir ) ) {
[869] Fix | Delete
$this->skin->error( $working_dir );
[870] Fix | Delete
$this->skin->after();
[871] Fix | Delete
if ( ! $options['is_multi'] ) {
[872] Fix | Delete
$this->skin->footer();
[873] Fix | Delete
}
[874] Fix | Delete
return $working_dir;
[875] Fix | Delete
}
[876] Fix | Delete
[877] Fix | Delete
// With the given options, this installs it to the destination directory.
[878] Fix | Delete
$result = $this->install_package(
[879] Fix | Delete
array(
[880] Fix | Delete
'source' => $working_dir,
[881] Fix | Delete
'destination' => $options['destination'],
[882] Fix | Delete
'clear_destination' => $options['clear_destination'],
[883] Fix | Delete
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
[884] Fix | Delete
'clear_working' => $options['clear_working'],
[885] Fix | Delete
'hook_extra' => $options['hook_extra'],
[886] Fix | Delete
)
[887] Fix | Delete
);
[888] Fix | Delete
[889] Fix | Delete
/**
[890] Fix | Delete
* Filters the result of WP_Upgrader::install_package().
[891] Fix | Delete
*
[892] Fix | Delete
* @since 5.7.0
[893] Fix | Delete
*
[894] Fix | Delete
* @param array|WP_Error $result Result from WP_Upgrader::install_package().
[895] Fix | Delete
* @param array $hook_extra Extra arguments passed to hooked filters.
[896] Fix | Delete
*/
[897] Fix | Delete
$result = apply_filters( 'upgrader_install_package_result', $result, $options['hook_extra'] );
[898] Fix | Delete
[899] Fix | Delete
$this->skin->set_result( $result );
[900] Fix | Delete
[901] Fix | Delete
if ( is_wp_error( $result ) ) {
[902] Fix | Delete
// An automatic plugin update will have already performed its rollback.
[903] Fix | Delete
if ( ! empty( $options['hook_extra']['temp_backup'] ) ) {
[904] Fix | Delete
$this->temp_restores[] = $options['hook_extra']['temp_backup'];
[905] Fix | Delete
[906] Fix | Delete
/*
[907] Fix | Delete
* Restore the backup on shutdown.
[908] Fix | Delete
* Actions running on `shutdown` are immune to PHP timeouts,
[909] Fix | Delete
* so in case the failure was due to a PHP timeout,
[910] Fix | Delete
* it will still be able to properly restore the previous version.
[911] Fix | Delete
*
[912] Fix | Delete
* Zero arguments are accepted as a string can sometimes be passed
[913] Fix | Delete
* internally during actions, causing an error because
[914] Fix | Delete
* `WP_Upgrader::restore_temp_backup()` expects an array.
[915] Fix | Delete
*/
[916] Fix | Delete
add_action( 'shutdown', array( $this, 'restore_temp_backup' ), 10, 0 );
[917] Fix | Delete
}
[918] Fix | Delete
$this->skin->error( $result );
[919] Fix | Delete
[920] Fix | Delete
if ( ! method_exists( $this->skin, 'hide_process_failed' ) || ! $this->skin->hide_process_failed( $result ) ) {
[921] Fix | Delete
$this->skin->feedback( 'process_failed' );
[922] Fix | Delete
}
[923] Fix | Delete
} else {
[924] Fix | Delete
// Installation succeeded.
[925] Fix | Delete
$this->skin->feedback( 'process_success' );
[926] Fix | Delete
}
[927] Fix | Delete
[928] Fix | Delete
$this->skin->after();
[929] Fix | Delete
[930] Fix | Delete
// Clean up the backup kept in the temporary backup directory.
[931] Fix | Delete
if ( ! empty( $options['hook_extra']['temp_backup'] ) ) {
[932] Fix | Delete
// Delete the backup on `shutdown` to avoid a PHP timeout.
[933] Fix | Delete
add_action( 'shutdown', array( $this, 'delete_temp_backup' ), 100, 0 );
[934] Fix | Delete
}
[935] Fix | Delete
[936] Fix | Delete
if ( ! $options['is_multi'] ) {
[937] Fix | Delete
[938] Fix | Delete
/**
[939] Fix | Delete
* Fires when the upgrader process is complete.
[940] Fix | Delete
*
[941] Fix | Delete
* See also {@see 'upgrader_package_options'}.
[942] Fix | Delete
*
[943] Fix | Delete
* @since 3.6.0
[944] Fix | Delete
* @since 3.7.0 Added to WP_Upgrader::run().
[945] Fix | Delete
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
[946] Fix | Delete
*
[947] Fix | Delete
* @param WP_Upgrader $upgrader WP_Upgrader instance. In other contexts this might be a
[948] Fix | Delete
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
[949] Fix | Delete
* @param array $hook_extra {
[950] Fix | Delete
* Array of bulk item update data.
[951] Fix | Delete
*
[952] Fix | Delete
* @type string $action Type of action. Default 'update'.
[953] Fix | Delete
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
[954] Fix | Delete
* @type bool $bulk Whether the update process is a bulk update. Default true.
[955] Fix | Delete
* @type array $plugins Array of the basename paths of the plugins' main files.
[956] Fix | Delete
* @type array $themes The theme slugs.
[957] Fix | Delete
* @type array $translations {
[958] Fix | Delete
* Array of translations update data.
[959] Fix | Delete
*
[960] Fix | Delete
* @type string $language The locale the translation is for.
[961] Fix | Delete
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
[962] Fix | Delete
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
[963] Fix | Delete
* 'default' for core translations.
[964] Fix | Delete
* @type string $version The version of a theme, plugin, or core.
[965] Fix | Delete
* }
[966] Fix | Delete
* }
[967] Fix | Delete
*/
[968] Fix | Delete
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
[969] Fix | Delete
[970] Fix | Delete
$this->skin->footer();
[971] Fix | Delete
}
[972] Fix | Delete
[973] Fix | Delete
return $result;
[974] Fix | Delete
}
[975] Fix | Delete
[976] Fix | Delete
/**
[977] Fix | Delete
* Toggles maintenance mode for the site.
[978] Fix | Delete
*
[979] Fix | Delete
* Creates/deletes the maintenance file to enable/disable maintenance mode.
[980] Fix | Delete
*
[981] Fix | Delete
* @since 2.8.0
[982] Fix | Delete
*
[983] Fix | Delete
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
[984] Fix | Delete
*
[985] Fix | Delete
* @param bool $enable True to enable maintenance mode, false to disable.
[986] Fix | Delete
*/
[987] Fix | Delete
public function maintenance_mode( $enable = false ) {
[988] Fix | Delete
global $wp_filesystem;
[989] Fix | Delete
[990] Fix | Delete
if ( ! $wp_filesystem ) {
[991] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/file.php';
[992] Fix | Delete
WP_Filesystem();
[993] Fix | Delete
}
[994] Fix | Delete
[995] Fix | Delete
$file = $wp_filesystem->abspath() . '.maintenance';
[996] Fix | Delete
if ( $enable ) {
[997] Fix | Delete
if ( ! wp_doing_cron() ) {
[998] Fix | Delete
$this->skin->feedback( 'maintenance_start' );
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function