Changeset 2749602
- Timestamp:
- 06/29/2022 11:11:11 AM (4 years ago)
- Location:
- local-sync/trunk
- Files:
-
- 2 added
- 19 edited
-
README.txt (modified) (2 diffs)
-
admin/class-local-sync-admin.php (modified) (10 diffs)
-
admin/class-local-sync-app-functions.php (modified) (12 diffs)
-
admin/class-local-sync-batch-download.php (added)
-
admin/class-local-sync-batch-upload.php (added)
-
admin/class-local-sync-db-op.php (modified) (1 diff)
-
admin/class-local-sync-exclude-option.php (modified) (1 diff)
-
admin/class-local-sync-files-op.php (modified) (4 diffs)
-
admin/class-local-sync-replace-db-links.php (modified) (2 diffs)
-
admin/class-local-sync-restore-op.php (modified) (8 diffs)
-
admin/js/local-sync-admin.js (modified) (7 diffs)
-
admin/views/local-sync-settings-display.php (modified) (6 diffs)
-
includes/class-local-sync-handle-server-requests.php (modified) (3 diffs)
-
includes/class-local-sync-options.php (modified) (16 diffs)
-
includes/class-local-sync.php (modified) (2 diffs)
-
local-sync-bridge/class-local-sync-file-system.php (modified) (5 diffs)
-
local-sync-bridge/index.js (modified) (3 diffs)
-
local-sync-bridge/index.php (modified) (2 diffs)
-
local-sync-constants.php (modified) (1 diff)
-
local-sync-generic-functions.php (modified) (1 diff)
-
local-sync.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
local-sync/trunk/README.txt
r2519732 r2749602 1 === Plugin Name===1 === WP Duplicate - WordPress Migration Plugin === 2 2 Contributors: localsync, dark-prince 3 3 Donate link: https://revmakx.com 4 Tags: clone, migrate, local sync, local site, dev site, duplicate site, duplicator, cloning, migration, simple cloning, easiest cloning, free cloning4 Tags: clone, migrate, wp duplicate, wpduplicate, copy site, local sync, local site, dev site, duplicate site, duplicator, cloning, migration, simple cloning, easiest cloning, free cloning 5 5 Requires at least: 3.0.1 6 Tested up to: 5.77 Stable tag: 1. 0.56 Tested up to: 6.0 7 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Clone live site to the local site and vice versa.11 Easily migrate or clone your WordPress Site from one host to another. 12 12 13 13 == Description == 14 14 15 LocalSync provides you the easiest way to clone or migrate a site from one server to another in the click of a button.<br> 15 WP Duplicate (Formerly LocalSync) provides you with the easiest and the fastest way to clone or migrate a site from one server to another with the click of a button.<br> 16 The migration process is highly reliable and is proven to migrate bigger sites without any errors.<br> 16 17 17 == Why LocalSync? ==18 == Why WP Duplicate? == 18 19 19 <h2><strong>Simplest Cloning Tool</strong></h2>Just install the LocalSyncplugin on the destination site and the live site and start syncing, no need to enter FTP details.<br><br>20 <h2><strong>Simplest Cloning Tool</strong></h2>Just install the WP Duplicate plugin on the destination site and the live site and start syncing, no need to enter FTP details.<br><br> 20 21 <h2><strong>Incremental Cloning</strong></h2>Only the changed files are cloned from the source site to the destination site. So the cloning process is faster.<br><br> 21 <h2><strong>Load Images From Live Site</strong></h2>With LocalSyncyou can directly load the images of Live site, so that you do not need to copy media files which will save a lot of time during the cloning process.<br><br>22 <h2><strong>Clone Live Site To Local Computer</strong></h2>With LocalSyncyou can clone any production site to your Local Computer (MAMP, LAMP, XAMP, etc..).22 <h2><strong>Load Images From Live Site</strong></h2>With WP Duplicate you can directly load the images of Live site, so that you do not need to copy media files which will save a lot of time during the cloning process.<br><br> 23 <h2><strong>Clone Live Site To Local Computer</strong></h2>With WP Duplicate you can clone any production site to your Local Computer (MAMP, LAMP, XAMP, etc..). 23 24 24 25 == Installation == 25 26 26 1. Spin off a WP site on the local server or any online servers.27 2. Install "Local Sync Plugin" on the WP site created as mentioned above and activate it.28 3. Go to " Local Sync Settings" and select "This is localsite" button.29 4. Install Local Sync Pluginon the live WP site.30 5. Go to " Local Sync Settings" and select "This is prod site" button.31 6. Login with your Local Syncaccount (created on https://localsync.io) on the live WP site.32 7. Copy the prod key and go to the Local Sync Settingson the local WP site.27 1. Spin off a WP site on the destination server. 28 2. Install and activate the "WP Duplicate Plugin" on the WP site created as mentioned above. 29 3. Go to "WP admin dashboard -> WP Duplicate" and select "This is duplicate site" button. 30 4. Install and activate "WP Duplicate Plugin" on the live WP site. 31 5. Go to "WP admin dashboard -> WP Duplicate" and select "This is prod site" button. 32 6. Login with your WP Duplicate account (created on https://localsync.io) on the live WP site. 33 7. Copy the prod key and go to the "WP admin dashboard -> WP Duplicate" on the local WP site. 33 34 8. Paste the prod key, and Add Site. 34 9. Now you are ready to perform the sync operations from the Local Site.35 9. Now you are ready to copy the live site to the duplicate site. 35 36 36 37 == Screenshots == 37 38 38 1. Local Site settings page. 39 1. Duplicate Site settings page. 40 2. Live Site settings page. 39 41 40 42 == Frequently Asked Questions == 41 43 42 = Can I clone the site to any server instead of the local server? =44 = Can I clone the site to the local Computer? = 43 45 44 Yes you can clone the live site to any proper WP site setup in any servers.46 Yes, you can clone the live site to the WP site on your local desktop server. 45 47 46 48 = Where is the documentation for your plugin? = … … 49 51 50 52 == Changelog == 53 = 1.1.0 = 54 *Release Date - 29 Jun 2022* 55 56 * Improvement : The migration process is revamped to increase reliability and prevent errors in bigger sites. 57 * Improvement : Renamed the plugin to WP Duplicate. 51 58 52 59 = 1.0.5 = 53 60 *Release Date - 22 Apr 2021* 54 61 55 * Fix : Not able to install LocalSyncplugin on WPTimeCapsule's staging site.56 * Fix : Not able to include, exclude Files/Folders on WPTimeCapsule plugin settings page when LocalSyncplugin is active.62 * Fix : Not able to install WP Duplicate plugin on WPTimeCapsule's staging site. 63 * Fix : Not able to include, exclude Files/Folders on WPTimeCapsule plugin settings page when WP Duplicate plugin is active. 57 64 58 65 * Improvement : LOCAL_SYNC_DOWNLOAD_CHUNK_SIZE constant is introduced. -
local-sync/trunk/admin/class-local-sync-admin.php
r2519732 r2749602 186 186 } 187 187 188 public function update_1_1_0_handle() { 189 190 $is_table_exist = $this->wpdb->query('SHOW TABLES LIKE "'.$this->wpdb->base_prefix.'local_sync_options%"'); 191 192 if(!$is_table_exist){ 193 194 return; 195 } 196 197 $site_type = $this->local_sync_options->get_option('site_type'); 198 199 if(empty($site_type)){ 200 201 return; 202 } 203 204 205 $local_sync_version_in_options_table = $this->local_sync_options->get_option('local_sync_version'); 206 207 if(empty($local_sync_version_in_options_table)){ 208 209 return; 210 } 211 212 if (version_compare($local_sync_version_in_options_table, '1.1.0', '<')) { 213 $table_name = $this->wpdb->base_prefix . 'local_sync_current_process'; 214 $this->wpdb->query("ALTER TABLE `$table_name` ADD `prev_uploaded_size` int(30) NULL;"); 215 216 local_sync_log($table_name,'----running-----update_1_1_0_handle-----------------'); 217 } 218 } 188 219 public function create_fresh_tables() { 189 220 $cachecollation = $this->local_sync_get_collation(); … … 212 243 `processed_time` varchar(30) NOT NULL, 213 244 `file_hash` varchar(128) DEFAULT NULL, 245 `prev_uploaded_size` int(30) NULL, 214 246 PRIMARY KEY (`id`), 215 247 INDEX `file_path` (`file_path`(191)) … … 338 370 add_menu_page( 339 371 'Local Sync', 340 ' Local Sync Settings',372 'WP Duplicate', 341 373 'activate_plugins', 342 374 plugin_dir_path(__FILE__) . 'views/local-sync-settings-display.php', … … 602 634 'import_local_file_list_dump' => 'waiting', 603 635 'process_file_list_difference' => 'waiting', 604 'zip_creation' => 'waiting', 605 'zip_download' => 'waiting', 606 'initiate_zip_extract' => 'waiting', 607 'continue_extract_from_bridge' => 'waiting', 636 'send_batch_download_requests' => 'waiting', 637 'copy_files_from_bridge' => 'waiting', 608 638 'prepare_delete_list_table' => 'waiting', 609 639 'db_dump_restore' => 'waiting', … … 645 675 $this->app_functions->do_zip_download(); 646 676 break; 677 case 'send_batch_download_requests': 678 $this->batch_download_obj = new Local_Sync_Batch_Download(); 679 $response = $this->batch_download_obj->send_batch_download_requests(); 680 break; 681 case 'initiate_bridge_files': 682 $this->app_functions->initiate_bridge_files(); 683 break; 647 684 case 'initiate_zip_extract': 648 685 $this->away_post_call_dont_handle_response('clear_temp_files_local_sync', $url); … … 702 739 if( $sync_current_action == 'file_list_preparation_for_local_dump' 703 740 || $sync_current_action == 'start_db_dump_local_file_list' 704 || $sync_current_action == 'initiate_zip_extract' ){ 741 || $sync_current_action == 'initiate_zip_extract' 742 || $sync_current_action == 'initiate_bridge_files' ){ 705 743 706 744 $is_away_action = true; … … 725 763 case 'process_file_list_difference': 726 764 $this->app_functions->process_file_list_difference(); 765 break; 766 case 'batch_upload_files': 767 $this->batch_upload_obj = new Local_Sync_Batch_Upload(); 768 $response = $this->batch_upload_obj->batch_upload_files(); 727 769 break; 728 770 case 'zip_creation': … … 757 799 ); 758 800 801 $post_body['load_images_from_live_site_settings'] = $this->local_sync_options->get_option('load_images_from_live_site_settings'); 759 802 if($away_action_first_call){ 760 803 $post_body['current_sync_unique_id'] = $this->local_sync_options->get_option('current_sync_unique_id'); 761 804 $post_body['prod_site_url'] = $this->local_sync_options->get_option('local_site_url'); 762 805 $post_body['away_sync_type_db_or_files'] = $this->local_sync_options->get_option('sync_type_db_or_files'); 763 $post_body['load_images_from_live_site_settings'] = $this->local_sync_options->get_option('load_images_from_live_site_settings');764 806 765 807 $post_body['away_site_abspath'] = wp_normalize_path(ABSPATH); … … 798 840 $this->local_sync_options->set_option('away_site_id_current_site', $response['away_site_id_current_site']); 799 841 $this->local_sync_options->set_option('away_blog_id_current_site', $response['away_blog_id_current_site']); 800 $this->local_sync_options->set_option('load_images_from_live_site_settings', $response['load_images_from_live_site_settings']);801 842 } 802 843 … … 852 893 853 894 $this->app_functions->process_features_from_response($response); 895 if(!empty($response['prod_site_url_enc'])){ 896 $this->local_sync_options->set_option('prod_site_url_enc', $response['prod_site_url_enc']); 897 $this->local_sync_options->set_option('prod_admin_url_enc', $response['prod_admin_url_enc']); 898 $this->local_sync_options->set_option('prod_uploads_url_enc', $response['prod_uploads_url_enc']); 899 $this->local_sync_options->set_option('away_site_abspath', $response['away_site_abspath']); 900 $this->local_sync_options->set_option('away_site_db_prefix', $response['away_site_db_prefix']); 901 $this->local_sync_options->set_option('is_away_site_multisite', $response['is_away_site_multisite']); 902 $this->local_sync_options->set_option('away_site_id_current_site', $response['away_site_id_current_site']); 903 $this->local_sync_options->set_option('away_blog_id_current_site', $response['away_blog_id_current_site']); 904 } 854 905 855 906 if( !empty($response) && !empty($response['success'])){ -
local-sync/trunk/admin/class-local-sync-app-functions.php
r2248180 r2749602 157 157 $post_body['prod_key_random_id'] = $this->local_sync_options->get_option('prod_key_random_id'); 158 158 159 $timeout = 30; 160 if(!empty($post_body) && !empty($post_body['action']) && $post_body['action'] == 'check_validity'){ 161 $timeout = 60; 162 } 159 163 $response = wp_remote_post( $url, array( 160 164 'method' => 'POST', 161 'timeout' => 30,165 'timeout' => $timeout, 162 166 'redirection' => 5, 163 ' httpversion' => '1.0',167 'sslverify' => false, 164 168 'blocking' => true, 165 169 'headers' => array(), … … 169 173 ); 170 174 171 $r esponse = wp_remote_retrieve_body( $response );172 173 $response = parse_local_sync_response_from_raw_data_php($r esponse);175 $raw_response = wp_remote_retrieve_body( $response ); 176 177 $response = parse_local_sync_response_from_raw_data_php($raw_response); 174 178 175 179 local_sync_log($response, "-----wp_remote_post_local_sync---response-----$url---"); 180 181 if(empty($response)){ 182 local_sync_log($raw_response, "-----wp_remote_post_local_sync---raw_response-----$url---"); 183 } 176 184 177 185 return json_decode($response, true); … … 386 394 387 395 $this->local_sync_files_op->add_full_db_file_to_current_process(); 388 $this->local_sync_options->set_option('sync_current_action', 'zip_creation'); 396 $next_action = 'batch_upload_files'; 397 $site_type = $this->local_sync_options->get_option('site_type'); 398 if($site_type == 'production'){ 399 $next_action = 'send_batch_download_requests'; 400 } 401 $this->local_sync_options->set_option('sync_current_action', $next_action); 389 402 390 403 $this->local_sync_options->set_this_current_action_step('processing'); … … 941 954 $this->local_sync_options->set_option('sync_current_action', 'continue_extract_from_live_bridge'); 942 955 $this->local_sync_options->set_option('sync_sub_action', 'continue_extract_from_live_bridge'); 956 $this->local_sync_options->set_this_current_action_step( 'processing'); 957 } 958 959 $this->local_sync_options->set_option('is_bridge_process', true); 960 961 local_sync_die_with_json_encode(array( 962 'success' => true, 963 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 964 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 965 'requires_next_call' => false 966 )); 967 } 968 969 public function initiate_bridge_files() { 970 $this->local_sync_options->set_option('sync_sub_action', 'creating_bridge_files'); 971 972 $restore_app_functions = new Local_Sync_Restore_Op(); 973 $download_result = $restore_app_functions->prepare(); 974 975 $restore_app_functions->reset_bridge_constants(); 976 977 $site_type = $this->local_sync_options->get_option('site_type'); 978 979 $this->local_sync_options->set_this_current_action_step('done'); 980 981 if(empty($site_type) || $site_type == 'local'){ 982 $this->local_sync_options->set_option('sync_current_action', 'copy_files_from_bridge'); 983 $this->local_sync_options->set_option('sync_sub_action', 'copy_files_from_bridge'); 984 $this->local_sync_options->set_this_current_action_step( 'processing'); 985 } elseif($site_type == 'production'){ 986 $this->local_sync_options->set_option('sync_current_action', 'copy_files_from_live_bridge'); 987 $this->local_sync_options->set_option('sync_sub_action', 'copy_files_from_live_bridge'); 943 988 $this->local_sync_options->set_this_current_action_step( 'processing'); 944 989 } … … 1000 1045 fwrite($fp, hex2bin($file_data)); 1001 1046 1002 // file_put_contents($file_list_dump_file, hex2bin($file_data), FILE_APPEND);1047 1003 1048 1004 1049 if(!file_exists($file_list_dump_file)){ … … 1038 1083 $fp = fopen($full_zip_file, 'rb+'); 1039 1084 fseek($fp, $start_range); 1040 fwrite($fp, hex2bin($file_data)); 1041 1042 // file_put_contents($full_zip_file, hex2bin($file_data), FILE_APPEND); 1085 fwrite( $fp, gzuncompress(hex2bin($file_data)) ); 1086 1043 1087 1044 1088 if(!file_exists($full_zip_file)){ … … 1149 1193 $modified_files = array(); 1150 1194 $modified_files_count = 0; 1195 $site_type = $this->local_sync_options->get_option('site_type'); 1196 1197 $next_action = 'batch_upload_files'; 1198 if($site_type == 'production'){ 1199 //hackish 1200 $next_action = 'send_batch_download_requests'; 1201 } 1151 1202 1152 1203 if( !$this->local_sync_options->is_feature_valid('filesDiff') ){ 1153 $this->local_sync_options->set_option('sync_current_action', 'zip_creation');1154 $this->local_sync_options->set_option('sync_sub_action', 'zip_creation');1204 $this->local_sync_options->set_option('sync_current_action', $next_action); 1205 $this->local_sync_options->set_option('sync_sub_action', $next_action); 1155 1206 } elseif($diff_result['is_completed']){ 1156 $this->local_sync_options->set_option('sync_current_action', 'zip_creation');1157 $this->local_sync_options->set_option('sync_sub_action', 'zip_creation');1207 $this->local_sync_options->set_option('sync_current_action', $next_action); 1208 $this->local_sync_options->set_option('sync_sub_action', $next_action); 1158 1209 1159 1210 $this->local_sync_files_op = new Local_Sync_Files_Op(); … … 1354 1405 local_sync_die_with_json_encode_simple(array( 1355 1406 'success' => true, 1356 'features' => $response['features'] 1407 'features' => $response['features'], 1408 'prod_site_url_enc' => $this->local_sync_options->get_option('local_site_url_enc'), 1409 'prod_admin_url_enc' => $this->local_sync_options->get_option('local_admin_url_enc'), 1410 'prod_uploads_url_enc' => $this->local_sync_options->get_option('local_uploads_url_enc'), 1411 'load_images_from_live_site_settings' => $this->local_sync_options->get_option('load_images_from_live_site_settings'), 1412 'away_site_abspath' => wp_normalize_path(ABSPATH), 1413 'is_away_site_multisite' => defined('MULTISITE') ? MULTISITE : false, 1414 'away_site_id_current_site' => defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : false, 1415 'away_blog_id_current_site' => defined('BLOG_ID_CURRENT_SITE') ? BLOG_ID_CURRENT_SITE : false, 1416 'away_site_db_prefix' => $this->wpdb->base_prefix, 1357 1417 )); 1358 1418 } … … 1383 1443 $post_body['URL'] = $post_body['url']; 1384 1444 1385 local_sync_log($post_body, "--------service_post_call--- --post_body---");1445 local_sync_log($post_body, "--------service_post_call---$main_action--post_body---"); 1386 1446 1387 1447 if(empty($post_body['email']) || empty($post_body['pass']) || empty($post_body['URL'])){ … … 1401 1461 $response = wp_remote_post( $service_url, array( 1402 1462 'method' => 'POST', 1403 'timeout' => 30,1463 'timeout' => 60, 1404 1464 'redirection' => 5, 1405 ' httpversion' => '1.0',1465 'sslverify' => false, 1406 1466 'blocking' => true, 1407 1467 'headers' => array( … … 1417 1477 $response = parse_wp_merge_response_from_raw_data_php($response); 1418 1478 1419 local_sync_log($response, "-----service_post_call- --response--------");1479 local_sync_log($response, "-----service_post_call-$main_action--response--------"); 1420 1480 1421 1481 $response = json_decode($response, true); … … 1425 1485 1426 1486 public function process_features_from_response($response=null) { 1487 if(empty($response)){ 1488 1489 return; 1490 } 1427 1491 if( !empty($response) && !empty($response['success']) && !empty($response['features'])){ 1428 1492 $this->local_sync_options->set_option('prod_site_features', json_encode($response['features'], true)); 1429 1430 1493 return; 1431 1494 } 1432 1495 1496 //to handle temp live site timeout 1497 if(!empty($response) && !empty($response['error']) && $response['error'] == 'Invalid Response.'){ 1498 1499 return; 1500 } 1501 1433 1502 $this->local_sync_options->set_option('prod_site_features', array()); 1434 1503 } -
local-sync/trunk/admin/class-local-sync-db-op.php
r2245393 r2749602 337 337 $columns = $this->wpdb->get_results("SHOW COLUMNS IN `$table`", OBJECT_K); 338 338 339 local_sync_log($this->select_query_limit, "--------select_query_limit--------");339 // local_sync_log($this->select_query_limit, "--------select_query_limit--------"); 340 340 341 341 if ($table_count != 0) { -
local-sync/trunk/admin/class-local-sync-exclude-option.php
r2248180 r2749602 255 255 } 256 256 257 private function get_keys($type = 'file' , $action , $category = 'backup'){257 private function get_keys($type = 'file' , $action = '', $category = 'backup'){ 258 258 259 259 $sql = "SELECT * FROM {$this->db->base_prefix}local_sync_inc_exc_contents WHERE `type` = '$type' AND `action` = '$action' AND `category` = '$category'"; -
local-sync/trunk/admin/class-local-sync-files-op.php
r2251904 r2749602 381 381 382 382 if(!$is_skip){ 383 $files_count_check = 10000;383 $files_count_check = 3000; 384 384 if(defined('ITERATOR_FILES_COUNT_CHECK')){ 385 385 $files_count_check = ITERATOR_FILES_COUNT_CHECK; … … 463 463 } 464 464 465 public function get_limited_files_to_zip($limit = 10) { 465 public function get_prev_uploaded_size($file) { 466 $sql = "SELECT prev_uploaded_size FROM `{$this->wpdb->base_prefix}local_sync_current_process` WHERE file_path='$file'"; 467 $response = $this->wpdb->get_var($sql); 468 469 if($response === false){ 470 local_sync_log($sql, "--------get_limited_files_to_zip---error-----"); 471 472 return 0; 473 } 474 475 return $response; 476 } 477 478 public function update_current_process_prev_uploaded_size($file_path, $file_size) { 479 480 $sql = "UPDATE `{$this->wpdb->base_prefix}local_sync_current_process` SET prev_uploaded_size=$file_size WHERE file_path='$file_path'"; 481 $response = $this->wpdb->query($sql); 482 483 if($response === false){ 484 local_sync_log($sql, "--------update_current_process_prev_uploaded_size---error-----"); 485 } 486 487 return $response; 488 } 489 490 public function update_current_file_status($file_path, $status) { 491 492 $sql = "UPDATE `{$this->wpdb->base_prefix}local_sync_current_process` SET status='$status' WHERE file_path='$file_path'"; 493 $response = $this->wpdb->query($sql); 494 495 if($response === false){ 496 local_sync_log($sql, "--------update_current_file_status---error-----"); 497 } 498 499 return $response; 500 } 501 502 public function get_limited_files_to_zip($limit = 50) { 466 503 $sql = "SELECT file_path FROM `{$this->wpdb->base_prefix}local_sync_current_process` WHERE STATUS='Q' LIMIT $limit"; 467 504 $response = $this->wpdb->get_results($sql); … … 480 517 if($response === false){ 481 518 local_sync_log($sql, "--------get_limited_files_to_zip---error-----"); 519 } 520 521 return $response; 522 } 523 524 public function get_processed_files_count() { 525 $sql = "SELECT COUNT(id) FROM `{$this->wpdb->base_prefix}local_sync_current_process` WHERE status='P'"; 526 $response = $this->wpdb->get_var($sql); 527 528 if($response === false){ 529 local_sync_log($sql, "--------get_processed_files_count---error-----"); 530 } 531 532 return $response; 533 } 534 535 public function get_queued_files_count() { 536 $sql = "SELECT COUNT(id) FROM `{$this->wpdb->base_prefix}local_sync_current_process` WHERE status='Q'"; 537 $response = $this->wpdb->get_var($sql); 538 539 if($response === false){ 540 local_sync_log($sql, "--------get_processed_files_count---error-----"); 482 541 } 483 542 … … 715 774 716 775 } 776 777 public function save_files_batch($files_post_obj, $start_range = 0) { 778 try { 779 780 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 781 782 foreach($files_post_obj as $kk => $vv){ 783 $this->save_single_batch_file([ 784 'file_name' => base64_decode($kk), 785 'file_data' => $vv, 786 ], $start_range); 787 } 788 } catch (Exception $e) { 789 local_sync_die_with_json_encode(array( 790 'success' => false, 791 'msg' => 'save_files_batch_error' . $e->getMessage(), 792 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 793 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 794 'requires_next_call' => false 795 )); 796 } 797 } 798 799 public function save_single_batch_file($file_obj = null, $start_range = 0) { 800 $full_file_name = rtrim($this->local_sync_options->get_backup_dir(), '/') . '/' . $file_obj['file_name']; 801 802 // local_sync_log($full_file_name, "--------save_single_batch_file--------"); 803 804 $this->recursive_mk_directory_of_this_file($full_file_name); 805 806 if( $start_range == 0 ){ 807 file_put_contents($full_file_name, ''); 808 } 809 810 $file_data = $file_obj['file_data']; 811 if(!empty($file_data)){ 812 $file_data = gzuncompress(hex2bin($file_data)); 813 } 814 815 $fp = fopen($full_file_name, 'rb+'); 816 fseek($fp, $start_range); 817 fwrite( $fp, $file_data); 818 819 if(!empty($fp)){ 820 fclose($fp); 821 } else { 822 local_sync_log($full_file_name, "--------save_full_file_name---failed-----"); 823 } 824 825 return true; 826 } 827 828 public function recursive_mk_directory_of_this_file($full_file_name) { 829 $this_dir_name = dirname($full_file_name); 830 831 if(!is_dir($this_dir_name)){ 832 $this->recursive_mk_directory_of_this_file($this_dir_name); 833 } else { 834 return; 835 } 836 837 mkdir($this_dir_name, 0755); 838 } 839 840 public function save_single_big_file($file_name, $file_data = null, $start_range = 0, $end_range = 0) { 841 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 842 843 $full_file_name = rtrim($this->local_sync_options->get_backup_dir(), '/') . '/' . $file_name; 844 845 $this->recursive_mk_directory_of_this_file($full_file_name); 846 847 if( $start_range == 0 ){ 848 file_put_contents($full_file_name, ''); 849 } 850 851 $fp = fopen($full_file_name, 'rb+'); 852 fseek($fp, $start_range); 853 fwrite( $fp, gzuncompress(hex2bin($file_data)) ); 854 855 fclose($fp); 856 857 if(!file_exists($full_file_name)){ 858 local_sync_log($full_file_name, "--------save_single_big_file---failed-----"); 859 860 local_sync_die_with_json_encode(array( 861 'error' => 'Cannot create full zip file', 862 'msg' => 'save_single_big_file_failed', 863 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 864 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 865 'requires_next_call' => false 866 )); 867 } 868 869 // local_sync_log(filesize($full_file_name), "--------file zise---save_single_big_file-----"); 870 871 local_sync_die_with_json_encode(array( 872 'success' => true, 873 'msg' => 'save_single_big_file_success', 874 'file_size' => filesize($full_file_name), 875 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 876 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 877 'requires_next_call' => true 878 )); 879 880 // return filesize($file_list_dump_file); 881 } 717 882 } -
local-sync/trunk/admin/class-local-sync-replace-db-links.php
r2245393 r2749602 115 115 } 116 116 117 public function prepare_replace_list_for_staging($replace_list = array(), $table_prefix , $old_url, $new_url, $type = '')117 public function prepare_replace_list_for_staging($replace_list = array(), $table_prefix = '', $old_url = '', $new_url = '', $type = '') 118 118 { 119 119 local_sync_log($table_prefix, "--------prepare_replace_list_for_staging--------"); … … 515 515 } else if (is_object($data)) { 516 516 517 $_tmp = $data; 518 $props = get_object_vars( $data ); 519 foreach ($props as $key => $value) { 520 //If some objects has \0 in the key it creates the fatal error so skip such contents 521 if (strstr($key, "\0") !== false ) { 522 continue; 517 if( get_class($data) != '__PHP_Incomplete_Class' ){ 518 519 $_tmp = $data; 520 $props = get_object_vars( $data ); 521 foreach ($props as $key => $value) { 522 //If some objects has \0 in the key it creates the fatal error so skip such contents 523 if (is_string($key) && strstr($key, "\0") !== false ) { 524 continue; 525 } 526 if (is_string($value) && strstr($value, "\0") !== false ) { 527 continue; 528 } 529 $_tmp->$key = $this->recursive_unserialize_replace( $from, $to, $value, false ); 523 530 } 524 $_tmp->$key = $this->recursive_unserialize_replace( $from, $to, $value, false ); 525 } 526 $data = $_tmp; 527 unset($_tmp); 531 $data = $_tmp; 532 unset($_tmp); 533 534 } 535 528 536 } else { 529 537 if (is_string($data)) { -
local-sync/trunk/admin/class-local-sync-restore-op.php
r2251904 r2749602 613 613 if ( $this->is_migration ) { 614 614 $current_query = $this->search_and_replace_db_name($current_query); 615 $current_query = $this->search_and_replace_prefix($current_query);615 // $current_query = $this->search_and_replace_prefix($current_query); 616 616 $replaceQuery = $this->search_and_replace_urls_new($current_query, $this->old_url, $this->new_url, $this->live_db_prefix); 617 617 } … … 625 625 if(!empty($replaceQuery['prevExec']) && !empty($tempQuery)) { 626 626 627 local_sync_log('', "--------prevExec---coming-----");627 // local_sync_log('', "--------prevExec---coming-----"); 628 628 629 629 // local_sync_log(strlen($tempQuery), "--------tempQuery--length---exec---"); … … 1035 1035 local_sync_log('', "--------search_and_replace_db_name--1--success----"); 1036 1036 1037 return 'CREATE DATABASE IF NOT EXISTS `' . DB_NAME . '`'; 1037 $this_query = 'CREATE DATABASE IF NOT EXISTS `' . DB_NAME . '`'; 1038 1039 return ''; 1038 1040 } 1039 1041 … … 1042 1044 local_sync_log('', "--------search_and_replace_db_name--2--success----"); 1043 1045 1044 return 'USE `' . DB_NAME . '`'; 1046 $this_query = 'USE `' . DB_NAME . '`'; 1047 1048 return ''; 1045 1049 } 1046 1050 … … 1180 1184 1181 1185 public function search_and_replace_prefix($query){ 1186 if(stripos($query, 'USE ') === 0){ 1187 local_sync_log($query, "--------use query man------"); 1188 1189 return $query; //revisit 1190 } 1182 1191 1183 1192 // return $query; //revisit … … 1465 1474 local_sync_wait_for_sometime(); 1466 1475 1467 local_sync_log($file, "--------deleting state file--delete_files_from_table_records------");1476 // local_sync_log($file, "--------deleting state file--delete_files_from_table_records------"); 1468 1477 1469 1478 $result = $this->fs->delete($file); … … 1479 1488 } 1480 1489 1481 $updated_files_str = ltrim($updated_files_str, ',');1482 $this->update_delete_list_table_status($updated_files_str, 'D');1483 1490 1484 1491 return array( … … 1488 1495 } 1489 1496 1490 // local_sync_log($updated_files_str, "--------updated_files_str----D----");1497 local_sync_log($updated_files_str, "--------deleted files str----D----"); 1491 1498 1492 1499 $updated_files_str = ltrim($updated_files_str, ','); -
local-sync/trunk/admin/js/local-sync-admin.js
r2248180 r2749602 4 4 var USER_SELECTION_MODIFIED_FILES = {}; 5 5 var SHOW_FS_METHOD_ERROR_LOSY = false; 6 var LOCAL_SYNC_AJAX_RUNNING = false; 6 7 7 8 function import_steps_losy(steps_parent){ … … 85 86 86 87 function continue_sync_from_live_losy(){ 87 if(typeof chosen_action_local_sync == 'undefined' || chosen_action_local_sync == '' ){88 if(typeof chosen_action_local_sync == 'undefined' || chosen_action_local_sync == '' || LOCAL_SYNC_AJAX_RUNNING){ 88 89 return; 89 90 } 91 LOCAL_SYNC_AJAX_RUNNING = true; 90 92 91 93 var data = { … … 103 105 104 106 console.log('continuing sync response', response); 107 LOCAL_SYNC_AJAX_RUNNING = false; 105 108 106 109 if(typeof response == 'undefined' || !response){ … … 179 182 } 180 183 184 if(typeof response.queued_files_count != 'undefined'){ 185 if(jQuery('#send_batch_download_requests_losy').length){ 186 jQuery('#send_batch_download_requests_losy').text(`Downloading ${response.queued_files_count} files...`); 187 } else if(jQuery('#batch_upload_files_losy').length){ 188 jQuery('#batch_upload_files_losy').text(`Uploading ${response.queued_files_count} files...`); 189 } 190 } 191 181 192 if(response.sync_current_action == 'continue_extract_from_bridge'){ 182 193 transfer_flow_to_bridge_losy(); 183 } else if(response.sync_current_action == 'continue_extract_from_live_bridge'){194 } else if(response.sync_current_action == 'continue_extract_from_live_bridge'){ 184 195 transfer_flow_to_live_bridge_losy(); 196 } else if(response.sync_current_action == 'copy_files_from_live_bridge'){ 197 transfer_flow_to_live_bridge_losy(); 198 } else if(response.sync_current_action == 'copy_files_from_bridge'){ 199 transfer_flow_to_bridge_losy(); 185 200 } 186 201 … … 196 211 197 212 function stop_and_re_init_continue_sync_from_live_losy(){ 198 if( (typeof continue_sync_interval_started != 'undefined' && continue_sync_interval_started) ){stop_continuing_sync_process_losy(true); 213 if( (typeof continue_sync_interval_started != 'undefined' && continue_sync_interval_started) ){ 214 stop_continuing_sync_process_losy(true); 199 215 200 216 continue_sync_interval_started = true; … … 352 368 353 369 function save_settings_losy(isAlert, pullSteps){ 370 jQuery('.save_settings_local_sync').val('Saving...'); 354 371 var ls_settings = {}; 355 372 // ls_settings['prod_key'] = jQuery('.prod_key_losy').val(); … … 373 390 374 391 jQuery.post(ajaxurl, data, function(response) { 375 376 console.log('save_settings_losy');377 378 response = parse_local_sync_response_from_raw_data(response);379 380 392 try{ 393 console.log('save_settings_losy'); 394 395 jQuery('.save_settings_local_sync').val('Save Changes'); 396 397 response = parse_local_sync_response_from_raw_data(response); 398 381 399 response = JSON.parse(response); 400 401 console.log(response); 402 403 if( typeof response != 'undefined' 404 && typeof response.prod_site_url != 'undefined' 405 && response.prod_site_url ){ 406 jQuery('.prod_site_url_losy').val(response.prod_site_url); 407 } 408 409 if(isAlert){ 410 alert('Success'); 411 } 412 if(pullSteps){ 413 import_steps_losy(chosen_action_local_sync); 414 } 415 382 416 }catch(err){ 383 417 console.log('json parse error', response); 384 }385 386 console.log(response);387 388 if( typeof response != 'undefined'389 && typeof response.prod_site_url != 'undefined'390 && response.prod_site_url ){391 jQuery('.prod_site_url_losy').val(response.prod_site_url);392 }393 394 if(isAlert){395 alert('Success');396 }397 if(pullSteps){398 import_steps_losy(chosen_action_local_sync);399 418 } 400 419 }); -
local-sync/trunk/admin/views/local-sync-settings-display.php
r2519732 r2749602 98 98 <div class="main-cols-losy"> 99 99 <div class="m-box-losy"> 100 <h2 class="hd">Login to your LocalSyncaccount <a href="https://localsync.io" target="_blank" style="float: right; text-decoration: none;">Signup</a></h2>100 <h2 class="hd">Login to your WP Duplicate account <a href="https://localsync.io" target="_blank" style="float: right; text-decoration: none;">Signup</a></h2> 101 101 <div class="pad"> 102 102 <div class="losy_login_error losy_login_erorr_success_flaps error-box-losy" style="display: none;"></div> … … 131 131 <div class="main-cols-losy"> 132 132 <div class="m-box-losy"> 133 <h2 class="hd">Is this the production site or localsite?</h2>133 <h2 class="hd">Is this the production site or duplicate site?</h2> 134 134 <div class="pad"> 135 <em>Click <strong>"This is local site"</strong> if you wish to set this site as the localsite, or , click <strong>"This is live site"</strong> if you wish to set this site as the production site. <a href="https://docs.localsync.io" target="_blank">help?</a></em>135 <em>Click <strong>"This is duplicate site"</strong> if you wish to set this site as the duplicate site, or , click <strong>"This is live site"</strong> if you wish to set this site as the production site. <a href="https://docs.localsync.io" target="_blank">help?</a></em> 136 136 </div> 137 137 <div class="pad cf" style="padding-top: 0;"> 138 138 <div class="col col50"> 139 <button class="button set_as_local_site_losy" style="float: left; margin: 5px 0 4px;" >This is localsite</button>139 <button class="button set_as_local_site_losy" style="float: left; margin: 5px 0 4px;" >This is duplicate site</button> 140 140 </div> 141 141 <div class="col col50"> … … 157 157 Enter the Prod Key copied from the live site. 158 158 <br> 159 (Live site WP admin -> Local Sync Settings)159 (Live site WP admin -> WP Duplicate) 160 160 </em> 161 161 </div> … … 242 242 <?php if($show_prod_site_options) : ?> 243 243 <div class="m-box-losy"> 244 <h2 class="hd">Connect Dev & Prod Local Sync plugins<a href="https://docs.localsync.io" target="_blank">help?</a> </h2>244 <h2 class="hd">Connect Live site & Duplicate site <a href="https://docs.localsync.io" target="_blank">help?</a> </h2> 245 245 <div class="pad"> 246 Copy and paste this key on the localsite, you want to clone.246 Copy and paste this key on the duplicate site, you want to clone. 247 247 </div> 248 248 <div class="pad"> … … 253 253 </div> 254 254 </div> 255 <div style="font-size: 11px; padding-top: 5px;">Copy & Paste this key in the Dev site's WP Admin Dashboard -> Local Sync Settings.</div>255 <div style="font-size: 11px; padding-top: 5px;">Copy & Paste this key in the Dev site's WP Admin Dashboard -> WP Duplicate.</div> 256 256 </div> 257 257 </div> … … 263 263 <div class="all-caps-heading" style="margin-bottom:5px;">INCLUDE/EXCLUDE CONTENT FOR PUSHING TO LOCAL</div> 264 264 <em>These settings apply when pulling this live site from the dev site. For include/exclude 265 settings for pulling from dev site, go to the Dev site's <strong> Local SyncPlugin</strong> settings</em><br><br>265 settings for pulling from dev site, go to the Dev site's <strong>WP Duplicate Plugin</strong> settings</em><br><br> 266 266 <div class="form-row"> 267 267 <label>Select folders, files or DB tables to include</label> -
local-sync/trunk/includes/class-local-sync-handle-server-requests.php
r2519732 r2749602 79 79 80 80 break; 81 case 'handle_batch_upload_files': 82 $this->handle_batch_upload_files(); 83 84 break; 85 case 'handle_upload_single_big_file': 86 $this->handle_upload_single_big_file(); 87 88 break; 81 89 case 'handle_upload_zip_file': 82 90 $this->handle_upload_zip_file(); 91 92 break; 93 case 'handle_batch_download_files': 94 $this->handle_batch_download_files(); 83 95 84 96 break; … … 345 357 $this->app_functions->initiate_zip_extract(); 346 358 break; 359 case 'initiate_bridge_files': 360 $this->app_functions->initiate_bridge_files(); 361 break; 347 362 348 363 default: … … 369 384 370 385 $this->app_functions->save_full_zip_file($this->request_data['file_data'], $this->request_data['start_range'], $this->request_data['end_range']); 386 } 387 388 public function handle_upload_single_big_file() { 389 $this->local_sync_options->set_option('sync_current_action', 'handle_upload_single_big_file'); 390 $this->local_sync_options->set_option('sync_sub_action', 'handle_upload_single_big_file'); 391 392 $this->local_sync_options->create_local_sync_files(); 393 394 $this->local_sync_files_op = new Local_Sync_Files_Op(); 395 $this->local_sync_files_op->save_single_big_file($this->request_data['file_name'], $this->request_data['file_data'], $this->request_data['start_range'], $this->request_data['end_range']); 396 397 } 398 399 public function handle_batch_upload_files() { 400 $this->local_sync_options->set_option('sync_current_action', 'handle_batch_upload_files'); 401 $this->local_sync_options->set_option('sync_sub_action', 'handle_batch_upload_files'); 402 403 $this->local_sync_options->create_local_sync_files(); 404 405 $this->local_sync_files_op = new Local_Sync_Files_Op(); 406 $this->local_sync_files_op->save_files_batch($this->request_data['files_data']); 407 408 } 409 410 public function handle_batch_download_files() { 411 $this->local_sync_options->set_option('sync_current_action', 'handle_batch_download_files'); 412 $this->local_sync_options->set_option('sync_sub_action', 'handle_batch_download_files'); 413 414 $this->local_sync_options->create_local_sync_files(); 415 416 $this->batch_download_obj = new Local_Sync_Batch_Download(); 417 $response = $this->batch_download_obj->batch_download_files(); 371 418 372 419 } -
local-sync/trunk/includes/class-local-sync-options.php
r2248180 r2749602 4 4 5 5 public $all_configs; 6 public $files_to_be_skipped_during_full_copy; 6 7 7 8 public function __construct() { … … 11 12 $this->all_configs = array(); 12 13 14 $this->files_to_be_skipped_during_full_copy = [ 15 'local_sync_deleted_files.txt', 16 'local_sync_file_list_dump', 17 'test.php', 18 ]; 13 19 $options_table_name = $this->wpdb->base_prefix . 'local_sync_options'; 14 20 $this->options_table_name = $options_table_name; … … 34 40 if($result === false){ 35 41 local_sync_log($name, "--------update_option-failed-------"); 42 local_sync_log($this->wpdb->last_error, "--------update_option-failed----last_error---"); 43 local_sync_log($this->wpdb->last_query, "--------update_option-failed----last_query---"); 36 44 } else { 37 45 $this->all_configs[$name] = $value; … … 251 259 $folder_name = trailingslashit($folder_name); 252 260 253 local_sync_log($folder_name, "----deleting----folder_name--------");261 // local_sync_log($folder_name, "----deleting----folder_name--------"); 254 262 255 263 $normalized_abspath = wp_normalize_path(ABSPATH); … … 296 304 } 297 305 298 local_sync_log($folder_name . $filename, "------deleting----------");306 // local_sync_log($folder_name . $filename, "------deleting----------"); 299 307 300 308 $this->fs->delete($folder_name . $filename); … … 340 348 341 349 foreach ((array) $dirlist as $filename => $fileinfo) { 342 if ( 'f' == $fileinfo['type'] && $filename != '.htaccess') {350 if (!empty($fileinfo) && 'f' == $fileinfo['type'] && $filename != '.htaccess') { 343 351 if (!$this->tc_file_system_copy($from . $filename, $to . $filename, false, FS_CHMOD_FILE)) { 344 352 $this->fs->chmod($to . $filename, 0644); … … 357 365 } 358 366 } 359 } elseif ( 'd' == $fileinfo['type']) {367 } elseif (!empty($fileinfo) && 'd' == $fileinfo['type']) { 360 368 if (!$this->fs->is_dir($to . $filename)) { 361 369 if (!$this->fs->mkdir($to . $filename, FS_CHMOD_DIR)) { … … 372 380 } 373 381 382 public function tc_file_system_move_dir($from, $to = '', $action = array('multicall_exit' => false)) { 383 384 $from = trailingslashit($from); 385 $to = trailingslashit($to); 386 387 $this->init_fs(); 388 $dirlist = $this->fs->dirlist($from); 389 390 foreach ((array) $dirlist as $filename => $fileinfo) { 391 if ('f' == $fileinfo['type'] && $filename != '.htaccess') { 392 393 // local_sync_log($filename, "----moving----filename--------"); 394 395 if (!$this->tc_file_system_move($from . $filename, $to . $filename, true, FS_CHMOD_FILE)) { 396 397 local_sync_log($filename, "----moving----false--------"); 398 399 $this->fs->chmod($to . $filename, 0644); 400 if (!$this->tc_file_system_move($from . $filename, $to . $filename, true, FS_CHMOD_FILE)) { 401 return true; 402 } 403 } 404 if ($action['multicall_exit'] == true) { 405 if(is_local_sync_timeout_cut()){ 406 die(json_encode([ 407 'success' => true, 408 'sync_sub_action' => 'tc_file_system_move_dir', 409 'sync_current_action' => $this->get_option('sync_current_action'), 410 'requires_next_call' => true 411 ])); 412 } 413 } 414 } elseif ('d' == $fileinfo['type']) { 415 // local_sync_log($filename, "----moving----dirname--------"); 416 417 if (!$this->fs->is_dir($to . $filename)) { 418 if (!$this->fs->mkdir($to . $filename, FS_CHMOD_DIR)) { 419 420 local_sync_log($filename, "----moving----false----mkdir----"); 421 422 return true; 423 } 424 } 425 $result = $this->tc_file_system_move_dir($from . $filename, $to . $filename, $action); 426 if (!$result) { 427 428 local_sync_log($filename, "----moving----false----recdir----"); 429 430 return true; 431 } 432 } 433 } 434 return true; 435 } 436 374 437 public function tc_file_system_copy($source, $destination, $overwrite = false, $mode = 0644) { 375 438 $this->init_fs(); … … 383 446 } 384 447 448 public function tc_file_system_move($source, $destination, $overwrite = false, $mode = 0644) { 449 if(empty($this->backup_dir)){ 450 $this->backup_dir = rtrim($this->get_backup_dir(), '/'); 451 } 452 453 $is_file_to_be_skipped = false; 454 foreach($this->files_to_be_skipped_during_full_copy as $vv){ 455 if(stripos($source, $this->backup_dir . '/' . $vv) !== false){ 456 $is_file_to_be_skipped = true; 457 break; 458 } 459 } 460 461 if($is_file_to_be_skipped){ 462 return true; 463 } 464 465 if(stripos($source, $this->backup_dir . '/' . 'wp-config.php' !== false)){ 466 $current_sync_type = $this->get_option('sync_type_db_or_files'); 467 if(!empty($current_sync_type) && $current_sync_type == 'files_alone'){ 468 return true; 469 } 470 } 471 472 local_sync_manual_debug('', 'during_moving_files', 500); 473 474 $this->init_fs(); 475 476 $copy_result = $this->fs->move($source, $destination, $overwrite); 477 478 if (!$copy_result && !$overwrite) { 479 return true; 480 } 481 482 $copy_result = true; 483 484 return $copy_result; 485 } 385 486 public function remove_garbage_files($options = array('is_restore' => false), $hard_reset = false) { 386 487 try { … … 534 635 $settings = $this->get_user_excluded_files_more_than_size(); 535 636 536 local_sync_log($settings, "--------get_user_excluded_files_more_than_size_for_echo--------");537 637 538 638 $yes = !empty($settings['status']) ? 'checked' : ''; … … 630 730 'start_file_list_preparation' => 'Preparing files list of the live site...', 631 731 'import_local_file_list_dump' => 'Import this site\'s files list on the live site...', 632 'process_file_list_difference' => 'Calculating modified files...', 633 'zip_creation' => 'Creating full zip of the live site...', 634 'zip_download' => 'Downloading the live site zip...', 635 'initiate_zip_extract' => 'Initiating live site zip extact...', 636 'continue_extract_from_bridge' => 'Extracting live zip...', 732 'process_file_list_difference' => 'Finding modified files...', 733 'send_batch_download_requests' => 'Downloading modified files...', 734 'copy_files_from_bridge' => 'Copying Modified Files...', 637 735 'prepare_delete_list_table' => 'Preparing the list of files to be deleted...', 638 736 'db_dump_restore' => 'Restoring the DB...', … … 644 742 'header' => 'Pulling from Live Site ', 645 743 'start_db_dump' => 'Preparing DB dump of the live site...', 646 'zip_creation' => 'Creating zip of the live site DB dump...', 647 'zip_download' => 'Downloading the live site zip...', 648 'initiate_zip_extract' => 'Initiating live site zip extact...', 649 'continue_extract_from_bridge' => 'Extracting live zip...', 744 'send_batch_download_requests' => 'Downloading DB dump...', 745 'copy_files_from_bridge' => 'Copying DB dump file...', 650 746 'db_dump_restore' => 'Restoring the DB...', 651 747 ); … … 658 754 'start_file_list_preparation' => 'Preparing files list of the live site...', 659 755 'import_local_file_list_dump' => 'Import this site\'s files list on the live site...', 660 'process_file_list_difference' => 'Calculating modified files...', 661 'zip_creation' => 'Creating full zip of the live site...', 662 'zip_download' => 'Downloading the live site zip...', 663 'initiate_zip_extract' => 'Initiating live site zip extact...', 664 'continue_extract_from_bridge' => 'Extracting live zip...', 756 'process_file_list_difference' => 'Finding modified files...', 757 'send_batch_download_requests' => 'Downloading modified files...', 758 'copy_files_from_bridge' => 'Copying Modified Files...', 665 759 'prepare_delete_list_table' => 'Preparing the list of files to be deleted...', 666 760 'delete_files_during_restore' => 'Deleting the selected files...', … … 690 784 'start_file_list_preparation' => 'Preparing files list of this site...', 691 785 'import_local_file_list_dump' => 'Import live site\'s files list on this site...', 692 'process_file_list_difference' => 'Calculating modified files...', 693 'zip_creation' => 'Creating full zip of this site...', 694 'zip_upload' => 'Uploading this site zip...', 695 'initiate_zip_extract' => 'Initiating this site zip extact...', 696 'continue_extract_from_bridge' => 'Extracting this site zip on the live site...', 786 'process_file_list_difference' => 'Finding modified files...', 787 'batch_upload_files' => 'Uploading modified files...', 788 'copy_files_from_live_bridge' => 'Copying modified files...', 697 789 'prepare_delete_list_table' => 'Preparing the list of files to be deleted...', 698 790 'db_dump_restore' => 'Restoring the DB...', … … 704 796 'header' => 'Pushing to Live Site ', 705 797 'start_db_dump' => 'Preparing DB dump of this site...', 706 'zip_creation' => 'Creating zip of this site DB dump...', 707 'zip_upload' => 'Uploading this site zip...', 708 'initiate_zip_extract' => 'Initiating this site zip extact...', 709 'continue_extract_from_bridge' => 'Extracting this site zip on the live site...', 798 'batch_upload_files' => 'Uploading DB dump...', 799 'copy_files_from_live_bridge' => 'Copying DB dump file...', 710 800 'db_dump_restore' => 'Restoring the DB...', 711 801 ); … … 718 808 'start_file_list_preparation' => 'Preparing files list of this site...', 719 809 'import_local_file_list_dump' => 'Import live site\'s files list on this site...', 720 'process_file_list_difference' => 'Calculating modified files...', 721 'zip_creation' => 'Creating full zip of this site...', 722 'zip_upload' => 'Uploading this site zip...', 723 'initiate_zip_extract' => 'Initiating this site zip extact...', 724 'continue_extract_from_bridge' => 'Extracting this site zip on the live site...', 810 'process_file_list_difference' => 'Finding modified files...', 811 'batch_upload_files' => 'Uploading modified files...', 812 'copy_files_from_live_bridge' => 'Copying modified files...', 725 813 'prepare_delete_list_table' => 'Preparing the list of files to be deleted...', 726 814 'delete_files_during_restore' => 'Deleting the selected files...', -
local-sync/trunk/includes/class-local-sync.php
r2248180 r2749602 114 114 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-local-sync-restore-op.php'; 115 115 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-local-sync-replace-db-links.php'; 116 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-local-sync-batch-upload.php'; 117 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-local-sync-batch-download.php'; 116 118 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'local-sync-bridge/wp-modified-functions.php'; 117 119 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'local-sync-bridge/class-local-sync-file-system.php'; … … 174 176 $plugin_admin->update_1_0_1_handle(); 175 177 $plugin_admin->update_1_0_2_handle(); 178 $plugin_admin->update_1_1_0_handle(); 176 179 177 180 $plugin_admin->check_db_upgrade(); -
local-sync/trunk/local-sync-bridge/class-local-sync-file-system.php
r2519732 r2749602 28 28 'timeout' => 60, 29 29 'redirection' => 5, 30 ' httpversion' => '1.0',30 'sslverify' => false, 31 31 'blocking' => true, 32 32 'headers' => array( … … 304 304 'timeout' => 30, 305 305 'redirection' => 5, 306 ' httpversion' => '1.0',306 'sslverify' => false, 307 307 'blocking' => true, 308 308 'headers' => array( … … 329 329 return false; 330 330 } 331 local_sync_log($file, "----multi_call_upload_using_curl----file--------"); 331 332 332 333 if(!file_exists($file)){ … … 384 385 $upload_action = 'handle_upload_file'; 385 386 387 // exit; 386 388 if( $file_list_or_full == 'full' ){ 387 389 $upload_action = 'handle_upload_zip_file'; … … 480 482 $uploadResponseHeaders[] = "HTTP/1.1 ".$info['http_code']." SOMETHING"; 481 483 $uploadResponseHeaders[] = "Content-Type: ".$info['content_type']; 482 483 484 return $currentResult; 484 485 } 486 487 public function single_big_file_upload_using_curl($URL, $file_obj, &$uploadResponseHeaders, $prev_uploaded_size = 0, $wpContentURL= false, $file_list_or_full = 'full'){ 488 if (!function_exists('curl_init') || !function_exists('curl_exec')){ 489 return false; 490 } 491 492 $file = $file_obj->file_full_path; 493 494 local_sync_log($file, "----single_big_file_upload_using_curl----file--------"); 495 496 if(empty($prev_uploaded_size)){ 497 $fp = fopen ($file, 'rb'); 498 } else{ 499 $fp = fopen ($file, 'rb'); 500 fseek($fp, $prev_uploaded_size); 501 } 502 503 if(!$fp){ 504 $this->last_error = "Could not open zip file for upload ($file)"; 505 506 return false; 507 } 508 509 $isBreak = false; 510 $isMultiPart = false; 511 512 $total_file_size = filesize($file); 513 514 $startRange = (empty($prev_uploaded_size)) ? 0 : $prev_uploaded_size; 515 516 $newEndRange = $startRange + $this->UPLOAD_CHUNK_SIZE; 517 $endRange = ($newEndRange > $total_file_size) ? $total_file_size : $newEndRange; 518 519 status_losy("Uploading Big file ".$file, $success=true, $return=false); 520 status_losy("Total size of the file ".$total_file_size, $success=true, $return=false); 521 status_losy("Upload start from ".$startRange, $success=true, $return=false); 522 523 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 524 525 $false_break = false; 526 527 do{ 528 529 //read from file 530 $currentOffest = (empty($startRange)) ? 0 : $startRange; 531 @fseek($fp, $currentOffest, SEEK_SET); 532 $file_data = @fread($fp, $this->UPLOAD_CHUNK_SIZE); 533 534 $gz_encoded_file_data = gzcompress($file_data, 9); 535 $file_data_enc = bin2hex($gz_encoded_file_data); 536 537 $upload_action = 'handle_upload_single_big_file'; 538 539 $post_arr = array( 540 'is_local_sync' => true, 541 'start_range' => $startRange, 542 'end_range' => $endRange, 543 'action' => $upload_action, 544 'file_name' => $file_obj->add_as, 545 'file_data' => $file_data_enc, 546 'current_sync_unique_id' => $current_sync_unique_id, 547 ); 548 549 $post_arr['prod_key_random_id'] = $this->local_sync_options->get_option('prod_key_random_id'); 550 551 $post_arr_copy = array( 552 'is_local_sync' => true, 553 'file_name' => $file_obj->add_as, 554 'start_range' => $startRange, 555 'end_range' => $endRange, 556 'action' => $upload_action, 557 ); 558 559 local_sync_log($post_arr_copy, "--------post_arr_copy--------"); 560 561 $callResponse = $this->wp_remote_post_local_sync_for_upload($URL, $post_arr); 562 563 $info = array( 564 'http_code' => 200, 565 'content_type' => 'something' 566 ); 567 568 // local_sync_log($info, "--------info--------"); 569 570 if( !empty($callResponse['success']) ){ 571 572 // local_sync_log('', "--------http_code is 206 ya--------"); 573 574 if(!empty($callResponse['file_size']) && $callResponse['file_size'] > $total_file_size){ 575 $this->last_error = 'Upload process corrupted.'; 576 577 $isBreak = true; 578 $false_break = true; 579 } 580 581 //multiCallDownloadUsingCURL($URL, $file, $uploadResponseHeaders); 582 $isMultiPart = true; 583 $startRange = ftell($fp); 584 // $startRange = $callResponse['file_size']; 585 $endRange = ($startRange + $this->UPLOAD_CHUNK_SIZE); 586 if($endRange >= $total_file_size){ 587 $endRange = $total_file_size; 588 } 589 if($startRange == $endRange){ 590 $isMultiPart = false; 591 } 592 } else { 593 local_sync_log($callResponse, "--------multicall upload response error--------"); 594 $this->last_error = 'Upload process failed.'; 595 596 $isBreak = true; 597 $false_break = true; 598 } 599 600 $rangeVariable = $startRange . '-' . $endRange; 601 if(!$isBreak){ 602 $isBreak = is_local_sync_timeout_cut(); 603 } 604 } 605 while(!$isBreak && $isMultiPart); 606 607 fclose($fp); 608 609 if($false_break){ 610 611 return false; 612 } 613 614 $currentResult = array(); 615 616 $currentResult['file'] = $file; 617 $currentResult['startRange'] = $startRange; 618 $currentResult['endRange'] = $endRange; 619 620 status_losy("File Uploaded size:".$endRange, $success=true, $return=false); 621 622 if($isBreak == true){ 623 $currentResult['status'] = 'partiallyCompleted'; 624 $currentResult['is_upload_multi_call'] = true; 625 } 626 627 if(!$isMultiPart){ 628 $currentResult['is_upload_multi_call'] = false; 629 } 630 631 $uploadResponseHeaders[] = "HTTP/1.1 ".$info['http_code']." SOMETHING"; 632 $uploadResponseHeaders[] = "Content-Type: ".$info['content_type']; 633 634 return $currentResult; 635 } 636 637 public function batch_files_upload_using_curl($URL, $files_this_batch, &$uploadResponseHeaders, $prevResult = array(), $wpContentURL= false, $file_list_or_full = 'full'){ 638 if (!function_exists('curl_init') || !function_exists('curl_exec')){ 639 return false; 640 } 641 642 local_sync_log(count($files_this_batch), "----batch_upload_using_curl----file--------"); 643 644 status_losy("Uploading batch of files "); 645 646 $this_files_data_to_upload = []; 647 648 foreach($files_this_batch as $vv){ 649 650 // $file = '/Applications/MAMP/htdocs/wp-site/vid-2.mp4'; 651 652 $file = $vv->file_full_path; 653 $fp = fopen ($file, 'rb'); 654 $this_start_range = 0; 655 fseek($fp, $this_start_range); 656 657 if(!$fp){ 658 status_losy("Not able to open file for uploading ".$file, $success=true, $return=false); 659 } 660 661 $isBreak = false; 662 $isMultiPart = false; 663 664 $startRange = 0; 665 $total_file_size = filesize($file); 666 $endRange = $total_file_size; 667 668 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 669 670 $false_break = false; 671 672 //read from file 673 $currentOffest = (empty($startRange)) ? 0 : $startRange; 674 @fseek($fp, $currentOffest, SEEK_SET); 675 $file_data = @fread($fp, $this->UPLOAD_CHUNK_SIZE); 676 677 $gz_encoded_file_data = gzcompress($file_data, 9); 678 $file_data_enc = bin2hex($gz_encoded_file_data); 679 680 $file_name_base_64 = base64_encode($vv->add_as); 681 $this_files_data_to_upload[$file_name_base_64] = $file_data_enc; 682 683 fclose($fp); 684 685 if($false_break){ 686 687 return false; 688 } 689 690 } 691 692 $upload_action = 'handle_batch_upload_files'; 693 694 $post_arr = array( 695 'is_local_sync' => true, 696 'start_range' => 1, 697 'end_range' => 1, 698 'action' => $upload_action, 699 'files_data' => $this_files_data_to_upload, 700 'current_sync_unique_id' => $current_sync_unique_id, 701 ); 702 703 $post_arr['prod_key_random_id'] = $this->local_sync_options->get_option('prod_key_random_id'); 704 705 $post_arr_copy = array( 706 'is_local_sync' => true, 707 'start_range' => 1, 708 'end_range' => 1, 709 'action' => $upload_action, 710 ); 711 712 local_sync_log($post_arr_copy, "--------post_arr_copy--------"); 713 714 $callResponse = $this->wp_remote_post_local_sync_for_upload($URL, $post_arr); 715 716 $info = array( 717 'http_code' => 200, 718 'content_type' => 'something' 719 ); 720 721 // local_sync_log($info, "--------info--------"); 722 723 if( !empty($callResponse['success']) ){ 724 725 // local_sync_log('', "--------http_code is 206 ya--------"); 726 727 if(false){ 728 $this->last_error = 'Upload process corrupted.'; 729 730 $isBreak = true; 731 $false_break = true; 732 } 733 734 } else { 735 local_sync_log($callResponse, "--------multicall upload response error--------"); 736 $this->last_error = 'Upload process failed.'; 737 738 $isBreak = true; 739 $false_break = true; 740 } 741 742 $rangeVariable = $startRange . '-' . $endRange; 743 if(!$isBreak){ 744 $isBreak = is_local_sync_timeout_cut(); 745 } 746 747 $currentResult = array(); 748 749 $currentResult['file'] = $file; 750 $currentResult['startRange'] = $startRange; 751 $currentResult['endRange'] = $endRange; 752 753 status_losy("File Uploaded size:".$endRange, $success=true, $return=false); 754 755 if($isBreak == true){ 756 $currentResult['status'] = 'partiallyCompleted'; 757 $currentResult['is_upload_multi_call'] = true; 758 } 759 760 if(!$isMultiPart){ 761 $currentResult['is_upload_multi_call'] = false; 762 } 763 764 $uploadResponseHeaders[] = "HTTP/1.1 ".$info['http_code']." SOMETHING"; 765 $uploadResponseHeaders[] = "Content-Type: ".$info['content_type']; 766 767 return $currentResult; 768 } 769 770 public function batch_files_download_using_curl($URL, &$uploadResponseHeaders, $wpContentURL= false, $file_list_or_full = 'full'){ 771 if (!function_exists('curl_init') || !function_exists('curl_exec')){ 772 return false; 773 } 774 775 local_sync_log($files_this_batch, "----batch_files_download_using_curl----file--------"); 776 777 status_losy("Downloading batch of files "); 778 779 $this_files_data_to_upload = []; 780 781 foreach($files_this_batch as $vv){ 782 783 // $file = '/Applications/MAMP/htdocs/wp-site/vid-2.mp4'; 784 785 $file = $vv->file_full_path; 786 $fp = fopen ($file, 'rb'); 787 $this_start_range = 0; 788 fseek($fp, $this_start_range); 789 790 if(!$fp){ 791 status_losy("Not able to open file for uploading ".$file, $success=true, $return=false); 792 } 793 794 $isBreak = false; 795 $isMultiPart = false; 796 797 $startRange = 0; 798 $total_file_size = filesize($file); 799 $endRange = $total_file_size; 800 801 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 802 803 $false_break = false; 804 805 //read from file 806 $currentOffest = (empty($startRange)) ? 0 : $startRange; 807 @fseek($fp, $currentOffest, SEEK_SET); 808 $file_data = @fread($fp, $this->UPLOAD_CHUNK_SIZE); 809 810 $gz_encoded_file_data = gzcompress($file_data, 9); 811 $file_data_enc = bin2hex($gz_encoded_file_data); 812 813 $file_name_base_64 = base64_encode($vv->add_as); 814 $this_files_data_to_upload[$file_name_base_64] = $file_data_enc; 815 816 fclose($fp); 817 818 if($false_break){ 819 820 return false; 821 } 822 823 } 824 825 $upload_action = 'handle_batch_upload_files'; 826 827 $post_arr = array( 828 'is_local_sync' => true, 829 'start_range' => 1, 830 'end_range' => 1, 831 'action' => $upload_action, 832 'files_data' => $this_files_data_to_upload, 833 'current_sync_unique_id' => $current_sync_unique_id, 834 ); 835 836 $post_arr['prod_key_random_id'] = $this->local_sync_options->get_option('prod_key_random_id'); 837 838 $post_arr_copy = array( 839 'is_local_sync' => true, 840 'start_range' => 1, 841 'end_range' => 1, 842 'action' => $upload_action, 843 ); 844 845 local_sync_log($post_arr_copy, "--------post_arr_copy--------"); 846 847 $callResponse = $this->wp_remote_post_local_sync_for_download($URL, $post_arr); 848 849 $info = array( 850 'http_code' => 200, 851 'content_type' => 'something' 852 ); 853 854 // local_sync_log($info, "--------info--------"); 855 856 if( !empty($callResponse['success']) ){ 857 858 // local_sync_log('', "--------http_code is 206 ya--------"); 859 860 if(false){ 861 $this->last_error = 'Upload process corrupted.'; 862 863 $isBreak = true; 864 $false_break = true; 865 } 866 867 } else { 868 local_sync_log($callResponse, "--------multicall upload response error--------"); 869 $this->last_error = 'Upload process failed.'; 870 871 $isBreak = true; 872 $false_break = true; 873 } 874 875 $rangeVariable = $startRange . '-' . $endRange; 876 if(!$isBreak){ 877 $isBreak = is_local_sync_timeout_cut(); 878 } 879 880 $currentResult = array(); 881 882 $currentResult['file'] = $file; 883 $currentResult['startRange'] = $startRange; 884 $currentResult['endRange'] = $endRange; 885 886 status_losy("File Uploaded size:".$endRange, $success=true, $return=false); 887 888 if($isBreak == true){ 889 $currentResult['status'] = 'partiallyCompleted'; 890 $currentResult['is_upload_multi_call'] = true; 891 } 892 893 if(!$isMultiPart){ 894 $currentResult['is_upload_multi_call'] = false; 895 } 896 897 $uploadResponseHeaders[] = "HTTP/1.1 ".$info['http_code']." SOMETHING"; 898 $uploadResponseHeaders[] = "Content-Type: ".$info['content_type']; 899 900 return $currentResult; 901 } 902 903 public function download_files_using_curl($URL){ 904 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 905 906 $upload_action = 'handle_batch_download_files'; 907 908 $post_arr = array( 909 'is_local_sync' => true, 910 'start_range' => 1, 911 'end_range' => 1, 912 'action' => $upload_action, 913 'current_sync_unique_id' => $current_sync_unique_id, 914 ); 915 916 $post_arr['prod_key_random_id'] = $this->local_sync_options->get_option('prod_key_random_id'); 917 918 $post_arr_copy = array( 919 'is_local_sync' => true, 920 'start_range' => 1, 921 'end_range' => 1, 922 'action' => $upload_action, 923 ); 924 925 local_sync_log($post_arr_copy, "--------post_arr_copy--------"); 926 927 $callResponse = $this->wp_remote_post_local_sync_for_download($URL, $post_arr); 928 929 // local_sync_log($callResponse, "--------callResponse---download_files_using_curl-----"); 930 931 // local_sync_log('', "--------exiting by me 5--------"); 932 // exit; 933 934 return $callResponse; 935 } 936 937 public function save_single_batch_file_during_download($URL, &$downloadResponseHeaders, $wpContentURL= false){ 938 if (!function_exists('curl_init') || !function_exists('curl_exec')){ 939 return false; 940 } 941 942 if(!file_exists($file)){ 943 touch($file); 944 } 945 946 if(!file_exists($file)){ 947 948 local_sync_log($file, "--------not able to touch file 22--------"); 949 950 $this->last_error = "Could not touch download file ($file)"; 951 952 return false; 953 } 954 955 if(empty($prevResult['file'])){ 956 $fp = fopen ($file, 'wb'); 957 } else{ 958 $file = $prevResult['file']; 959 $fp = fopen ($file, 'rb+'); 960 fseek($fp, $prevResult['startRange']); 961 } 962 if(!$fp){ 963 $this->last_error = "Could not open download file ($file)"; 964 965 local_sync_log('', "--------Could not open download file--------"); 966 967 return false; 968 } 969 970 $isBreak = false; 971 $isMultiPart = false; 972 973 $startRange = (empty($prevResult['startRange']) && empty($prevResult['file']))? 0 : $prevResult['startRange']; 974 $endRange = (empty($prevResult['endRange']) && empty($prevResult['file']))? $this->DOWNLOAD_CHUNK_SIZE : $prevResult['endRange']; 975 976 status_losy("Downloading file ".$URL, $success=true, $return=false); 977 status_losy("Total size of the file ".$total_file_size, $success=true, $return=false); 978 status_losy("Download start from ".$startRange, $success=true, $return=false); 979 980 do{ 981 local_sync_log('', "--------sleeping during download--------"); 982 983 $info = $this->away_post_call_get_file_data($URL, $fp, $startRange, $endRange, $file); 984 985 if($info['call_again']){ 986 //multiCallDownloadUsingCURL($URL, $file, $downloadResponseHeaders); 987 $isMultiPart = true; 988 $startRange = ftell($fp); 989 $endRange = ($startRange + $this->DOWNLOAD_CHUNK_SIZE); 990 if($endRange >= $total_file_size){ 991 $endRange = $total_file_size; 992 } 993 if($startRange == $endRange){ 994 $isMultiPart = false; 995 } 996 } 997 $rangeVariable = $startRange . '-' . $endRange; 998 $isBreak = is_local_sync_timeout_cut(); 999 } 1000 while(!($isBreak) && $isMultiPart); 1001 1002 fclose($fp); 1003 1004 $currentResult = array(); 1005 1006 $this->initialize_response_array($currentResult); 1007 1008 $currentResult['file'] = $file; 1009 $currentResult['startRange'] = $startRange; 1010 $currentResult['endRange'] = $endRange; 1011 1012 status_losy("File Downloaded size:".$startRange, $success=true, $return=false); 1013 1014 if($isBreak == true){ 1015 $currentResult['status'] = 'partiallyCompleted'; 1016 $currentResult['is_download_multi_call'] = true; 1017 } 1018 1019 if(!$isMultiPart){ 1020 $currentResult['is_download_multi_call'] = false; 1021 } 1022 1023 $downloadResponseHeaders[] = "HTTP/1.1 ".$info['http_code']." SOMETHING"; 1024 $downloadResponseHeaders[] = "Content-Type: ".$info['content_type']; 1025 1026 return $currentResult; 1027 } 485 1028 } -
local-sync/trunk/local-sync-bridge/index.js
r2245393 r2749602 3 3 var USER_SELECTION_FILES_FOR_DELETE = {}; 4 4 var RETRIES_LOCAL_SYNC = 0; 5 var LOCAL_SYNC_AJAX_RUNNING = false; 5 6 6 7 function import_steps_losy(steps_parent){ … … 136 137 137 138 function continue_sync_from_live_losy(){ 139 if(LOCAL_SYNC_AJAX_RUNNING){ 140 141 return; 142 } 143 144 LOCAL_SYNC_AJAX_RUNNING = true; 138 145 var data = { 139 146 'action': 'sync_from_live_site', … … 147 154 148 155 jQuery.post(ajaxurl, data, function(fullResponse) { 156 LOCAL_SYNC_AJAX_RUNNING = false; 149 157 150 158 console.log('continuing sync fullResponse', fullResponse); -
local-sync/trunk/local-sync-bridge/index.php
r2248180 r2749602 134 134 break; 135 135 136 case 'copy_files_from_live_bridge': 137 138 $this->local_sync_options->set_this_step_by_name('start_db_dump', 'done'); //hack 139 $this->local_sync_options->set_this_step_by_name('download_local_file_list_dump', 'done'); //hack 140 $this->local_sync_options->set_this_step_by_name('batch_upload_files', 'done'); //hack 141 142 $this->copy_files_from_live_bridge(); 143 144 break; 145 146 case 'copy_files_from_bridge': 147 148 $this->copy_files_from_live_bridge(); 149 150 break; 136 151 case 'prepare_delete_list_table': 137 152 … … 276 291 277 292 // unlink($single_backup_file); 293 $this->local_sync_options->set_this_current_action_step('done'); 294 295 $this->local_sync_options->set_option('sync_sub_action', 'prepare_delete_list_table'); 296 $this->local_sync_options->set_option('sync_current_action', 'prepare_delete_list_table'); 297 298 $this->local_sync_options->set_this_current_action_step('processing'); 299 300 die_with_ls_signature(array( 301 'success' => true, 302 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 303 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 304 'requires_next_call' => true 305 )); 306 } 307 308 public function copy_files_from_live_bridge() { 309 310 $unzip_dir = ABSPATH; 311 // $unzip_dir = dirname(__FILE__) . '/restore_result'; 312 313 $current_sync_unique_id = $this->local_sync_options->get_option('current_sync_unique_id'); 314 315 $backup_dir = WP_CONTENT_DIR . "/uploads/local_sync/backups/"; 316 317 local_sync_log($backup_dir, "--------backup_dir--------"); 318 319 $move_result = $this->local_sync_options->tc_file_system_move_dir($backup_dir, $unzip_dir); 320 321 local_sync_log($move_result, "--------move_result--------"); 322 323 // if ( !empty($extracted) && !empty($extracted['break']) ) { 324 325 // local_sync_log('', "--------extraction in multicall--------"); 326 327 // $this->local_sync_options->set_option('extract_multi_call_flags_losy', json_encode($extracted)); 328 329 // die_with_ls_signature(array( 330 // 'success' => true, 331 // 'sync_sub_action' => $this->local_sync_options->get_option('sync_sub_action'), 332 // 'sync_current_action' => $this->local_sync_options->get_option('sync_current_action'), 333 // 'requires_next_call' => true 334 // )); 335 // } 336 337 // $this->local_sync_options->remove_tmp_dir(); 338 339 // unlink($single_backup_file); 340 341 // local_sync_log($move_result, "--------exciting by me----after files copy----"); 342 // local_sync_log($move_result, "--------exciting by me--------"); 343 344 // exit; 278 345 279 346 $this->local_sync_options->set_this_current_action_step('done'); -
local-sync/trunk/local-sync-constants.php
r2519732 r2749602 75 75 76 76 public function versions(){ 77 $this->define( 'LOCAL_SYNC_VERSION', '1. 0.5' );77 $this->define( 'LOCAL_SYNC_VERSION', '1.1.0' ); 78 78 $this->define( 'LOCAL_SYNC_DATABASE_VERSION', '1.0' ); 79 79 } -
local-sync/trunk/local-sync-generic-functions.php
r2245393 r2749602 400 400 $msg['site_type'] = $local_sync_options->get_option('site_type'); 401 401 402 local_sync_log($msg, "--------msg--------");402 // local_sync_log($msg, "--------msg--------"); 403 403 404 404 reset_last_request_local_sync(); -
local-sync/trunk/local-sync.php
r2519732 r2749602 2 2 3 3 /** 4 * Local Sync4 * WP Duplicate - WordPress Migration Plugin 5 5 * 6 6 * @link https://revmakx.com … … 9 9 * 10 10 * @wordpress-plugin 11 * Plugin Name: Local Sync11 * Plugin Name: WP Duplicate - WordPress Migration Plugin 12 12 * Plugin URI: https://localsync.io 13 * Description: Clone live site to the local site and vice versa.14 * Version: 1. 0.513 * Description: Easily migrate your WordPress Site from one host to another. 14 * Version: 1.1.0 15 15 * Author: Revmakx 16 16 * Author URI: https://revmakx.com
Note: See TracChangeset
for help on using the changeset viewer.