InfiniteWP Client - Version 1.2.2

Version Description

  • Improvement: Minor improvements for restore/clone
  • Fix: Warning errors and bug fixes for restore/clone
Download this release

Release Info

Developer infinitewp
Plugin Icon 128x128 InfiniteWP Client
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

Files changed (3) hide show
  1. backup.class.php +23 -14
  2. init.php +2 -2
  3. readme.txt +4 -0
backup.class.php CHANGED
@@ -1202,7 +1202,7 @@ function delete_task_now($task_name){
1202
function iwp_mmb_direct_to_any_copy_dir($from, $to, $skip_list = array() ) {//$from => direct file system, $to => automatic filesystem
1203
global $wp_filesystem;
1204
1205
- $wp_temp_direct = new WP_Filesystem_Direct();
1206
1207
1208
$dirlist = $wp_temp_direct->dirlist($from);
@@ -1399,8 +1399,18 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1399
1400
// do process
1401
$temp_dir = get_temp_dir();
1402
- $new_temp_folder = trailingslashit($temp_dir).'IWP_Restore_temp_dir_kjhdsjfkhsdkhfksjhdfkjh/';//should be random
1403
- mkdir($new_temp_folder, 0755);// new folder should be empty
1404
1405
//echo '<pre>$new_temp_folder:'; var_dump($new_temp_folder); echo '</pre>';
1406
@@ -1424,10 +1434,10 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1424
/////////////////// dev ////////////////////////
1425
1426
if ($backup_file && file_exists($backup_file)) {
1427
- if ($overwrite) {
1428
//Keep old db credentials before overwrite
1429
if (!$wp_filesystem->copy($remote_abspath . 'wp-config.php', $remote_abspath . 'iwp-temp-wp-config.php', true)) {
1430
- @unlink($backup_file);
1431
return array(
1432
'error' => 'Error creating wp-config. Please check your write permissions.'
1433
);
@@ -1486,9 +1496,9 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1486
}
1487
$this->wpdb_reconnect();
1488
1489
- /*if ($unlink_file) {
1490
@unlink($backup_file);
1491
- }*/
1492
1493
if (!$result) {
1494
return array(
@@ -1510,7 +1520,7 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1510
1511
} else {
1512
return array(
1513
- 'error' => 'Error while restoring. The WP root directory is not writable. Set write permission(755 or 777).'
1514
);
1515
}
1516
@@ -1519,8 +1529,8 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1519
$copy_result = $this->iwp_mmb_direct_to_any_copy_dir($new_temp_folder, $remote_abspath);
1520
1521
if ( is_wp_error($copy_result) ){
1522
- $wp_temp_direct2 = WP_Filesystem_Direct();
1523
- $wp_temp_direct2->delete($new_temp_folder, 2);
1524
return $copy_result;
1525
}
1526
@@ -1530,7 +1540,7 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1530
1531
1532
//Replace options and content urls
1533
- if ($overwrite) {//fresh WP package to existing site
1534
//Get New Table prefix
1535
$new_table_prefix = trim($this->get_table_prefix());
1536
//Retrieve old wp_config
@@ -1647,8 +1657,8 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1647
}
1648
1649
//clear the temp directory
1650
- $wp_temp_direct2 = new WP_Filesystem_Direct();
1651
- $wp_temp_direct2->delete($new_temp_folder, 2);
1652
1653
return !empty($new_user) ? $new_user : true ;
1654
}
@@ -1718,7 +1728,6 @@ function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $
1718
}
1719
}
1720
1721
- @unlink($file_name);
1722
return true;
1723
}
1724
1202
function iwp_mmb_direct_to_any_copy_dir($from, $to, $skip_list = array() ) {//$from => direct file system, $to => automatic filesystem
1203
global $wp_filesystem;
1204
1205
+ $wp_temp_direct = new WP_Filesystem_Direct('');
1206
1207
1208
$dirlist = $wp_temp_direct->dirlist($from);
1399
1400
// do process
1401
$temp_dir = get_temp_dir();
1402
+ $new_temp_folder = untrailingslashit($temp_dir);
1403
+ $temp_uniq = md5(microtime(1));//should be random
1404
+ while (is_dir($new_temp_folder .'/'. $temp_uniq )) {
1405
+ $temp_uniq = md5(microtime(1));
1406
+ }
1407
+ $new_temp_folder = trailingslashit($new_temp_folder .'/'. $temp_uniq);
1408
+ $is_dir_created = mkdir($new_temp_folder);// new folder should be empty
1409
+ if(!$is_dir_created){
1410
+ return array(
1411
+ 'error' => 'Unable to create a temporary directory.'
1412
+ );
1413
+ }
1414
1415
//echo '<pre>$new_temp_folder:'; var_dump($new_temp_folder); echo '</pre>';
1416
1434
/////////////////// dev ////////////////////////
1435
1436
if ($backup_file && file_exists($backup_file)) {
1437
+ if ($overwrite) {//clone only fresh or existing to existing
1438
//Keep old db credentials before overwrite
1439
if (!$wp_filesystem->copy($remote_abspath . 'wp-config.php', $remote_abspath . 'iwp-temp-wp-config.php', true)) {
1440
+ if($unlink_file) @unlink($backup_file);
1441
return array(
1442
'error' => 'Error creating wp-config. Please check your write permissions.'
1443
);
1496
}
1497
$this->wpdb_reconnect();
1498
1499
+ if ($unlink_file) {
1500
@unlink($backup_file);
1501
+ }
1502
1503
if (!$result) {
1504
return array(
1520
1521
} else {
1522
return array(
1523
+ 'error' => 'Backup file not found.'
1524
);
1525
}
1526
1529
$copy_result = $this->iwp_mmb_direct_to_any_copy_dir($new_temp_folder, $remote_abspath);
1530
1531
if ( is_wp_error($copy_result) ){
1532
+ $wp_temp_direct2 = new WP_Filesystem_Direct('');
1533
+ $wp_temp_direct2->delete($new_temp_folder, true);
1534
return $copy_result;
1535
}
1536
1540
1541
1542
//Replace options and content urls
1543
+ if ($overwrite) {//fresh WP package or existing to existing site
1544
//Get New Table prefix
1545
$new_table_prefix = trim($this->get_table_prefix());
1546
//Retrieve old wp_config
1657
}
1658
1659
//clear the temp directory
1660
+ $wp_temp_direct2 = new WP_Filesystem_Direct('');
1661
+ $wp_temp_direct2->delete($new_temp_folder, true);
1662
1663
return !empty($new_user) ? $new_user : true ;
1664
}
1728
}
1729
}
1730
1731
return true;
1732
}
1733
init.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: InfiniteWP - Client
4
Plugin URI: http://infinitewp.com/
5
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
6
Author: Revmakx
7
- Version: 1.2.1
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
@@ -26,7 +26,7 @@ Author URI: http://www.revmakx.com
26
**************************************************************/
27
28
if(!defined('IWP_MMB_CLIENT_VERSION'))
29
- define('IWP_MMB_CLIENT_VERSION', '1.2.1');
30
31
32
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
4
Plugin URI: http://infinitewp.com/
5
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
6
Author: Revmakx
7
+ Version: 1.2.2
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
26
**************************************************************/
27
28
if(!defined('IWP_MMB_CLIENT_VERSION'))
29
+ define('IWP_MMB_CLIENT_VERSION', '1.2.2');
30
31
32
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
readme.txt CHANGED
@@ -48,6 +48,10 @@ Credits: [Vladimir Prelovac](http://prelovac.com/vladimir) for his worker plugin
48
49
== Changelog ==
50
51
= 1.2.1 =
52
* Fix: Fatal error calling prefix method while cloning a fresh package to existing site
53
48
49
== Changelog ==
50
51
+ = 1.2.2 =
52
+ * Improvement: Minor improvements for restore/clone
53
+ * Fix: Warning errors and bug fixes for restore/clone
54
+
55
= 1.2.1 =
56
* Fix: Fatal error calling prefix method while cloning a fresh package to existing site
57