Plugin Directory

Changeset 3315519


Ignore:
Timestamp:
06/21/2025 12:03:37 AM (7 months ago)
Author:
codexonics
Message:

Updated trunk for version 2.0.7

Location:
prime-mover/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • prime-mover/trunk/PrimeMoverFactory.php

    r3301867 r3315519  
    319319        $this->removePrimeMoverDirectoriesOnUninstall();
    320320        $this->removePrimeMoverOptionsInDb();
     321        $this->removePrimeMoverCrons();
     322    }
     323   
     324    /**
     325     * Remove Prime Mover cron hooks on uninstall
     326     */
     327    private function removePrimeMoverCrons()
     328    {
     329        if (!function_exists('getPrimeMoverCronHooks')) {
     330            return;
     331        }
     332       
     333        $prime_mover_crons = getPrimeMoverCronHooks();
     334        if (!is_array($prime_mover_crons)) {
     335            return;
     336        }
     337       
     338        foreach ($prime_mover_crons as $cron_hook) {
     339            if ($cron_hook && is_string($cron_hook)) {
     340                wp_unschedule_hook($cron_hook);
     341            }           
     342        }
    321343    }
    322344   
  • prime-mover/trunk/changelog.txt

    r3301867 r3315519  
    22
    33**This is a list detailing changes for all Prime Mover releases.**
     4
     5= 2.0.4 =
     6
     7* Fixed: Data was missing on import due to a large extended insert in the database restore.
     8* Updated Freemius SDK to the latest version.
    49
    510= 2.0.3 =
  • prime-mover/trunk/classes/PrimeMoverSystemFunctions.php

    r3301867 r3315519  
    11951195         */
    11961196        if ((isset($diff['users'])) && (! empty($diff['users']))) {
     1197            $admin_text = esc_html__('administrator', 'prime-mover');
     1198            $platform_text = esc_html__('WordPress', 'prime-mover');
     1199            $tutorial_link = PRIME_MOVER_RESETDB_TUTORIAL;
     1200            if (is_multisite()) {
     1201                $admin_text = esc_html__('super administrator', 'prime-mover');
     1202                $platform_text = esc_html__('WordPress multisite', 'prime-mover');
     1203                $tutorial_link = PRIME_MOVER_RESETDB_MULTISITE_TUTORIAL;
     1204            }           
     1205             
    11971206            $blank_site = true;
    11981207            if (isset($diff['users']['blank_site'])) {
     
    12161225            $msg .= esc_html__('For best restoration results, the following is recommended:', 'prime-mover');
    12171226            $msg .= '<ol>';
    1218             $msg .= '<li>' . sprintf(esc_html__('Start with a %s', 'prime-mover'), '<a class="prime-mover-external-link" target="_blank" href="' . PRIME_MOVER_RESETDB_TUTORIAL . '">' . esc_html__('fresh WordPress install', 'prime-mover') . '</a>.') . '</li>';
     1227            $msg .= '<li>' . sprintf(esc_html__('Start with a %s', 'prime-mover'), '<a class="prime-mover-external-link" target="_blank" href="' . $tutorial_link . '">' . sprintf(esc_html__('fresh %s install', 'prime-mover'), $platform_text) . '</a>.') . '</li>';
    12191228           
    12201229            $recommended_email = '';
     
    12241233           
    12251234            if ($recommended_email) {
    1226                 $msg .= '<li>' . sprintf(esc_html__('Set %s as its administrator.', 'prime-mover'), '<strong>' . $recommended_email . '</strong>') . '</li>';
     1235                $msg .= '<li>' . sprintf(esc_html__('Set %s as its %s.', 'prime-mover'), '<strong>' . $recommended_email . '</strong>', $admin_text) . '</li>';
    12271236            } else {
    12281237                $msg .= '<li>' . sprintf(esc_html__('Use a %s email, and do not use %s to avoid user restoration conflicts', 'prime-mover'), '<em>' .
     
    12311240           
    12321241            $msg .= '</ol>';
    1233             $msg .= sprintf(esc_html__('To do this, you must cancel this import by clicking the "%s" button and re-install WordPress in a fresh state. Please %s about this feature.', 'prime-mover'),
     1242            $msg .= sprintf(esc_html__('To do this, you must cancel this import by clicking the "%s" button and re-install %s in a fresh state. Please %s about this feature.', 'prime-mover'),
    12341243                '<strong>' . esc_html__('No', 'prime-mover') . '</strong>',
     1244                $platform_text,
    12351245                '<a class="prime-mover-external-link" target="_blank" href="' . CODEXONICS_USER_DIFF_FAQ . '">' . esc_html__('read the FAQ', 'prime-mover') . '</a>');
    12361246            $msg .= PHP_EOL;
     
    47594769   
    47604770    /**
     4771     * Replace is_multisite returns TRUE if multisite.
     4772     * This function returns TRUE if multisite AND MAIN SITE IS fresh (entire network also)
     4773     * @param number $blog_id
     4774     * @return boolean
     4775     */
     4776    public function isFreshMultisiteMainSite($blog_id = 0)
     4777    {
     4778        if (!$blog_id) {
     4779            return false;
     4780        }
     4781
     4782        if (!is_multisite()) {
     4783            return false;
     4784        }
     4785       
     4786        $admins = get_super_admins();
     4787        if (!is_array($admins)) {
     4788            return false;
     4789        }
     4790       
     4791        $count_admins = count($admins);
     4792        $count_admins = (int)$count_admins;
     4793        if ($count_admins > 1) {
     4794            return false;
     4795        }
     4796       
     4797        $count_users = get_user_count();
     4798        $count_users = (int)$count_users;
     4799        if ($count_users > 1) {
     4800            return false;
     4801        }
     4802       
     4803        $large_network = wp_is_large_network();
     4804        if ($large_network) {
     4805            return false;
     4806        }
     4807       
     4808        $count_blogs = get_blog_count();
     4809        $count_blogs = (int)$count_blogs;
     4810        if ($count_blogs > 1) {
     4811            return false;
     4812        }       
     4813       
     4814        if (!$this->isMultisiteMainSite($blog_id)) {
     4815            return false;
     4816        }
     4817       
     4818        return true;
     4819    }
     4820   
     4821    /**
    47614822     * Clean Tables to export
    47624823     * @param number $blogid_to_export
  • prime-mover/trunk/classes/PrimeMoverUsers.php

    r3217325 r3315519  
    134134        add_filter('prime_mover_process_userid_adjustment_db', [$this, 'dBCustomerUserIdsHelper'], 10, 13);
    135135       
    136         add_filter('prime_mover_filter_config_after_diff_check', [ $this, 'handleUserDifferences'], 99, 1);
     136        add_filter('prime_mover_filter_config_after_diff_check', [ $this, 'handleUserDifferences'], 99, 2);
    137137    }   
    138138   
     
    140140     * Handle user differences
    141141     * @param array $import_data
    142      * @return array
    143      */
    144     public function handleUserDifferences(array $import_data)
    145     {
    146         $bailout = apply_filters('prime_mover_maybe_bailout_user_diff_check', false, $import_data);
     142     * @param number $blog_id
     143     * @return array
     144     */
     145    public function handleUserDifferences(array $import_data = [], $blog_id = 0)
     146    {
     147        $bailout = apply_filters('prime_mover_maybe_bailout_user_diff_check', false, $import_data, $blog_id);
    147148        if ($bailout) {
    148149            return $import_data;
     
    154155       
    155156        $do_user_diff_check = !wp_is_large_user_count();
    156         if (!$do_user_diff_check || is_multisite()) {
     157        if (!$do_user_diff_check) {
     158            return $import_data;
     159        }
     160       
     161        if (is_multisite() && false === $this->getSystemFunctions()->isFreshMultisiteMainSite($blog_id)) {
    157162            return $import_data;
    158163        }
  • prime-mover/trunk/engines/prime-mover-panel/advance/PrimeMoverTroubleshooting.php

    r3217325 r3315519  
    178178        add_action('wp_ajax_prime_mover_clear_locked_settings', [$this,'clearLockedSettings']);
    179179       
    180         add_filter('prime_mover_maybe_bailout_user_diff_check', [$this, 'maybeBailOutUserSiteDiff'], 10, 1);
     180        add_filter('prime_mover_maybe_bailout_user_diff_check', [$this, 'maybeBailOutUserSiteDiff'], 10, 3);
    181181    }
    182182
     
    184184     * Maybe bail out user site diff
    185185     * @param boolean $bailout
     186     * @param array $ret
     187     * @param number $blog_id
    186188     * @return string|boolean
    187189     */
    188     public function maybeBailOutUserSiteDiff($bailout = false)
     190    public function maybeBailOutUserSiteDiff($bailout = false, $ret = [], $blog_id = 0)
    189191    {
    190192        $setting = $this->getPrimeMoverSettings()->getSetting(self::DISABLE_USER_DIFF_CHECK);
    191         if (!$setting || is_multisite()) {
     193        if (!$setting) {
     194            return $bailout;
     195        }
     196       
     197        if (is_multisite() && false === $this->getPrimeMover()->getSystemFunctions()->isFreshMultisiteMainSite($blog_id)) {
    192198            return $bailout;
    193199        }
     
    740746    public function renderDisableUserDiffMarkup()
    741747    {
     748        $blog_id = 0;
    742749        if (is_multisite()) {
     750            $blog_id = get_current_blog_id();
     751        }
     752       
     753        if ($blog_id && false === $this->getPrimeMover()->getSystemFunctions()->isFreshMultisiteMainSite($blog_id)) {   
    743754            return;
    744755        }
  • prime-mover/trunk/engines/prime-mover-panel/prime-mover-panel.php

    r3301867 r3315519  
    4343}
    4444define( 'PRIME_MOVER_PANEL_PLUGINPATH', plugin_dir_path( __FILE__ ) );
    45 define( 'PRIME_MOVER_PANEL_VERSION', '2.0.6' );
     45define( 'PRIME_MOVER_PANEL_VERSION', '2.0.7' );
    4646define( 'PRIME_MOVER_PANEL_MAINPLUGIN_FILE', __FILE__ );
    4747define( 'PRIME_MOVER_PANEL_PLUGINBASENAME', plugin_basename( PRIME_MOVER_PANEL_MAINPLUGIN_FILE ) );
  • prime-mover/trunk/engines/prime-mover-panel/vendor/composer/installed.php

    r3301867 r3315519  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '50872445a354c9a4f93d35b245b7a9b4db40a151',
     6        'reference' => '44126d4736eeaf70024cc5acab43fdfe647dd0df',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '50872445a354c9a4f93d35b245b7a9b4db40a151',
     16            'reference' => '44126d4736eeaf70024cc5acab43fdfe647dd0df',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • prime-mover/trunk/global/PrimeMoverGlobalConstants.php

    r3301867 r3315519  
    99}
    1010
    11 define('PRIME_MOVER_VERSION', '2.0.6');
     11define('PRIME_MOVER_VERSION', '2.0.7');
    1212define('PRIME_MOVER_PLUGIN_CODENAME', 'Prime Mover');
    1313define('PRIME_MOVER_PRO_PLUGIN_CODENAME', 'Prime Mover PRO');
     
    224224}
    225225
     226if (!defined('PRIME_MOVER_RESETDB_MULTISITE_TUTORIAL')) {
     227    define('PRIME_MOVER_RESETDB_MULTISITE_TUTORIAL', 'https://codexonics.com/prime_mover/prime-mover/how-to-create-a-fresh-wordpress-multisite-install-with-a-specific-network-administrator-email/');
     228}
     229
    226230if (!defined('PRIME_MOVER_FIX_MU_SCRIPT_TUTORIAL')) {
    227231    define('PRIME_MOVER_FIX_MU_SCRIPT_TUTORIAL', 'https://codexonics.com/prime_mover/prime-mover/troubleshooting-unable-to-activate-prime-mover-in-restricted-mu-plugins-directory/');
  • prime-mover/trunk/global/PrimeMoverGlobalFunctions.php

    r3301867 r3315519  
    615615
    616616}
     617if ( !function_exists( 'str_starts_with' ) ) {
     618    function str_starts_with(  $haystack, $needle  ) {
     619        if ( '' === $needle ) {
     620            return true;
     621        }
     622        return 0 === strpos( $haystack, $needle );
     623    }
     624
     625}
     626if ( !function_exists( 'getPrimeMoverCronHooks' ) ) {
     627    function getPrimeMoverCronHooks() {
     628        $prime_mover_crons = [];
     629        if ( !function_exists( '_get_cron_array' ) ) {
     630            return $prime_mover_crons;
     631        }
     632        $cron = _get_cron_array();
     633        if ( !is_array( $cron ) ) {
     634            return $prime_mover_crons;
     635        }
     636        $cron_values = array_values( $cron );
     637        foreach ( $cron_values as $v ) {
     638            if ( !is_array( $v ) ) {
     639                continue;
     640            }
     641            $cron_hooks = array_keys( $v );
     642            foreach ( $cron_hooks as $hook ) {
     643                if ( $hook && is_string( $hook ) && str_starts_with( $hook, 'primeMover' ) ) {
     644                    $prime_mover_crons[] = $hook;
     645                }
     646            }
     647        }
     648        return $prime_mover_crons;
     649    }
     650
     651}
    617652if ( !function_exists( 'primeMoverRestoreAdminCaps' ) ) {
    618653    function primeMoverRestoreAdminCaps() {
  • prime-mover/trunk/prime-mover.php

    r3301867 r3315519  
    55Plugin URI: https://codexonics.com/
    66Description: The simplest all-around WordPress migration tool/backup plugin. These support multisite backup/migration or clone WP site/multisite subsite.
    7 Version: 2.0.6
     7Version: 2.0.7
    88Author: Codexonics
    99Author URI: https://codexonics.com/
  • prime-mover/trunk/readme.txt

    r3301867 r3315519  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 2.0.6
     8Stable tag: 2.0.7
    99License: GPLv3 or later
    1010License URI: https://codexonics.com
     
    105105== Changelog ==
    106106
     107= 2.0.7 =
     108
     109* Fixed: Malformed domain name due to edge case double search replace.
     110* Feature: Added user difference check when migrating site to multisite main site.
     111* Fixed: Removed cron jobs when the plugin is uninstalled.
     112
    107113= 2.0.6 =
    108114
     
    125131* Usability: Added tutorial to download packages in different ways.
    126132
    127 = 2.0.4 =
    128 
    129 * Fixed: Data was missing on import due to a large extended insert in the database restore.
    130 * Updated Freemius SDK to the latest version.
    131 
    132133See the previous changelogs in changelog.txt.
  • prime-mover/trunk/utilities/PrimeMoverSearchReplaceUtilities.php

    r3263153 r3315519  
    325325        add_filter('prime_mover_filter_final_replaceables', [$this, 'maybeUnsetWpRoot'], 25000, 4);
    326326        add_filter('prime_mover_filter_final_replaceables', [$this, 'maybeAdjustEdgeRelativeCustomContentUploads'], 30000, 4);
     327        add_filter('prime_mover_filter_final_replaceables', [$this, 'maybeUnsetGenericAltDomain'], 35000, 4);
     328    }
     329 
     330    /**
     331     * Maybe unset generic alt domain
     332     * @param array $replaceables
     333     * @param array $ret
     334     * @param boolean $retries
     335     * @param number $blogid_to_import
     336     */
     337    public function maybeUnsetGenericAltDomain($replaceables = [], $ret = [], $retries = false, $blogid_to_import = 0)
     338    {
     339        if (!$this->getSystemAuthorization()->isUserAuthorized() || !is_array($replaceables)) {
     340            return $replaceables;
     341        }
     342       
     343        if (!is_multisite()) {
     344            return $replaceables;
     345        }
     346       
     347        if (!isset($replaceables['generic_alt_domain_scheme'])) {               
     348            return $replaceables;
     349        }     
     350       
     351        $generic_domain_scheme_replace = '';
     352        $generic_alt_domain_scheme_replace = '';
     353       
     354        if (isset($replaceables['generic_domain_scheme']['replace'])) {
     355            $generic_domain_scheme_replace = $replaceables['generic_domain_scheme']['replace'];
     356        }
     357           
     358        if (isset($replaceables['generic_alt_domain_scheme']['replace'])) {
     359            $generic_alt_domain_scheme_replace = $replaceables['generic_alt_domain_scheme']['replace'];
     360        }
     361       
     362        if (!$generic_domain_scheme_replace || !$generic_alt_domain_scheme_replace) {
     363            return $replaceables;
     364        }
     365       
     366        if ($generic_domain_scheme_replace !== $generic_alt_domain_scheme_replace) {
     367            return $replaceables;
     368        }
     369       
     370        $search = '';
     371        $replace = '';
     372        $subject = '';
     373       
     374        if (isset($replaceables['generic_alt_domain_scheme']['search'])) {
     375            $search = $replaceables['generic_alt_domain_scheme']['search'];
     376        }
     377       
     378        if (isset($replaceables['generic_alt_domain_scheme']['replace'])) {
     379            $replace = $replaceables['generic_alt_domain_scheme']['replace'];
     380        }
     381       
     382        if (isset($replaceables['generic_domain_scheme']['replace'])) {
     383            $subject = $replaceables['generic_domain_scheme']['replace'];
     384        }
     385       
     386        if (!$search || !$replace || !$subject) {
     387            return $replaceables;
     388        }
     389       
     390        if (!is_string($search) || !is_string($replace) || !is_string($subject)) {
     391            return $replaceables;
     392        }
     393       
     394        $search = trim($search);
     395        $replace = trim($replace);
     396        $subject = trim($subject);
     397       
     398        $result = str_replace($search, $replace, $subject);
     399        $problem = false;
     400        if ($result !== $subject && $result !== $replace) {
     401             $problem = true;
     402        }
     403       
     404        if (!$problem) {
     405            return $replaceables;           
     406        }
     407       
     408        if (isset($replaceables['generic_alt_domain_scheme'])) {
     409            unset($replaceables['generic_alt_domain_scheme']);
     410        }
     411
     412        if (isset($replaceables['generic_alt_domain_scheme_slashedvar'])) {
     413            unset($replaceables['generic_alt_domain_scheme_slashedvar']);
     414        }
     415       
     416        return $replaceables;;
    327417    }
    328418   
  • prime-mover/trunk/vendor/composer/installed.php

    r3301867 r3315519  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '50872445a354c9a4f93d35b245b7a9b4db40a151',
     6        'reference' => '44126d4736eeaf70024cc5acab43fdfe647dd0df',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '50872445a354c9a4f93d35b245b7a9b4db40a151',
     16            'reference' => '44126d4736eeaf70024cc5acab43fdfe647dd0df',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.