InfiniteWP Client - Version 1.8.5

Version Description

  • Sep 4th 2018 =
  • Improvement: Multisite support for broken link checker plugin.
  • Improvement: MySQL DB dump process is improved in multicall and single call backup.
  • Improvement: Phoenix method now doesn't wait for the wp-cron to start the backup.
  • Improvement: Debug log added for few errors.
  • Improvement: If your server gets timed out, the files which are already backed up will be skipped while resume/retrying it(Phoenix backups).
  • Improvement: Phoenix Backups keep running in the background even when it's stopped from your admin panel.
  • Improvement: Phoenix Backup files are not deleted when we kill a backup process manually.
  • Fix: Multicall backup files S3 bucket Global users permission.
  • Fix: Broken link checker plugin unlink and mark not as broken action throws a fatal error.
  • Fix: Phoenix backup files on your server is removed when you immediately backup your site using the single/multicall method after a phoenix backup.
  • Fix: Piwik warning.
  • Fix: A few PHP warnings are fixed.
  • Fix: FTP backup keeps running if slash is added at the end of the FTP path.
Download this release

Release Info

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

Code changes from version 1.8.3 to 1.8.5

addons/brokenlinks/brokenlinks.class.php CHANGED
@@ -93,7 +93,7 @@ class IWP_MMB_BLC extends IWP_MMB_Core
93
{
94
if($this->_checkBLC()){
95
global $wpdb;
96
- $sql = "SELECT l.*,i.container_id,i.link_text FROM (SELECT link_id,url,redirect_count,http_code,status_text,broken,false_positive,dismissed FROM ".$wpdb->base_prefix."blc_links) AS l INNER JOIN (SELECT link_id,container_id,link_text FROM ".$wpdb->base_prefix."blc_instances) AS i ON l.link_id=i.link_id";
97
$success = $wpdb->get_results($sql);
98
if(!empty($success)){
99
foreach ($success as $link) {
@@ -147,6 +147,7 @@ class IWP_MMB_BLC extends IWP_MMB_Core
147
$link->broken = false;
148
$link->false_positive = true;
149
$link->last_check_attempt = time();
150
$link->log = __("This link was manually marked as working by the user.", 'broken-link-checker');
151
152
//Save the changes
@@ -176,6 +177,7 @@ class IWP_MMB_BLC extends IWP_MMB_Core
176
return "Oops, I can't find the link ". intval($params['linkID']) ;
177
}
178
$link->dismissed = $dismiss;
179
if ( $link->save() ){
180
$rez = array('old_link_id'=>$params['linkID'],'linkType'=>$params['linkType'],'dismissvalue_set'=>1);
181
} else {
93
{
94
if($this->_checkBLC()){
95
global $wpdb;
96
+ $sql = "SELECT l.*,i.container_id,i.link_text FROM (SELECT link_id,url,redirect_count,http_code,status_text,broken,false_positive,dismissed FROM ".$wpdb->prefix."blc_links) AS l INNER JOIN (SELECT link_id,container_id,link_text FROM ".$wpdb->prefix."blc_instances) AS i ON l.link_id=i.link_id";
97
$success = $wpdb->get_results($sql);
98
if(!empty($success)){
99
foreach ($success as $link) {
147
$link->broken = false;
148
$link->false_positive = true;
149
$link->last_check_attempt = time();
150
+ $link->isOptionLinkChanged = true;
151
$link->log = __("This link was manually marked as working by the user.", 'broken-link-checker');
152
153
//Save the changes
177
return "Oops, I can't find the link ". intval($params['linkID']) ;
178
}
179
$link->dismissed = $dismiss;
180
+ $link->isOptionLinkChanged = true;
181
if ( $link->save() ){
182
$rez = array('old_link_id'=>$params['linkID'],'linkType'=>$params['linkType'],'dismissvalue_set'=>1);
183
} else {
backup.class.multicall.php CHANGED
@@ -208,10 +208,10 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
208
209
if(!empty($params))
210
{
211
- $disk_space = iwp_mmb_check_disk_space();
212
- if ($disk_space != false) {
213
- iwp_mmb_response(array('error' => 'Your disk space is very low available space: '.$disk_space.'MB'), false);
214
- }
215
initialize_manual_debug();
216
$this->cleanup();
217
$initialize_result = refresh_iwp_files_db();
@@ -411,7 +411,7 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
411
$temp_sql_file_name = $file.".sql";
412
$file = $db_folder . $temp_sql_file_name;
413
global $wpdb;
414
- $paths = $this->check_mysql_paths();
415
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
416
//$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
417
$command0 = $wpdb->get_col('SHOW TABLES LIKE "'.$wpdb->base_prefix.'%"');
@@ -445,6 +445,7 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
445
//$this->statusLog($historyID, "backupDB", true, "completed", $params, true);
446
//$this->statusLog($historyID, array('stage' => $backupStage, 'status' => 'completed', 'statusMsg' => 'backupDBCompleted'));
447
$db_final_response['success']['status'] = 'partiallyCompleted';
448
$this->statusLog($historyID, array('stage' => $backupStage, 'status' => 'completed', 'statusMsg' => 'backupDBCompleted','nextFunc' => 'backupDBZip', 'responseParams' => $db_final_response['success']));
449
unset($db_final_response['success']['response_data']);
450
//to continue in the same call
@@ -494,6 +495,53 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
494
495
return $paths;
496
}
497
498
function backup_uploads($historyID)
499
{
@@ -613,14 +661,14 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
613
{
614
manual_debug('', 'backupDBStart');
615
$this->statusLog($historyID, array('stage' => 'backupDB', 'status' => 'processing', 'statusMsg' => 'backupDBInitiated'));
616
-
617
if(file_exists(IWP_DB_DIR) && is_dir(IWP_DB_DIR))
618
{
619
$this->statusLog($historyID, array('stage' => 'verification', 'status' => 'processing', 'statusMsg' => 'Directorywritable'));
620
}
621
else
622
{
623
- $mkdir = @mkdir(IWP_DB_DIR, 0755, true);
624
if(!$mkdir){
625
return $this->statusLog($historyID, array('stage' => 'verification', 'status' => 'error', 'statusMsg' => 'Error creating database backup folder (' . IWP_DB_DIR . '). Make sure you have corrrect write permissions.', 'statusCode' => 'error_creating_database_backup_folder'));
626
}
@@ -1421,10 +1469,13 @@ class IWP_MMB_Backup_Multicall extends IWP_MMB_Core
1421
$file_size_in_this_call = (iwp_mmb_get_file_size($backup_file)/1024/1024) - $initialFileSize;
1422
echo "<br>iwpmsg file size in this call".$file_size_in_this_call;
1423
echo "<br>iwpmsg Time taken in this call ".$fileNextTimeTaken."<br>";
1424
- if(($file_size_in_this_call == 0) && !(is_array($returnArr) && !empty($returnArr['error'])) && !(is_array($returnArr) && !empty($returnArr['isGetFileList'])))
1425
{
1426
return array( 'error' => 'Zip-error: Unable to zip', 'error_code' => 'zip_error_unable_to_zip');
1427
}
1428
return $returnArr;
1429
}
1430
else
@@ -3999,7 +4050,7 @@ function ftp_backup($historyID,$args = '')
3999
$backup_file_base_name = basename($backup_file);
4000
}
4001
4002
- $upload = $this -> ftp_multi_upload($conn_id, $ftp_remote_folder . '/' . basename($backup_file_base_name), $backup_file, FTP_BINARY, $historyID, $tempArgs, $current_file_num);
4003
4004
4005
if ($upload === false) { //Try ascii
@@ -4082,6 +4133,7 @@ function ftp_backup($historyID,$args = '')
4082
if(!$file_size)
4083
$file_size = 0;
4084
4085
//read the parts local file , if it is a second call start reading the file from the left out part which is at the offset of the remote file's filesize.
4086
$fp = fopen($backup_file, 'r');
4087
fseek($fp,$file_size);
@@ -4135,6 +4187,9 @@ function ftp_backup($historyID,$args = '')
4135
{
4136
@unlink($backup_file);
4137
} */
4138
return $resArray;
4139
}
4140
else
@@ -6163,8 +6218,8 @@ function ftp_backup($historyID,$args = '')
6163
}
6164
$deleted = array();
6165
6166
if (is_array($files) && count($files)) {
6167
- $results = array();
6168
$cloudFailedBackup = array();
6169
$failedBackupHisID = array();
6170
if (!empty($tasks)) {
@@ -6198,9 +6253,35 @@ function ftp_backup($historyID,$args = '')
6198
}
6199
}
6200
}
6201
$num_deleted = 0;
6202
foreach ($files as $file) {
6203
- if ((!in_array($file, $results) || in_array($file, $failedBackupHisID)) && basename($file) != 'index.php') {
6204
@unlink($file);
6205
// $deleted[] = basename($file);
6206
$deleted[] = $file;
208
209
if(!empty($params))
210
{
211
+ // $disk_space = iwp_mmb_check_disk_space();
212
+ // if ($disk_space != false) {
213
+ // iwp_mmb_response(array('error' => 'Your disk space is very low available space: '.$disk_space.'MB'), false);
214
+ // }
215
initialize_manual_debug();
216
$this->cleanup();
217
$initialize_result = refresh_iwp_files_db();
411
$temp_sql_file_name = $file.".sql";
412
$file = $db_folder . $temp_sql_file_name;
413
global $wpdb;
414
+ $paths = $this->getMySQLPath();
415
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
416
//$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
417
$command0 = $wpdb->get_col('SHOW TABLES LIKE "'.$wpdb->base_prefix.'%"');
445
//$this->statusLog($historyID, "backupDB", true, "completed", $params, true);
446
//$this->statusLog($historyID, array('stage' => $backupStage, 'status' => 'completed', 'statusMsg' => 'backupDBCompleted'));
447
$db_final_response['success']['status'] = 'partiallyCompleted';
448
+ $backupStage = 'backupDBMultiCall';
449
$this->statusLog($historyID, array('stage' => $backupStage, 'status' => 'completed', 'statusMsg' => 'backupDBCompleted','nextFunc' => 'backupDBZip', 'responseParams' => $db_final_response['success']));
450
unset($db_final_response['success']['response_data']);
451
//to continue in the same call
495
496
return $paths;
497
}
498
+
499
+ public function getMySQLPath(){
500
+ global $wpdb;
501
+ $paths = array(
502
+ 'mysql' => '',
503
+ 'mysqldump' => ''
504
+ );
505
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
506
+ $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
507
+ if ($mysql_install) {
508
+ $install_path = str_replace('\\', '/', $mysql_install->Value);
509
+ $paths['mysql'] = $install_path . '/bin/mysql.exe';
510
+ $paths['mysqldump'] = $install_path . '/bin/mysqldump.exe';
511
+ } else {
512
+ $paths['mysql'] = 'mysql.exe';
513
+ $paths['mysqldump'] = 'mysqldump.exe';
514
+ }
515
+ } else{
516
+ $mysqlPath = "/usr/bin/mysqldump,/bin/mysqldump,/usr/local/bin/mysqldump,/usr/sfw/bin/mysqldump,/usr/xdg4/bin/mysqldump,/opt/bin/mysqldump";
517
+ $bin = explode(',' , $mysqlPath);
518
+ $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
519
+ $db_folder = IWP_DB_DIR . '/';
520
+ $temp_sql_file_name = "iwp_temp.sql";
521
+ $file = $db_folder . $temp_sql_file_name;
522
+ foreach ($bin as $key => $value) {
523
+ $command = $brace . $value . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables --extended-insert=FALSE "' . DB_NAME . '" ""'.$wpdb->base_prefix.'options"" > ' . $brace . $file . $brace;
524
+ $result = $this->iwp_mmb_exec($command);
525
+ if (!$result) {
526
+ continue;
527
+ }
528
+
529
+ if (iwp_mmb_get_file_size($file) == 0 || !is_file($file) || !$result) {
530
+ continue;
531
+ }
532
+ unlink($file);
533
+ $paths = array(
534
+ 'mysql' => $value,
535
+ 'mysqldump' => $value
536
+ );
537
+
538
+ return $paths;
539
+ }
540
+ unlink($file);
541
+ }
542
+
543
+ return $paths;
544
+ }
545
546
function backup_uploads($historyID)
547
{
661
{
662
manual_debug('', 'backupDBStart');
663
$this->statusLog($historyID, array('stage' => 'backupDB', 'status' => 'processing', 'statusMsg' => 'backupDBInitiated'));
664
+ clearstatcache();
665
if(file_exists(IWP_DB_DIR) && is_dir(IWP_DB_DIR))
666
{
667
$this->statusLog($historyID, array('stage' => 'verification', 'status' => 'processing', 'statusMsg' => 'Directorywritable'));
668
}
669
else
670
{
671
+ $mkdir = mkdir(IWP_DB_DIR, 0755, true);
672
if(!$mkdir){
673
return $this->statusLog($historyID, array('stage' => 'verification', 'status' => 'error', 'statusMsg' => 'Error creating database backup folder (' . IWP_DB_DIR . '). Make sure you have corrrect write permissions.', 'statusCode' => 'error_creating_database_backup_folder'));
674
}
1469
$file_size_in_this_call = (iwp_mmb_get_file_size($backup_file)/1024/1024) - $initialFileSize;
1470
echo "<br>iwpmsg file size in this call".$file_size_in_this_call;
1471
echo "<br>iwpmsg Time taken in this call ".$fileNextTimeTaken."<br>";
1472
+ /*
1473
+ //Some times the difference between intitial and this call may equal to 0
1474
+ if( !(($file_size_in_this_call == 0) && is_array($returnArr) && !empty($returnArr['error'])) && !(is_array($returnArr) && !empty($returnArr['isGetFileList'])))
1475
{
1476
return array( 'error' => 'Zip-error: Unable to zip', 'error_code' => 'zip_error_unable_to_zip');
1477
}
1478
+ */
1479
return $returnArr;
1480
}
1481
else
4050
$backup_file_base_name = basename($backup_file);
4051
}
4052
4053
+ $upload = $this -> ftp_multi_upload($conn_id, rtrim($ftp_remote_folder, '/') . '/' . basename($backup_file_base_name), $backup_file, FTP_BINARY, $historyID, $tempArgs, $current_file_num);
4054
4055
4056
if ($upload === false) { //Try ascii
4133
if(!$file_size)
4134
$file_size = 0;
4135
4136
+ $real_size = filesize($local_file_path);
4137
//read the parts local file , if it is a second call start reading the file from the left out part which is at the offset of the remote file's filesize.
4138
$fp = fopen($backup_file, 'r');
4139
fseek($fp,$file_size);
4187
{
4188
@unlink($backup_file);
4189
} */
4190
+ echo "backup not yet finished";
4191
+ echo "real file size $real_size";
4192
+ echo "FTP file size $size";
4193
return $resArray;
4194
}
4195
else
6218
}
6219
$deleted = array();
6220
6221
+ $results = array();
6222
if (is_array($files) && count($files)) {
6223
$cloudFailedBackup = array();
6224
$failedBackupHisID = array();
6225
if (!empty($tasks)) {
6253
}
6254
}
6255
}
6256
+
6257
+ $pheonixBackup = $GLOBALS['iwp_backup_core']->get_backup_history();
6258
+ if (!empty($pheonixBackup)) {
6259
+ foreach ($pheonixBackup as $timestamp => $backup) {
6260
+ if (!empty($backup['plugins'])) {
6261
+ $results = array_merge($results, $backup['plugins']);
6262
+ }
6263
+ if (!empty($backup['themes'])) {
6264
+ $results = array_merge($results, $backup['themes']);
6265
+ }
6266
+ if (!empty($backup['uploads'])) {
6267
+ $results = array_merge($results, $backup['uploads']);
6268
+ }
6269
+ if (!empty($backup['others'])) {
6270
+ $results = array_merge($results, $backup['others']);
6271
+ }
6272
+ if (!empty($backup['more'])) {
6273
+ $results = array_merge($results, $backup['more']);
6274
+ }
6275
+ if (!empty($backup['db'])) {
6276
+ $results[] = $backup['db'];
6277
+ }
6278
+ $results[] = $backup['backup_file_basename'];
6279
+ }
6280
+ }
6281
+
6282
$num_deleted = 0;
6283
foreach ($files as $file) {
6284
+ if (((!in_array($file, $results) && !in_array(basename($file), $results)) || in_array($file, $failedBackupHisID)) && basename($file) != 'index.php') {
6285
@unlink($file);
6286
// $deleted[] = basename($file);
6287
$deleted[] = $file;
backup.class.singlecall.php CHANGED
@@ -1,3 +1,4 @@
1
<?php
2
3
/************************************************************
@@ -1078,7 +1079,7 @@ function delete_task_now($task_name){
1078
function backup_db_dump($file)
1079
{
1080
global $wpdb;
1081
- $paths = $this->check_mysql_paths();
1082
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
1083
//$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
1084
$command0 = $wpdb->get_col('SHOW TABLES LIKE "'.$wpdb->base_prefix.'%"');
@@ -1328,6 +1329,53 @@ function delete_task_now($task_name){
1328
1329
return $paths;
1330
}
1331
1332
//Check if exec, system, passthru functions exist
1333
function check_sys()
@@ -2675,6 +2723,13 @@ function ftp_backup($args)
2675
$deleteRes = $wpdb->query($delete_query);
2676
}
2677
2678
function get_this_tasks($requestParams = ''){
2679
$this->wpdb_reconnect();
2680
@@ -2978,13 +3033,15 @@ function ftp_backup($args)
2978
2979
function cleanup()
2980
{
2981
- $tasks = $this->get_all_tasks(); //all backups task results array.
2982
$backup_folder = WP_CONTENT_DIR . '/' . md5('iwp_mmb-client') . '/iwp_backups/';
2983
$backup_folder_new = IWP_BACKUP_DIR . '/';
2984
- $backup_temp_folder = IWP_PCLZIP_TEMPORARY_DIR;
2985
$files = glob($backup_folder . "*");
2986
$new = glob($backup_folder_new . "*");
2987
- $new_temp = glob($backup_temp_folder . "*");
2988
2989
//Failed db files first
2990
$db_folder = IWP_DB_DIR . '/';
@@ -2993,7 +3050,7 @@ function ftp_backup($args)
2993
foreach ($db_files as $file) {
2994
@unlink($file);
2995
}
2996
- @unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
2997
@rmdir(IWP_DB_DIR);
2998
}
2999
@@ -3008,53 +3065,91 @@ function ftp_backup($args)
3008
}
3009
3010
if (!empty($new)) {
3011
- foreach ($new as $b) {
3012
- $files[] = $b;
3013
- }
3014
}
3015
- if (!empty($new_temp)) {
3016
- foreach ($new_temp as $c) {
3017
- $files[] = $c;
3018
- }
3019
- }
3020
$deleted = array();
3021
3022
if (is_array($files) && count($files)) {
3023
- $results = array();
3024
if (!empty($tasks)) {
3025
- foreach ((array) $tasks as $task) {
3026
//if (isset($task) && count($task)) {
3027
// foreach ($task as $backup) {
3028
- if (isset($task['task_results']) && count($task['task_results'])) {
3029
- foreach ($task['task_results'] as $backup) {
3030
if (isset($backup['server'])) {
3031
- $this_backup_file = $backup['server']['file_path'];
3032
- if(is_array($this_backup_file))
3033
- {
3034
- foreach($this_backup_file as $single_backup_file)
3035
- {
3036
- $results[] = $single_backup_file;
3037
- }
3038
- }
3039
- else
3040
- {
3041
- $results[] = $this_backup_file;
3042
- }
3043
}
3044
}
3045
}
3046
}
3047
}
3048
$num_deleted = 0;
3049
-
3050
foreach ($files as $file) {
3051
- if ((!in_array($file, $results) && basename($file) != 'index.php')) {
3052
@unlink($file);
3053
// $deleted[] = basename($file);
3054
- $deleted[] = $file;
3055
$num_deleted++;
3056
}
3057
}
3058
}
3059
return $deleted;
3060
}
1
+
2
<?php
3
4
/************************************************************
1079
function backup_db_dump($file)
1080
{
1081
global $wpdb;
1082
+ $paths = $this->getMySQLPath();
1083
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
1084
//$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
1085
$command0 = $wpdb->get_col('SHOW TABLES LIKE "'.$wpdb->base_prefix.'%"');
1329
1330
return $paths;
1331
}
1332
+
1333
+ public function getMySQLPath(){
1334
+ global $wpdb;
1335
+ $paths = array(
1336
+ 'mysql' => '',
1337
+ 'mysqldump' => ''
1338
+ );
1339
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
1340
+ $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
1341
+ if ($mysql_install) {
1342
+ $install_path = str_replace('\\', '/', $mysql_install->Value);
1343
+ $paths['mysql'] = $install_path . '/bin/mysql.exe';
1344
+ $paths['mysqldump'] = $install_path . '/bin/mysqldump.exe';
1345
+ } else {
1346
+ $paths['mysql'] = 'mysql.exe';
1347
+ $paths['mysqldump'] = 'mysqldump.exe';
1348
+ }
1349
+ } else{
1350
+ $mysqlPath = "/usr/bin/mysqldump,/bin/mysqldump,/usr/local/bin/mysqldump,/usr/sfw/bin/mysqldump,/usr/xdg4/bin/mysqldump,/opt/bin/mysqldump";
1351
+ $bin = explode(',' , $mysqlPath);
1352
+ $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
1353
+ $db_folder = IWP_DB_DIR . '/';
1354
+ $temp_sql_file_name = "iwp_temp.sql";
1355
+ $file = $db_folder . $temp_sql_file_name;
1356
+ foreach ($bin as $key => $value) {
1357
+ $command = $brace . $value . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables --extended-insert=FALSE "' . DB_NAME . '" ""'.$wpdb->base_prefix.'options"" > ' . $brace . $file . $brace;
1358
+ $result = $this->iwp_mmb_exec($command);
1359
+ if (!$result) {
1360
+ continue;
1361
+ }
1362
+
1363
+ if (iwp_mmb_get_file_size($file) == 0 || !is_file($file) || !$result) {
1364
+ continue;
1365
+ }
1366
+ unlink($file);
1367
+ $paths = array(
1368
+ 'mysql' => $value,
1369
+ 'mysqldump' => $value
1370
+ );
1371
+
1372
+ return $paths;
1373
+ }
1374
+ unlink($file);
1375
+ }
1376
+
1377
+ return $paths;
1378
+ }
1379
1380
//Check if exec, system, passthru functions exist
1381
function check_sys()
2723
$deleteRes = $wpdb->query($delete_query);
2724
}
2725
2726
+ function remove_failed_backups_by_hisID($ID){
2727
+ global $wpdb;
2728
+ $table_name = $wpdb->base_prefix . "iwp_backup_status";
2729
+ $delete_query = "DELETE FROM ".$table_name." WHERE historyID IN (".implode(', ', $ID).") ";
2730
+ $deleteRes = $wpdb->query($delete_query);
2731
+ }
2732
+
2733
function get_this_tasks($requestParams = ''){
2734
$this->wpdb_reconnect();
2735
3033
3034
function cleanup()
3035
{
3036
+ $tasks = $this->get_all_tasks(); //all backups task results array.
3037
+ $requestParams = $this->get_all_tasks(true);
3038
+ $thisTask = $this->get_this_tasks();
3039
$backup_folder = WP_CONTENT_DIR . '/' . md5('iwp_mmb-client') . '/iwp_backups/';
3040
$backup_folder_new = IWP_BACKUP_DIR . '/';
3041
+ $backup_temp_folder = IWP_PCLZIP_TEMPORARY_DIR;
3042
$files = glob($backup_folder . "*");
3043
$new = glob($backup_folder_new . "*");
3044
+ $new_temp = glob($backup_temp_folder . "*");
3045
3046
//Failed db files first
3047
$db_folder = IWP_DB_DIR . '/';
3050
foreach ($db_files as $file) {
3051
@unlink($file);
3052
}
3053
+ @unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
3054
@rmdir(IWP_DB_DIR);
3055
}
3056
3065
}
3066
3067
if (!empty($new)) {
3068
+ foreach ($new as $b) {
3069
+ $files[] = $b;
3070
+ }
3071
}
3072
+ if (!empty($new_temp)) {
3073
+ foreach ($new_temp as $c) {
3074
+ $files[] = $c;
3075
+ }
3076
+ }
3077
$deleted = array();
3078
3079
+ $results = array();
3080
if (is_array($files) && count($files)) {
3081
+ $cloudFailedBackup = array();
3082
+ $failedBackupHisID = array();
3083
if (!empty($tasks)) {
3084
+ foreach ((array) $tasks as $taskName => $task) {
3085
//if (isset($task) && count($task)) {
3086
// foreach ($task as $backup) {
3087
+ if (isset($task['task_results']) && count($task['task_results'])) {
3088
+ foreach ($task['task_results'] as $historyID => $backup) {
3089
if (isset($backup['server'])) {
3090
+ $this_backup_file = $backup['server']['file_path'];
3091
+ if(is_array($this_backup_file))
3092
+ {
3093
+ foreach($this_backup_file as $single_backup_file)
3094
+ { if (!empty($requestParams[$taskName]['requestParams'][$historyID]['account_info']) && $thisTask['historyID'] != $historyID) {
3095
+ $cloudFailedBackup[]= $single_backup_file;
3096
+ $failedBackupHisID[$historyID]=$historyID;
3097
+ }
3098
+ $results[] = $single_backup_file;
3099
+ }
3100
+ }
3101
+ else
3102
+ {
3103
+ if (!empty($requestParams[$taskName]['requestParams'][$historyID]['account_info']) && $thisTask['historyID'] != $historyID) {
3104
+ $cloudFailedBackup[]= $this_backup_file;
3105
+ $failedBackupHisID[$historyID]=$historyID;
3106
+ }
3107
+ $results[] = $this_backup_file;
3108
+ }
3109
}
3110
}
3111
}
3112
}
3113
}
3114
+
3115
+ $pheonixBackup = $GLOBALS['iwp_backup_core']->get_backup_history();
3116
+ if (!empty($pheonixBackup)) {
3117
+ foreach ($pheonixBackup as $timestamp => $backup) {
3118
+ if (!empty($backup['plugins'])) {
3119
+ $results = array_merge($results, $backup['plugins']);
3120
+ }
3121
+ if (!empty($backup['themes'])) {
3122
+ $results = array_merge($results, $backup['themes']);
3123
+ }
3124
+ if (!empty($backup['uploads'])) {
3125
+ $results = array_merge($results, $backup['uploads']);
3126
+ }
3127
+ if (!empty($backup['others'])) {
3128
+ $results = array_merge($results, $backup['others']);
3129
+ }
3130
+ if (!empty($backup['more'])) {
3131
+ $results = array_merge($results, $backup['more']);
3132
+ }
3133
+ if (!empty($backup['db'])) {
3134
+ $results[] = $backup['db'];
3135
+ }
3136
+ $results[] = $backup['backup_file_basename'];
3137
+ }
3138
+ }
3139
+
3140
$num_deleted = 0;
3141
foreach ($files as $file) {
3142
+ if (((!in_array($file, $results) && !in_array(basename($file), $results)) || in_array($file, $failedBackupHisID)) && basename($file) != 'index.php') {
3143
@unlink($file);
3144
// $deleted[] = basename($file);
3145
+ $deleted[] = $file;
3146
$num_deleted++;
3147
}
3148
}
3149
+
3150
+ if (!empty($failedBackupHisID)) {
3151
+ $this->remove_failed_backups_by_hisID($failedBackupHisID);
3152
+ }
3153
}
3154
return $deleted;
3155
}
backup/backup.core.class.php CHANGED
@@ -300,9 +300,9 @@ class IWP_MMB_Backup_Core {
300
# Temporary files from the database dump process - not needed, as is caught by the catch-all
301
# $table_match = preg_match("/${match}-table-(.*)\.table(\.tmp)?\.gz#x2F;i", $entry);
302
# The gz goes in with the txt, because we *don't* want to reap the raw .txt files
303
- if ((preg_match("/$match\.(tmp|table|txt\.gz)(\.gz)?#x2F;i", $entry) || $cachelist_match || $ziparchive_match || $binzip_match || $manifest_match || $browserlog_match) && is_file($iwp_backup_dir.'/'.$entry)) {
304
// We delete if a parameter was specified (and either it is a ZipArchive match or an order to delete of whatever age), or if over 12 hours old
305
- if (($match && ($ziparchive_match || $binzip_match || $cachelist_match || $manifest_match || 0 == $older_than) && $now_time-filemtime($iwp_backup_dir.'/'.$entry) >= $older_than) || $now_time-filemtime($iwp_backup_dir.'/'.$entry)>43200) {
306
$this->log("Deleting old temporary file: $entry");
307
@unlink($iwp_backup_dir.'/'.$entry);
308
}
@@ -310,6 +310,19 @@ class IWP_MMB_Backup_Core {
310
}
311
@closedir($handle);
312
}
313
}
314
315
public function backup_time_nonce($nonce = false) {
@@ -2182,6 +2195,7 @@ class IWP_MMB_Backup_Core {
2182
// Array of backup times keyed by nonce
2183
$known_nonces = array();
2184
$changes = false;
2185
2186
$backupable_entities = $this->get_backupable_file_entities(true, false);
2187
@@ -2201,7 +2215,7 @@ class IWP_MMB_Backup_Core {
2201
if (!is_array($values)) $values=array($values);
2202
foreach ($values as $val) {
2203
if (!is_string($val)) continue;
2204
- if (preg_match('/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-[\-a-z]+([0-9]+)?+(\.(zip|gz|gz\.crypt))?#x2F;i', $val, $matches)) {
2205
$nonce = $matches[2];
2206
if (isset($bdata['service']) && ($bdata['service'] === 'none' || (is_array($bdata['service']) && (array('none') === $bdata['service'] || (1 == count($bdata['service']) && isset($bdata['service'][0]) && empty($bdata['service'][0]))))) && !is_file($iwp_backup_dir.'/'.$val)) {
2207
# File without remote storage is no longer present
@@ -2245,9 +2259,9 @@ class IWP_MMB_Backup_Core {
2245
if ($only_add_this_file !== false && $entry != $only_add_this_file['file']) continue;
2246
2247
if ('.' == $entry || '..' == $entry) continue;
2248
-
2249
# TODO: Make compatible with Incremental naming
2250
- if (preg_match('/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?(\.(zip|gz|gz\.crypt))?#x2F;i', $entry, $matches)) {
2251
// Interpret the time as one from the blog's local timezone, rather than as UTC
2252
# $matches[1] is YYYY-MM-DD-HHmm, to be interpreted as being the local timezone
2253
$btime2 = strtotime($matches[1]);
@@ -2362,7 +2376,7 @@ class IWP_MMB_Backup_Core {
2362
2363
# $backup_history[$btime]['nonce'] = $nonce
2364
foreach ($remotefiles as $file => $services) {
2365
- if (!preg_match('/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?(\.(zip|gz|gz\.crypt))?#x2F;i', $file, $matches)) continue;
2366
$nonce = $matches[2];
2367
$type = $matches[3];
2368
if ('db' == $type) {
@@ -3663,7 +3677,13 @@ CREATE TABLE $wpdb->signups (
3663
$job_id = $params['params']['backup_id'];
3664
$job_data = $this->jobdata_getarray($job_id);
3665
if ($result == '1') {
3666
- return array('success'=>array('status' => 'partiallyCompleted', 'params' => $params['params'], 'jobdata'=>$job_data));
3667
} elseif ($result == '0') {
3668
$cron = $this->get_cron($job_id);
3669
if ($cron == false) {
@@ -3683,7 +3703,7 @@ CREATE TABLE $wpdb->signups (
3683
wp_cron();
3684
}
3685
}
3686
- return array('success'=>array('status' => 'partiallyCompleted', 'params' => $params['params'], 'jobdata'=>$job_data, 'cron_data' => $cron), 'wp_content_url' => content_url() );
3687
}
3688
3689
}
@@ -4728,9 +4748,11 @@ CREATE TABLE $wpdb->signups (
4728
4729
if (preg_match("/^[0-9a-f]{12}#x2F;", $job_id)) {
4730
4731
$cron = get_option('cron');
4732
$found_it = false;
4733
-
4734
foreach ($cron as $time => $job) {
4735
if (isset($job['IWP_backup_resume'])) {
4736
foreach ($job['IWP_backup_resume'] as $hook => $info) {
@@ -4752,6 +4774,7 @@ CREATE TABLE $wpdb->signups (
4752
public function kill_new_backup($params){
4753
$this->activejobs_delete($params['result_id']);
4754
$backups = $this->get_backup_history();
4755
delete_option('IWP_jobdata_'.$params['result_id']);
4756
delete_option('IWP_backup_status', '0');
4757
delete_option('IWP_semaphore_fd');
@@ -4761,14 +4784,14 @@ CREATE TABLE $wpdb->signups (
4761
delete_option('IWP_unlocked_d');
4762
delete_option('IWP_locked_d');
4763
wp_clear_scheduled_hook('IWP_backup_resume');
4764
- if (!empty($backups)) {
4765
foreach ($backups as $key => $value) {
4766
if ($value['nonce'] == $params['result_id']) {
4767
$params['result_id'] = $key;
4768
}
4769
- }
4770
return $this->delete_backup($params);
4771
- }
4772
4773
return true;
4774
}
@@ -4877,4 +4900,17 @@ CREATE TABLE $wpdb->signups (
4877
}
4878
}
4879
}
4880
}
300
# Temporary files from the database dump process - not needed, as is caught by the catch-all
301
# $table_match = preg_match("/${match}-table-(.*)\.table(\.tmp)?\.gz#x2F;i", $entry);
302
# The gz goes in with the txt, because we *don't* want to reap the raw .txt files
303
+ if ((preg_match("/$match\.(tmp|table|txt\.gz)(\.gz)?#x2F;i", $entry) || $cachelist_match || $ziparchive_match || $binzip_match || $manifest_match || $browserlog_match) && is_file($iwp_backup_dir.'/'.$entry) && !strrpos($entry,'backup_meta')) {
304
// We delete if a parameter was specified (and either it is a ZipArchive match or an order to delete of whatever age), or if over 12 hours old
305
+ if ((($match || $match == '') && ($ziparchive_match || $binzip_match || $cachelist_match || $manifest_match || 0 == $older_than) && $now_time-filemtime($iwp_backup_dir.'/'.$entry) >= $older_than) || $now_time-filemtime($iwp_backup_dir.'/'.$entry)>43200) {
306
$this->log("Deleting old temporary file: $entry");
307
@unlink($iwp_backup_dir.'/'.$entry);
308
}
310
}
311
@closedir($handle);
312
}
313
+
314
+ foreach (array(ABSPATH, ABSPATH.'wp-admin/', $iwp_backup_dir.'/') as $path) {
315
+ if ($handle = opendir($path)) {
316
+ while (false !== ($entry = readdir($handle))) {
317
+ // With the old pclzip temporary files, there is no need to keep them around after they're not in use - so we don't use $older_than here - just go for 15 minutes
318
+ if (preg_match("/^pclzip-[a-z0-9]+.tmp#x2F;", $entry) && $now_time-filemtime($path.$entry) >= 900) {
319
+ $this->log("Deleting old PclZip temporary file: $entry");
320
+ @unlink($path.$entry);
321
+ }
322
+ }
323
+ @closedir($handle);
324
+ }
325
+ }
326
}
327
328
public function backup_time_nonce($nonce = false) {
2195
// Array of backup times keyed by nonce
2196
$known_nonces = array();
2197
$changes = false;
2198
+ $site_name = iwp_getSiteName();
2199
2200
$backupable_entities = $this->get_backupable_file_entities(true, false);
2201
2215
if (!is_array($values)) $values=array($values);
2216
foreach ($values as $val) {
2217
if (!is_string($val)) continue;
2218
+ if (preg_match('/^'.$site_name.'backup_([\-0-9]{15})_.*_([0-9a-f]{12})-[\-a-z]+([0-9]+)?+(\.(zip|gz|gz\.crypt))?#x2F;i', $val, $matches)) {
2219
$nonce = $matches[2];
2220
if (isset($bdata['service']) && ($bdata['service'] === 'none' || (is_array($bdata['service']) && (array('none') === $bdata['service'] || (1 == count($bdata['service']) && isset($bdata['service'][0]) && empty($bdata['service'][0]))))) && !is_file($iwp_backup_dir.'/'.$val)) {
2221
# File without remote storage is no longer present
2259
if ($only_add_this_file !== false && $entry != $only_add_this_file['file']) continue;
2260
2261
if ('.' == $entry || '..' == $entry) continue;
2262
# TODO: Make compatible with Incremental naming
2263
+ if (preg_match('/^'.$site_name.'backup_([\-0-9]{15})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?(\.(zip|gz|gz\.crypt))?#x2F;i', $entry, $matches)) {
2264
+
2265
// Interpret the time as one from the blog's local timezone, rather than as UTC
2266
# $matches[1] is YYYY-MM-DD-HHmm, to be interpreted as being the local timezone
2267
$btime2 = strtotime($matches[1]);
2376
2377
# $backup_history[$btime]['nonce'] = $nonce
2378
foreach ($remotefiles as $file => $services) {
2379
+ if (!preg_match('/^'.$site_name.'backup_([\-0-9]{15})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?(\.(zip|gz|gz\.crypt))?#x2F;i', $file, $matches)) continue;
2380
$nonce = $matches[2];
2381
$type = $matches[3];
2382
if ('db' == $type) {
3677
$job_id = $params['params']['backup_id'];
3678
$job_data = $this->jobdata_getarray($job_id);
3679
if ($result == '1') {
3680
+ $cron_disable = false;
3681
+ $cron_params = array();
3682
+ if (( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON )) {
3683
+ $cron_disable = true;
3684
+ $cron_params = $this->get_cron($job_id);
3685
+ }
3686
+ return array('success'=>array('status' => 'partiallyCompleted', 'params' => $params['params'], 'jobdata'=>$job_data, 'cron_disable' => $cron_disable, 'cron_params' =>$cron_params, 'wp_content_url' => content_url()));
3687
} elseif ($result == '0') {
3688
$cron = $this->get_cron($job_id);
3689
if ($cron == false) {
3703
wp_cron();
3704
}
3705
}
3706
+ return array('success'=>array('status' => 'partiallyCompleted', 'params' => $params['params'], 'jobdata'=>$job_data, 'cron_data' => $cron, 'wp_content_url' => content_url()) );
3707
}
3708
3709
}
4748
4749
if (preg_match("/^[0-9a-f]{12}#x2F;", $job_id)) {
4750
4751
+ global $iwp_backup_core;
4752
$cron = get_option('cron');
4753
$found_it = false;
4754
+ $iwp_backup_dir = $iwp_backup_core->backups_dir_location();
4755
+ if (file_exists($iwp_backup_dir.'/log.'.$job_id.'.txt')) touch($iwp_backup_dir.'/deleteflag-'.$job_id.'.txt');
4756
foreach ($cron as $time => $job) {
4757
if (isset($job['IWP_backup_resume'])) {
4758
foreach ($job['IWP_backup_resume'] as $hook => $info) {
4774
public function kill_new_backup($params){
4775
$this->activejobs_delete($params['result_id']);
4776
$backups = $this->get_backup_history();
4777
+ $this->delete_backup_by_id($params['result_id']);
4778
delete_option('IWP_jobdata_'.$params['result_id']);
4779
delete_option('IWP_backup_status', '0');
4780
delete_option('IWP_semaphore_fd');
4784
delete_option('IWP_unlocked_d');
4785
delete_option('IWP_locked_d');
4786
wp_clear_scheduled_hook('IWP_backup_resume');
4787
+ /*if (!empty($backups)) {
4788
foreach ($backups as $key => $value) {
4789
if ($value['nonce'] == $params['result_id']) {
4790
$params['result_id'] = $key;
4791
}
4792
+ }*/
4793
return $this->delete_backup($params);
4794
+ //}
4795
4796
return true;
4797
}
4900
}
4901
}
4902
}
4903
+
4904
+ function delete_backup_by_id($backup_id){
4905
+ $iwp_backup_dir = $this->backups_dir_location();
4906
+
4907
+ if (!$handle = opendir($iwp_backup_dir)) return;
4908
+
4909
+ // See if there are any more files in the local directory than the ones already known about
4910
+ while (false !== ($entry = readdir($handle))) {
4911
+ if (strrpos($entry, $backup_id) /*&& strrpos($entry, 'log.') === false*/ && strrpos($entry, 'deleteflag-') === false) {
4912
+ @unlink($iwp_backup_dir.'/'.$entry);
4913
+ }
4914
+ }
4915
+ }
4916
}
backup/backup.php CHANGED
@@ -2129,8 +2129,7 @@ class IWP_MMB_Backup {
2129
} else {
2130
2131
# Don't put this in the for loop, or the magic __get() method gets called and opens the zip file every time the loop goes round
2132
- $numfiles = $zip->z;
2133
-
2134
for ($i=0; $i < $numfiles; $i++) {
2135
$si = $zip->statIndex($i);
2136
$name = $si['name'];
@@ -2495,6 +2494,7 @@ class IWP_MMB_Backup {
2495
# TODO: Test this new method for PclZip - are we still getting the performance gains? Test for ZipArchive too.
2496
if ('IWP_MMB_PclZip' == $this->use_zip_object && ($this->makezip_recursive_batchedbytes < 512*1048576 || (defined('IWP_PCLZIP_FORCEALLINONE') && IWP_PCLZIP_FORCEALLINONE == true && 'IWP_MMB_PclZip' == $this->use_zip_object))) {
2497
$iwp_backup_core->log("Only one archive required (".$this->use_zip_object.") - will attempt to do in single operation (data: ".round($this->makezip_recursive_batchedbytes/1024,1)." KB, split: ".round($this->zip_split_every/1024, 1)." KB)");
2498
}
2499
}
2500
2129
} else {
2130
2131
# Don't put this in the for loop, or the magic __get() method gets called and opens the zip file every time the loop goes round
2132
+ $numfiles = $zip->numFiles;
2133
for ($i=0; $i < $numfiles; $i++) {
2134
$si = $zip->statIndex($i);
2135
$name = $si['name'];
2494
# TODO: Test this new method for PclZip - are we still getting the performance gains? Test for ZipArchive too.
2495
if ('IWP_MMB_PclZip' == $this->use_zip_object && ($this->makezip_recursive_batchedbytes < 512*1048576 || (defined('IWP_PCLZIP_FORCEALLINONE') && IWP_PCLZIP_FORCEALLINONE == true && 'IWP_MMB_PclZip' == $this->use_zip_object))) {
2496
$iwp_backup_core->log("Only one archive required (".$this->use_zip_object.") - will attempt to do in single operation (data: ".round($this->makezip_recursive_batchedbytes/1024,1)." KB, split: ".round($this->zip_split_every/1024, 1)." KB)");
2497
+ $force_allinone = true;
2498
}
2499
}
2500
backup/functions.php CHANGED
@@ -5,11 +5,11 @@ if ( ! defined('ABSPATH') )
5
6
if( !function_exists ( 'iwp_mmb_define_constant' )) {
7
function iwp_mmb_define_constant(){
8
- define('IWP_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,backup*,*backups,mysql.sql,debug.log,managewp,infinity-cache,backupwordpress,old-cache,nfwlog,wflogs,wishlist-backup,w3tc,logs,widget_cache,updraftplus');
9
10
- define('IWP_DEFAULT_INCLUDES','google,wp-config.php,.htaccess');
11
12
- define('IWP_DEFAULT_UPLOADS_EXCLUDE','backup*,*backups,backwpup*,wp-clone,snapshots,db-backup,backupbuddy_backups,vcf,pb_backupbuddy,sucuri,aiowps_backups,mainwp,wp_system,wpcf7_captcha,wc-logs,siteorigin-widgets,wp-hummingbird-cache,wp-security-audit-log,backwpup-12b462-backups,backwpup-12b462-logs,backwpup-12b462-temp,Dropbox_Backup,cache');
13
14
if (!defined('IWP_DATA_OPTIONAL_TABLES')) define('IWP_DATA_OPTIONAL_TABLES', 'bwps_log,statpress,slim_stats,redirection_logs,Counterize,Counterize_Referers,Counterize_UserAgents,wbz404_logs,wbz404_redirects,tts_trafficstats,tts_referrer_stats,wponlinebackup_generations,svisitor_stat,simple_feed_stats,itsec_log,relevanssi_log,blc_instances,wysija_email_user_stat,woocommerce_sessions,et_bloom_stats,redirection_404,iwp_backup_status,iwp_file_list');
15
@@ -23,7 +23,7 @@ if( !function_exists ( 'iwp_mmb_define_constant' )) {
23
24
if (!defined('IWP_SPLIT_MIN')) define('IWP_SPLIT_MIN', 200);
25
26
- if (!defined('IWP_MAXBATCHFILES')) define('IWP_MAXBATCHFILES', 200);
27
28
if (!defined('IWP_WARN_EMAIL_SIZE')) define('IWP_WARN_EMAIL_SIZE', 20*1048576);
29
5
6
if( !function_exists ( 'iwp_mmb_define_constant' )) {
7
function iwp_mmb_define_constant(){
8
+ if (!defined('IWP_DEFAULT_OTHERS_EXCLUDE')) define('IWP_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,backup*,*backups,mysql.sql,debug.log,managewp,infinity-cache,backupwordpress,old-cache,nfwlog,wflogs,wishlist-backup,w3tc,logs,widget_cache,updraftplus');
9
10
+ if (!defined('IWP_DEFAULT_INCLUDES')) define('IWP_DEFAULT_INCLUDES','google,wp-config.php,.htaccess');
11
12
+ if (!defined('IWP_DEFAULT_UPLOADS_EXCLUDE')) define('IWP_DEFAULT_UPLOADS_EXCLUDE','backup*,*backups,backwpup*,wp-clone,snapshots,db-backup,backupbuddy_backups,vcf,pb_backupbuddy,sucuri,aiowps_backups,mainwp,wp_system,wpcf7_captcha,wc-logs,siteorigin-widgets,wp-hummingbird-cache,wp-security-audit-log,backwpup-12b462-backups,backwpup-12b462-logs,backwpup-12b462-temp,Dropbox_Backup,cache');
13
14
if (!defined('IWP_DATA_OPTIONAL_TABLES')) define('IWP_DATA_OPTIONAL_TABLES', 'bwps_log,statpress,slim_stats,redirection_logs,Counterize,Counterize_Referers,Counterize_UserAgents,wbz404_logs,wbz404_redirects,tts_trafficstats,tts_referrer_stats,wponlinebackup_generations,svisitor_stat,simple_feed_stats,itsec_log,relevanssi_log,blc_instances,wysija_email_user_stat,woocommerce_sessions,et_bloom_stats,redirection_404,iwp_backup_status,iwp_file_list');
15
23
24
if (!defined('IWP_SPLIT_MIN')) define('IWP_SPLIT_MIN', 200);
25
26
+ if (!defined('IWP_MAXBATCHFILES')) define('IWP_MAXBATCHFILES', 500);
27
28
if (!defined('IWP_WARN_EMAIL_SIZE')) define('IWP_WARN_EMAIL_SIZE', 20*1048576);
29
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.8.3
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
@@ -28,7 +28,7 @@ if(basename($_SERVER['SCRIPT_FILENAME']) == "init.php"):
28
exit;
29
endif;
30
if(!defined('IWP_MMB_CLIENT_VERSION'))
31
- define('IWP_MMB_CLIENT_VERSION', '1.8.3');
32
33
34
@@ -45,6 +45,18 @@ $iwp_mmb_wp_version = $wp_version;
45
$iwp_mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
46
$iwp_mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
47
48
require_once("$iwp_mmb_plugin_dir/helper.class.php");
49
require_once("$iwp_mmb_plugin_dir/backup/backup.options.php");
50
require_once("$iwp_mmb_plugin_dir/backup/functions.php");
@@ -175,7 +187,7 @@ if( !function_exists ('iwp_mmb_parse_request')) {
175
176
$auth = $iwp_mmb_core->authenticate_message($action . $id, $signature, $id);
177
if ($auth === true) {
178
- if (!defined('WP_ADMIN') && $action == 'get_stats' || $action == 'do_upgrade' || $action == 'install_addon' || $action == 'edit_plugins_themes') {
179
define('WP_ADMIN', true);
180
}
181
if (is_multisite()) {
@@ -685,9 +697,9 @@ if( !function_exists ( 'iwp_mmb_new_scheduled_backup' )) {
685
$params['restrict_files_to_override']= explode(',', $params['args']['exclude']);
686
}
687
// return true;
688
- //if (defined('IWP_PHOENIX_BACKUP_CRON_START') && IWP_PHOENIX_BACKUP_CRON_START) {
689
$params['cron_start'] = 1;
690
- //}
691
$params['use_nonce'] = $backupId;
692
$params['label'] = $params['task_name'];
693
$params['backup_name'] = $params['args']['backup_name'];
@@ -803,9 +815,9 @@ if( !function_exists ( 'iwp_mmb_new_run_task_now' )) {
803
$params['restrict_files_to_override']= explode(',', $params['args']['exclude']);
804
}
805
// return true;
806
- //if (defined('IWP_PHOENIX_BACKUP_CRON_START') && IWP_PHOENIX_BACKUP_CRON_START) {
807
$params['cron_start'] = 1;
808
- //}
809
$params['use_nonce'] = $backupId;
810
$params['label'] = $params['task_name'];
811
$params['backup_name'] = $params['args']['backup_name'];
@@ -2179,7 +2191,7 @@ if (!function_exists('iwp_mmb_change_stausMsg_column_type_backup_status_table'))
2179
function iwp_mmb_change_stausMsg_column_type_backup_status_table(){
2180
global $wpdb;
2181
$table_name = $wpdb->base_prefix . "iwp_backup_status";
2182
- $sql = "alter table " . $table_name . " change statusMsg statusMsg LONGTEXT;";
2183
$isDone = $wpdb->query($sql);
2184
if ($isDone) {
2185
update_option( "iwp_backup_table_version", '1.1.4');
@@ -2209,6 +2221,7 @@ if(!function_exists('iwp_mmb_get_file_size')){
2209
if(!$file)
2210
{
2211
echo 'iwp_mmb_get_file_size_error : realPath error';
2212
}
2213
$ch = curl_init("file://" . $file);
2214
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FILE);
@@ -2224,6 +2237,7 @@ if(!function_exists('iwp_mmb_get_file_size')){
2224
else
2225
{
2226
echo 'iwp_mmb_get_file_size_error : '.$curl_error;
2227
return $normal_file_size;
2228
}
2229
}
@@ -2615,14 +2629,14 @@ if (!function_exists('check_invalid_UTF8')) {
2615
}
2616
}
2617
2618
- define('MAX_SERIALIZED_INPUT_LENGTH', 8192);
2619
- define('MAX_SERIALIZED_ARRAY_LENGTH', 512);
2620
- define('MAX_SERIALIZED_ARRAY_DEPTH', 20);
2621
function _iwp_mmb_safe_unserialize($str)
2622
{
2623
- if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
2624
{
2625
- // input exceeds MAX_SERIALIZED_INPUT_LENGTH
2626
return false;
2627
}
2628
if(empty($str) || !is_string($str))
@@ -2671,7 +2685,7 @@ function _iwp_mmb_safe_unserialize($str)
2671
$value = substr($matches[2], 0, (int)$matches[1]);
2672
$str = substr($matches[2], (int)$matches[1] + 2);
2673
}
2674
- else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH)
2675
{
2676
$expectedLength = (int)$matches[1];
2677
$str = $matches[2];
@@ -2686,9 +2700,9 @@ function _iwp_mmb_safe_unserialize($str)
2686
case 3: // in array, expecting value or another array
2687
if($type == 'a')
2688
{
2689
- if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
2690
{
2691
- // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH
2692
return false;
2693
}
2694
$stack[] = &$list;
@@ -2726,9 +2740,9 @@ function _iwp_mmb_safe_unserialize($str)
2726
}
2727
if($type == 'i' || $type == 's')
2728
{
2729
- if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
2730
{
2731
- // array size exceeds MAX_SERIALIZED_ARRAY_LENGTH
2732
return false;
2733
}
2734
if(count($list) >= end($expected))
@@ -2745,9 +2759,9 @@ function _iwp_mmb_safe_unserialize($str)
2745
case 0: // expecting array or value
2746
if($type == 'a')
2747
{
2748
- if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
2749
{
2750
- // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH
2751
return false;
2752
}
2753
$data = array();
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.8.5
8
Author URI: http://www.revmakx.com
9
*/
10
/************************************************************
28
exit;
29
endif;
30
if(!defined('IWP_MMB_CLIENT_VERSION'))
31
+ define('IWP_MMB_CLIENT_VERSION', '1.8.5');
32
33
34
45
$iwp_mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
46
$iwp_mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
47
48
+ if(!defined('IWP_BACKUP_DIR')){
49
+ define('IWP_BACKUP_DIR', WP_CONTENT_DIR . '/infinitewp/backups');
50
+ }
51
+
52
+ if(!defined('IWP_DB_DIR')){
53
+ define('IWP_DB_DIR', IWP_BACKUP_DIR . '/iwp_db');
54
+ }
55
+
56
+ if(!defined('IWP_PCLZIP_TEMPORARY_DIR')){
57
+ define('IWP_PCLZIP_TEMPORARY_DIR', WP_CONTENT_DIR . '/infinitewp/temp/');
58
+ }
59
+
60
require_once("$iwp_mmb_plugin_dir/helper.class.php");
61
require_once("$iwp_mmb_plugin_dir/backup/backup.options.php");
62
require_once("$iwp_mmb_plugin_dir/backup/functions.php");
187
188
$auth = $iwp_mmb_core->authenticate_message($action . $id, $signature, $id);
189
if ($auth === true) {
190
+ if (!defined('WP_ADMIN') && $action == 'get_stats' || $action == 'do_upgrade' || $action == 'install_addon' || $action == 'edit_plugins_themes' || $action == 'bulk_actions_processor') {
191
define('WP_ADMIN', true);
192
}
193
if (is_multisite()) {
697
$params['restrict_files_to_override']= explode(',', $params['args']['exclude']);
698
}
699
// return true;
700
+ if (defined('IWP_PHOENIX_BACKUP_CRON_START') && IWP_PHOENIX_BACKUP_CRON_START) {
701
$params['cron_start'] = 1;
702
+ }
703
$params['use_nonce'] = $backupId;
704
$params['label'] = $params['task_name'];
705
$params['backup_name'] = $params['args']['backup_name'];
815
$params['restrict_files_to_override']= explode(',', $params['args']['exclude']);
816
}
817
// return true;
818
+ if (defined('IWP_PHOENIX_BACKUP_CRON_START') && IWP_PHOENIX_BACKUP_CRON_START) {
819
$params['cron_start'] = 1;
820
+ }
821
$params['use_nonce'] = $backupId;
822
$params['label'] = $params['task_name'];
823
$params['backup_name'] = $params['args']['backup_name'];
2191
function iwp_mmb_change_stausMsg_column_type_backup_status_table(){
2192
global $wpdb;
2193
$table_name = $wpdb->base_prefix . "iwp_backup_status";
2194
+ $sql = "alter table " . $table_name . " change statusMsg LONGTEXT;";
2195
$isDone = $wpdb->query($sql);
2196
if ($isDone) {
2197
update_option( "iwp_backup_table_version", '1.1.4');
2221
if(!$file)
2222
{
2223
echo 'iwp_mmb_get_file_size_error : realPath error';
2224
+ echo "File Name: $file";
2225
}
2226
$ch = curl_init("file://" . $file);
2227
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FILE);
2237
else
2238
{
2239
echo 'iwp_mmb_get_file_size_error : '.$curl_error;
2240
+ echo "File Name: $file";
2241
return $normal_file_size;
2242
}
2243
}
2629
}
2630
}
2631
2632
+ define('IWP_MAX_SERIALIZED_INPUT_LENGTH', 8192);
2633
+ define('IWP_MAX_SERIALIZED_ARRAY_LENGTH', 512);
2634
+ define('IWP_MAX_SERIALIZED_ARRAY_DEPTH', 20);
2635
function _iwp_mmb_safe_unserialize($str)
2636
{
2637
+ if(strlen($str) > IWP_MAX_SERIALIZED_INPUT_LENGTH)
2638
{
2639
+ // input exceeds IWP_MAX_SERIALIZED_INPUT_LENGTH
2640
return false;
2641
}
2642
if(empty($str) || !is_string($str))
2685
$value = substr($matches[2], 0, (int)$matches[1]);
2686
$str = substr($matches[2], (int)$matches[1] + 2);
2687
}
2688
+ else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < IWP_MAX_SERIALIZED_ARRAY_LENGTH)
2689
{
2690
$expectedLength = (int)$matches[1];
2691
$str = $matches[2];
2700
case 3: // in array, expecting value or another array
2701
if($type == 'a')
2702
{
2703
+ if(count($stack) >= IWP_MAX_SERIALIZED_ARRAY_DEPTH)
2704
{
2705
+ // array nesting exceeds IWP_MAX_SERIALIZED_ARRAY_DEPTH
2706
return false;
2707
}
2708
$stack[] = &$list;
2740
}
2741
if($type == 'i' || $type == 's')
2742
{
2743
+ if(count($list) >= IWP_MAX_SERIALIZED_ARRAY_LENGTH)
2744
{
2745
+ // array size exceeds IWP_MAX_SERIALIZED_ARRAY_LENGTH
2746
return false;
2747
}
2748
if(count($list) >= end($expected))
2759
case 0: // expecting array or value
2760
if($type == 'a')
2761
{
2762
+ if(count($stack) >= IWP_MAX_SERIALIZED_ARRAY_DEPTH)
2763
{
2764
+ // array nesting exceeds IWP_MAX_SERIALIZED_ARRAY_DEPTH
2765
return false;
2766
}
2767
$data = array();
lib/amazon/s3IWPBackup.php CHANGED
@@ -164,7 +164,7 @@ class IWP_MMB_S3_MULTICALL extends IWP_MMB_Backup_Multicall
164
'Bucket' => $as3_bucket,
165
'SourceFile' => $backup_file,
166
'Key' => $as3_file,
167
- 'ACL' => 'authenticated-read'
168
));
169
$current_file_num += 1;
170
$resArray = array (
@@ -217,7 +217,7 @@ class IWP_MMB_S3_MULTICALL extends IWP_MMB_Backup_Multicall
217
$result = $s3->createMultipartUpload(array(
218
'Bucket' => $as3_bucket,
219
'Key' => $as3_file,
220
- 'ACL' => 'authenticated-read',
221
222
));
223
@@ -659,7 +659,7 @@ class IWP_MMB_S3_SINGLECALL extends IWP_MMB_Backup_Multicall
659
'Bucket' => $as3_bucket,
660
'SourceFile' => $backup_file,
661
'Key' => $as3_file,
662
- 'ACL' => 'authenticated-read'
663
));
664
return true;
665
}catch (Exception $e){
@@ -682,7 +682,7 @@ class IWP_MMB_S3_SINGLECALL extends IWP_MMB_Backup_Multicall
682
$result = $s3->createMultipartUpload(array(
683
'Bucket' => $as3_bucket,
684
'Key' => $as3_file,
685
- 'ACL' => 'authenticated-read',
686
687
));
688
164
'Bucket' => $as3_bucket,
165
'SourceFile' => $backup_file,
166
'Key' => $as3_file,
167
+ 'ACL' => 'private'
168
));
169
$current_file_num += 1;
170
$resArray = array (
217
$result = $s3->createMultipartUpload(array(
218
'Bucket' => $as3_bucket,
219
'Key' => $as3_file,
220
+ 'ACL' => 'private',
221
222
));
223
659
'Bucket' => $as3_bucket,
660
'SourceFile' => $backup_file,
661
'Key' => $as3_file,
662
+ 'ACL' => 'private'
663
));
664
return true;
665
}catch (Exception $e){
682
$result = $s3->createMultipartUpload(array(
683
'Bucket' => $as3_bucket,
684
'Key' => $as3_file,
685
+ 'ACL' => 'private',
686
687
));
688
pclzip.class.php CHANGED
@@ -3593,11 +3593,12 @@ endif;
3593
//$timeTak = microtime(true) - $tempLoopStart;
3594
3595
// ----- Check the minimum file size
3596
- if (version_compare(phpversion(), '7','<')) {
3597
- $version_bytes = 18;
3598
- }else{
3599
- $version_bytes = 0;
3600
- }
3601
if (iwp_mmb_get_file_size($v_gzip_temp_name) < $version_bytes) {
3602
echo "Check the minimum file size error".iwp_mmb_get_file_size($v_gzip_temp_name);
3603
echo "minimum file size".$version_bytes;
@@ -6514,6 +6515,7 @@ endif;
6514
if(!$file)
6515
{
6516
echo 'iwp_mmb_get_file_size_error : realPath error';
6517
}
6518
$ch = curl_init("file://" . $file);
6519
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FILE);
@@ -6529,6 +6531,7 @@ endif;
6529
else
6530
{
6531
echo 'iwp_mmb_get_file_size_error : '.$curl_error;
6532
return $normal_file_size;
6533
}
6534
}
3593
//$timeTak = microtime(true) - $tempLoopStart;
3594
3595
// ----- Check the minimum file size
3596
+ // if (version_compare(phpversion(), '7','<')) {
3597
+ // $version_bytes = 18;
3598
+ // }else{
3599
+ // $version_bytes = 0;
3600
+ // }
3601
+ $version_bytes = 0;
3602
if (iwp_mmb_get_file_size($v_gzip_temp_name) < $version_bytes) {
3603
echo "Check the minimum file size error".iwp_mmb_get_file_size($v_gzip_temp_name);
3604
echo "minimum file size".$version_bytes;
6515
if(!$file)
6516
{
6517
echo 'iwp_mmb_get_file_size_error : realPath error';
6518
+ echo "File Name: $file";
6519
}
6520
$ch = curl_init("file://" . $file);
6521
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FILE);
6531
else
6532
{
6533
echo 'iwp_mmb_get_file_size_error : '.$curl_error;
6534
+ echo "File Name: $file";
6535
return $normal_file_size;
6536
}
6537
}
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
Contributors: infinitewp
3
Tags: admin, administration, amazon, api, authentication, automatic, dashboard, dropbox, events, integration, manage, multisite, multiple, notification, performance, s3, security, seo, stats, tracking, infinitewp, updates, backup, restore, iwp, infinite
4
Requires at least: 3.1
5
- Tested up to: 4.9.7
6
Stable tag: trunk
7
8
Install this plugin on unlimited sites and manage them all from a central dashboard.
@@ -47,6 +47,21 @@ Credits: [Vladimir Prelovac](http://prelovac.com/vladimir) for his worker plugin
47
5. One-click updates
48
49
== Changelog ==
50
= 1.8.3 - May 15th 2018 =
51
* Improvement: Auto cron task is enabled by default for Phoenix method backups.
52
* Improvement: Calling Next Function failed error when Shell DB dump backup fails error.
2
Contributors: infinitewp
3
Tags: admin, administration, amazon, api, authentication, automatic, dashboard, dropbox, events, integration, manage, multisite, multiple, notification, performance, s3, security, seo, stats, tracking, infinitewp, updates, backup, restore, iwp, infinite
4
Requires at least: 3.1
5
+ Tested up to: 4.9.8
6
Stable tag: trunk
7
8
Install this plugin on unlimited sites and manage them all from a central dashboard.
47
5. One-click updates
48
49
== Changelog ==
50
+ = 1.8.5 - Sep 4th 2018 =
51
+ * Improvement: Multisite support for broken link checker plugin.
52
+ * Improvement: MySQL DB dump process is improved in multicall and single call backup.
53
+ * Improvement: Phoenix method now doesn't wait for the wp-cron to start the backup.
54
+ * Improvement: Debug log added for few errors.
55
+ * Improvement: If your server gets timed out, the files which are already backed up will be skipped while resume/retrying it(Phoenix backups).
56
+ * Improvement: Phoenix Backups keep running in the background even when it's stopped from your admin panel.
57
+ * Improvement: Phoenix Backup files are not deleted when we kill a backup process manually.
58
+ * Fix: Multicall backup files – S3 bucket – Global users permission.
59
+ * Fix: Broken link checker plugin unlink and mark not as broken action throws a fatal error.
60
+ * Fix: Phoenix backup files on your server is removed when you immediately backup your site using the single/multicall method after a phoenix backup.
61
+ * Fix: Piwik warning.
62
+ * Fix: A few PHP warnings are fixed.
63
+ * Fix: FTP backup keeps running if slash is added at the end of the FTP path.
64
+
65
= 1.8.3 - May 15th 2018 =
66
* Improvement: Auto cron task is enabled by default for Phoenix method backups.
67
* Improvement: Calling Next Function failed error when Shell DB dump backup fails error.
stats.class.php CHANGED
@@ -429,7 +429,9 @@ class IWP_MMB_Stats extends IWP_MMB_Core
429
global $wpdb, $iwp_mmb_wp_version, $iwp_mmb_plugin_dir, $wp_version, $wp_local_package;
430
431
$current = get_site_transient( 'update_plugins' );
432
- $r = $current->response['iwp-client/init.php'];
433
434
//For WPE
435
$use_cookie = 0;
@@ -438,8 +440,10 @@ class IWP_MMB_Stats extends IWP_MMB_Core
438
}
439
440
$stats['client_version'] = IWP_MMB_CLIENT_VERSION;
441
- $stats['client_new_version'] = $r->new_version;
442
- $stats['client_new_package'] = $r->package;
443
$stats['wordpress_version'] = $wp_version;
444
$stats['wordpress_locale_pckg'] = $wp_local_package;
445
$stats['php_version'] = phpversion();
429
global $wpdb, $iwp_mmb_wp_version, $iwp_mmb_plugin_dir, $wp_version, $wp_local_package;
430
431
$current = get_site_transient( 'update_plugins' );
432
+ if (isset($current->response['iwp-client/init.php'])) {
433
+ $r = $current->response['iwp-client/init.php'];
434
+ }
435
436
//For WPE
437
$use_cookie = 0;
440
}
441
442
$stats['client_version'] = IWP_MMB_CLIENT_VERSION;
443
+ if (!empty($rs)) {
444
+ $stats['client_new_version'] = $r->new_version;
445
+ $stats['client_new_package'] = $r->package;
446
+ }
447
$stats['wordpress_version'] = $wp_version;
448
$stats['wordpress_locale_pckg'] = $wp_local_package;
449
$stats['php_version'] = phpversion();