WS_OK_7.4.33 HEX
HEX
Server: nginx/1.21.4
System: Linux v12674 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: endtheignorance (1014)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v12674/lcalosangeles/public_html/wp-content/plugins/autoupdater/lib/Command/Selfupdate.php
<?php
defined('AUTOUPDATER_LIB') or die;

class AutoUpdater_Command_Selfupdate extends AutoUpdater_Command_Base
{
    /**
     * AutoUpdater WordPress plugin self-update
     *
     * @when before_wp_load
     */
    public function __invoke($args, $assoc_args)
    {
        $current_version = AUTOUPDATER_VERSION;
        WP_CLI::line(sprintf('Updating %s %s ...', AUTOUPDATER_WP_PLUGIN_NAME, $current_version));

        try {
            /** @var AutoUpdater_Task_ChildUpdate $task */
            $task = AutoUpdater_Task::getInstance('ChildUpdate');
            $result = $task->doTask();
        } catch (AutoUpdater_Exception_Response $e) {
            if ($e->getErrorCode()) {
                WP_CLI::error(sprintf('Failed to update plugin. Error [%s] %s', $e->getErrorCode(), $e->getErrorMessage()));
                return;
            }
            WP_CLI::error(sprintf('Failed to update plugin. Error [%s] %s', $e->getCode(), $e->getMessage()));
            return;
        } catch (Exception $e) {
            WP_CLI::error(sprintf('Failed to update plugin. Error [%s] %s', $e->getCode(), $e->getMessage()));
            return;
        }

        $installer = AutoUpdater_Installer::getInstance();
        $new_version = $installer->getVersion();

        if ($new_version && version_compare($current_version, $new_version, '>=') && (!empty($result['success']) || $result['error']['code'] === 'no_update_warning')) {
            WP_CLI::success('Plugin is already up-to-date.');
            return;
        }

        if (empty($result['success'])) {
            WP_CLI::error(sprintf('Failed to update plugin. Error [%s] %s', $result['error']['code'], $result['error']['message']));
            return;
        }

        if (!$installer->update()) {
            WP_CLI::error(sprintf('Failed to run post-update process after updating to version %s. Try again!', $new_version));
            return;
        }

        WP_CLI::success(sprintf('Plugin has been successfully update to version %s', $new_version));
    }

    public static function beforeInvoke()
    {
    }
}