mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Fix issue that appears if we try to update several plugins at once
This commit is contained in:
@@ -266,7 +266,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
$active_plugins = UM()->dependencies()->get_active_plugins();
|
||||
foreach ( $slugs as $slug ) {
|
||||
if ( in_array( $slug, $active_plugins ) ) {
|
||||
$plugin_data = get_plugin_data( um_path . '..' . DIRECTORY_SEPARATOR . $slug );
|
||||
$path = wp_normalize_path( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
if(!file_exists( $path)){
|
||||
continue;
|
||||
}
|
||||
$plugin_data = get_plugin_data( $path );
|
||||
if ( version_compare( '2.0', $plugin_data['Version'], '>' ) ) {
|
||||
$show = true;
|
||||
break;
|
||||
|
||||
@@ -519,8 +519,9 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->columns();
|
||||
$this->admin()->notices();
|
||||
$this->admin_navmenu();
|
||||
$this->theme_updater();
|
||||
$this->access();
|
||||
$this->plugin_updater();
|
||||
$this->theme_updater();
|
||||
} elseif ( $this->is_request( 'admin' ) ) {
|
||||
$this->admin();
|
||||
$this->admin_menu();
|
||||
@@ -532,9 +533,9 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->admin()->notices();
|
||||
$this->users();
|
||||
$this->dragdrop();
|
||||
$this->plugin_updater();
|
||||
$this->admin_gdpr();
|
||||
$this->admin_navmenu();
|
||||
$this->plugin_updater();
|
||||
$this->theme_updater();
|
||||
} elseif ( $this->is_request( 'frontend' ) ) {
|
||||
$this->enqueue();
|
||||
|
||||
@@ -28,6 +28,9 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
//cron request to UM()->store_url;
|
||||
add_action( 'um_check_extensions_licenses', array( &$this, 'um_checklicenses' ) );
|
||||
|
||||
// clean update plugin cache
|
||||
add_action( 'upgrader_process_complete', array( &$this, 'clean_update_plugins_cache' ), 20, 2 );
|
||||
|
||||
//update plugin info
|
||||
add_filter( 'pre_set_site_transient_update_plugins', array( &$this, 'check_update' ) );
|
||||
@@ -36,6 +39,22 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
add_filter( 'plugins_api', array( &$this, 'plugin_information' ), 9999, 3 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This action is documented in wp-admin/includes/class-wp-upgrader.php
|
||||
*
|
||||
* @see file /wp-admin/includes/class-plugin-upgrader.php method bulk_upgrade()
|
||||
* @since 2.1.1 [2019-11-15]
|
||||
*
|
||||
* @param Plugin_Upgrader $Plugin_Upgrader
|
||||
* @param array $action
|
||||
*/
|
||||
public function clean_update_plugins_cache( $Plugin_Upgrader, $action = array() ) {
|
||||
if ( is_a( $Plugin_Upgrader, 'Plugin_Upgrader' ) && isset( $Plugin_Upgrader->result ) && isset( $Plugin_Upgrader->result['destination_name'] ) && strpos( $Plugin_Upgrader->result['destination_name'], 'um-' ) === 0 && $action['action'] === 'update' && $action['action'] === 'plugin' ) {
|
||||
wp_clean_plugins_cache( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all paid UM extensions
|
||||
@@ -337,7 +356,11 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
$path = wp_normalize_path( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
if(!file_exists( $path)){
|
||||
continue;
|
||||
}
|
||||
$plugin_data = get_plugin_data( $path );
|
||||
|
||||
$version_info = $this->get_cached_version_info( $slug );
|
||||
if ( false === $version_info ) {
|
||||
|
||||
Reference in New Issue
Block a user