Plugin Directory

Changeset 3360834


Ignore:
Timestamp:
09/13/2025 12:21:42 AM (7 months ago)
Author:
codexonics
Message:

Updated trunk for version 2.0.9

Location:
prime-mover/trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • prime-mover/trunk/changelog.txt

    r3336904 r3360834  
    22
    33**This is a list detailing changes for all Prime Mover releases.**
     4
     5= 2.0.6 =
     6
     7* Feature: Support was added to exclude database tables from export.
     8* Usability: Added missing features tutorials.
     9* Fixed: The white-labelled license upgrade page goes to a non-existent page.
     10* Fixed: The user was presented with an upgrade instead of activating the license buttons.
     11* Usability: Improved labeling of subsite action buttons based on plan subscription status.
     12* Usability: Improved handling of upgrade buttons.
     13* Updated Freemius SDK to the latest version.
    414
    515= 2.0.5 =
  • prime-mover/trunk/classes/PrimeMoverErrorHandlers.php

    r3176508 r3360834  
    741741        if ( is_array( $processed_path ) ) {
    742742            foreach ( $processed_path as $path_to_delete ) {
     743                $path_to_delete = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($path_to_delete, $blog_id);
    743744                if ( $wp_filesystem->exists($path_to_delete) && apply_filters('prime_mover_delete_package_on_error', true, $path_to_delete, $blog_id)) {                   
    744745                    $this->reallyDeletePackage($path_to_delete, $error, $blog_id);
  • prime-mover/trunk/classes/PrimeMoverImporter.php

    r3263153 r3360834  
    636636            return $ret;
    637637        }
     638       
     639        if (isset($ret['blog_id'])) {           
     640            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     641        }
     642       
    638643        $this->getSystemInitialization()->setTemporaryImportPackagePath($unzipped_directory);       
    639644        $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits();       
     
    875880        if (isset($ret['unzipped_directory'])) {
    876881            $unzipped_directory = $ret['unzipped_directory'];
     882           
     883            if (isset($ret['blog_id'])) {
     884                $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     885            }
     886           
    877887            $directory_name = basename($unzipped_directory);
    878888            $exploded = explode("_", $directory_name);
     
    932942        if (isset($ret['unzipped_directory'])) {
    933943            $unzipped_directory = $ret['unzipped_directory'];
     944           
     945            if (isset($ret['blog_id'])) {
     946                $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     947            }
     948           
    934949            $footprint_package  = $unzipped_directory . 'footprint.json';
    935950            if ($wp_filesystem->exists($footprint_package)) {
     
    10641079                $unzipped_directory = $ret['unzipped_directory'];
    10651080            }
    1066         }   
     1081        }
     1082       
     1083        if (isset($ret['blog_id'])) {
     1084            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     1085        }
     1086       
    10671087        $ret = apply_filters('prime_mover_after_user_diff_confirmation', $ret, $blogid_to_import);
    10681088        if ($is_extracting_tar) {
     
    12171237        }
    12181238       
     1239        if (isset($ret['blog_id'])) {
     1240            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     1241        }
     1242       
    12191243        $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits();
    12201244        $skipped_languages_folder = true;
     
    13541378                $unzipped_directory = $ret['unzipped_directory'];
    13551379            }
    1356         }       
     1380        }
     1381       
     1382        if (isset($ret['blog_id'])) {
     1383            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     1384        }
     1385       
    13571386        $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits();             
    13581387        if (!empty($ret['skipped_media'])) {
     
    16511680
    16521681        $unzipped_path = $ret['unzipped_directory'];
     1682        if (isset($ret['blog_id'])) {
     1683            $unzipped_path = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_path, $ret['blog_id']);
     1684        }
     1685       
    16531686        $import_path_sql = $this->handleEncrypteddB($unzipped_path, $blogid_to_import);       
    16541687        if (!$import_path_sql ) {
     
    18841917        foreach ($db_import_options as $extension ) {
    18851918            $sql_file_name = $blogid_to_import . $extension;
    1886             $temp_path_sql = $unzipped_path . $sql_file_name;           
     1919            $temp_path_sql = trailingslashit($unzipped_path) . $sql_file_name;           
    18871920           
    18881921            if ($wp_filesystem->exists($temp_path_sql)) {
    18891922                $import_path_sql = $temp_path_sql;
    1890             }           
     1923            } else {
     1924                do_action('prime_mover_log_processed_events', "ERROR: SQL PATH DOES NOT EXISTS: {$temp_path_sql}", $blogid_to_import, 'import', __FUNCTION__, $this);
     1925            }
    18911926            if ($import_path_sql && '.sql.enc' === $extension) {
    18921927                $this->getSystemInitialization()->setEncryptedDb(true);
  • prime-mover/trunk/classes/PrimeMoverSystemFunctions.php

    r3336904 r3360834  
    14341434    public function getExportPathOfThisSubsite($blog_id = 0)
    14351435    {
    1436         if (! $this->getSystemAuthorization()->isUserAuthorized()) {
    1437             return;
    1438         }
    1439         $ret = '';
    1440         $blog_id = (int) $blog_id;
    1441         $export_path = $this->getSystemInitialization()->getMultisiteExportFolderPath();
    1442         if ($blog_id > 0 && $export_path) {
    1443             $ret= $export_path . $blog_id . DIRECTORY_SEPARATOR;
    1444         }
    1445         return $ret;
    1446     }
     1436        return $this->getSystemInitialization()->getExportPathOfThisSubsite($blog_id);
     1437    }
     1438   
    14471439    /**
    14481440     * Check if directory is empty
     
    16551647            return;
    16561648        }
    1657         if (isset($ret['unzipped_directory']) && $wp_filesystem->exists($ret['unzipped_directory'])) {
    1658             $wp_filesystem->rmdir($ret['unzipped_directory'], true);
     1649       
     1650        $unzipped_directory = '';
     1651        if (isset($ret['unzipped_directory'])) {
     1652            $unzipped_directory = $ret['unzipped_directory'];
     1653            if (isset($ret['blog_id'])) {
     1654                $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     1655            }
     1656        }       
     1657           
     1658        if ($unzipped_directory && $wp_filesystem->exists($unzipped_directory)) {
     1659            $wp_filesystem->rmdir($unzipped_directory, true);
    16591660        }
    16601661    }
     
    48934894        return false;
    48944895    }
     4896
     4897    /**
     4898     * Compute dynamic paths for preview domains
     4899     * Applicable only to WPRIME package paths inside export directory of specific site [DYNAMIC] / wprime
     4900     * Or unzipped directory inside export or import directory [DYNAMIC] / unzipped_directory
     4901     * @param string $static
     4902     * @param number $blog_id
     4903     * @return string
     4904     */
     4905    public function computeDynamicPathsPreviewDomains($static = '', $blog_id = 0)
     4906    {
     4907        return $this->getSystemInitialization()->getDynamicPathsPreviewDomains($static, $blog_id);
     4908    }
    48954909   
    48964910    /**
  • prime-mover/trunk/classes/PrimeMoverSystemInitialization.php

    r3301867 r3360834  
    37363736        return '';       
    37373737    }
     3738
     3739    /**
     3740     * Checks if preview domain
     3741     * @param string $given
     3742     * Returns TRUE if preview_domain
     3743     * Otherwise false if not preview domain
     3744     *
     3745     * @return boolean
     3746     */
     3747    public function isPreviewDomain($given = '')
     3748    {
     3749        if (!is_string($given) || !$given) {
     3750            return false;
     3751        }
     3752       
     3753        $preview_domain_values = PRIME_MOVER_PREVIEW_DOMAINS;
     3754        $preview_domains = json_decode($preview_domain_values, true);
     3755        if (!is_array($preview_domains)) {
     3756            return false;
     3757        }
     3758       
     3759        foreach ($preview_domains as $preview_domain) {
     3760            if (str_contains($given, $preview_domain)) {
     3761                return true;
     3762            }
     3763        }
     3764       
     3765        return false;
     3766    }
     3767 
     3768    /**
     3769     * Given the blog ID, retrieved the export subsite directory
     3770     * @compatible 5.6
     3771     * @param number $blog_id
     3772     * @return string
     3773     * @tested Codexonics\PrimeMoverFramework\Tests\TestPrimeMoverSystemFunctions::itGetsExportPathofSubsite()
     3774     * @tested Codexonics\PrimeMoverFramework\Tests\TestPrimeMoverSystemFunctions::itDoesNotGetExportPathIfNotAuthorized()
     3775     */
     3776    public function getExportPathOfThisSubsite($blog_id = 0)
     3777    {
     3778        if (! $this->getSystemAuthorization()->isUserAuthorized()) {
     3779            return;
     3780        }
     3781        $ret = '';
     3782        $blog_id = (int) $blog_id;
     3783        $export_path = $this->getMultisiteExportFolderPath();
     3784        if ($blog_id > 0 && $export_path) {
     3785            $ret= $export_path . $blog_id . DIRECTORY_SEPARATOR;
     3786        }
     3787        return $ret;
     3788    }
     3789
     3790    /**
     3791     * Compute dynamic paths for preview domains
     3792     * Applicable only to WPRIME package paths inside export directory of specific site [DYNAMIC] / wprime
     3793     * Or unzipped directory inside export directory [DYNAMIC] / unzipped_directory
     3794     * @param string $static
     3795     * @param number $blog_id
     3796     * @return string
     3797     */
     3798    public function getDynamicPathsPreviewDomains($static = '', $blog_id = 0)
     3799    {
     3800        if (!$this->isPreviewDomain($static)) {
     3801            return $static;
     3802        }
     3803       
     3804        if (!is_multisite() && !$blog_id) {
     3805            $blog_id = 1;
     3806        }
     3807             
     3808        $base = '';
     3809        if (str_contains($static, $this->getUploadTmpPathSlug())) {
     3810            $base = $this->getDefaultImportFolder();
     3811        }
     3812       
     3813        if (!$base && str_contains($static, $this->getMultisiteExportFolderSlug())) {
     3814            $base = $this->getExportPathOfThisSubsite($blog_id);
     3815        }
     3816       
     3817        if (!$base && str_contains($static, $this->getTmpDownloadsFolderSlug())) {
     3818            $base = $this->getTmpDownloadsFolder();
     3819        }
     3820       
     3821        if (!$base) {
     3822            return $static;
     3823        }
     3824       
     3825        $basename = basename($static);       
     3826        $recomputed = wp_normalize_path(trailingslashit($base) . $basename);
     3827        if (is_dir($recomputed)) {
     3828            $recomputed = trailingslashit($recomputed);
     3829        }
     3830       
     3831        if (file_exists($recomputed)) {
     3832            do_action('prime_mover_log_processed_events', "PREVIEW DOMAIN RECOMPUTED PATH EXISTS AND RETURNED: {$recomputed}", $blog_id, 'import', __FUNCTION__, $this);
     3833            return $recomputed;
     3834           
     3835        } else {
     3836            do_action('prime_mover_log_processed_events', "PREVIEW DOMAIN RECOMPUTED RETURNED STATIC: {$static}, {$recomputed} DOES NOT EXISTS.", $blog_id, 'import', __FUNCTION__, $this);
     3837            return $static;
     3838        }
     3839    }
    37383840   
    37393841    /**
  • prime-mover/trunk/classes/PrimeMoverSystemProcessors.php

    r3217325 r3360834  
    253253            global $wp_filesystem;
    254254            $temp_dir = $delete_tmpfile_post['temp_file_to_delete'];
     255           
     256            $temp_dir = $this->getSystemFunctions()->computeDynamicPathsPreviewDomains($temp_dir, $blog_id);
    255257            if ($temp_dir && $wp_filesystem->exists($temp_dir)) {
    256258                $this->getSystemInitialization()->setProcessingDelay(3);
     
    523525                if (isset($data_to_continue['unzipped_directory']) && isset($data_to_continue['diff']) && isset($data_to_continue['blog_id'])) {
    524526                    $unzipped_directory_to_check = $data_to_continue['unzipped_directory'];
     527                    $blogid_to_import = (int) $data_to_continue['blog_id'];
     528                    $unzipped_directory_to_check = $this->getSystemFunctions()->computeDynamicPathsPreviewDomains($unzipped_directory_to_check, $blogid_to_import);
    525529                    if ($wp_filesystem->exists($unzipped_directory_to_check)) {
    526530                        unset($data_to_continue['diff']);
    527531                        $data_to_continue['diff_confirmation'] = true;
    528                         $blogid_to_import = (int) $data_to_continue['blog_id'];
     532                       
    529533                        if ($blogid_to_import > 0) {
    530534                            $ret = $data_to_continue;
     
    573577                    $import_package_path = $import_ajax_input['multisite_import_package_uploaded_file'];
    574578                }
     579               
     580                $import_package_path = $this->getSystemFunctions()->computeDynamicPathsPreviewDomains($import_package_path, $blogid_to_import);
    575581                if (! $import_initiated && $blogid_to_import > 0 && $requisites_meet && $this->getSystemFunctions()->fileExists($import_package_path)) {
    576582                    do_action('prime_mover_log_processed_events', 'Original handler cleared and validated, starting the import.', $blogid_to_import, 'import', 'primeMoverImportProcessor', $this);
  • prime-mover/trunk/classes/PrimeMoverUsers.php

    r3315519 r3360834  
    284284     * @param boolean $last_processor
    285285     * @param string $handle_unique_constraint
    286      * @param boolean $non_user_adjustment
     286     * @param array $non_user_adjustment
    287287     * @param array $filter_clause
    288288     * @return array|boolean
    289289     */
    290290    public function dBCustomerUserIdsHelper($ret = [], $table = '', $blogid_to_import = 0, $leftoff_identifier = '', $primary_index = '', $column_strings = '',
    291         $update_variable = '', $progress_identifier = '', $start_time = 0, $last_processor = false, $handle_unique_constraint = '', $non_user_adjustment = false, $filter_clause = [])
    292     {
     291        $update_variable = '', $progress_identifier = '', $start_time = 0, $last_processor = false, $handle_unique_constraint = '', $non_user_adjustment = [], $filter_clause = [])
     292    {       
    293293        return $this->getUserUtilities()->getUserFunctions()->getUserQueries()->dBCustomerUserIdsHelper($ret, $table, $blogid_to_import, $leftoff_identifier, $primary_index, $column_strings,
    294294            $update_variable, $progress_identifier, $start_time, $last_processor, $handle_unique_constraint, $non_user_adjustment, $filter_clause);
  • prime-mover/trunk/classes/PrimeMoverValidationHandlers.php

    r2703582 r3360834  
    362362            return false;
    363363        }
     364       
     365        $input_data = $this->getMultisteMigration()->getSystemFunctions()->computeDynamicPathsPreviewDomains($input_data, $blog_id);       
    364366        if (is_file($input_data)) {
    365367            return false;
     
    440442            return false;
    441443        }       
     444       
     445        $filepath = $this->getMultisteMigration()->getSystemFunctions()->computeDynamicPathsPreviewDomains($filepath, $blog_id);
    442446        if ( ! file_exists($filepath) || ! is_file($filepath) ) {
    443447            do_action('prime_mover_log_processed_events', 'Package zip does not seem to exist', $blog_id, 'common', 'isMigrationPackage', $this);
    444448            return false;
    445449        }
     450       
    446451        if ( ! $this->getMultisteMigration()->getSystemFunctions()->isReallyValidFormat($filepath)) {
    447452            do_action('prime_mover_log_processed_events', 'Package zip is not a zip file.', $blog_id, 'common', 'isMigrationPackage', $this);
    448453            return false;
    449454        }
     455       
    450456        $package_description = '';
    451457        $tar_config = [];
  • prime-mover/trunk/compatibility/PrimeMoverBuddyPressCompat.php

    r3301867 r3360834  
    438438        $filter_clause['target_blog_id'] = $blogid_to_import;
    439439       
     440        $non_user_adjustment = ['format' => OBJECT];
     441     
    440442        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_two_leftoff", $primary_index, $column_strings,
    441         "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', true, $filter_clause);
     443        "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', $non_user_adjustment, $filter_clause);
    442444    }
    443445   
     
    476478       
    477479        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_six_leftoff", $primary_index, $column_strings,
    478         "3rdparty_{$table}_six_updated", "{$table} six table", $start_time, $last_processor, '', false, $filter_clause);
     480        "3rdparty_{$table}_six_updated", "{$table} six table", $start_time, $last_processor, '', [], $filter_clause);
    479481    }
    480482   
     
    515517       
    516518        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_five_leftoff", $primary_index, $column_strings,
    517         "3rdparty_{$table}_five_updated", "{$table} five table", $start_time, $last_processor, '', false, $filter_clause);
     519        "3rdparty_{$table}_five_updated", "{$table} five table", $start_time, $last_processor, '', [], $filter_clause);
    518520    }
    519521   
     
    550552        $filter_clause = [];
    551553        $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'members'];
    552 
     554       
    553555        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_four_leftoff", $primary_index, $column_strings,
    554         "3rdparty_{$table}_four_updated", "{$table} four table", $start_time, $last_processor, '', false, $filter_clause);
     556        "3rdparty_{$table}_four_updated", "{$table} four table", $start_time, $last_processor, '', [], $filter_clause);
    555557    }
    556558   
     
    641643       
    642644        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_leftoff", $primary_index, $column_strings,
    643         "3rdparty_{$table}_updated", "{$table} table", $start_time, $last_processor, '', false, $filter_clause);
     645        "3rdparty_{$table}_updated", "{$table} table", $start_time, $last_processor, '', [], $filter_clause);
    644646    }
    645647   
     
    678680       
    679681        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_leftoff", $primary_index, $column_strings,
    680         "3rdparty_{$table}_updated", "{$table} table", $start_time, $last_processor, '', false, $filter_clause);
     682        "3rdparty_{$table}_updated", "{$table} table", $start_time, $last_processor, '', [], $filter_clause);
    681683    }
    682684   
     
    717719        $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'forums', 'condition' => 'OR'];
    718720        $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'activity'];
    719        
     721               
    720722        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_three_leftoff", $primary_index, $column_strings,
    721         "3rdparty_{$table}_three_updated", "{$table} three table", $start_time, $last_processor, '', false, $filter_clause);
     723        "3rdparty_{$table}_three_updated", "{$table} three table", $start_time, $last_processor, '', [], $filter_clause);
    722724    }
    723725   
     
    755757        $filter_clause = [];
    756758        $filter_clause['where_clause'][] = ['field' => 'component', 'value' => 'friends'];       
    757        
     759               
    758760        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_three_leftoff", $primary_index, $column_strings,
    759         "3rdparty_{$table}_three_updated", "{$table} three table", $start_time, $last_processor, '', false, $filter_clause);
     761        "3rdparty_{$table}_three_updated", "{$table} three table", $start_time, $last_processor, '', [], $filter_clause);
    760762    }
    761763   
     
    795797       
    796798        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_two_leftoff", $primary_index, $column_strings,
    797         "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', false, $filter_clause);
     799        "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', [], $filter_clause);
    798800    }
    799801   
     
    832834       
    833835        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, 1, "3rdparty_{$table}_two_leftoff", $primary_index, $column_strings,
    834         "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', false, $filter_clause);
     836        "3rdparty_{$table}_two_updated", "{$table} two table", $start_time, $last_processor, '', [], $filter_clause);
    835837    }
    836838   
  • prime-mover/trunk/compatibility/PrimeMoverMultilingualCompat.php

    r3176508 r3360834  
    688688       
    689689        $unzipped_directory = $ret['unzipped_directory'];
     690        if (isset($ret['blog_id'])) {
     691            $blog_id = $ret['blog_id'];
     692            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $blog_id);           
     693        }
     694       
    690695        $lang_folder = $tar_config['prime_mover_source_site_lang_folder'];
    691696       
  • prime-mover/trunk/compatibility/PrimeMoverPageBuilderCompat.php

    r3176508 r3360834  
    3232    private $replaceables;
    3333    private $system_utilities;
     34    private $brizy_plugin;
     35    private $brizy_leftoff_identifier;
     36    private $brizy_compilation_option;
    3437   
    3538    /**
     
    4245        $this->prime_mover = $prime_mover;
    4346        $this->tagdiv_plugin = 'td-composer/td-composer.php';
     47        $this->brizy_plugin = 'brizy/brizy.php';
    4448       
    4549        $this->callbacks = [
    46             'maybeAdjustTagDivEncodedData' => 35           
     50            'maybeAdjustTagDivEncodedData' => 35,
     51            'maybeAdjustBrizyEncodedData' => 40
    4752        ];
     53       
    4854        $this->leftoff_identifier = '3rdparty_tagdiv_leftoff';
     55        $this->brizy_leftoff_identifier = '3rdparty_brizy_leftoff';
     56       
    4957        $this->replaceables = [       
    5058            'wpupload_url_alternative',
     
    6270         ];
    6371        $this->system_utilities = $utilities['sys_utilities'];
     72        $this->brizy_compilation_option = 'prime_mover_mark_brizy_for_compilation';
     73    }
     74   
     75    /**
     76     * Get Brizy compilation option
     77     * @return string
     78     */
     79    public function getBrizyCompilationOption()
     80    {
     81        return $this->brizy_compilation_option;
    6482    }
    6583   
     
    92110   
    93111    /**
     112     * Get Brizy leftoff identifier
     113     * @return string
     114     */
     115    public function getBrizyLeftOffIdentifier()
     116    {
     117        return $this->brizy_leftoff_identifier;
     118    }
     119   
     120    /**
    94121     * Get callbacks
    95122     * @return number[]
     
    107134    {
    108135        return $this->tagdiv_plugin;
     136    }
     137   
     138    /**
     139     *
     140     * Get Brizy plugin
     141     * @return string
     142     */
     143    public function getBrizyPlugin()
     144    {
     145        return $this->brizy_plugin;
    109146    }
    110147   
     
    173210       
    174211        add_action('prime_mover_before_thirdparty_data_processing', [$this, 'removeProcessorHooksWhenDependencyNotMeet'], 10, 2);   
     212        add_action('prime_mover_before_thirdparty_data_processing', [$this, 'removeBrizyAdjustmentWhenDependencyNotMeet'], 10, 2);       
    175213        add_filter('prime_mover_non_user_adjustment_select_query', [$this, 'seekPostToUpdateQuery'], 10, 6);
     214       
     215        add_filter('prime_mover_non_user_adjustment_select_query', [$this, 'brizySeekToUpdateQuery'], 10, 6);   
    176216        add_filter('prime_mover_non_user_adjustment_update_data', [$this, 'updateEncodedPageBuilderEncodedData'], 10, 7);
     217        add_filter('prime_mover_non_user_adjustment_update_data', [$this, 'updateBrizyEncodedData'], 10, 7);
    177218       
    178219        add_filter('prime_mover_filter_export_footprint', [$this, 'maybeExportingThemeLessSite'], 500, 2);
    179220        add_action('prime_mover_after_actual_import', [$this, 'maybeDisableThemeIfThemeLessSite'], 10, 2);
     221        add_action('prime_mover_after_actual_import', [$this, 'maybeMarkBrizyForCompilation'], 2000, 2);
     222       
     223        add_action('wp_loaded', [$this, 'maybeRefreshBrizyCompiler'], 2000, 2);
    180224    }   
     225   
     226    /**
     227     * Check if we need to refresh Brizy compiler (page builder)
     228     * @param array $ret
     229     * @param number $blogid_to_import
     230     */
     231    public function maybeMarkBrizyForCompilation($ret = [], $blogid_to_import = 0)
     232    {
     233        if (!$this->getSystemAuthorization()->isUserAuthorized()) {
     234            return;
     235        }
     236     
     237        if (!is_multisite()) {
     238            $blogid_to_import = 1;
     239        }
     240       
     241        if (!$blogid_to_import) {
     242            return;
     243        }
     244       
     245        $this->getSystemFunctions()->switchToBlog($blogid_to_import);
     246        if (!$this->getSystemFunctions()->isPluginActive($this->getBrizyPlugin())) {
     247            $this->getSystemFunctions()->restoreCurrentBlog();
     248            return;
     249        }
     250       
     251        $this->getSystemFunctions()->restoreCurrentBlog(); 
     252        $this->getSystemFunctions()->updateBlogOption($blogid_to_import, $this->getBrizyCompilationOption(), 'yes');
     253    }
     254   
     255    /**
     256     * Check if we need to refresh Brizy compiler (page builder)
     257     */
     258    public function maybeRefreshBrizyCompiler()
     259    {
     260        if (!$this->getSystemAuthorization()->isUserAuthorized()) {
     261            return;
     262        }
     263       
     264        if (!$this->getSystemFunctions()->isPluginActive($this->getBrizyPlugin())) {
     265            return;
     266        }
     267       
     268        $blog_id = 1;
     269        if (is_multisite()) {
     270            $blog_id = get_current_blog_id();
     271        }
     272       
     273        if ('yes' !== $this->getSystemFunctions()->getBlogOption($blog_id, $this->getBrizyCompilationOption())) {
     274            return;
     275        }
     276       
     277        if (!class_exists('Brizy_Editor_Post')) {
     278            return;
     279        }
     280       
     281        if (!method_exists('Brizy_Editor_Post','markAllForCompilation')) {
     282            return;
     283        }
     284       
     285        \Brizy_Editor_Post::markAllForCompilation(); 
     286       
     287        do_action('prime_mover_log_processed_events', 'Brizy plugin re-compilation completed - marking done by deleting options.', $blog_id, 'import', __FUNCTION__, $this);
     288        if (is_multisite()) {
     289            delete_blog_option($blog_id, $this->getBrizyCompilationOption());
     290        } else {
     291            delete_option($this->getBrizyCompilationOption());
     292        }       
     293    }
    181294   
    182295    /**
     
    205318       
    206319        return $export_system_footprint;
     320    }
     321   
     322    /**
     323     * Update Brizy encoded data
     324     * @param number $primary_index_id
     325     * @param string $value
     326     * @param string $table
     327     * @param string $primary_index
     328     * @param string $user_id_column
     329     * @param string $leftoff_identifier
     330     * @param array $ret
     331     */
     332    public function updateBrizyEncodedData($primary_index_id = 0, $value = '', $table = '', $primary_index = '', $user_id_column = '', $leftoff_identifier = '', $ret = [])
     333    {
     334        if (!$this->getSystemAuthorization()->isUserAuthorized()) {
     335            return $primary_index_id;
     336        }
     337       
     338        if ($this->getBrizyLeftOffIdentifier() !== $leftoff_identifier) {
     339            return $primary_index_id;
     340        }
     341       
     342        if (!isset($ret['prime_mover_final_replaceables'])) {
     343            return $primary_index_id;
     344        }
     345         
     346        if (!isset($ret['prime_mover_final_replaceables']['generic_domain_scheme']['search'])) {
     347            return $primary_index_id;
     348        }
     349       
     350        if (!isset($ret['prime_mover_final_replaceables']['generic_domain_scheme']['replace'])) {
     351            return $primary_index_id;
     352        }
     353       
     354        $from = $ret['prime_mover_final_replaceables']['generic_domain_scheme']['search'];
     355        $to = $ret['prime_mover_final_replaceables']['generic_domain_scheme']['replace'];
     356       
     357        $meta_id = (int)$primary_index_id;
     358        $meta_value = $value;
     359       
     360        $fromEncoded = urlencode($from);
     361        $toEncoded   = urlencode($to);
     362       
     363        $data = maybe_unserialize($meta_value);
     364        if (false === $data) {
     365            return $primary_index_id;
     366        }
     367       
     368        if (empty($data['brizy-post']['editor_data'])) {
     369            return $primary_index_id;
     370        }
     371       
     372        $json = base64_decode($data['brizy-post']['editor_data']);
     373        if (!$json || (!strpos($json, $from) && !strpos($json, $fromEncoded))) {
     374            return $primary_index_id;
     375        }
     376       
     377        $blog_id = 1;
     378        if (is_multisite()) {
     379            $blog_id = get_current_blog_id();
     380        }
     381        do_action('prime_mover_log_processed_events', 'Brizy plugin search and replacing URLs in database.', $blog_id, 'import', __FUNCTION__, $this);
     382        $json = str_replace($from, $to, $json);
     383        $json = str_replace($fromEncoded, $toEncoded, $json);
     384        $data['brizy-post']['editor_data'] = base64_encode($json);
     385        $data['brizy-post']['compiled_html'] = '';
     386       
     387        $wpdb = $this->getPrimeMover()->getSystemInitialization()->getWpdB();
     388        $query = $wpdb->prepare("
     389            UPDATE $wpdb->postmeta
     390            SET meta_value = %s
     391            WHERE meta_id = %d",
     392            $data, $meta_id
     393        );
     394       
     395        return $this->getUserQueries()->updateCustomerUserIdBySQL($meta_id, 0, '', '', '', $query);       
    207396    }
    208397   
     
    301490     * @param string $primary_index
    302491     * @param string $column_strings
    303      * @return string
    304      */
    305     public function seekPostToUpdateQuery($query = '', $ret = [], $leftoff_identifier = '', $table = '', $primary_index = '', $column_strings = '')
     492     * @param string $given_identifier
     493     * @param string $where
     494     * @return string
     495     */
     496    public function seekPostToUpdateQuery($query = '', $ret = [], $leftoff_identifier = '', $table = '', $primary_index = '',
     497        $column_strings = '', $given_identifier = '', $where = '')
    306498    {
    307499        if (!$this->getSystemAuthorization()->isUserAuthorized()) {
    308500            return $query;
    309501        }
    310        
    311         if ($this->getLeftOffIdentifier() !== $leftoff_identifier) {
     502       
     503        if (!$given_identifier) {
     504            $given_identifier = $this->getLeftOffIdentifier();
     505        }
     506       
     507        if ($given_identifier !== $leftoff_identifier) {
    312508            return $query;
    313509        }
    314510       
    315511        $wpdb = $this->getPrimeMover()->getSystemInitialization()->getWpdB();
    316         $postcontent_column = $this->getUserQueries()->parsePrimaryIndexUserColumns($column_strings, 'user');
    317         $where = "WHERE {$postcontent_column} LIKE '%tdc_css=\"%' AND post_status = 'publish'";
     512        if (!$where) {
     513            $target_column = $this->getUserQueries()->parsePrimaryIndexUserColumns($column_strings, 'user');
     514            $where = "WHERE {$target_column} LIKE '%tdc_css=\"%' AND post_status = 'publish'";
     515        }       
    318516       
    319517        $left_off = 0;
     
    327525       
    328526        $orderby = $wpdb->prepare("ORDER BY {$primary_index} DESC LIMIT %d", PRIME_MOVER_NON_USER_ADJUSTMENT_LOOKUP_LIMIT);       
    329        
    330527        $tbl = "{$wpdb->prefix}{$table}";
    331528        $sql = "SELECT {$column_strings} FROM `{$tbl}` {$where} {$orderby}";
     
    335532   
    336533    /**
    337      * Remove processor hooks when plugin not activated
     534     * Brizy seek posts meta to update
     535     * @param string $query
     536     * @param array $ret
     537     * @param string $leftoff_identifier
     538     * @param string $table
     539     * @param string $primary_index
     540     * @param string $column_strings
     541     * @return string
     542     */
     543    public function brizySeekToUpdateQuery($query = '', $ret = [], $leftoff_identifier = '', $table = '', $primary_index = '', $column_strings = '')
     544    {
     545        $given_identifier= $this->getBrizyLeftOffIdentifier();
     546        $where = "WHERE meta_key = 'brizy'";
     547       
     548        return $this->seekPostToUpdateQuery($query, $ret, $leftoff_identifier, $table, $primary_index, $column_strings, $given_identifier, $where);
     549    }
     550   
     551    /**
     552     * Remove processor hooks when dependency not meet
    338553     * @param array $ret
    339554     * @param number $blogid_to_import
    340      */
    341     public function removeProcessorHooksWhenDependencyNotMeet($ret = [], $blogid_to_import = 0)
    342     {
    343         $validation_error = apply_filters('prime_mover_validate_thirdpartyuser_processing', $ret, $blogid_to_import, $this->getTagDivPlugin());
     555     * @param string $plugin
     556     * @param string $callback
     557     */
     558    public function removeProcessorHooksWhenDependencyNotMeet($ret = [], $blogid_to_import = 0, $plugin = '', $callback = '')
     559    {
     560        if (!$plugin) {
     561            $plugin = $this->getTagDivPlugin();
     562        }
     563       
     564        if (!$callback) {
     565            $callback = 'maybeAdjustTagDivEncodedData';
     566        }
     567       
     568        $callbacks = $this->getCallBacks();       
     569        if (!isset($callbacks[$callback])) {
     570            return;
     571        }
     572       
     573        $priority = $callbacks[$callback];       
     574        $validation_error = $this->getUserQueries()->maybeRequisitesNotMeetForAdjustment($ret, $blogid_to_import, $plugin, false);
    344575        if (is_array($validation_error)) {
    345             foreach ($this->getCallBacks() as $callback => $priority) {
    346                 remove_filter('prime_mover_do_process_thirdparty_data', [$this, $callback], $priority, 3);
    347             }
    348         }
     576            remove_filter('prime_mover_do_process_thirdparty_data', [$this, $callback], $priority, 3);
     577        }
     578    }
     579   
     580    /**
     581     * Remove processor hooks for Brizy page builder if not active
     582     * @param array $ret
     583     * @param number $blogid_to_import
     584     */
     585    public function removeBrizyAdjustmentWhenDependencyNotMeet($ret = [], $blogid_to_import = 0)
     586    {       
     587        $plugin = $this->getBrizyPlugin();
     588        $callback = 'maybeAdjustBrizyEncodedData';
     589             
     590        $this->removeProcessorHooksWhenDependencyNotMeet($ret, $blogid_to_import, $plugin, $callback);
    349591    }
    350592   
     
    379621        $last_processor = apply_filters('prime_mover_is_thirdparty_lastprocessor', false, $this, __FUNCTION__, $ret, $blogid_to_import);
    380622        $handle_unique_constraint = '';
    381         $non_user_adjustment = true;
    382                
     623        $non_user_adjustment = ['format' => OBJECT];
     624       
    383625        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, $blogid_to_import, $leftoff_identifier, $primary_index, $column_strings,
    384626            $update_variable, $progress_identifier, $start_time, $last_processor, $handle_unique_constraint, $non_user_adjustment);
    385627    }
     628   
     629    /**
     630     * Maybe adjust Brizy builder encoded data
     631     * Hooked to `prime_mover_do_process_thirdparty_data` filter - priority 40
     632     * @param array $ret
     633     * @param number $blogid_to_import
     634     * @param number $start_time
     635     * @return array
     636     */
     637    public function maybeAdjustBrizyEncodedData($ret = [], $blogid_to_import = 0, $start_time = 0)
     638    {     
     639        $validation_error = $this->getUserQueries()->maybeRequisitesNotMeetForAdjustment($ret, $blogid_to_import, $this->getBrizyPlugin(), false);
     640        if (is_array($validation_error)) {
     641            return $validation_error;
     642        }
     643       
     644        if (!empty($ret['3rdparty_current_function']) && __FUNCTION__ !== $ret['3rdparty_current_function']) {
     645            return $ret;
     646        }
     647       
     648        $ret['3rdparty_current_function'] = __FUNCTION__;
     649        $table = 'postmeta';
     650        $leftoff_identifier = $this->getBrizyLeftOffIdentifier();
     651
     652        $primary_index = 'meta_id';
     653        $column_strings = 'meta_id, meta_value';
     654        $update_variable = '3rdparty_brizy_log_updated';
     655        $progress_identifier = 'brizy encoded data';
     656
     657        $last_processor = apply_filters('prime_mover_is_thirdparty_lastprocessor', false, $this, __FUNCTION__, $ret, $blogid_to_import);       
     658        $handle_unique_constraint = '';
     659        $non_user_adjustment = ['format' => ARRAY_A];
     660       
     661        return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, $blogid_to_import, $leftoff_identifier, $primary_index, $column_strings,
     662            $update_variable, $progress_identifier, $start_time, $last_processor, $handle_unique_constraint, $non_user_adjustment);
     663    }
    386664}
  • prime-mover/trunk/engines/prime-mover-panel/prime-mover-panel.php

    r3336904 r3360834  
    4343}
    4444define( 'PRIME_MOVER_PANEL_PLUGINPATH', plugin_dir_path( __FILE__ ) );
    45 define( 'PRIME_MOVER_PANEL_VERSION', '2.0.8' );
     45define( 'PRIME_MOVER_PANEL_VERSION', '2.0.9' );
    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

    r3336904 r3360834  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'b43a698a8963df51301d085ad31d59ee24041c09',
     6        'reference' => '542158f1e01b9a562caf16e7e4848046389c154d',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'b43a698a8963df51301d085ad31d59ee24041c09',
     16            'reference' => '542158f1e01b9a562caf16e7e4848046389c154d',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • prime-mover/trunk/global/PrimeMoverGlobalConstants.php

    r3336904 r3360834  
    99}
    1010
    11 define('PRIME_MOVER_VERSION', '2.0.8');
     11define('PRIME_MOVER_VERSION', '2.0.9');
    1212define('PRIME_MOVER_PLUGIN_CODENAME', 'Prime Mover');
    1313define('PRIME_MOVER_PRO_PLUGIN_CODENAME', 'Prime Mover PRO');
     
    411411    define('PRIME_MOVER_MUST_PLUGIN_MANAGER_CLASS', 'Codexonics\PrimeMoverFramework\general\PrimeMoverMustUsePluginManager');
    412412}
     413
     414if (!defined('PRIME_MOVER_PREVIEW_DOMAINS')) {
     415    define('PRIME_MOVER_PREVIEW_DOMAINS', json_encode (
     416        [
     417            'hostingersite.com',
     418            'builder-preview.com'
     419        ]
     420        ));
     421}
  • prime-mover/trunk/menus/PrimeMoverBackupMenuListTable.php

    r3301867 r3360834  
    348348     */
    349349    public function column_cb($item)
    350     {
     350    {       
    351351        return sprintf(
    352352            '<input type="checkbox" name="%1$s[]" value="%2$s" />',
    353353             $this->_args['singular'], 
    354              $item['package_filepath']               
     354            $item['package_filepath']
    355355            );
    356356    }   
     
    460460            return;
    461461        }   
     462       
    462463        $deleted = [];
    463         $blog_id = $this->getBlogId();
     464        $blog_id = $this->getBlogId();       
    464465        foreach ($input_data['prime_mover_backup'] as $backup) {
     466           
     467            $backup = $this->getPrimeMover()->getSystemFunctions()->computeDynamicPathsPreviewDomains($backup, $blog_id);           
    465468            $delete_result = $this->getPrimeMover()->getSystemFunctions()->primeMoverDoDelete($backup);           
    466469            if ($delete_result) {
  • prime-mover/trunk/prime-mover.php

    r3336904 r3360834  
    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.8
     7Version: 2.0.9
    88Author: Codexonics
    99Author URI: https://codexonics.com/
  • prime-mover/trunk/readme.txt

    r3336904 r3360834  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 2.0.8
     8Stable tag: 2.0.9
    99License: GPLv3 or later
    1010License URI: https://codexonics.com
     
    105105== Changelog ==
    106106
     107= 2.0.9 =
     108
     109* Fixed: Added support for page builders using base64 encoded data.
     110* Fixed: Compatibility issues with the preview domains setup.
     111
    107112= 2.0.8 =
    108113
     
    122127* Fixed: Removed cron jobs when the plugin is uninstalled.
    123128
    124 = 2.0.6 =
    125 
    126 * Feature: Support was added to exclude database tables from export.
    127 * Usability: Added missing features tutorials.
    128 * Fixed: The white-labelled license upgrade page goes to a non-existent page.
    129 * Fixed: The user was presented with an upgrade instead of activating the license buttons.
    130 * Usability: Improved labeling of subsite action buttons based on plan subscription status.
    131 * Usability: Improved handling of upgrade buttons.
    132 * Updated Freemius SDK to the latest version.
    133 
    134129See the previous changelogs in changelog.txt.
  • prime-mover/trunk/users/PrimeMoverUserFunctions.php

    r3176508 r3360834  
    126126            return $ret;
    127127        }
     128       
    128129        $unzipped_dir = $ret['unzipped_directory'];
     130        if (isset($ret['blog_id'])) {
     131            $unzipped_dir = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_dir, $ret['blog_id']);
     132        }
     133       
    129134        $path = $this->getSpecialMetaKeysImportFile($unzipped_dir);
    130135        if ( ! $path) { 
  • prime-mover/trunk/users/PrimeMoverUserQueries.php

    r3217325 r3360834  
    578578     * @param string $table
    579579     * @param object $wpdb
    580      * @param boolean $non_user_adjustment
     580     * @param array $non_user_adjustment
    581581     * @param boolean $set_foreign_key_checks
    582582     * @return array
    583583     */
    584584    private function bailOutAndReturnRetArray($ret = [], $leftoff_identifier = '', $update_variable = '', $last_processor = false,
    585         $handle_unique_constraint = '', $table = '', $wpdb = null, $non_user_adjustment = false, $set_foreign_key_checks = false)
     585        $handle_unique_constraint = '', $table = '', $wpdb = null, $non_user_adjustment = [], $set_foreign_key_checks = false)
    586586    {       
    587587        $ret = $this->cleanUpRetArrayAfterCustomerIdProcessing($ret, $leftoff_identifier, $update_variable, $last_processor,
     
    606606     * @param boolean $last_processor
    607607     * @param string $handle_unique_constraint
    608      * @param boolean $non_user_adjustment
     608     * @param array $non_user_adjustment
    609609     * @param array $filter_clause
    610610     * @return array|boolean
    611611     */
    612612    public function dBCustomerUserIdsHelper($ret = [], $table = '', $blogid_to_import = 0, $leftoff_identifier = '', $primary_index = '', $column_strings = '',
    613         $update_variable = '', $progress_identifier = '', $start_time = 0, $last_processor = false, $handle_unique_constraint = '', $non_user_adjustment = false, $filter_clause = [])
     613        $update_variable = '', $progress_identifier = '', $start_time = 0, $last_processor = false, $handle_unique_constraint = '', $non_user_adjustment = [], $filter_clause = [])
    614614    {
    615615        $wpdb = $this->getSystemInitialization()->getWpdB();
    616616        $this->getSystemFunctions()->switchToBlog($blogid_to_import);
    617        
     617               
    618618        if (!$this->getSystemAuthorization()->isUserAuthorized()) { 
    619619            return $this->bailOutAndReturnRetArray($ret, $leftoff_identifier, $update_variable, $last_processor, $handle_unique_constraint, $table, $wpdb, $non_user_adjustment);
     
    633633        }
    634634       
    635         if (!$table_exists) {
     635        if (!$table_exists) { 
    636636            do_action('prime_mover_log_processed_events', "$table TABLE DOES NOT EXIST - SKIPPING THIS USER ADJUSTMENT TABLE PROCESSING." , $blogid_to_import, 'import', __FUNCTION__, $this);
    637637            return $this->bailOutAndReturnRetArray($ret, $leftoff_identifier, $update_variable, $last_processor, $handle_unique_constraint, $table, $wpdb, $non_user_adjustment);
    638638        }
    639         
     639 
    640640        $query = $this->seekCustomersToUpdateQuery($ret, $leftoff_identifier, $table, $primary_index, $column_strings, $non_user_adjustment, $filter_clause);
    641641        if (!$query) {
     
    657657       
    658658        $format = ARRAY_A;
    659         if ($non_user_adjustment) {
    660             $format = OBJECT;
     659        if (is_array($non_user_adjustment) && !empty($non_user_adjustment['format'])) {
     660            $format = $non_user_adjustment['format'];
     661            $format = constant($format);
    661662        }
    662663       
     
    667668                $ret = $this->updateCustomerIds($results, $user_equivalence, $ret, $update_variable, $column_strings, $table, $leftoff_identifier, $non_user_adjustment, $filter_clause, $set_foreign_key_checks);
    668669            }
    669             
     670 
    670671            $query = $this->seekCustomersToUpdateQuery($ret, $leftoff_identifier, $table, $primary_index, $column_strings, $non_user_adjustment, $filter_clause);
    671672            $retry_timeout = apply_filters('prime_mover_retry_timeout_seconds', PRIME_MOVER_RETRY_TIMEOUT_SECONDS, __FUNCTION__);
     
    722723     * @param string $primary_index
    723724     * @param string $column_strings
    724      * @param boolean $non_user_adjustment
     725     * @param array $non_user_adjustment
    725726     * @param array $filter_clause
    726      * @return string
    727      */
    728     protected function seekCustomersToUpdateQuery($ret = [], $leftoff_identifier = '', $table = '', $primary_index = '', $column_strings = '', $non_user_adjustment = false, $filter_clause = [])
    729     {
    730         $query = '';
    731         if ($non_user_adjustment) {
     727     * @return mixed|NULL|array|string
     728     */
     729    protected function seekCustomersToUpdateQuery($ret = [], $leftoff_identifier = '', $table = '', $primary_index = '', $column_strings = '', $non_user_adjustment = [], $filter_clause = [])
     730    {
     731        $query = '';               
     732        if (!empty($non_user_adjustment)) {
    732733            $query = apply_filters('prime_mover_non_user_adjustment_select_query', '', $ret, $leftoff_identifier, $table, $primary_index, $column_strings);           
    733734        }
     
    806807     * @param string $table
    807808     * @param string $leftoff_identifier
    808      * @param boolean $non_user_adjustment
     809     * @param array $non_user_adjustment
    809810     * @param array $filter_clause
    810811     * @param boolean $set_foreign_key_checks
     
    812813     */
    813814    protected function updateCustomerIds($results = [], $user_equivalence = null, $ret = [], $update_variable = '', $column_strings = '',
    814         $table = '', $leftoff_identifier = '', $non_user_adjustment = false, $filter_clause = [], $set_foreign_key_checks = false)
     815        $table = '', $leftoff_identifier = '', $non_user_adjustment = [], $filter_clause = [], $set_foreign_key_checks = false)
    815816    {
    816817        if (empty($results)) {
    817818            return;
    818819        }
    819        
     820               
    820821        $customers_updated = 0;
    821822        if (isset($ret[$update_variable])) {
     
    826827        $primary_index_id = 0;
    827828        $processing_serialized = $this->isSerialized($filter_clause);
    828                 
    829         foreach ($results as $result) {
    830            
    831             $this->maybeEnableUserImportExportTestMode(PRIME_MOVER_USER_ADJUSTMENT_TEST_DELAY, false);           
    832             if ($non_user_adjustment) {
    833                                
    834                 if (!is_object($result)) {
    835                     continue;
    836                 }
    837                                
    838                 if (!isset($result->{$primary_index}) || !isset($result->{$user_id_column})) {
     829       
     830        $processing_non_user_adjustment = false;
     831        if (!empty($non_user_adjustment)) {
     832            $processing_non_user_adjustment = true;
     833        }
     834       
     835        foreach ($results as $result) {           
     836            $this->maybeEnableUserImportExportTestMode(PRIME_MOVER_USER_ADJUSTMENT_TEST_DELAY, false);             
     837            if ($processing_non_user_adjustment) {             
     838                $validated = $this->validateResultFormat($result, $user_id_column, $primary_index);
     839                if (is_bool($validated) && false === $validated) {
    839840                    continue;
    840841                }
    841842               
    842                 $primary_index_id = $result->{$primary_index};
    843                 $value = $result->{$user_id_column};
    844                
    845                 if (!$primary_index_id || !$value) {
    846                     continue;
    847                 }               
     843                list($primary_index_id, $value) = $this->validateResultFormat($result, $user_id_column, $primary_index);
    848844                $primary_index_id = apply_filters('prime_mover_non_user_adjustment_update_data', $primary_index_id, $value, $table, $primary_index, $user_id_column, $leftoff_identifier, $ret, $filter_clause);               
    849845               
     
    904900
    905901    /**
     902     * Valdate result format
     903     * Returns false if data is invalid
     904     * Otherwise return validated data (which could either be an array or object)
     905     *
     906     * @param mixed $result
     907     * @param mixed $user_id_column
     908     * @param mixed $primary_index
     909     * @return array| boolean
     910     */
     911    protected function validateResultFormat($result, $user_id_column, $primary_index)
     912    {       
     913       
     914        if (is_object($result) && isset($result->{$primary_index}) && isset($result->{$user_id_column})) {
     915            $primary_index_id = $result->{$primary_index};
     916            $value = $result->{$user_id_column};
     917        }
     918       
     919        if (is_array($result) && isset($result[$primary_index]) && isset($result[$user_id_column])) {
     920            $primary_index_id = $result[$primary_index];
     921            $value = $result[$user_id_column];
     922        }     
     923       
     924        if (!$primary_index_id || !$value) {
     925            return false;
     926        } 
     927     
     928        return [$primary_index_id, $value];           
     929    }
     930   
     931    /**
    906932     * Checks if the callback is meant to process serialized data
    907933     * This does not check if data is actually serialized.
     
    9791005     * @param string $table
    9801006     * @param wpdb $wpdb
    981      * @param boolean $non_user_adjustment
     1007     * @param array $non_user_adjustment
    9821008     * @param boolean $set_foreign_key_checks
    9831009     * @return array
    9841010     */
    9851011    protected function cleanUpRetArrayAfterCustomerIdProcessing($ret = [], $leftoff_identifier = '', $update_variable = '',
    986         $last_processor = false, $handle_unique_constraint = '', $table = '', wpdb $wpdb = null, $non_user_adjustment = false, $set_foreign_key_checks = false)
     1012        $last_processor = false, $handle_unique_constraint = '', $table = '', wpdb $wpdb = null, $non_user_adjustment = [], $set_foreign_key_checks = false)
    9871013    {
    9881014        if (isset($ret[$leftoff_identifier])) {
     
    10021028        }
    10031029       
    1004         if ($last_processor && false === $non_user_adjustment) {
     1030        if ($last_processor && empty($non_user_adjustment)) {
    10051031            $this->invalidateReportCacheAfterMigration();
    10061032        }
  • prime-mover/trunk/utilities/PrimeMoverImportUtilities.php

    r3301867 r3360834  
    12511251            return $ret;
    12521252        }
    1253         $unzipped_directory = $import_data['unzipped_directory'];
     1253       
     1254        $unzipped_directory = $import_data['unzipped_directory'];       
     1255        if (isset($import_data['blog_id'])) {
     1256            $unzipped_directory = $this->getImporter()->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $import_data['blog_id']);
     1257        }
     1258       
    12541259        $plugins_foldername = $this->getExportUtilities()->getPluginFoldername();
    12551260        $plugins_package_path = $unzipped_directory . $plugins_foldername . '/';
     
    12711276        }
    12721277        $unzipped_directory = $import_data['unzipped_directory'];
     1278       
     1279        if (isset($import_data['blog_id'])) {
     1280            $unzipped_directory = $this->getImporter()->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $import_data['blog_id']);
     1281        }
     1282       
    12731283        $themes_foldername = $this->getExportUtilities()->getThemeFoldername();
    12741284        $themes_package_path = $unzipped_directory . $themes_foldername . DIRECTORY_SEPARATOR;
  • prime-mover/trunk/utilities/PrimeMoverOpenSSLUtilities.php

    r3301867 r3360834  
    243243       
    244244        $unzipped_directory = $ret['unzipped_directory'];
     245        if (isset($ret['blog_id'])) {
     246            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     247        }
     248       
    245249        $signature_file = $unzipped_directory . $this->getSystemInitialization()->getSignatureFile();
    246250       
  • prime-mover/trunk/utilities/PrimeMoverUserUtilities.php

    r3217325 r3360834  
    276276        }
    277277       
     278        $unzipped_directory = $ret['unzipped_directory'];
     279        if (isset($ret['blog_id'])) {
     280            $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']);
     281        }
     282       
    278283        $users_export_file = $this->getUserFunctions()->getUsersExportFilePath($ret['unzipped_directory']);
    279284        if (!$users_export_file ) {
  • prime-mover/trunk/vendor/composer/installed.php

    r3336904 r3360834  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'b43a698a8963df51301d085ad31d59ee24041c09',
     6        'reference' => '542158f1e01b9a562caf16e7e4848046389c154d',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'b43a698a8963df51301d085ad31d59ee24041c09',
     16            'reference' => '542158f1e01b9a562caf16e7e4848046389c154d',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.