Plugin Directory

Changeset 3805834


Ignore:
Timestamp:
11/16/2026 06:20:29 PM (less than one hour ago)
Author:
1clickmigration
Message:

Release 3.3.4

Location:
1-click-migration
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • 1-click-migration/tags/3.3.4/inc/backup/class-ocm-backup.php

    r3796862 r3805834  
    433433    const OPTION_BINARY_PREFLIGHT = 'ocm_binary_preflight_verdict';
    434434    const OPTION_RESTORE_PLUGINS_ISOLATED = 'ocm_restore_plugins_isolated';
     435    /** Plugins a finished restore left turned off; drives the wp-admin reminder. */
     436    const OPTION_PLUGINS_OFF_AFTER_RESTORE = 'ocm_plugins_off_after_restore';
    435437    /** Hosts the staging URL rewrite collected so far, for a resumed rewrite. */
    436438    const OPTION_RESTORE_URL_HOSTS = 'ocm_restore_url_hosts';
    … …  
    18401842     * @param string $reason    Short reason for the review_ask log line.
    18411843     */
     1844    /**
     1845     * A restore turns every other plugin off (active_plugins is written
     1846     * directly, no hooks) and leaves them off. Remember which ones at every
     1847     * successful end, so wp-admin can remind the admin to turn them back on.
     1848     *
     1849     * @return void
     1850     */
     1851    private static function remember_plugins_off_after_restore()
     1852    {
     1853        $saved = get_option('ocm_force_deactivated_plugins', array());
     1854        if (!is_array($saved) || !$saved) {
     1855            return;
     1856        }
     1857        $own = plugin_basename(OCM_MAIN_FILE);
     1858        $list = array();
     1859        foreach ($saved as $plugin) {
     1860            if (is_string($plugin) && $plugin !== '' && $plugin !== $own) {
     1861                $list[$plugin] = true;
     1862            }
     1863        }
     1864        if ($list) {
     1865            update_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE, array_keys($list), false);
     1866        }
     1867    }
     1868
     1869    /**
     1870     * Plugins the last finished restore turned off that are still off and
     1871     * still installed. Clears the reminder once none are left.
     1872     *
     1873     * @return string[] plugin basenames
     1874     */
     1875    public static function plugins_still_off_after_restore()
     1876    {
     1877        $list = get_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE, array());
     1878        if (!is_array($list) || !$list) {
     1879            return array();
     1880        }
     1881        $active = get_option('active_plugins', array());
     1882        $active = is_array($active) ? $active : array();
     1883        $still_off = array();
     1884        foreach ($list as $plugin) {
     1885            if (!is_string($plugin) || $plugin === '' || in_array($plugin, $active, true)) {
     1886                continue;
     1887            }
     1888            if (validate_file($plugin) !== 0 || !is_file(WP_PLUGIN_DIR . '/' . $plugin)) {
     1889                continue;
     1890            }
     1891            $still_off[] = $plugin;
     1892        }
     1893        if (!$still_off) {
     1894            delete_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE);
     1895        }
     1896        return $still_off;
     1897    }
     1898
    18421899    public static function apply_restore_success_flags($is_warned, $reason = '')
    18431900    {
     1901        self::remember_plugins_off_after_restore();
    18441902        update_option('ocm_show_restore_success', time(), false);
    18451903        $is_partial = (is_string($reason) && false !== strpos($reason, 'partial'));
    … …  
    89078965      delete_option(self::OPTION_RESTORE_PLUGINS_ISOLATED);
    89088966      delete_option(self::OPTION_RESTORE_WAS_WARNED);
     8967      delete_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE);
    89098968      delete_option(self::OPTION_RESTORE_URL_HOSTS);
    89108969      // A run abandoned mid-import left its prefix; this run's dumps are new.
  • 1-click-migration/tags/3.3.4/one-click-migration.php

    r3796862 r3805834  
    55 * Plugin URI: https://wordpress.org/plugins/1-click-migration/
    66 * Description: Migrate, copy, or clone your entire site with 1 click. <strong>Any host, no size limitation.</strong> $9.99 per migration, success guaranteed or a refund.
    7  * Version: 3.3.3
     7 * Version: 3.3.4
    88 * Requires at least: 5.3
    99 * Requires PHP: 7.4
    … …  
    182182        add_action('admin_notices', array(__CLASS__, 'maybe_show_review_notice'));
    183183
     184        // After a restore the site's other plugins are still turned off.
     185        add_action('admin_init', array(__CLASS__, 'handle_plugins_off_dismiss'));
     186        add_action('admin_notices', array(__CLASS__, 'maybe_show_plugins_off_notice'));
     187
    184188    }
    185189
    … …  
    317321    }
    318322
     323    /** Dismiss the "your plugins are still turned off" reminder. */
     324    public static function handle_plugins_off_dismiss()
     325    {
     326        if (empty($_GET['ocm_dismiss_plugins_off']) || empty($_GET['_wpnonce']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     327            || !wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['_wpnonce'])), 'ocm_dismiss_plugins_off') // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     328        ) {
     329            return;
     330        }
     331        if (!current_user_can('activate_plugins')) {
     332            return;
     333        }
     334        delete_option(OCM_Backup::OPTION_PLUGINS_OFF_AFTER_RESTORE);
     335    }
     336
     337    /**
     338     * After a finished restore, every plugin except this one is still turned
     339     * off. Say so on every wp-admin screen until they are back on or the
     340     * admin dismisses the reminder.
     341     */
     342    public static function maybe_show_plugins_off_notice()
     343    {
     344        if (!current_user_can('activate_plugins')) {
     345            return;
     346        }
     347        $still_off = OCM_Backup::plugins_still_off_after_restore();
     348        if (!$still_off) {
     349            return;
     350        }
     351
     352        $names = array();
     353        $all = function_exists('get_plugins') ? get_plugins() : array();
     354        foreach ($still_off as $plugin) {
     355            if (!empty($all[$plugin]['Name'])) {
     356                $names[] = $all[$plugin]['Name'];
     357            } else {
     358                $names[] = dirname($plugin) === '.' ? basename($plugin, '.php') : dirname($plugin);
     359            }
     360        }
     361        $shown = array_slice($names, 0, 8);
     362        $more = count($names) - count($shown);
     363        $list = implode(', ', $shown);
     364        if ($more > 0) {
     365            /* translators: 1: list of plugin names, 2: how many more plugins are not listed */
     366            $list = sprintf(__('%1$s and %2$d more', '1-click-migration'), $list, $more);
     367        }
     368        $count = count($still_off);
     369        $plugins_url = admin_url('plugins.php?plugin_status=inactive');
     370        $dismiss_url = wp_nonce_url(add_query_arg('ocm_dismiss_plugins_off', '1'), 'ocm_dismiss_plugins_off');
     371        ?>
     372        <div class="notice notice-warning ocm-plugins-off-notice">
     373            <p><strong><?php
     374                /* translators: %d: number of plugins */
     375                echo esc_html(sprintf(_n(
     376                    'Your restore is done, but %d plugin is still turned off.',
     377                    'Your restore is done, but %d plugins are still turned off.',
     378                    $count,
     379                    '1-click-migration'
     380                ), $count));
     381            ?></strong>
     382            <?php esc_html_e('1 Click Migration turns your other plugins off while it restores a site. They do not work until you turn them back on.', '1-click-migration'); ?></p>
     383            <p><?php echo esc_html($list); ?></p>
     384            <p>
     385                <a class="button button-primary" href="<?php echo esc_url($plugins_url); ?>"><?php esc_html_e('Turn my plugins back on', '1-click-migration'); ?></a>
     386                <a href="<?php echo esc_url($dismiss_url); ?>" style="margin-left: 12px;"><?php esc_html_e('Dismiss', '1-click-migration'); ?></a>
     387            </p>
     388        </div>
     389        <?php
     390    }
     391
    319392    /**
    320393     * Persistent admin notice asking for a review after the first clean restore.
    … …  
    367440            'ocm_show_restore_success',
    368441            'ocm_show_review_cta',
     442            'ocm_plugins_off_after_restore',
    369443            'ocm_extra_domain_candidates',
    370444            'ocm_restore_url_plan',
  • 1-click-migration/tags/3.3.4/readme.txt

    r3796862 r3805834  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 3.3.3
     7Stable tag: 3.3.4
    88Author URI: https://1clickmigration.com
    99License: GPLv3 or later
    … …  
    134134
    135135== Changelog ==
     136= 3.3.4 =
     137* **A reminder to turn your plugins back on**: A restore turns your other plugins off, and they stay off until you turn them back on. Nothing said so, and a site could run for days with its plugins not working. After a restore, your dashboard now lists the plugins that are still off, with a button that takes you to them.
     138
    136139= 3.3.3 =
    137140* **"Out of disk space" now shows on the page**: When a hosting account ran out of space during a backup, the plugin's own progress notes could get cut short. The page then stayed on the last step, such as "Archiving plugins", without saying the backup had stopped or why. It now shows that the account is out of disk space and how to fix it.
    … …  
    251254== Upgrade Notice ==
    252255
     256= 3.3.4 =
     257After a restore, your dashboard now reminds you to turn your other plugins back on. Includes all 3.3.3 changes.
     258
    253259= 3.3.3 =
    254260A backup that runs out of disk space now says so on the page instead of stopping silently. Includes all 3.3.2 changes.
  • 1-click-migration/trunk/inc/backup/class-ocm-backup.php

    r3796862 r3805834  
    433433    const OPTION_BINARY_PREFLIGHT = 'ocm_binary_preflight_verdict';
    434434    const OPTION_RESTORE_PLUGINS_ISOLATED = 'ocm_restore_plugins_isolated';
     435    /** Plugins a finished restore left turned off; drives the wp-admin reminder. */
     436    const OPTION_PLUGINS_OFF_AFTER_RESTORE = 'ocm_plugins_off_after_restore';
    435437    /** Hosts the staging URL rewrite collected so far, for a resumed rewrite. */
    436438    const OPTION_RESTORE_URL_HOSTS = 'ocm_restore_url_hosts';
    … …  
    18401842     * @param string $reason    Short reason for the review_ask log line.
    18411843     */
     1844    /**
     1845     * A restore turns every other plugin off (active_plugins is written
     1846     * directly, no hooks) and leaves them off. Remember which ones at every
     1847     * successful end, so wp-admin can remind the admin to turn them back on.
     1848     *
     1849     * @return void
     1850     */
     1851    private static function remember_plugins_off_after_restore()
     1852    {
     1853        $saved = get_option('ocm_force_deactivated_plugins', array());
     1854        if (!is_array($saved) || !$saved) {
     1855            return;
     1856        }
     1857        $own = plugin_basename(OCM_MAIN_FILE);
     1858        $list = array();
     1859        foreach ($saved as $plugin) {
     1860            if (is_string($plugin) && $plugin !== '' && $plugin !== $own) {
     1861                $list[$plugin] = true;
     1862            }
     1863        }
     1864        if ($list) {
     1865            update_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE, array_keys($list), false);
     1866        }
     1867    }
     1868
     1869    /**
     1870     * Plugins the last finished restore turned off that are still off and
     1871     * still installed. Clears the reminder once none are left.
     1872     *
     1873     * @return string[] plugin basenames
     1874     */
     1875    public static function plugins_still_off_after_restore()
     1876    {
     1877        $list = get_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE, array());
     1878        if (!is_array($list) || !$list) {
     1879            return array();
     1880        }
     1881        $active = get_option('active_plugins', array());
     1882        $active = is_array($active) ? $active : array();
     1883        $still_off = array();
     1884        foreach ($list as $plugin) {
     1885            if (!is_string($plugin) || $plugin === '' || in_array($plugin, $active, true)) {
     1886                continue;
     1887            }
     1888            if (validate_file($plugin) !== 0 || !is_file(WP_PLUGIN_DIR . '/' . $plugin)) {
     1889                continue;
     1890            }
     1891            $still_off[] = $plugin;
     1892        }
     1893        if (!$still_off) {
     1894            delete_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE);
     1895        }
     1896        return $still_off;
     1897    }
     1898
    18421899    public static function apply_restore_success_flags($is_warned, $reason = '')
    18431900    {
     1901        self::remember_plugins_off_after_restore();
    18441902        update_option('ocm_show_restore_success', time(), false);
    18451903        $is_partial = (is_string($reason) && false !== strpos($reason, 'partial'));
    … …  
    89078965      delete_option(self::OPTION_RESTORE_PLUGINS_ISOLATED);
    89088966      delete_option(self::OPTION_RESTORE_WAS_WARNED);
     8967      delete_option(self::OPTION_PLUGINS_OFF_AFTER_RESTORE);
    89098968      delete_option(self::OPTION_RESTORE_URL_HOSTS);
    89108969      // A run abandoned mid-import left its prefix; this run's dumps are new.
  • 1-click-migration/trunk/one-click-migration.php

    r3796862 r3805834  
    55 * Plugin URI: https://wordpress.org/plugins/1-click-migration/
    66 * Description: Migrate, copy, or clone your entire site with 1 click. <strong>Any host, no size limitation.</strong> $9.99 per migration, success guaranteed or a refund.
    7  * Version: 3.3.3
     7 * Version: 3.3.4
    88 * Requires at least: 5.3
    99 * Requires PHP: 7.4
    … …  
    182182        add_action('admin_notices', array(__CLASS__, 'maybe_show_review_notice'));
    183183
     184        // After a restore the site's other plugins are still turned off.
     185        add_action('admin_init', array(__CLASS__, 'handle_plugins_off_dismiss'));
     186        add_action('admin_notices', array(__CLASS__, 'maybe_show_plugins_off_notice'));
     187
    184188    }
    185189
    … …  
    317321    }
    318322
     323    /** Dismiss the "your plugins are still turned off" reminder. */
     324    public static function handle_plugins_off_dismiss()
     325    {
     326        if (empty($_GET['ocm_dismiss_plugins_off']) || empty($_GET['_wpnonce']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     327            || !wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['_wpnonce'])), 'ocm_dismiss_plugins_off') // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     328        ) {
     329            return;
     330        }
     331        if (!current_user_can('activate_plugins')) {
     332            return;
     333        }
     334        delete_option(OCM_Backup::OPTION_PLUGINS_OFF_AFTER_RESTORE);
     335    }
     336
     337    /**
     338     * After a finished restore, every plugin except this one is still turned
     339     * off. Say so on every wp-admin screen until they are back on or the
     340     * admin dismisses the reminder.
     341     */
     342    public static function maybe_show_plugins_off_notice()
     343    {
     344        if (!current_user_can('activate_plugins')) {
     345            return;
     346        }
     347        $still_off = OCM_Backup::plugins_still_off_after_restore();
     348        if (!$still_off) {
     349            return;
     350        }
     351
     352        $names = array();
     353        $all = function_exists('get_plugins') ? get_plugins() : array();
     354        foreach ($still_off as $plugin) {
     355            if (!empty($all[$plugin]['Name'])) {
     356                $names[] = $all[$plugin]['Name'];
     357            } else {
     358                $names[] = dirname($plugin) === '.' ? basename($plugin, '.php') : dirname($plugin);
     359            }
     360        }
     361        $shown = array_slice($names, 0, 8);
     362        $more = count($names) - count($shown);
     363        $list = implode(', ', $shown);
     364        if ($more > 0) {
     365            /* translators: 1: list of plugin names, 2: how many more plugins are not listed */
     366            $list = sprintf(__('%1$s and %2$d more', '1-click-migration'), $list, $more);
     367        }
     368        $count = count($still_off);
     369        $plugins_url = admin_url('plugins.php?plugin_status=inactive');
     370        $dismiss_url = wp_nonce_url(add_query_arg('ocm_dismiss_plugins_off', '1'), 'ocm_dismiss_plugins_off');
     371        ?>
     372        <div class="notice notice-warning ocm-plugins-off-notice">
     373            <p><strong><?php
     374                /* translators: %d: number of plugins */
     375                echo esc_html(sprintf(_n(
     376                    'Your restore is done, but %d plugin is still turned off.',
     377                    'Your restore is done, but %d plugins are still turned off.',
     378                    $count,
     379                    '1-click-migration'
     380                ), $count));
     381            ?></strong>
     382            <?php esc_html_e('1 Click Migration turns your other plugins off while it restores a site. They do not work until you turn them back on.', '1-click-migration'); ?></p>
     383            <p><?php echo esc_html($list); ?></p>
     384            <p>
     385                <a class="button button-primary" href="<?php echo esc_url($plugins_url); ?>"><?php esc_html_e('Turn my plugins back on', '1-click-migration'); ?></a>
     386                <a href="<?php echo esc_url($dismiss_url); ?>" style="margin-left: 12px;"><?php esc_html_e('Dismiss', '1-click-migration'); ?></a>
     387            </p>
     388        </div>
     389        <?php
     390    }
     391
    319392    /**
    320393     * Persistent admin notice asking for a review after the first clean restore.
    … …  
    367440            'ocm_show_restore_success',
    368441            'ocm_show_review_cta',
     442            'ocm_plugins_off_after_restore',
    369443            'ocm_extra_domain_candidates',
    370444            'ocm_restore_url_plan',
  • 1-click-migration/trunk/readme.txt

    r3796862 r3805834  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 3.3.3
     7Stable tag: 3.3.4
    88Author URI: https://1clickmigration.com
    99License: GPLv3 or later
    … …  
    134134
    135135== Changelog ==
     136= 3.3.4 =
     137* **A reminder to turn your plugins back on**: A restore turns your other plugins off, and they stay off until you turn them back on. Nothing said so, and a site could run for days with its plugins not working. After a restore, your dashboard now lists the plugins that are still off, with a button that takes you to them.
     138
    136139= 3.3.3 =
    137140* **"Out of disk space" now shows on the page**: When a hosting account ran out of space during a backup, the plugin's own progress notes could get cut short. The page then stayed on the last step, such as "Archiving plugins", without saying the backup had stopped or why. It now shows that the account is out of disk space and how to fix it.
    … …  
    251254== Upgrade Notice ==
    252255
     256= 3.3.4 =
     257After a restore, your dashboard now reminds you to turn your other plugins back on. Includes all 3.3.3 changes.
     258
    253259= 3.3.3 =
    254260A backup that runs out of disk space now says so on the page instead of stopping silently. Includes all 3.3.2 changes.
Note: See TracChangeset for help on using the changeset viewer.