Version Description
- WordPress Multisite Backup issue fixed
- Bugs fixed
Download this release
Release Info
Developer | infinitewp |
Plugin | InfiniteWP Client |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- backup.class.php +101 -9
- core.class.php +3 -1
- helper.class.php +5 -5
- init.php +47 -5
- installer.class.php +35 -9
- plugins/cleanup/cleanup.php +7 -1
- readme.txt +4 -0
- stats.class.php +16 -0
backup.class.php
CHANGED
@@ -73,9 +73,11 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
73 |
parent::__construct();
|
74 |
$this->site_name = str_replace(array(
|
75 |
"_",
|
76 |
-
"/"
|
|
|
77 |
), array(
|
78 |
"",
|
|
|
79 |
"-"
|
80 |
), rtrim($this->remove_http(get_bloginfo('url')), "/"));
|
81 |
$this->statuses = array(
|
@@ -100,6 +102,12 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
100 |
{
|
101 |
//$params => [$task_name, $args, $error]
|
102 |
if (!empty($params)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
extract($params);
|
104 |
|
105 |
//$before = $this->get_backup_settings();
|
@@ -119,7 +127,7 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
119 |
}
|
120 |
|
121 |
//Update with error
|
122 |
-
if ($error) {
|
123 |
if (is_array($error)) {
|
124 |
$before[$task_name]['task_results'][count($before[$task_name]['task_results']) - 1]['error'] = $error['error'];
|
125 |
} else {
|
@@ -149,12 +157,18 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
149 |
}
|
150 |
return $return;
|
151 |
}
|
|
|
|
|
|
|
152 |
return false;
|
153 |
}
|
154 |
|
155 |
//Cron check
|
156 |
function check_backup_tasks()
|
157 |
{
|
|
|
|
|
|
|
158 |
$settings = $this->tasks;
|
159 |
if (is_array($settings) && !empty($settings)) {
|
160 |
foreach ($settings as $task_name => $setting) {
|
@@ -228,7 +242,7 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
228 |
|
229 |
//Try increase memory limit and execution time
|
230 |
@ini_set('memory_limit', '256M');
|
231 |
-
@set_time_limit(
|
232 |
|
233 |
//Remove old backup(s)
|
234 |
$this->remove_old_backups($task_name);
|
@@ -348,7 +362,7 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
348 |
}
|
349 |
|
350 |
$temp = $backup_settings[$task_name]['task_results'];
|
351 |
-
$temp = array_values($temp);
|
352 |
$paths['time'] = time();
|
353 |
|
354 |
|
@@ -446,21 +460,36 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
446 |
//Exclude paths
|
447 |
$exclude_data = "-x";
|
448 |
|
|
|
|
|
449 |
if (!empty($exclude)) {
|
450 |
foreach ($exclude as $data) {
|
451 |
if (is_dir(ABSPATH . $data)) {
|
452 |
if ($sys == 'WIN')
|
453 |
$exclude_data .= " $data/*.*";
|
454 |
else
|
455 |
-
$exclude_data .= "
|
|
|
|
|
456 |
} else {
|
457 |
-
if ($sys == 'WIN')
|
|
|
458 |
$exclude_data .= " $data";
|
459 |
-
|
|
|
|
|
|
|
460 |
$exclude_data .= " '$data'";
|
|
|
461 |
}
|
462 |
}
|
463 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
|
465 |
foreach ($remove as $data) {
|
466 |
if ($sys == 'WIN')
|
@@ -584,7 +613,6 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
584 |
'error' => 'Failed to zip files. pclZip error (' . $archive->error_code . '): .' . $archive->error_string
|
585 |
);
|
586 |
}
|
587 |
-
|
588 |
}
|
589 |
|
590 |
//Reconnect
|
@@ -698,7 +726,7 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
698 |
|
699 |
extract($args);
|
700 |
@ini_set('memory_limit', '256M');
|
701 |
-
@set_time_limit(
|
702 |
|
703 |
$unlink_file = true; //Delete file after restore
|
704 |
|
@@ -724,6 +752,8 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
724 |
$what = $tasks[$task_name]['task_args']['what'];
|
725 |
}
|
726 |
|
|
|
|
|
727 |
if ($backup_file && file_exists($backup_file)) {
|
728 |
if ($overwrite) {
|
729 |
//Keep old db credentials before overwrite
|
@@ -804,6 +834,8 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
804 |
);
|
805 |
}
|
806 |
|
|
|
|
|
807 |
//Replace options and content urls
|
808 |
if ($overwrite) {
|
809 |
//Get New Table prefix
|
@@ -1403,11 +1435,13 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
1403 |
|
1404 |
function wpdb_reconnect(){
|
1405 |
global $wpdb;
|
|
|
1406 |
//Reconnect to avoid timeout problem after ZIP files
|
1407 |
if(class_exists('wpdb') && function_exists('wp_set_wpdb_vars')){
|
1408 |
@mysql_close($wpdb->dbh);
|
1409 |
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
|
1410 |
wp_set_wpdb_vars();
|
|
|
1411 |
}
|
1412 |
}
|
1413 |
|
@@ -1424,6 +1458,64 @@ class IWP_MMB_Backup extends IWP_MMB_Core
|
|
1424 |
}
|
1425 |
}
|
1426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1427 |
}
|
1428 |
|
|
|
|
|
|
|
1429 |
?>
|
73 |
parent::__construct();
|
74 |
$this->site_name = str_replace(array(
|
75 |
"_",
|
76 |
+
"/",
|
77 |
+
"~"
|
78 |
), array(
|
79 |
"",
|
80 |
+
"-",
|
81 |
"-"
|
82 |
), rtrim($this->remove_http(get_bloginfo('url')), "/"));
|
83 |
$this->statuses = array(
|
102 |
{
|
103 |
//$params => [$task_name, $args, $error]
|
104 |
if (!empty($params)) {
|
105 |
+
|
106 |
+
//Make sure backup cron job is set
|
107 |
+
if (!wp_next_scheduled('iwp_client_backup_tasks')) {
|
108 |
+
wp_schedule_event( time(), 'tenminutes', 'iwp_client_backup_tasks' );
|
109 |
+
}
|
110 |
+
|
111 |
extract($params);
|
112 |
|
113 |
//$before = $this->get_backup_settings();
|
127 |
}
|
128 |
|
129 |
//Update with error
|
130 |
+
if (isset($error)) {
|
131 |
if (is_array($error)) {
|
132 |
$before[$task_name]['task_results'][count($before[$task_name]['task_results']) - 1]['error'] = $error['error'];
|
133 |
} else {
|
157 |
}
|
158 |
return $return;
|
159 |
}
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
return false;
|
164 |
}
|
165 |
|
166 |
//Cron check
|
167 |
function check_backup_tasks()
|
168 |
{
|
169 |
+
|
170 |
+
$this->check_cron_remove();
|
171 |
+
|
172 |
$settings = $this->tasks;
|
173 |
if (is_array($settings) && !empty($settings)) {
|
174 |
foreach ($settings as $task_name => $setting) {
|
242 |
|
243 |
//Try increase memory limit and execution time
|
244 |
@ini_set('memory_limit', '256M');
|
245 |
+
@set_time_limit(1200); //20 mins
|
246 |
|
247 |
//Remove old backup(s)
|
248 |
$this->remove_old_backups($task_name);
|
362 |
}
|
363 |
|
364 |
$temp = $backup_settings[$task_name]['task_results'];
|
365 |
+
$temp = @array_values($temp);
|
366 |
$paths['time'] = time();
|
367 |
|
368 |
|
460 |
//Exclude paths
|
461 |
$exclude_data = "-x";
|
462 |
|
463 |
+
$exclude_file_data = '';
|
464 |
+
|
465 |
if (!empty($exclude)) {
|
466 |
foreach ($exclude as $data) {
|
467 |
if (is_dir(ABSPATH . $data)) {
|
468 |
if ($sys == 'WIN')
|
469 |
$exclude_data .= " $data/*.*";
|
470 |
else
|
471 |
+
$exclude_data .= " $data/*";
|
472 |
+
|
473 |
+
|
474 |
} else {
|
475 |
+
if ($sys == 'WIN'){
|
476 |
+
if(file_exists(ABSPATH . $data)){
|
477 |
$exclude_data .= " $data";
|
478 |
+
$exclude_file_data .= " $data";
|
479 |
+
}
|
480 |
+
} else {
|
481 |
+
if(file_exists(ABSPATH . $data)){
|
482 |
$exclude_data .= " '$data'";
|
483 |
+
$exclude_file_data .= " '$data'";
|
484 |
}
|
485 |
}
|
486 |
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
if($exclude_file_data){
|
491 |
+
$exclude_file_data = "-x".$exclude_file_data;
|
492 |
+
}
|
493 |
|
494 |
foreach ($remove as $data) {
|
495 |
if ($sys == 'WIN')
|
613 |
'error' => 'Failed to zip files. pclZip error (' . $archive->error_code . '): .' . $archive->error_string
|
614 |
);
|
615 |
}
|
|
|
616 |
}
|
617 |
|
618 |
//Reconnect
|
726 |
|
727 |
extract($args);
|
728 |
@ini_set('memory_limit', '256M');
|
729 |
+
@set_time_limit(1200);
|
730 |
|
731 |
$unlink_file = true; //Delete file after restore
|
732 |
|
752 |
$what = $tasks[$task_name]['task_args']['what'];
|
753 |
}
|
754 |
|
755 |
+
$this->wpdb_reconnect();
|
756 |
+
|
757 |
if ($backup_file && file_exists($backup_file)) {
|
758 |
if ($overwrite) {
|
759 |
//Keep old db credentials before overwrite
|
834 |
);
|
835 |
}
|
836 |
|
837 |
+
$this->wpdb_reconnect();
|
838 |
+
|
839 |
//Replace options and content urls
|
840 |
if ($overwrite) {
|
841 |
//Get New Table prefix
|
1435 |
|
1436 |
function wpdb_reconnect(){
|
1437 |
global $wpdb;
|
1438 |
+
$old_wpdb = $wpdb;
|
1439 |
//Reconnect to avoid timeout problem after ZIP files
|
1440 |
if(class_exists('wpdb') && function_exists('wp_set_wpdb_vars')){
|
1441 |
@mysql_close($wpdb->dbh);
|
1442 |
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
|
1443 |
wp_set_wpdb_vars();
|
1444 |
+
$wpdb->options = $old_wpdb->options;//fix for multi site full backup
|
1445 |
}
|
1446 |
}
|
1447 |
|
1458 |
}
|
1459 |
}
|
1460 |
|
1461 |
+
function check_cron_remove(){
|
1462 |
+
if(empty($this->tasks) || (count($this->tasks) == 1 && isset($this->tasks['Backup Now'])) ){
|
1463 |
+
wp_clear_scheduled_hook('iwp_client_backup_tasks');
|
1464 |
+
exit;
|
1465 |
+
}
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
|
1469 |
+
public static function readd_tasks( $params = array() ){
|
1470 |
+
global $iwp_mmb_core;
|
1471 |
+
|
1472 |
+
if( empty($params) || !isset($params['backups']) )
|
1473 |
+
return $params;
|
1474 |
+
|
1475 |
+
$before = array();
|
1476 |
+
$tasks = $params['backups'];
|
1477 |
+
if( !empty($tasks) ){
|
1478 |
+
$iwp_mmb_backup = new IWP_MMB_Backup();
|
1479 |
+
|
1480 |
+
if( function_exists( 'wp_next_scheduled' ) ){
|
1481 |
+
if ( !wp_next_scheduled('iwp_client_backup_tasks') ) {
|
1482 |
+
wp_schedule_event( time(), 'tenminutes', 'iwp_client_backup_tasks' );
|
1483 |
+
}
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
foreach( $tasks as $task ){
|
1487 |
+
$before[$task['task_name']] = array();
|
1488 |
+
|
1489 |
+
if(isset($task['secure'])){
|
1490 |
+
if($decrypted = $iwp_mmb_core->_secure_data($task['secure'])){
|
1491 |
+
$decrypted = maybe_unserialize($decrypted);
|
1492 |
+
if(is_array($decrypted)){
|
1493 |
+
foreach($decrypted as $key => $val){
|
1494 |
+
if(!is_numeric($key))
|
1495 |
+
$task[$key] = $val;
|
1496 |
+
}
|
1497 |
+
unset($task['secure']);
|
1498 |
+
} else
|
1499 |
+
$task['secure'] = $decrypted;
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
}
|
1503 |
+
if (isset($task['account_info']) && is_array($task['account_info'])) { //only if sends from master first time(secure data)
|
1504 |
+
$task['args']['account_info'] = $task['account_info'];
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
$before[$task['task_name']]['task_args'] = $task['args'];
|
1508 |
+
$before[$task['task_name']]['task_args']['next'] = $iwp_mmb_backup->schedule_next($task['args']['type'], $task['args']['schedule']);
|
1509 |
+
}
|
1510 |
+
}
|
1511 |
+
update_option('iwp_client_backup_tasks', $before);
|
1512 |
+
|
1513 |
+
unset($params['backups']);
|
1514 |
+
return $params;
|
1515 |
+
}
|
1516 |
}
|
1517 |
|
1518 |
+
if( function_exists('add_filter') ){
|
1519 |
+
add_filter( 'iwp_website_add', 'IWP_MMB_Backup::readd_tasks' );
|
1520 |
+
}
|
1521 |
?>
|
core.class.php
CHANGED
@@ -542,7 +542,7 @@ class IWP_MMB_Core extends IWP_MMB_Helper
|
|
542 |
|
543 |
if (!$this->is_server_writable()) {
|
544 |
return array(
|
545 |
-
'error' => 'Failed
|
546 |
);
|
547 |
}
|
548 |
|
@@ -559,6 +559,8 @@ class IWP_MMB_Core extends IWP_MMB_Helper
|
|
559 |
)
|
560 |
));
|
561 |
ob_end_clean();
|
|
|
|
|
562 |
if (is_wp_error($result) || !$result) {
|
563 |
return array(
|
564 |
'error' => 'InfiniteWP Client plugin could not be updated.'
|
542 |
|
543 |
if (!$this->is_server_writable()) {
|
544 |
return array(
|
545 |
+
'error' => 'Failed. please add FTP details for automatic upgrades.'
|
546 |
);
|
547 |
}
|
548 |
|
559 |
)
|
560 |
));
|
561 |
ob_end_clean();
|
562 |
+
@wp_update_plugins();
|
563 |
+
|
564 |
if (is_wp_error($result) || !$result) {
|
565 |
return array(
|
566 |
'error' => 'InfiniteWP Client plugin could not be updated.'
|
helper.class.php
CHANGED
@@ -353,7 +353,7 @@ class IWP_MMB_Helper
|
|
353 |
$pl_key = $this->get_admin_panel_public_key();
|
354 |
if (!$pl_key) {
|
355 |
return array(
|
356 |
-
'error' => 'Authentication failed. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP
|
357 |
);
|
358 |
}
|
359 |
|
@@ -364,7 +364,7 @@ class IWP_MMB_Helper
|
|
364 |
return true;
|
365 |
} else if ($verify == 0) {
|
366 |
return array(
|
367 |
-
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP
|
368 |
);
|
369 |
} else {
|
370 |
return array(
|
@@ -378,13 +378,13 @@ class IWP_MMB_Helper
|
|
378 |
return true;
|
379 |
}
|
380 |
return array(
|
381 |
-
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP
|
382 |
);
|
383 |
}
|
384 |
// no rand key - deleted in get_stat maybe
|
385 |
else
|
386 |
return array(
|
387 |
-
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP
|
388 |
);
|
389 |
}
|
390 |
|
@@ -499,7 +499,7 @@ class IWP_MMB_Helper
|
|
499 |
}
|
500 |
|
501 |
|
502 |
-
|
503 |
|
504 |
|
505 |
}
|
353 |
$pl_key = $this->get_admin_panel_public_key();
|
354 |
if (!$pl_key) {
|
355 |
return array(
|
356 |
+
'error' => 'Authentication failed. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP Admin Panel and add it again.'
|
357 |
);
|
358 |
}
|
359 |
|
364 |
return true;
|
365 |
} else if ($verify == 0) {
|
366 |
return array(
|
367 |
+
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP Admin Panel and add it again.'
|
368 |
);
|
369 |
} else {
|
370 |
return array(
|
378 |
return true;
|
379 |
}
|
380 |
return array(
|
381 |
+
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP Admin Panel and add it again.'
|
382 |
);
|
383 |
}
|
384 |
// no rand key - deleted in get_stat maybe
|
385 |
else
|
386 |
return array(
|
387 |
+
'error' => 'Invalid message signature. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP Admin Panel and add it again.'
|
388 |
);
|
389 |
}
|
390 |
|
499 |
}
|
500 |
|
501 |
|
502 |
+
|
503 |
|
504 |
|
505 |
}
|
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.0.
|
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.0.
|
30 |
|
31 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
32 |
$siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
|
@@ -51,6 +51,26 @@ require_once("$iwp_mmb_plugin_dir/plugins/search/search.php");
|
|
51 |
require_once("$iwp_mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if( !function_exists ('iwp_mmb_parse_request')) {
|
55 |
function iwp_mmb_parse_request()
|
56 |
{
|
@@ -65,6 +85,10 @@ if( !function_exists ('iwp_mmb_parse_request')) {
|
|
65 |
if ($data){
|
66 |
//$num = @extract(unserialize($data));
|
67 |
$unserialized_data = unserialize($data);
|
|
|
|
|
|
|
|
|
68 |
$iwp_action = $unserialized_data['iwp_action'];
|
69 |
$params = $unserialized_data['params'];
|
70 |
$id = $unserialized_data['id'];
|
@@ -339,7 +363,11 @@ if( !function_exists ( 'iwp_mmb_get_backup_req' )) {
|
|
339 |
$iwp_mmb_core->get_stats_instance();
|
340 |
$return = $iwp_mmb_core->stats_instance->get_backup_req($params);
|
341 |
|
|
|
|
|
|
|
342 |
iwp_mmb_response($return, true);
|
|
|
343 |
}
|
344 |
}
|
345 |
|
@@ -391,6 +419,9 @@ if( !function_exists ( 'iwp_mmb_restore_now' )) {
|
|
391 |
}
|
392 |
}
|
393 |
|
|
|
|
|
|
|
394 |
if( !function_exists ( 'iwp_mmb_clean_orphan_backups' )) {
|
395 |
function iwp_mmb_clean_orphan_backups()
|
396 |
{
|
@@ -524,15 +555,14 @@ if( !function_exists ( 'iwp_mmb_set_alerts' )) {
|
|
524 |
$iwp_mmb_core->get_stats_instance();
|
525 |
$return = $iwp_mmb_core->stats_instance->set_alerts($params);
|
526 |
iwp_mmb_response(true, true);
|
527 |
-
}
|
528 |
-
|
529 |
}
|
530 |
|
531 |
if(!function_exists('iwp_mmb_more_reccurences')){
|
532 |
//Backup Tasks
|
533 |
add_filter('cron_schedules', 'iwp_mmb_more_reccurences');
|
534 |
function iwp_mmb_more_reccurences($schedules) {
|
535 |
-
|
536 |
$schedules['minutely'] = array('interval' => 60, 'display' => 'Once in a minute');
|
537 |
$schedules['fiveminutes'] = array('interval' => 300, 'display' => 'Once every five minutes');
|
538 |
$schedules['tenminutes'] = array('interval' => 600, 'display' => 'Once every ten minutes');
|
@@ -541,6 +571,18 @@ if(!function_exists('iwp_mmb_more_reccurences')){
|
|
541 |
}
|
542 |
}
|
543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
if( !function_exists('iwp_check_notifications') ){
|
545 |
function iwp_check_notifications() {
|
546 |
global $iwp_mmb_core, $_wp_using_ext_object_cache;
|
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.0.3
|
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.0.3');
|
30 |
|
31 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
32 |
$siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
|
51 |
require_once("$iwp_mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
52 |
|
53 |
|
54 |
+
if( !function_exists ( 'iwp_mmb_filter_params' )) {
|
55 |
+
function iwp_mmb_filter_params( $array = array() ){
|
56 |
+
|
57 |
+
$filter = array( 'current_user', 'wpdb' );
|
58 |
+
$return = array();
|
59 |
+
foreach ($array as $key => $val) {
|
60 |
+
if( !is_int($key) && in_array($key, $filter) )
|
61 |
+
continue;
|
62 |
+
|
63 |
+
if( is_array( $val ) ) {
|
64 |
+
$return[$key] = iwp_mmb_filter_params( $val );
|
65 |
+
} else {
|
66 |
+
$return[$key] = $val;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $return;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
if( !function_exists ('iwp_mmb_parse_request')) {
|
75 |
function iwp_mmb_parse_request()
|
76 |
{
|
85 |
if ($data){
|
86 |
//$num = @extract(unserialize($data));
|
87 |
$unserialized_data = unserialize($data);
|
88 |
+
if(isset($unserialized_data['params'])){
|
89 |
+
$unserialized_data['params'] = iwp_mmb_filter_params($unserialized_data['params']);
|
90 |
+
}
|
91 |
+
|
92 |
$iwp_action = $unserialized_data['iwp_action'];
|
93 |
$params = $unserialized_data['params'];
|
94 |
$id = $unserialized_data['id'];
|
363 |
$iwp_mmb_core->get_stats_instance();
|
364 |
$return = $iwp_mmb_core->stats_instance->get_backup_req($params);
|
365 |
|
366 |
+
if (is_array($return) && array_key_exists('error', $return))
|
367 |
+
iwp_mmb_response($return['error'], false);
|
368 |
+
else {
|
369 |
iwp_mmb_response($return, true);
|
370 |
+
}
|
371 |
}
|
372 |
}
|
373 |
|
419 |
}
|
420 |
}
|
421 |
|
422 |
+
|
423 |
+
|
424 |
+
|
425 |
if( !function_exists ( 'iwp_mmb_clean_orphan_backups' )) {
|
426 |
function iwp_mmb_clean_orphan_backups()
|
427 |
{
|
555 |
$iwp_mmb_core->get_stats_instance();
|
556 |
$return = $iwp_mmb_core->stats_instance->set_alerts($params);
|
557 |
iwp_mmb_response(true, true);
|
558 |
+
}
|
|
|
559 |
}
|
560 |
|
561 |
if(!function_exists('iwp_mmb_more_reccurences')){
|
562 |
//Backup Tasks
|
563 |
add_filter('cron_schedules', 'iwp_mmb_more_reccurences');
|
564 |
function iwp_mmb_more_reccurences($schedules) {
|
565 |
+
$schedules['halfminute'] = array('interval' => 30, 'display' => 'Once in a half minute');
|
566 |
$schedules['minutely'] = array('interval' => 60, 'display' => 'Once in a minute');
|
567 |
$schedules['fiveminutes'] = array('interval' => 300, 'display' => 'Once every five minutes');
|
568 |
$schedules['tenminutes'] = array('interval' => 600, 'display' => 'Once every ten minutes');
|
571 |
}
|
572 |
}
|
573 |
|
574 |
+
add_action('iwp_client_backup_tasks', 'iwp_client_check_backup_tasks');
|
575 |
+
|
576 |
+
if( !function_exists('iwp_client_check_backup_tasks') ){
|
577 |
+
function iwp_client_check_backup_tasks() {
|
578 |
+
global $iwp_mmb_core, $_wp_using_ext_object_cache;
|
579 |
+
$_wp_using_ext_object_cache = false;
|
580 |
+
|
581 |
+
$iwp_mmb_core->get_backup_instance();
|
582 |
+
$iwp_mmb_core->backup_instance->check_backup_tasks();
|
583 |
+
}
|
584 |
+
}
|
585 |
+
|
586 |
if( !function_exists('iwp_check_notifications') ){
|
587 |
function iwp_check_notifications() {
|
588 |
global $iwp_mmb_core, $_wp_using_ext_object_cache;
|
installer.class.php
CHANGED
@@ -58,7 +58,13 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
58 |
return array(
|
59 |
'error' => '<p>No files received. Internal error.</p>'
|
60 |
);
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
if (defined('WP_INSTALLING') && file_exists(ABSPATH . '.maintenance'))
|
63 |
return array(
|
64 |
'error' => '<p>Site under maintanace.</p>'
|
@@ -128,12 +134,12 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
128 |
{
|
129 |
if ($params == null || empty($params))
|
130 |
return array(
|
131 |
-
'
|
132 |
);
|
133 |
|
134 |
if (!$this->is_server_writable()) {
|
135 |
return array(
|
136 |
-
'error' => 'Failed
|
137 |
);
|
138 |
}
|
139 |
|
@@ -543,7 +549,7 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
543 |
}
|
544 |
}
|
545 |
|
546 |
-
function get_upgradable_plugins()
|
547 |
{
|
548 |
$current = $this->iwp_mmb_get_transient('update_plugins');
|
549 |
|
@@ -556,6 +562,9 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
556 |
continue;
|
557 |
|
558 |
$data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
|
|
|
|
|
|
|
559 |
if (strlen($data['Name']) > 0 && strlen($data['Version']) > 0) {
|
560 |
$current->response[$plugin_path]->name = $data['Name'];
|
561 |
$current->response[$plugin_path]->old_version = $data['Version'];
|
@@ -569,7 +578,7 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
569 |
return array();
|
570 |
}
|
571 |
|
572 |
-
function get_upgradable_themes()
|
573 |
{
|
574 |
$all_themes = get_themes();
|
575 |
$upgrade_themes = array();
|
@@ -580,6 +589,9 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
580 |
if(isset($theme_data['Parent Theme']) && !empty($theme_data['Parent Theme']))
|
581 |
continue;
|
582 |
|
|
|
|
|
|
|
583 |
foreach ($current->response as $current_themes => $theme) {
|
584 |
if ($theme_data['Template'] == $current_themes) {
|
585 |
if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
|
@@ -640,17 +652,31 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
640 |
if ($plugin['Name'] != 'InfiniteWP - Client') {
|
641 |
if (in_array($path, $activated_plugins)) {
|
642 |
$plugins['active'][$br_a]['path'] = $path;
|
643 |
-
$plugins['active'][$br_a]['name'] = $plugin['Name'];
|
644 |
$br_a++;
|
645 |
}
|
646 |
|
647 |
if (!in_array($path, $activated_plugins)) {
|
648 |
$plugins['inactive'][$br_i]['path'] = $path;
|
649 |
-
$plugins['inactive'][$br_i]['name'] = $plugin['Name'];
|
650 |
$br_i++;
|
651 |
}
|
652 |
|
653 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
}
|
655 |
}
|
656 |
|
@@ -681,14 +707,14 @@ class IWP_MMB_Installer extends IWP_MMB_Core
|
|
681 |
foreach ($all_themes as $theme_name => $theme) {
|
682 |
if ($current_theme == $theme_name) {
|
683 |
$themes['active'][$br_a]['path'] = $theme['Template'];
|
684 |
-
$themes['active'][$br_a]['name'] = $theme['Name'];
|
685 |
$themes['active'][$br_a]['stylesheet'] = $theme['Stylesheet'];
|
686 |
$br_a++;
|
687 |
}
|
688 |
|
689 |
if ($current_theme != $theme_name) {
|
690 |
$themes['inactive'][$br_i]['path'] = $theme['Template'];
|
691 |
-
$themes['inactive'][$br_i]['name'] = $theme['Name'];
|
692 |
$themes['inactive'][$br_i]['stylesheet'] = $theme['Stylesheet'];
|
693 |
$br_i++;
|
694 |
}
|
58 |
return array(
|
59 |
'error' => '<p>No files received. Internal error.</p>'
|
60 |
);
|
61 |
+
|
62 |
+
if (!$this->is_server_writable()) {
|
63 |
+
return array(
|
64 |
+
'error' => 'Failed, please add FTP details'
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
if (defined('WP_INSTALLING') && file_exists(ABSPATH . '.maintenance'))
|
69 |
return array(
|
70 |
'error' => '<p>Site under maintanace.</p>'
|
134 |
{
|
135 |
if ($params == null || empty($params))
|
136 |
return array(
|
137 |
+
'error' => 'No upgrades passed.'
|
138 |
);
|
139 |
|
140 |
if (!$this->is_server_writable()) {
|
141 |
return array(
|
142 |
+
'error' => 'Failed. please add FTP details.'
|
143 |
);
|
144 |
}
|
145 |
|
549 |
}
|
550 |
}
|
551 |
|
552 |
+
function get_upgradable_plugins( $filter = array() )
|
553 |
{
|
554 |
$current = $this->iwp_mmb_get_transient('update_plugins');
|
555 |
|
562 |
continue;
|
563 |
|
564 |
$data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
|
565 |
+
if(isset($data['Name']) && in_array($data['Name'], $filter))
|
566 |
+
continue;
|
567 |
+
|
568 |
if (strlen($data['Name']) > 0 && strlen($data['Version']) > 0) {
|
569 |
$current->response[$plugin_path]->name = $data['Name'];
|
570 |
$current->response[$plugin_path]->old_version = $data['Version'];
|
578 |
return array();
|
579 |
}
|
580 |
|
581 |
+
function get_upgradable_themes( $filter = array() )
|
582 |
{
|
583 |
$all_themes = get_themes();
|
584 |
$upgrade_themes = array();
|
589 |
if(isset($theme_data['Parent Theme']) && !empty($theme_data['Parent Theme']))
|
590 |
continue;
|
591 |
|
592 |
+
if(isset($theme_data['Name']) && in_array($theme_data['Name'], $filter))
|
593 |
+
continue;
|
594 |
+
|
595 |
foreach ($current->response as $current_themes => $theme) {
|
596 |
if ($theme_data['Template'] == $current_themes) {
|
597 |
if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
|
652 |
if ($plugin['Name'] != 'InfiniteWP - Client') {
|
653 |
if (in_array($path, $activated_plugins)) {
|
654 |
$plugins['active'][$br_a]['path'] = $path;
|
655 |
+
$plugins['active'][$br_a]['name'] = strip_tags($plugin['Name']);
|
656 |
$br_a++;
|
657 |
}
|
658 |
|
659 |
if (!in_array($path, $activated_plugins)) {
|
660 |
$plugins['inactive'][$br_i]['path'] = $path;
|
661 |
+
$plugins['inactive'][$br_i]['name'] = strip_tags($plugin['Name']);
|
662 |
$br_i++;
|
663 |
}
|
664 |
|
665 |
}
|
666 |
+
|
667 |
+
if ($search) {
|
668 |
+
foreach ($plugins['active'] as $k => $plugin) {
|
669 |
+
if (!stristr($plugin['name'], $search)) {
|
670 |
+
unset($plugins['active'][$k]);
|
671 |
+
}
|
672 |
+
}
|
673 |
+
|
674 |
+
foreach ($plugins['inactive'] as $k => $plugin) {
|
675 |
+
if (!stristr($plugin['name'], $search)) {
|
676 |
+
unset($plugins['inactive'][$k]);
|
677 |
+
}
|
678 |
+
}
|
679 |
+
}
|
680 |
}
|
681 |
}
|
682 |
|
707 |
foreach ($all_themes as $theme_name => $theme) {
|
708 |
if ($current_theme == $theme_name) {
|
709 |
$themes['active'][$br_a]['path'] = $theme['Template'];
|
710 |
+
$themes['active'][$br_a]['name'] = strip_tags($theme['Name']);
|
711 |
$themes['active'][$br_a]['stylesheet'] = $theme['Stylesheet'];
|
712 |
$br_a++;
|
713 |
}
|
714 |
|
715 |
if ($current_theme != $theme_name) {
|
716 |
$themes['inactive'][$br_i]['path'] = $theme['Template'];
|
717 |
+
$themes['inactive'][$br_i]['name'] = strip_tags($theme['Name']);
|
718 |
$themes['inactive'][$br_i]['stylesheet'] = $theme['Stylesheet'];
|
719 |
$br_i++;
|
720 |
}
|
plugins/cleanup/cleanup.php
CHANGED
@@ -21,6 +21,9 @@ add_filter('iwp_mmb_stats_filter', 'iwp_mmb_get_extended_info');
|
|
21 |
|
22 |
function iwp_mmb_get_extended_info($stats)
|
23 |
{
|
|
|
|
|
|
|
24 |
$stats['num_revisions'] = iwp_mmb_num_revisions();
|
25 |
//$stats['num_revisions'] = 5;
|
26 |
$stats['overhead'] = iwp_mmb_handle_overhead(false);
|
@@ -35,13 +38,16 @@ iwp_mmb_add_action('cleanup_delete', 'iwp_mmb_cleanup_delete_client');
|
|
35 |
function iwp_mmb_cleanup_delete_client($params = array())
|
36 |
{
|
37 |
global $iwp_mmb_core;
|
|
|
|
|
38 |
|
39 |
$params_array = explode('_', $params['actions']);
|
40 |
$return_array = array();
|
|
|
41 |
foreach ($params_array as $param) {
|
42 |
switch ($param) {
|
43 |
case 'revision':
|
44 |
-
if (iwp_mmb_delete_all_revisions()) {
|
45 |
$return_array['revision'] = 'OK';
|
46 |
} else {
|
47 |
$return_array['revision_error'] = 'Failed, please try again';
|
21 |
|
22 |
function iwp_mmb_get_extended_info($stats)
|
23 |
{
|
24 |
+
global $iwp_mmb_core;
|
25 |
+
$params = get_option('iwp_mmb_stats_filter');
|
26 |
+
$filter = isset($params['plugins']['cleanup']) ? $params['plugins']['cleanup'] : array();
|
27 |
$stats['num_revisions'] = iwp_mmb_num_revisions();
|
28 |
//$stats['num_revisions'] = 5;
|
29 |
$stats['overhead'] = iwp_mmb_handle_overhead(false);
|
38 |
function iwp_mmb_cleanup_delete_client($params = array())
|
39 |
{
|
40 |
global $iwp_mmb_core;
|
41 |
+
$revision_params = get_option('iwp_mmb_stats_filter');
|
42 |
+
$revision_filter = isset($revision_params['plugins']['cleanup']) ? $revision_params['plugins']['cleanup'] : array();
|
43 |
|
44 |
$params_array = explode('_', $params['actions']);
|
45 |
$return_array = array();
|
46 |
+
|
47 |
foreach ($params_array as $param) {
|
48 |
switch ($param) {
|
49 |
case 'revision':
|
50 |
+
if (iwp_mmb_delete_all_revisions($revision_filter['revisions'])) {
|
51 |
$return_array['revision'] = 'OK';
|
52 |
} else {
|
53 |
$return_array['revision_error'] = 'Failed, please try again';
|
readme.txt
CHANGED
@@ -45,6 +45,10 @@ Check out [InfiniteWP.com](http://infinitewp.com/ "Manage Multiple WordPress").
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
|
|
48 |
= 1.0.2 =
|
49 |
* Bugs fixed
|
50 |
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= 1.0.3 =
|
49 |
+
* WordPress Multisite Backup issue fixed
|
50 |
+
* Bugs fixed
|
51 |
+
|
52 |
= 1.0.2 =
|
53 |
* Bugs fixed
|
54 |
|
stats.class.php
CHANGED
@@ -513,6 +513,7 @@ class IWP_MMB_Stats extends IWP_MMB_Core
|
|
513 |
|
514 |
function set_hit_count($fix_count = false)
|
515 |
{
|
|
|
516 |
if ($fix_count || (!is_admin() && !IWP_MMB_Stats::is_bot())) {
|
517 |
$date = date('Y-m-d');
|
518 |
$iwp_client_user_hit_count = (array) get_option('iwp_client_user_hit_count');
|
@@ -766,5 +767,20 @@ class IWP_MMB_Stats extends IWP_MMB_Core
|
|
766 |
update_option('iwp_client_pageview_alerts',array('site_id' => $site_id,'alert' => $alert,'url' => $url));
|
767 |
}
|
768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
}
|
770 |
?>
|
513 |
|
514 |
function set_hit_count($fix_count = false)
|
515 |
{
|
516 |
+
global $iwp_mmb_core;
|
517 |
if ($fix_count || (!is_admin() && !IWP_MMB_Stats::is_bot())) {
|
518 |
$date = date('Y-m-d');
|
519 |
$iwp_client_user_hit_count = (array) get_option('iwp_client_user_hit_count');
|
767 |
update_option('iwp_client_pageview_alerts',array('site_id' => $site_id,'alert' => $alert,'url' => $url));
|
768 |
}
|
769 |
|
770 |
+
public static function readd_alerts( $params = array() ){
|
771 |
+
if( empty($params) || !isset($params['alerts']))
|
772 |
+
return $params;
|
773 |
+
|
774 |
+
if( !empty($params['alerts']) ){
|
775 |
+
update_option('iwp_client_pageview_alerts', $params['alerts']);
|
776 |
+
unset($params['alerts']);
|
777 |
+
}
|
778 |
+
|
779 |
+
return $params;
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
if( function_exists('add_filter') ){
|
784 |
+
add_filter( 'iwp_website_add', 'IWP_MMB_Stats::readd_alerts' );
|
785 |
}
|
786 |
?>
|