| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/admin-columns-pro.5.1.3/classes/ |
Upload File : |
<?php
namespace ACP;
use AC\Capabilities;
use AC\Registrable;
use ACP\API\Cached;
use ACP\Type\SiteUrl;
class Updates implements Registrable {
/**
* @var API
*/
private $api;
/**
* @var LicenseKeyRepository
*/
private $license_key_repository;
/**
* @var SiteUrl
*/
private $site_url;
/**
* @var Plugins
*/
private $plugins;
public function __construct( API $api, LicenseKeyRepository $license_key_repository, SiteUrl $site_url, Plugins $plugins ) {
$this->api = $api;
$this->license_key_repository = $license_key_repository;
$this->site_url = $site_url;
$this->plugins = $plugins;
}
public function register() {
add_action( 'init', [ $this, 'register_updater' ], 9 );
add_action( 'init', [ $this, 'force_plugin_update_check_on_request' ] );
}
/**
* @return bool
*/
private function is_doing_ajax_update_process() {
return wp_doing_ajax() && 'update-plugin' === filter_input( INPUT_POST, 'action' );
}
public function register_updater() {
// Skip updater during the ajax update process
if ( $this->is_doing_ajax_update_process() ) {
return;
}
foreach ( $this->plugins->all() as $plugin ) {
// Add plugins to update process
$updater = new Updates\Updater( $plugin, new API\Cached( $this->api ), $this->site_url, $this->plugins, $this->license_key_repository->find() );
$updater->register();
// Click "view details" on plugin page
$view_details = new Updates\ViewPluginDetails( $plugin->get_dirname(), $this->api );
$view_details->register();
}
}
public function force_plugin_update_check_on_request() {
global $pagenow;
if ( '1' !== filter_input( INPUT_GET, 'force-check' )
|| $pagenow !== 'update-core.php'
|| ! current_user_can( Capabilities::MANAGE ) ) {
return;
}
$api = new API\Cached( $this->api );
$api->dispatch(
new API\Request\ProductsUpdate( $this->site_url, $this->plugins, $this->license_key_repository->find() ), [
Cached::FORCE_UPDATE => true,
]
);
}
}