Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -274,6 +274,8 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
* @since 2.8.0
|
||||
* @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
|
||||
*
|
||||
* @global string $wp_version The WordPress version string.
|
||||
*
|
||||
* @param string[] $plugins Array of paths to plugin files relative to the plugins directory.
|
||||
* @param array $args {
|
||||
* Optional. Other arguments for upgrading several plugins at once.
|
||||
@@ -283,6 +285,8 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
* @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem.
|
||||
*/
|
||||
public function bulk_upgrade( $plugins, $args = array() ) {
|
||||
global $wp_version;
|
||||
|
||||
$defaults = array(
|
||||
'clear_update_cache' => true,
|
||||
);
|
||||
@@ -326,7 +330,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
$this->update_count = count( $plugins );
|
||||
$this->update_current = 0;
|
||||
foreach ( $plugins as $plugin ) {
|
||||
$this->update_current++;
|
||||
++$this->update_current;
|
||||
$this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true );
|
||||
|
||||
if ( ! isset( $current->response[ $plugin ] ) ) {
|
||||
@@ -343,23 +347,55 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->skin->plugin_active = is_plugin_active( $plugin );
|
||||
|
||||
$result = $this->run(
|
||||
array(
|
||||
'package' => $r->package,
|
||||
'destination' => WP_PLUGIN_DIR,
|
||||
'clear_destination' => true,
|
||||
'clear_working' => true,
|
||||
'is_multi' => true,
|
||||
'hook_extra' => array(
|
||||
'plugin' => $plugin,
|
||||
'temp_backup' => array(
|
||||
'slug' => dirname( $plugin ),
|
||||
'src' => WP_PLUGIN_DIR,
|
||||
'dir' => 'plugins',
|
||||
if ( isset( $r->requires ) && ! is_wp_version_compatible( $r->requires ) ) {
|
||||
$result = new WP_Error(
|
||||
'incompatible_wp_required_version',
|
||||
sprintf(
|
||||
/* translators: 1: Current WordPress version, 2: WordPress version required by the new plugin version. */
|
||||
__( 'Your WordPress version is %1$s, however the new plugin version requires %2$s.' ),
|
||||
$wp_version,
|
||||
$r->requires
|
||||
)
|
||||
);
|
||||
|
||||
$this->skin->before( $result );
|
||||
$this->skin->error( $result );
|
||||
$this->skin->after();
|
||||
} elseif ( isset( $r->requires_php ) && ! is_php_version_compatible( $r->requires_php ) ) {
|
||||
$result = new WP_Error(
|
||||
'incompatible_php_required_version',
|
||||
sprintf(
|
||||
/* translators: 1: Current PHP version, 2: PHP version required by the new plugin version. */
|
||||
__( 'The PHP version on your server is %1$s, however the new plugin version requires %2$s.' ),
|
||||
PHP_VERSION,
|
||||
$r->requires_php
|
||||
)
|
||||
);
|
||||
|
||||
$this->skin->before( $result );
|
||||
$this->skin->error( $result );
|
||||
$this->skin->after();
|
||||
} else {
|
||||
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
|
||||
$result = $this->run(
|
||||
array(
|
||||
'package' => $r->package,
|
||||
'destination' => WP_PLUGIN_DIR,
|
||||
'clear_destination' => true,
|
||||
'clear_working' => true,
|
||||
'is_multi' => true,
|
||||
'hook_extra' => array(
|
||||
'plugin' => $plugin,
|
||||
'temp_backup' => array(
|
||||
'slug' => dirname( $plugin ),
|
||||
'src' => WP_PLUGIN_DIR,
|
||||
'dir' => 'plugins',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
)
|
||||
);
|
||||
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
|
||||
}
|
||||
|
||||
$results[ $plugin ] = $result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user