Changeset 3360834
- Timestamp:
- 09/13/2025 12:21:42 AM (7 months ago)
- Location:
- prime-mover/trunk
- Files:
-
- 23 edited
-
changelog.txt (modified) (1 diff)
-
classes/PrimeMoverErrorHandlers.php (modified) (1 diff)
-
classes/PrimeMoverImporter.php (modified) (8 diffs)
-
classes/PrimeMoverSystemFunctions.php (modified) (3 diffs)
-
classes/PrimeMoverSystemInitialization.php (modified) (1 diff)
-
classes/PrimeMoverSystemProcessors.php (modified) (3 diffs)
-
classes/PrimeMoverUsers.php (modified) (1 diff)
-
classes/PrimeMoverValidationHandlers.php (modified) (2 diffs)
-
compatibility/PrimeMoverBuddyPressCompat.php (modified) (10 diffs)
-
compatibility/PrimeMoverMultilingualCompat.php (modified) (1 diff)
-
compatibility/PrimeMoverPageBuilderCompat.php (modified) (11 diffs)
-
engines/prime-mover-panel/prime-mover-panel.php (modified) (1 diff)
-
engines/prime-mover-panel/vendor/composer/installed.php (modified) (2 diffs)
-
global/PrimeMoverGlobalConstants.php (modified) (2 diffs)
-
menus/PrimeMoverBackupMenuListTable.php (modified) (2 diffs)
-
prime-mover.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
users/PrimeMoverUserFunctions.php (modified) (1 diff)
-
users/PrimeMoverUserQueries.php (modified) (12 diffs)
-
utilities/PrimeMoverImportUtilities.php (modified) (2 diffs)
-
utilities/PrimeMoverOpenSSLUtilities.php (modified) (1 diff)
-
utilities/PrimeMoverUserUtilities.php (modified) (1 diff)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
prime-mover/trunk/changelog.txt
r3336904 r3360834 2 2 3 3 **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. 4 14 5 15 = 2.0.5 = -
prime-mover/trunk/classes/PrimeMoverErrorHandlers.php
r3176508 r3360834 741 741 if ( is_array( $processed_path ) ) { 742 742 foreach ( $processed_path as $path_to_delete ) { 743 $path_to_delete = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($path_to_delete, $blog_id); 743 744 if ( $wp_filesystem->exists($path_to_delete) && apply_filters('prime_mover_delete_package_on_error', true, $path_to_delete, $blog_id)) { 744 745 $this->reallyDeletePackage($path_to_delete, $error, $blog_id); -
prime-mover/trunk/classes/PrimeMoverImporter.php
r3263153 r3360834 636 636 return $ret; 637 637 } 638 639 if (isset($ret['blog_id'])) { 640 $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']); 641 } 642 638 643 $this->getSystemInitialization()->setTemporaryImportPackagePath($unzipped_directory); 639 644 $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits(); … … 875 880 if (isset($ret['unzipped_directory'])) { 876 881 $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 877 887 $directory_name = basename($unzipped_directory); 878 888 $exploded = explode("_", $directory_name); … … 932 942 if (isset($ret['unzipped_directory'])) { 933 943 $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 934 949 $footprint_package = $unzipped_directory . 'footprint.json'; 935 950 if ($wp_filesystem->exists($footprint_package)) { … … 1064 1079 $unzipped_directory = $ret['unzipped_directory']; 1065 1080 } 1066 } 1081 } 1082 1083 if (isset($ret['blog_id'])) { 1084 $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']); 1085 } 1086 1067 1087 $ret = apply_filters('prime_mover_after_user_diff_confirmation', $ret, $blogid_to_import); 1068 1088 if ($is_extracting_tar) { … … 1217 1237 } 1218 1238 1239 if (isset($ret['blog_id'])) { 1240 $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']); 1241 } 1242 1219 1243 $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits(); 1220 1244 $skipped_languages_folder = true; … … 1354 1378 $unzipped_directory = $ret['unzipped_directory']; 1355 1379 } 1356 } 1380 } 1381 1382 if (isset($ret['blog_id'])) { 1383 $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']); 1384 } 1385 1357 1386 $this->getSystemFunctions()->temporarilyIncreaseMemoryLimits(); 1358 1387 if (!empty($ret['skipped_media'])) { … … 1651 1680 1652 1681 $unzipped_path = $ret['unzipped_directory']; 1682 if (isset($ret['blog_id'])) { 1683 $unzipped_path = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_path, $ret['blog_id']); 1684 } 1685 1653 1686 $import_path_sql = $this->handleEncrypteddB($unzipped_path, $blogid_to_import); 1654 1687 if (!$import_path_sql ) { … … 1884 1917 foreach ($db_import_options as $extension ) { 1885 1918 $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; 1887 1920 1888 1921 if ($wp_filesystem->exists($temp_path_sql)) { 1889 1922 $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 } 1891 1926 if ($import_path_sql && '.sql.enc' === $extension) { 1892 1927 $this->getSystemInitialization()->setEncryptedDb(true); -
prime-mover/trunk/classes/PrimeMoverSystemFunctions.php
r3336904 r3360834 1434 1434 public function getExportPathOfThisSubsite($blog_id = 0) 1435 1435 { 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 1447 1439 /** 1448 1440 * Check if directory is empty … … 1655 1647 return; 1656 1648 } 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); 1659 1660 } 1660 1661 } … … 4893 4894 return false; 4894 4895 } 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 } 4895 4909 4896 4910 /** -
prime-mover/trunk/classes/PrimeMoverSystemInitialization.php
r3301867 r3360834 3736 3736 return ''; 3737 3737 } 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 } 3738 3840 3739 3841 /** -
prime-mover/trunk/classes/PrimeMoverSystemProcessors.php
r3217325 r3360834 253 253 global $wp_filesystem; 254 254 $temp_dir = $delete_tmpfile_post['temp_file_to_delete']; 255 256 $temp_dir = $this->getSystemFunctions()->computeDynamicPathsPreviewDomains($temp_dir, $blog_id); 255 257 if ($temp_dir && $wp_filesystem->exists($temp_dir)) { 256 258 $this->getSystemInitialization()->setProcessingDelay(3); … … 523 525 if (isset($data_to_continue['unzipped_directory']) && isset($data_to_continue['diff']) && isset($data_to_continue['blog_id'])) { 524 526 $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); 525 529 if ($wp_filesystem->exists($unzipped_directory_to_check)) { 526 530 unset($data_to_continue['diff']); 527 531 $data_to_continue['diff_confirmation'] = true; 528 $blogid_to_import = (int) $data_to_continue['blog_id'];532 529 533 if ($blogid_to_import > 0) { 530 534 $ret = $data_to_continue; … … 573 577 $import_package_path = $import_ajax_input['multisite_import_package_uploaded_file']; 574 578 } 579 580 $import_package_path = $this->getSystemFunctions()->computeDynamicPathsPreviewDomains($import_package_path, $blogid_to_import); 575 581 if (! $import_initiated && $blogid_to_import > 0 && $requisites_meet && $this->getSystemFunctions()->fileExists($import_package_path)) { 576 582 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 284 284 * @param boolean $last_processor 285 285 * @param string $handle_unique_constraint 286 * @param boolean$non_user_adjustment286 * @param array $non_user_adjustment 287 287 * @param array $filter_clause 288 288 * @return array|boolean 289 289 */ 290 290 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 { 293 293 return $this->getUserUtilities()->getUserFunctions()->getUserQueries()->dBCustomerUserIdsHelper($ret, $table, $blogid_to_import, $leftoff_identifier, $primary_index, $column_strings, 294 294 $update_variable, $progress_identifier, $start_time, $last_processor, $handle_unique_constraint, $non_user_adjustment, $filter_clause); -
prime-mover/trunk/classes/PrimeMoverValidationHandlers.php
r2703582 r3360834 362 362 return false; 363 363 } 364 365 $input_data = $this->getMultisteMigration()->getSystemFunctions()->computeDynamicPathsPreviewDomains($input_data, $blog_id); 364 366 if (is_file($input_data)) { 365 367 return false; … … 440 442 return false; 441 443 } 444 445 $filepath = $this->getMultisteMigration()->getSystemFunctions()->computeDynamicPathsPreviewDomains($filepath, $blog_id); 442 446 if ( ! file_exists($filepath) || ! is_file($filepath) ) { 443 447 do_action('prime_mover_log_processed_events', 'Package zip does not seem to exist', $blog_id, 'common', 'isMigrationPackage', $this); 444 448 return false; 445 449 } 450 446 451 if ( ! $this->getMultisteMigration()->getSystemFunctions()->isReallyValidFormat($filepath)) { 447 452 do_action('prime_mover_log_processed_events', 'Package zip is not a zip file.', $blog_id, 'common', 'isMigrationPackage', $this); 448 453 return false; 449 454 } 455 450 456 $package_description = ''; 451 457 $tar_config = []; -
prime-mover/trunk/compatibility/PrimeMoverBuddyPressCompat.php
r3301867 r3360834 438 438 $filter_clause['target_blog_id'] = $blogid_to_import; 439 439 440 $non_user_adjustment = ['format' => OBJECT]; 441 440 442 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); 442 444 } 443 445 … … 476 478 477 479 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); 479 481 } 480 482 … … 515 517 516 518 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); 518 520 } 519 521 … … 550 552 $filter_clause = []; 551 553 $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'members']; 552 554 553 555 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); 555 557 } 556 558 … … 641 643 642 644 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); 644 646 } 645 647 … … 678 680 679 681 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); 681 683 } 682 684 … … 717 719 $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'forums', 'condition' => 'OR']; 718 720 $filter_clause['where_clause'][] = ['field' => 'component_name', 'value' => 'activity']; 719 721 720 722 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); 722 724 } 723 725 … … 755 757 $filter_clause = []; 756 758 $filter_clause['where_clause'][] = ['field' => 'component', 'value' => 'friends']; 757 759 758 760 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); 760 762 } 761 763 … … 795 797 796 798 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); 798 800 } 799 801 … … 832 834 833 835 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); 835 837 } 836 838 -
prime-mover/trunk/compatibility/PrimeMoverMultilingualCompat.php
r3176508 r3360834 688 688 689 689 $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 690 695 $lang_folder = $tar_config['prime_mover_source_site_lang_folder']; 691 696 -
prime-mover/trunk/compatibility/PrimeMoverPageBuilderCompat.php
r3176508 r3360834 32 32 private $replaceables; 33 33 private $system_utilities; 34 private $brizy_plugin; 35 private $brizy_leftoff_identifier; 36 private $brizy_compilation_option; 34 37 35 38 /** … … 42 45 $this->prime_mover = $prime_mover; 43 46 $this->tagdiv_plugin = 'td-composer/td-composer.php'; 47 $this->brizy_plugin = 'brizy/brizy.php'; 44 48 45 49 $this->callbacks = [ 46 'maybeAdjustTagDivEncodedData' => 35 50 'maybeAdjustTagDivEncodedData' => 35, 51 'maybeAdjustBrizyEncodedData' => 40 47 52 ]; 53 48 54 $this->leftoff_identifier = '3rdparty_tagdiv_leftoff'; 55 $this->brizy_leftoff_identifier = '3rdparty_brizy_leftoff'; 56 49 57 $this->replaceables = [ 50 58 'wpupload_url_alternative', … … 62 70 ]; 63 71 $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; 64 82 } 65 83 … … 92 110 93 111 /** 112 * Get Brizy leftoff identifier 113 * @return string 114 */ 115 public function getBrizyLeftOffIdentifier() 116 { 117 return $this->brizy_leftoff_identifier; 118 } 119 120 /** 94 121 * Get callbacks 95 122 * @return number[] … … 107 134 { 108 135 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; 109 146 } 110 147 … … 173 210 174 211 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); 175 213 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); 176 216 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); 177 218 178 219 add_filter('prime_mover_filter_export_footprint', [$this, 'maybeExportingThemeLessSite'], 500, 2); 179 220 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); 180 224 } 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 } 181 294 182 295 /** … … 205 318 206 319 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); 207 396 } 208 397 … … 301 490 * @param string $primary_index 302 491 * @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 = '') 306 498 { 307 499 if (!$this->getSystemAuthorization()->isUserAuthorized()) { 308 500 return $query; 309 501 } 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) { 312 508 return $query; 313 509 } 314 510 315 511 $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 } 318 516 319 517 $left_off = 0; … … 327 525 328 526 $orderby = $wpdb->prepare("ORDER BY {$primary_index} DESC LIMIT %d", PRIME_MOVER_NON_USER_ADJUSTMENT_LOOKUP_LIMIT); 329 330 527 $tbl = "{$wpdb->prefix}{$table}"; 331 528 $sql = "SELECT {$column_strings} FROM `{$tbl}` {$where} {$orderby}"; … … 335 532 336 533 /** 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 338 553 * @param array $ret 339 554 * @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); 344 575 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); 349 591 } 350 592 … … 379 621 $last_processor = apply_filters('prime_mover_is_thirdparty_lastprocessor', false, $this, __FUNCTION__, $ret, $blogid_to_import); 380 622 $handle_unique_constraint = ''; 381 $non_user_adjustment = true;382 623 $non_user_adjustment = ['format' => OBJECT]; 624 383 625 return apply_filters('prime_mover_process_userid_adjustment_db', $ret, $table, $blogid_to_import, $leftoff_identifier, $primary_index, $column_strings, 384 626 $update_variable, $progress_identifier, $start_time, $last_processor, $handle_unique_constraint, $non_user_adjustment); 385 627 } 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 } 386 664 } -
prime-mover/trunk/engines/prime-mover-panel/prime-mover-panel.php
r3336904 r3360834 43 43 } 44 44 define( 'PRIME_MOVER_PANEL_PLUGINPATH', plugin_dir_path( __FILE__ ) ); 45 define( 'PRIME_MOVER_PANEL_VERSION', '2.0. 8' );45 define( 'PRIME_MOVER_PANEL_VERSION', '2.0.9' ); 46 46 define( 'PRIME_MOVER_PANEL_MAINPLUGIN_FILE', __FILE__ ); 47 47 define( 'PRIME_MOVER_PANEL_PLUGINBASENAME', plugin_basename( PRIME_MOVER_PANEL_MAINPLUGIN_FILE ) ); -
prime-mover/trunk/engines/prime-mover-panel/vendor/composer/installed.php
r3336904 r3360834 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' b43a698a8963df51301d085ad31d59ee24041c09',6 'reference' => '542158f1e01b9a562caf16e7e4848046389c154d', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' b43a698a8963df51301d085ad31d59ee24041c09',16 'reference' => '542158f1e01b9a562caf16e7e4848046389c154d', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
prime-mover/trunk/global/PrimeMoverGlobalConstants.php
r3336904 r3360834 9 9 } 10 10 11 define('PRIME_MOVER_VERSION', '2.0. 8');11 define('PRIME_MOVER_VERSION', '2.0.9'); 12 12 define('PRIME_MOVER_PLUGIN_CODENAME', 'Prime Mover'); 13 13 define('PRIME_MOVER_PRO_PLUGIN_CODENAME', 'Prime Mover PRO'); … … 411 411 define('PRIME_MOVER_MUST_PLUGIN_MANAGER_CLASS', 'Codexonics\PrimeMoverFramework\general\PrimeMoverMustUsePluginManager'); 412 412 } 413 414 if (!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 348 348 */ 349 349 public function column_cb($item) 350 { 350 { 351 351 return sprintf( 352 352 '<input type="checkbox" name="%1$s[]" value="%2$s" />', 353 353 $this->_args['singular'], 354 $item['package_filepath']354 $item['package_filepath'] 355 355 ); 356 356 } … … 460 460 return; 461 461 } 462 462 463 $deleted = []; 463 $blog_id = $this->getBlogId(); 464 $blog_id = $this->getBlogId(); 464 465 foreach ($input_data['prime_mover_backup'] as $backup) { 466 467 $backup = $this->getPrimeMover()->getSystemFunctions()->computeDynamicPathsPreviewDomains($backup, $blog_id); 465 468 $delete_result = $this->getPrimeMover()->getSystemFunctions()->primeMoverDoDelete($backup); 466 469 if ($delete_result) { -
prime-mover/trunk/prime-mover.php
r3336904 r3360834 5 5 Plugin URI: https://codexonics.com/ 6 6 Description: The simplest all-around WordPress migration tool/backup plugin. These support multisite backup/migration or clone WP site/multisite subsite. 7 Version: 2.0. 87 Version: 2.0.9 8 8 Author: Codexonics 9 9 Author URI: https://codexonics.com/ -
prime-mover/trunk/readme.txt
r3336904 r3360834 6 6 Tested up to: 6.8 7 7 Requires PHP: 5.6 8 Stable tag: 2.0. 88 Stable tag: 2.0.9 9 9 License: GPLv3 or later 10 10 License URI: https://codexonics.com … … 105 105 == Changelog == 106 106 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 107 112 = 2.0.8 = 108 113 … … 122 127 * Fixed: Removed cron jobs when the plugin is uninstalled. 123 128 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 134 129 See the previous changelogs in changelog.txt. -
prime-mover/trunk/users/PrimeMoverUserFunctions.php
r3176508 r3360834 126 126 return $ret; 127 127 } 128 128 129 $unzipped_dir = $ret['unzipped_directory']; 130 if (isset($ret['blog_id'])) { 131 $unzipped_dir = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_dir, $ret['blog_id']); 132 } 133 129 134 $path = $this->getSpecialMetaKeysImportFile($unzipped_dir); 130 135 if ( ! $path) { -
prime-mover/trunk/users/PrimeMoverUserQueries.php
r3217325 r3360834 578 578 * @param string $table 579 579 * @param object $wpdb 580 * @param boolean$non_user_adjustment580 * @param array $non_user_adjustment 581 581 * @param boolean $set_foreign_key_checks 582 582 * @return array 583 583 */ 584 584 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) 586 586 { 587 587 $ret = $this->cleanUpRetArrayAfterCustomerIdProcessing($ret, $leftoff_identifier, $update_variable, $last_processor, … … 606 606 * @param boolean $last_processor 607 607 * @param string $handle_unique_constraint 608 * @param boolean$non_user_adjustment608 * @param array $non_user_adjustment 609 609 * @param array $filter_clause 610 610 * @return array|boolean 611 611 */ 612 612 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 = []) 614 614 { 615 615 $wpdb = $this->getSystemInitialization()->getWpdB(); 616 616 $this->getSystemFunctions()->switchToBlog($blogid_to_import); 617 617 618 618 if (!$this->getSystemAuthorization()->isUserAuthorized()) { 619 619 return $this->bailOutAndReturnRetArray($ret, $leftoff_identifier, $update_variable, $last_processor, $handle_unique_constraint, $table, $wpdb, $non_user_adjustment); … … 633 633 } 634 634 635 if (!$table_exists) { 635 if (!$table_exists) { 636 636 do_action('prime_mover_log_processed_events', "$table TABLE DOES NOT EXIST - SKIPPING THIS USER ADJUSTMENT TABLE PROCESSING." , $blogid_to_import, 'import', __FUNCTION__, $this); 637 637 return $this->bailOutAndReturnRetArray($ret, $leftoff_identifier, $update_variable, $last_processor, $handle_unique_constraint, $table, $wpdb, $non_user_adjustment); 638 638 } 639 639 640 640 $query = $this->seekCustomersToUpdateQuery($ret, $leftoff_identifier, $table, $primary_index, $column_strings, $non_user_adjustment, $filter_clause); 641 641 if (!$query) { … … 657 657 658 658 $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); 661 662 } 662 663 … … 667 668 $ret = $this->updateCustomerIds($results, $user_equivalence, $ret, $update_variable, $column_strings, $table, $leftoff_identifier, $non_user_adjustment, $filter_clause, $set_foreign_key_checks); 668 669 } 669 670 670 671 $query = $this->seekCustomersToUpdateQuery($ret, $leftoff_identifier, $table, $primary_index, $column_strings, $non_user_adjustment, $filter_clause); 671 672 $retry_timeout = apply_filters('prime_mover_retry_timeout_seconds', PRIME_MOVER_RETRY_TIMEOUT_SECONDS, __FUNCTION__); … … 722 723 * @param string $primary_index 723 724 * @param string $column_strings 724 * @param boolean$non_user_adjustment725 * @param array $non_user_adjustment 725 726 * @param array $filter_clause 726 * @return string727 */ 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)) { 732 733 $query = apply_filters('prime_mover_non_user_adjustment_select_query', '', $ret, $leftoff_identifier, $table, $primary_index, $column_strings); 733 734 } … … 806 807 * @param string $table 807 808 * @param string $leftoff_identifier 808 * @param boolean$non_user_adjustment809 * @param array $non_user_adjustment 809 810 * @param array $filter_clause 810 811 * @param boolean $set_foreign_key_checks … … 812 813 */ 813 814 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) 815 816 { 816 817 if (empty($results)) { 817 818 return; 818 819 } 819 820 820 821 $customers_updated = 0; 821 822 if (isset($ret[$update_variable])) { … … 826 827 $primary_index_id = 0; 827 828 $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) { 839 840 continue; 840 841 } 841 842 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); 848 844 $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); 849 845 … … 904 900 905 901 /** 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 /** 906 932 * Checks if the callback is meant to process serialized data 907 933 * This does not check if data is actually serialized. … … 979 1005 * @param string $table 980 1006 * @param wpdb $wpdb 981 * @param boolean$non_user_adjustment1007 * @param array $non_user_adjustment 982 1008 * @param boolean $set_foreign_key_checks 983 1009 * @return array 984 1010 */ 985 1011 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) 987 1013 { 988 1014 if (isset($ret[$leftoff_identifier])) { … … 1002 1028 } 1003 1029 1004 if ($last_processor && false === $non_user_adjustment) {1030 if ($last_processor && empty($non_user_adjustment)) { 1005 1031 $this->invalidateReportCacheAfterMigration(); 1006 1032 } -
prime-mover/trunk/utilities/PrimeMoverImportUtilities.php
r3301867 r3360834 1251 1251 return $ret; 1252 1252 } 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 1254 1259 $plugins_foldername = $this->getExportUtilities()->getPluginFoldername(); 1255 1260 $plugins_package_path = $unzipped_directory . $plugins_foldername . '/'; … … 1271 1276 } 1272 1277 $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 1273 1283 $themes_foldername = $this->getExportUtilities()->getThemeFoldername(); 1274 1284 $themes_package_path = $unzipped_directory . $themes_foldername . DIRECTORY_SEPARATOR; -
prime-mover/trunk/utilities/PrimeMoverOpenSSLUtilities.php
r3301867 r3360834 243 243 244 244 $unzipped_directory = $ret['unzipped_directory']; 245 if (isset($ret['blog_id'])) { 246 $unzipped_directory = $this->getSystemInitialization()->getDynamicPathsPreviewDomains($unzipped_directory, $ret['blog_id']); 247 } 248 245 249 $signature_file = $unzipped_directory . $this->getSystemInitialization()->getSignatureFile(); 246 250 -
prime-mover/trunk/utilities/PrimeMoverUserUtilities.php
r3217325 r3360834 276 276 } 277 277 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 278 283 $users_export_file = $this->getUserFunctions()->getUsersExportFilePath($ret['unzipped_directory']); 279 284 if (!$users_export_file ) { -
prime-mover/trunk/vendor/composer/installed.php
r3336904 r3360834 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' b43a698a8963df51301d085ad31d59ee24041c09',6 'reference' => '542158f1e01b9a562caf16e7e4848046389c154d', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' b43a698a8963df51301d085ad31d59ee24041c09',16 'reference' => '542158f1e01b9a562caf16e7e4848046389c154d', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.