Version Description
- New: Full range of SEO Statistics now trackable for your websites (Google Page Rank and Page Speed, Backlinks and 20+ more)
- New: Google keyword rank tracking with history
- New: Uptime monitoring (5 min interval with email/SMS notification)
- New: Insights into server PHP error logs right in your dashboard
- New: Remote maintenance mode for your websites
- Fix: A bug when a completed backup was reported as failed
Download this release
Release Info
| Developer | freediver |
| Plugin | |
| Version | 3.9.15 |
| Comparing to | |
| See all releases | |
Code changes from version 3.9.14 to 3.9.15
- backup.class.php +87 -15
- core.class.php +13 -7
- init.php +76 -5
- installer.class.php +53 -30
- plugins/cleanup/cleanup.php +1 -0
- post.class.php +33 -0
- readme.txt +13 -0
- stats.class.php +80 -39
- version +1 -1
backup.class.php
CHANGED
|
@@ -159,7 +159,6 @@ class MMB_Backup extends MMB_Core
|
|
| 159 |
//Cron check
|
| 160 |
function check_backup_tasks()
|
| 161 |
{
|
| 162 |
-
//$settings = $this->get_backup_settings();
|
| 163 |
$settings = $this->tasks;
|
| 164 |
if (is_array($settings) && !empty($settings)) {
|
| 165 |
foreach ($settings as $task_name => $setting) {
|
|
@@ -173,15 +172,27 @@ class MMB_Backup extends MMB_Core
|
|
| 173 |
'site_key' => $setting['task_args']['site_key']
|
| 174 |
);
|
| 175 |
|
| 176 |
-
$this->validate_task($check_data, $setting['task_args']['url']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
|
| 179 |
//Update task with next schedule
|
| 180 |
-
$this->set_backup_task(
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
|
|
|
| 185 |
|
| 186 |
$result = $this->backup($setting['task_args'], $task_name);
|
| 187 |
$error = '';
|
|
@@ -202,6 +213,38 @@ class MMB_Backup extends MMB_Core
|
|
| 202 |
|
| 203 |
}
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
|
| 207 |
/*
|
|
@@ -571,9 +614,8 @@ class MMB_Backup extends MMB_Core
|
|
| 571 |
$this->update_status($task_name, $this->statuses['files_zip']);
|
| 572 |
chdir(ABSPATH);
|
| 573 |
ob_start();
|
| 574 |
-
$command = "$zip -q -j $comp_level $backup_file * $exclude_data";
|
| 575 |
$result_f = $this->mmb_exec($command, false, true);
|
| 576 |
-
|
| 577 |
if (!$result_f || $result_f == 18) { // disregard permissions error, file can't be accessed
|
| 578 |
$command = "$zip -q -r $comp_level $backup_file $include_data $exclude_data";
|
| 579 |
$result_d = $this->mmb_exec($command, false, true);
|
|
@@ -782,7 +824,7 @@ class MMB_Backup extends MMB_Core
|
|
| 782 |
$backup_file = download_url($backup_url);
|
| 783 |
if (is_wp_error($backup_file)) {
|
| 784 |
return array(
|
| 785 |
-
'error' =>
|
| 786 |
);
|
| 787 |
}
|
| 788 |
$what = 'full';
|
|
@@ -844,6 +886,7 @@ class MMB_Backup extends MMB_Core
|
|
| 844 |
|
| 845 |
$clone_options['mwp_backup_tasks'] = serialize(get_option('mwp_backup_tasks'));
|
| 846 |
$clone_options['mwp_notifications'] = serialize(get_option('mwp_notifications'));
|
|
|
|
| 847 |
|
| 848 |
|
| 849 |
}
|
|
@@ -968,6 +1011,13 @@ class MMB_Backup extends MMB_Core
|
|
| 968 |
}
|
| 969 |
}
|
| 970 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 971 |
}
|
| 972 |
|
| 973 |
return true;
|
|
@@ -978,6 +1028,7 @@ class MMB_Backup extends MMB_Core
|
|
| 978 |
global $wpdb;
|
| 979 |
$paths = $this->check_mysql_paths();
|
| 980 |
$file_path = ABSPATH . 'mwp_db';
|
|
|
|
| 981 |
$file_name = glob($file_path . '/*.sql');
|
| 982 |
$file_name = $file_name[0];
|
| 983 |
|
|
@@ -1597,8 +1648,8 @@ class MMB_Backup extends MMB_Core
|
|
| 1597 |
}
|
| 1598 |
}
|
| 1599 |
}
|
| 1600 |
-
|
| 1601 |
-
|
| 1602 |
|
| 1603 |
}
|
| 1604 |
}
|
|
@@ -1611,7 +1662,7 @@ class MMB_Backup extends MMB_Core
|
|
| 1611 |
$tasks = $this->tasks;
|
| 1612 |
if (is_array($tasks) && !empty($tasks)) {
|
| 1613 |
foreach ($tasks as $task_name => $info) {
|
| 1614 |
-
$stats[$task_name] = $info['task_args']['next'];
|
| 1615 |
}
|
| 1616 |
}
|
| 1617 |
return $stats;
|
|
@@ -1664,7 +1715,11 @@ class MMB_Backup extends MMB_Core
|
|
| 1664 |
|
| 1665 |
} //end foreach
|
| 1666 |
|
| 1667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1668 |
$this->update_tasks($backups);
|
| 1669 |
//update_option('mwp_backup_tasks', $backups);
|
| 1670 |
}
|
|
@@ -1862,7 +1917,11 @@ class MMB_Backup extends MMB_Core
|
|
| 1862 |
$this->update_tasks($tasks);
|
| 1863 |
$this->cleanup();
|
| 1864 |
exit;
|
| 1865 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1866 |
}
|
| 1867 |
|
| 1868 |
function update_status($task_name, $status, $completed = false)
|
|
@@ -1912,6 +1971,19 @@ class MMB_Backup extends MMB_Core
|
|
| 1912 |
}
|
| 1913 |
}
|
| 1914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1915 |
}
|
| 1916 |
|
| 1917 |
?>
|
| 159 |
//Cron check
|
| 160 |
function check_backup_tasks()
|
| 161 |
{
|
|
|
|
| 162 |
$settings = $this->tasks;
|
| 163 |
if (is_array($settings) && !empty($settings)) {
|
| 164 |
foreach ($settings as $task_name => $setting) {
|
| 172 |
'site_key' => $setting['task_args']['site_key']
|
| 173 |
);
|
| 174 |
|
| 175 |
+
$check = $this->validate_task($check_data, $setting['task_args']['url']);
|
| 176 |
+
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
$update = array(
|
| 180 |
+
'task_name' => $task_name,
|
| 181 |
+
'args' => $settings[$task_name]['task_args']
|
| 182 |
+
);
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
if($check != 'paused'){
|
| 186 |
+
$update['time'] = time();
|
| 187 |
}
|
| 188 |
|
| 189 |
//Update task with next schedule
|
| 190 |
+
$this->set_backup_task($update);
|
| 191 |
+
|
| 192 |
+
if($check == 'paused'){
|
| 193 |
+
continue;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
|
| 197 |
$result = $this->backup($setting['task_args'], $task_name);
|
| 198 |
$error = '';
|
| 213 |
|
| 214 |
}
|
| 215 |
|
| 216 |
+
function task_now($task_name){
|
| 217 |
+
|
| 218 |
+
$settings = $this->tasks;
|
| 219 |
+
if(!array_key_exists($task_name,$settings)){
|
| 220 |
+
return array('error' => $task_name." does not exist.");
|
| 221 |
+
} else {
|
| 222 |
+
$setting = $settings[$task_name];
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
$this->set_backup_task(array(
|
| 226 |
+
'task_name' => $task_name,
|
| 227 |
+
'args' => $settings[$task_name]['task_args'],
|
| 228 |
+
'time' => time()
|
| 229 |
+
));
|
| 230 |
+
|
| 231 |
+
//Run backup
|
| 232 |
+
$result = $this->backup($setting['task_args'], $task_name);
|
| 233 |
+
|
| 234 |
+
//Check for error
|
| 235 |
+
if (is_array($result) && array_key_exists('error', $result)) {
|
| 236 |
+
$this->set_backup_task(array(
|
| 237 |
+
'task_name' => $task_name,
|
| 238 |
+
'args' => $settings[$task_name]['task_args'],
|
| 239 |
+
'error' => $result['error']
|
| 240 |
+
));
|
| 241 |
+
return $result;
|
| 242 |
+
} else {
|
| 243 |
+
return $this->get_backup_stats();
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
|
| 249 |
|
| 250 |
/*
|
| 614 |
$this->update_status($task_name, $this->statuses['files_zip']);
|
| 615 |
chdir(ABSPATH);
|
| 616 |
ob_start();
|
| 617 |
+
$command = "$zip -q -j $comp_level $backup_file .* * $exclude_data";
|
| 618 |
$result_f = $this->mmb_exec($command, false, true);
|
|
|
|
| 619 |
if (!$result_f || $result_f == 18) { // disregard permissions error, file can't be accessed
|
| 620 |
$command = "$zip -q -r $comp_level $backup_file $include_data $exclude_data";
|
| 621 |
$result_d = $this->mmb_exec($command, false, true);
|
| 824 |
$backup_file = download_url($backup_url);
|
| 825 |
if (is_wp_error($backup_file)) {
|
| 826 |
return array(
|
| 827 |
+
'error' => 'Unable to download backup file ('.$backup_file->get_error_message().')'
|
| 828 |
);
|
| 829 |
}
|
| 830 |
$what = 'full';
|
| 886 |
|
| 887 |
$clone_options['mwp_backup_tasks'] = serialize(get_option('mwp_backup_tasks'));
|
| 888 |
$clone_options['mwp_notifications'] = serialize(get_option('mwp_notifications'));
|
| 889 |
+
$clone_options['mwp_pageview_alerts'] = serialize(get_option('mwp_pageview_alerts'));
|
| 890 |
|
| 891 |
|
| 892 |
}
|
| 1011 |
}
|
| 1012 |
}
|
| 1013 |
}
|
| 1014 |
+
|
| 1015 |
+
//Remove hit count
|
| 1016 |
+
$query = "DELETE FROM " . $new_table_prefix . "options WHERE option_name = 'user_hit_count'";
|
| 1017 |
+
$wpdb->query($wpdb->prepare($query));
|
| 1018 |
+
|
| 1019 |
+
//Check for .htaccess permalinks update
|
| 1020 |
+
$this->replace_htaccess($home);
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
return true;
|
| 1028 |
global $wpdb;
|
| 1029 |
$paths = $this->check_mysql_paths();
|
| 1030 |
$file_path = ABSPATH . 'mwp_db';
|
| 1031 |
+
@chmod($file_path,0755);
|
| 1032 |
$file_name = glob($file_path . '/*.sql');
|
| 1033 |
$file_name = $file_name[0];
|
| 1034 |
|
| 1648 |
}
|
| 1649 |
}
|
| 1650 |
}
|
| 1651 |
+
if (is_array($info['task_results']))
|
| 1652 |
+
$stats[$task_name] = array_values($info['task_results']);
|
| 1653 |
|
| 1654 |
}
|
| 1655 |
}
|
| 1662 |
$tasks = $this->tasks;
|
| 1663 |
if (is_array($tasks) && !empty($tasks)) {
|
| 1664 |
foreach ($tasks as $task_name => $info) {
|
| 1665 |
+
$stats[$task_name] = isset($info['task_args']['next']) ? $info['task_args']['next'] : array();
|
| 1666 |
}
|
| 1667 |
}
|
| 1668 |
return $stats;
|
| 1715 |
|
| 1716 |
} //end foreach
|
| 1717 |
|
| 1718 |
+
if (is_array($backups[$task_name]['task_results']))
|
| 1719 |
+
$backups[$task_name]['task_results'] = array_values($backups[$task_name]['task_results']);
|
| 1720 |
+
else
|
| 1721 |
+
$backups[$task_name]['task_results']=array();
|
| 1722 |
+
|
| 1723 |
$this->update_tasks($backups);
|
| 1724 |
//update_option('mwp_backup_tasks', $backups);
|
| 1725 |
}
|
| 1917 |
$this->update_tasks($tasks);
|
| 1918 |
$this->cleanup();
|
| 1919 |
exit;
|
| 1920 |
+
} elseif(is_array($result) && $result['body'] == 'mwp_pause_task'){
|
| 1921 |
+
return 'paused';
|
| 1922 |
+
}
|
| 1923 |
+
|
| 1924 |
+
return 'ok';
|
| 1925 |
}
|
| 1926 |
|
| 1927 |
function update_status($task_name, $status, $completed = false)
|
| 1971 |
}
|
| 1972 |
}
|
| 1973 |
|
| 1974 |
+
function replace_htaccess($url)
|
| 1975 |
+
{
|
| 1976 |
+
$file = @file_get_contents(ABSPATH.'.htaccess');
|
| 1977 |
+
if ($file && strlen($file)) {
|
| 1978 |
+
$args = parse_url($url);
|
| 1979 |
+
$string = rtrim($args['path'], "/");
|
| 1980 |
+
$regex = "/BEGIN WordPress(.*?)RewriteBase(.*?)\n(.*?)RewriteRule \.(.*?)index\.php(.*?)END WordPress/sm";
|
| 1981 |
+
$replace = "BEGIN WordPress$1RewriteBase " . $string . "/ \n$3RewriteRule . " . $string . "/index.php$5END WordPress";
|
| 1982 |
+
$file = preg_replace($regex, $replace, $file);
|
| 1983 |
+
@file_put_contents(ABSPATH.'.htaccess', $file);
|
| 1984 |
+
}
|
| 1985 |
+
}
|
| 1986 |
+
|
| 1987 |
}
|
| 1988 |
|
| 1989 |
?>
|
core.class.php
CHANGED
|
@@ -92,10 +92,11 @@ class MMB_Core extends MMB_Helper
|
|
| 92 |
$_mmb_item_filter['get'] = array( 'updates', 'errors' );
|
| 93 |
|
| 94 |
$this->mmb_pre_init_actions = array(
|
| 95 |
-
'
|
| 96 |
-
'backup_req' => 'mmb_get_backup_req'
|
| 97 |
);
|
|
|
|
| 98 |
$this->mmb_init_actions = array(
|
|
|
|
| 99 |
'get_stats' => 'mmb_stats_get',
|
| 100 |
'remove_site' => 'mmb_remove_site',
|
| 101 |
'backup_clone' => 'mmb_backup_now',
|
|
@@ -113,6 +114,7 @@ class MMB_Core extends MMB_Helper
|
|
| 113 |
'email_backup' => 'mmb_email_backup',
|
| 114 |
'check_backup_compat' => 'mmb_check_backup_compat',
|
| 115 |
'scheduled_backup' => 'mmb_scheduled_backup',
|
|
|
|
| 116 |
'execute_php_code' => 'mmb_execute_php_code',
|
| 117 |
'delete_backup' => 'mmm_delete_backup',
|
| 118 |
'remote_backup_now' => 'mmb_remote_backup_now',
|
|
@@ -122,10 +124,12 @@ class MMB_Core extends MMB_Helper
|
|
| 122 |
'edit_users' => 'mmb_edit_users',
|
| 123 |
'get_plugins_themes' => 'mmb_get_plugins_themes',
|
| 124 |
'edit_plugins_themes' => 'mmb_edit_plugins_themes',
|
| 125 |
-
'worker_brand' => 'mmb_worker_brand'
|
|
|
|
|
|
|
| 126 |
);
|
| 127 |
|
| 128 |
-
|
| 129 |
add_action('admin_init', array(&$this,'admin_actions'));
|
| 130 |
add_action('init', array( &$this, 'mmb_remote_action'), 9999);
|
| 131 |
add_action('setup_theme', 'mmb_parse_request');
|
|
@@ -414,6 +418,7 @@ class MMB_Core extends MMB_Helper
|
|
| 414 |
delete_option('mwp_backup_tasks');
|
| 415 |
delete_option('mwp_notifications');
|
| 416 |
delete_option('mwp_worker_brand');
|
|
|
|
| 417 |
|
| 418 |
}
|
| 419 |
|
|
@@ -450,6 +455,7 @@ class MMB_Core extends MMB_Helper
|
|
| 450 |
delete_blog_option($blog_id, '_worker_nossl_key');
|
| 451 |
delete_blog_option($blog_id, '_worker_public_key');
|
| 452 |
delete_blog_option($blog_id, '_action_message_id');
|
|
|
|
| 453 |
}
|
| 454 |
}
|
| 455 |
} else {
|
|
@@ -468,14 +474,14 @@ class MMB_Core extends MMB_Helper
|
|
| 468 |
delete_option('_action_message_id');
|
| 469 |
}
|
| 470 |
|
| 471 |
-
//Delete
|
|
|
|
| 472 |
delete_option('mwp_backup_tasks');
|
| 473 |
wp_clear_scheduled_hook('mwp_backup_tasks');
|
| 474 |
-
|
| 475 |
-
//Delete notifications
|
| 476 |
delete_option('mwp_notifications');
|
| 477 |
wp_clear_scheduled_hook('mwp_notifications');
|
| 478 |
delete_option('mwp_worker_brand');
|
|
|
|
| 479 |
}
|
| 480 |
|
| 481 |
|
| 92 |
$_mmb_item_filter['get'] = array( 'updates', 'errors' );
|
| 93 |
|
| 94 |
$this->mmb_pre_init_actions = array(
|
| 95 |
+
'backup_req' => 'mmb_get_backup_req',
|
|
|
|
| 96 |
);
|
| 97 |
+
|
| 98 |
$this->mmb_init_actions = array(
|
| 99 |
+
'do_upgrade' => 'mmb_do_upgrade',
|
| 100 |
'get_stats' => 'mmb_stats_get',
|
| 101 |
'remove_site' => 'mmb_remove_site',
|
| 102 |
'backup_clone' => 'mmb_backup_now',
|
| 114 |
'email_backup' => 'mmb_email_backup',
|
| 115 |
'check_backup_compat' => 'mmb_check_backup_compat',
|
| 116 |
'scheduled_backup' => 'mmb_scheduled_backup',
|
| 117 |
+
'run_task' => 'mmb_run_task_now',
|
| 118 |
'execute_php_code' => 'mmb_execute_php_code',
|
| 119 |
'delete_backup' => 'mmm_delete_backup',
|
| 120 |
'remote_backup_now' => 'mmb_remote_backup_now',
|
| 124 |
'edit_users' => 'mmb_edit_users',
|
| 125 |
'get_plugins_themes' => 'mmb_get_plugins_themes',
|
| 126 |
'edit_plugins_themes' => 'mmb_edit_plugins_themes',
|
| 127 |
+
'worker_brand' => 'mmb_worker_brand',
|
| 128 |
+
'set_alerts' => 'mmb_set_alerts',
|
| 129 |
+
'maintenance' => 'mmb_maintenance_mode'
|
| 130 |
);
|
| 131 |
|
| 132 |
+
add_action('rightnow_end', array( &$this, 'add_right_now_info' ));
|
| 133 |
add_action('admin_init', array(&$this,'admin_actions'));
|
| 134 |
add_action('init', array( &$this, 'mmb_remote_action'), 9999);
|
| 135 |
add_action('setup_theme', 'mmb_parse_request');
|
| 418 |
delete_option('mwp_backup_tasks');
|
| 419 |
delete_option('mwp_notifications');
|
| 420 |
delete_option('mwp_worker_brand');
|
| 421 |
+
delete_option('mwp_pageview_alerts');
|
| 422 |
|
| 423 |
}
|
| 424 |
|
| 455 |
delete_blog_option($blog_id, '_worker_nossl_key');
|
| 456 |
delete_blog_option($blog_id, '_worker_public_key');
|
| 457 |
delete_blog_option($blog_id, '_action_message_id');
|
| 458 |
+
delete_blog_option($blog_id, 'mwp_maintenace_mode');
|
| 459 |
}
|
| 460 |
}
|
| 461 |
} else {
|
| 474 |
delete_option('_action_message_id');
|
| 475 |
}
|
| 476 |
|
| 477 |
+
//Delete options
|
| 478 |
+
delete_option('mwp_maintenace_mode');
|
| 479 |
delete_option('mwp_backup_tasks');
|
| 480 |
wp_clear_scheduled_hook('mwp_backup_tasks');
|
|
|
|
|
|
|
| 481 |
delete_option('mwp_notifications');
|
| 482 |
wp_clear_scheduled_hook('mwp_notifications');
|
| 483 |
delete_option('mwp_worker_brand');
|
| 484 |
+
delete_option('mwp_pageview_alerts');
|
| 485 |
}
|
| 486 |
|
| 487 |
|
init.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: ManageWP - Worker
|
|
| 4 |
Plugin URI: http://managewp.com/
|
| 5 |
Description: Manage all your blogs from one dashboard. Visit <a href="http://managewp.com">ManageWP.com</a> to sign up.
|
| 6 |
Author: Prelovac Media
|
| 7 |
-
Version: 3.9.
|
| 8 |
Author URI: http://www.prelovac.com
|
| 9 |
*/
|
| 10 |
|
|
@@ -20,14 +20,13 @@ Author URI: http://www.prelovac.com
|
|
| 20 |
**************************************************************/
|
| 21 |
|
| 22 |
if(!defined('MMB_WORKER_VERSION'))
|
| 23 |
-
define('MMB_WORKER_VERSION', '3.9.
|
| 24 |
|
| 25 |
if ( !defined('MMB_XFRAME_COOKIE')){
|
| 26 |
$siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
|
| 27 |
define('MMB_XFRAME_COOKIE', $xframe = 'wordpress_'.md5($siteurl).'_xframe');
|
| 28 |
}
|
| 29 |
global $wpdb, $mmb_plugin_dir, $mmb_plugin_url, $wp_version, $mmb_filters, $_mmb_item_filter;
|
| 30 |
-
|
| 31 |
if (version_compare(PHP_VERSION, '5.0.0', '<')) // min version 5 supported
|
| 32 |
exit("<p>ManageWP Worker plugin requires PHP 5 or higher.</p>");
|
| 33 |
|
|
@@ -281,8 +280,13 @@ if( !function_exists ( 'mmb_post_create' )) {
|
|
| 281 |
$return = $mmb_core->post_instance->create($params);
|
| 282 |
if (is_int($return))
|
| 283 |
mmb_response($return, true);
|
| 284 |
-
else
|
| 285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
}
|
| 287 |
}
|
| 288 |
|
|
@@ -339,6 +343,20 @@ if( !function_exists ( 'mmb_backup_now' )) {
|
|
| 339 |
}
|
| 340 |
}
|
| 341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
if( !function_exists ( 'mmb_email_backup' )) {
|
| 343 |
function mmb_email_backup($params)
|
| 344 |
{
|
|
@@ -640,6 +658,17 @@ if( !function_exists ( 'mmb_set_notifications' )) {
|
|
| 640 |
}
|
| 641 |
}
|
| 642 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
if(!function_exists('mmb_more_reccurences')){
|
| 644 |
//Backup Tasks
|
| 645 |
add_filter('cron_schedules', 'mmb_more_reccurences');
|
|
@@ -714,6 +743,20 @@ if( !function_exists('mmb_worker_brand')){
|
|
| 714 |
}
|
| 715 |
}
|
| 716 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
if( !function_exists('mmb_plugin_actions') ){
|
| 718 |
function mmb_plugin_actions() {
|
| 719 |
global $mmb_actions, $mmb_core;
|
|
@@ -736,6 +779,34 @@ if( !function_exists('mmb_plugin_actions') ){
|
|
| 736 |
|
| 737 |
}
|
| 738 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 739 |
}
|
| 740 |
}
|
| 741 |
|
| 4 |
Plugin URI: http://managewp.com/
|
| 5 |
Description: Manage all your blogs from one dashboard. Visit <a href="http://managewp.com">ManageWP.com</a> to sign up.
|
| 6 |
Author: Prelovac Media
|
| 7 |
+
Version: 3.9.16
|
| 8 |
Author URI: http://www.prelovac.com
|
| 9 |
*/
|
| 10 |
|
| 20 |
**************************************************************/
|
| 21 |
|
| 22 |
if(!defined('MMB_WORKER_VERSION'))
|
| 23 |
+
define('MMB_WORKER_VERSION', '3.9.16');
|
| 24 |
|
| 25 |
if ( !defined('MMB_XFRAME_COOKIE')){
|
| 26 |
$siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
|
| 27 |
define('MMB_XFRAME_COOKIE', $xframe = 'wordpress_'.md5($siteurl).'_xframe');
|
| 28 |
}
|
| 29 |
global $wpdb, $mmb_plugin_dir, $mmb_plugin_url, $wp_version, $mmb_filters, $_mmb_item_filter;
|
|
|
|
| 30 |
if (version_compare(PHP_VERSION, '5.0.0', '<')) // min version 5 supported
|
| 31 |
exit("<p>ManageWP Worker plugin requires PHP 5 or higher.</p>");
|
| 32 |
|
| 280 |
$return = $mmb_core->post_instance->create($params);
|
| 281 |
if (is_int($return))
|
| 282 |
mmb_response($return, true);
|
| 283 |
+
else{
|
| 284 |
+
if(isset($return['error'])){
|
| 285 |
+
mmb_response($return['error'], false);
|
| 286 |
+
} else {
|
| 287 |
+
mmb_response($return, false);
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
}
|
| 291 |
}
|
| 292 |
|
| 343 |
}
|
| 344 |
}
|
| 345 |
|
| 346 |
+
if( !function_exists ( 'mmb_run_task_now' )) {
|
| 347 |
+
function mmb_run_task_now($params)
|
| 348 |
+
{
|
| 349 |
+
global $mmb_core;
|
| 350 |
+
$mmb_core->get_backup_instance();
|
| 351 |
+
$return = $mmb_core->backup_instance->task_now($params['task_name']);
|
| 352 |
+
if (is_array($return) && array_key_exists('error', $return))
|
| 353 |
+
mmb_response($return['error'], false);
|
| 354 |
+
else {
|
| 355 |
+
mmb_response($return, true);
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
if( !function_exists ( 'mmb_email_backup' )) {
|
| 361 |
function mmb_email_backup($params)
|
| 362 |
{
|
| 658 |
}
|
| 659 |
}
|
| 660 |
|
| 661 |
+
if( !function_exists ( 'mmb_set_alerts' )) {
|
| 662 |
+
function mmb_set_alerts($params)
|
| 663 |
+
{
|
| 664 |
+
global $mmb_core;
|
| 665 |
+
$mmb_core->get_stats_instance();
|
| 666 |
+
$return = $mmb_core->stats_instance->set_alerts($params);
|
| 667 |
+
mmb_response(true, true);
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
if(!function_exists('mmb_more_reccurences')){
|
| 673 |
//Backup Tasks
|
| 674 |
add_filter('cron_schedules', 'mmb_more_reccurences');
|
| 743 |
}
|
| 744 |
}
|
| 745 |
|
| 746 |
+
if( !function_exists('mmb_maintenance_mode')){
|
| 747 |
+
function mmb_maintenance_mode( $params ) {
|
| 748 |
+
global $wp_object_cache;
|
| 749 |
+
|
| 750 |
+
$default = get_option('mwp_maintenace_mode');
|
| 751 |
+
$params = empty($default) ? $params : array_merge($default, $params);
|
| 752 |
+
update_option("mwp_maintenace_mode", $params);
|
| 753 |
+
|
| 754 |
+
if(!empty($wp_object_cache))
|
| 755 |
+
@$wp_object_cache->flush();
|
| 756 |
+
mmb_response(true, true);
|
| 757 |
+
}
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
if( !function_exists('mmb_plugin_actions') ){
|
| 761 |
function mmb_plugin_actions() {
|
| 762 |
global $mmb_actions, $mmb_core;
|
| 779 |
|
| 780 |
}
|
| 781 |
}
|
| 782 |
+
|
| 783 |
+
global $pagenow, $current_user, $mmode;
|
| 784 |
+
if( !is_admin() && !in_array($pagenow, array( 'wp-login.php' ))){
|
| 785 |
+
$mmode = get_option('mwp_maintenace_mode');
|
| 786 |
+
if( !empty($mmode) ){
|
| 787 |
+
if(isset($mmode['active']) && $mmode['active'] == true){
|
| 788 |
+
if(isset($current_user->data) && !empty($current_user->data) && isset($mmode['hidecaps']) && !empty($mmode['hidecaps'])){
|
| 789 |
+
$usercaps = array();
|
| 790 |
+
if(isset($current_user->caps) && !empty($current_user->caps)){
|
| 791 |
+
$usercaps = $current_user->caps;
|
| 792 |
+
}
|
| 793 |
+
foreach($mmode['hidecaps'] as $cap => $hide){
|
| 794 |
+
if(!$hide)
|
| 795 |
+
continue;
|
| 796 |
+
|
| 797 |
+
foreach($usercaps as $ucap => $val){
|
| 798 |
+
if($ucap == $cap){
|
| 799 |
+
ob_end_clean();
|
| 800 |
+
ob_end_flush();
|
| 801 |
+
die($mmode['template']);
|
| 802 |
+
}
|
| 803 |
+
}
|
| 804 |
+
}
|
| 805 |
+
} else
|
| 806 |
+
die($mmode['template']);
|
| 807 |
+
}
|
| 808 |
+
}
|
| 809 |
+
}
|
| 810 |
}
|
| 811 |
}
|
| 812 |
|
installer.class.php
CHANGED
|
@@ -120,7 +120,7 @@ class MMB_Installer extends MMB_Core
|
|
| 120 |
|
| 121 |
function do_upgrade($params = null)
|
| 122 |
{
|
| 123 |
-
|
| 124 |
return array(
|
| 125 |
'failed' => 'No upgrades passed.'
|
| 126 |
);
|
|
@@ -131,6 +131,7 @@ class MMB_Installer extends MMB_Core
|
|
| 131 |
);
|
| 132 |
}
|
| 133 |
|
|
|
|
| 134 |
$params = isset($params['upgrades_all']) ? $params['upgrades_all'] : $params;
|
| 135 |
|
| 136 |
$core_upgrade = isset($params['wp_upgrade']) ? $params['wp_upgrade'] : array();
|
|
@@ -360,27 +361,36 @@ class MMB_Installer extends MMB_Core
|
|
| 360 |
return array(
|
| 361 |
'error' => 'No plugin files for upgrade.'
|
| 362 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
$return = array();
|
| 364 |
if (class_exists('Plugin_Upgrader') && class_exists('Bulk_Plugin_Upgrader_Skin')) {
|
| 365 |
$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
|
| 366 |
$result = $upgrader->bulk_upgrade(array_keys($plugins));
|
| 367 |
-
|
| 368 |
-
if (!function_exists('wp_update_plugins'))
|
| 369 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 370 |
|
| 371 |
@wp_update_plugins();
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
if (!empty($result)) {
|
| 375 |
foreach ($result as $plugin_slug => $plugin_info) {
|
| 376 |
if (!$plugin_info || is_wp_error($plugin_info)) {
|
| 377 |
$return[$plugin_slug] = $this->mmb_get_error($plugin_info);
|
| 378 |
} else {
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
|
|
|
| 384 |
}
|
| 385 |
}
|
| 386 |
ob_end_clean();
|
|
@@ -405,30 +415,39 @@ class MMB_Installer extends MMB_Core
|
|
| 405 |
return array(
|
| 406 |
'error' => 'No theme files for upgrade.'
|
| 407 |
);
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 414 |
|
| 415 |
@wp_update_themes();
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
$return = array();
|
| 419 |
if (!empty($result)) {
|
| 420 |
foreach ($result as $theme_tmp => $theme_info) {
|
| 421 |
-
|
| 422 |
$return[$theme_tmp] = $this->mmb_get_error($theme_info);
|
| 423 |
} else {
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
|
|
|
| 429 |
}
|
| 430 |
}
|
| 431 |
-
|
| 432 |
return array(
|
| 433 |
'upgraded' => $return
|
| 434 |
);
|
|
@@ -519,6 +538,7 @@ class MMB_Installer extends MMB_Core
|
|
| 519 |
function get_upgradable_plugins()
|
| 520 |
{
|
| 521 |
$current = $this->mmb_get_transient('update_plugins');
|
|
|
|
| 522 |
$upgradable_plugins = array();
|
| 523 |
if (!empty($current->response)) {
|
| 524 |
if (!function_exists('get_plugin_data'))
|
|
@@ -547,15 +567,18 @@ class MMB_Installer extends MMB_Core
|
|
| 547 |
$upgrade_themes = array();
|
| 548 |
|
| 549 |
$current = $this->mmb_get_transient('update_themes');
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
|
|
|
|
|
|
|
|
|
| 553 |
if ($theme_data['Template'] == $current_themes) {
|
| 554 |
if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
|
| 555 |
$current->response[$current_themes]['name'] = $theme_data['Name'];
|
| 556 |
$current->response[$current_themes]['old_version'] = $theme_data['Version'];
|
| 557 |
$current->response[$current_themes]['theme_tmp'] = $theme_data['Template'];
|
| 558 |
-
$upgrade_themes[]
|
| 559 |
}
|
| 560 |
}
|
| 561 |
}
|
| 120 |
|
| 121 |
function do_upgrade($params = null)
|
| 122 |
{
|
| 123 |
+
if ($params == null || empty($params))
|
| 124 |
return array(
|
| 125 |
'failed' => 'No upgrades passed.'
|
| 126 |
);
|
| 131 |
);
|
| 132 |
}
|
| 133 |
|
| 134 |
+
|
| 135 |
$params = isset($params['upgrades_all']) ? $params['upgrades_all'] : $params;
|
| 136 |
|
| 137 |
$core_upgrade = isset($params['wp_upgrade']) ? $params['wp_upgrade'] : array();
|
| 361 |
return array(
|
| 362 |
'error' => 'No plugin files for upgrade.'
|
| 363 |
);
|
| 364 |
+
|
| 365 |
+
$current = $this->mmb_get_transient('update_plugins');
|
| 366 |
+
$versions = array();
|
| 367 |
+
if(!empty($current)){
|
| 368 |
+
foreach($plugins as $plugin => $data){
|
| 369 |
+
if(isset($current->checked[$plugin])){
|
| 370 |
+
$versions[$current->checked[$plugin]] = $plugin;
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
}
|
| 374 |
$return = array();
|
| 375 |
if (class_exists('Plugin_Upgrader') && class_exists('Bulk_Plugin_Upgrader_Skin')) {
|
| 376 |
$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
|
| 377 |
$result = $upgrader->bulk_upgrade(array_keys($plugins));
|
| 378 |
+
if (!function_exists('wp_update_plugins'))
|
|
|
|
| 379 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 380 |
|
| 381 |
@wp_update_plugins();
|
| 382 |
+
$current = $this->mmb_get_transient('update_plugins');
|
| 383 |
+
if (!empty($result)) {
|
|
|
|
| 384 |
foreach ($result as $plugin_slug => $plugin_info) {
|
| 385 |
if (!$plugin_info || is_wp_error($plugin_info)) {
|
| 386 |
$return[$plugin_slug] = $this->mmb_get_error($plugin_info);
|
| 387 |
} else {
|
| 388 |
+
if(!empty($result[$plugin_slug]) || (isset($current->checked[$plugin_slug]) && version_compare(array_search($plugin_slug, $versions), $current->checked[$plugin_slug], '<') == true)){
|
| 389 |
+
$return[$plugin_slug] = 1;
|
| 390 |
+
} else {
|
| 391 |
+
update_option('mmb_forcerefresh', true);
|
| 392 |
+
$return[$plugin_slug] = 'Could not refresh upgrade transients, please reload website data';
|
| 393 |
+
}
|
| 394 |
}
|
| 395 |
}
|
| 396 |
ob_end_clean();
|
| 415 |
return array(
|
| 416 |
'error' => 'No theme files for upgrade.'
|
| 417 |
);
|
| 418 |
+
|
| 419 |
+
$current = $this->mmb_get_transient('update_themes');
|
| 420 |
+
$versions = array();
|
| 421 |
+
if(!empty($current)){
|
| 422 |
+
foreach($themes as $theme){
|
| 423 |
+
if(isset($current->checked[$theme])){
|
| 424 |
+
$versions[$current->checked[$theme]] = $theme;
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
}
|
| 428 |
+
if (class_exists('Theme_Upgrader') && class_exists('Bulk_Theme_Upgrader_Skin')) {
|
| 429 |
+
$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
|
| 430 |
+
$result = $upgrader->bulk_upgrade($themes);
|
| 431 |
+
|
| 432 |
+
if (!function_exists('wp_update_themes'))
|
| 433 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 434 |
|
| 435 |
@wp_update_themes();
|
| 436 |
+
$current = $this->mmb_get_transient('update_themes');
|
| 437 |
+
$return = array();
|
|
|
|
| 438 |
if (!empty($result)) {
|
| 439 |
foreach ($result as $theme_tmp => $theme_info) {
|
| 440 |
+
if (is_wp_error($theme_info) || empty($theme_info)) {
|
| 441 |
$return[$theme_tmp] = $this->mmb_get_error($theme_info);
|
| 442 |
} else {
|
| 443 |
+
if(!empty($result[$theme_tmp]) || (isset($current->checked[$theme_tmp]) && version_compare(array_search($theme_tmp, $versions), $current->checked[$theme_tmp], '<') == true)){
|
| 444 |
+
$return[$theme_tmp] = 1;
|
| 445 |
+
} else {
|
| 446 |
+
update_option('mmb_forcerefresh', true);
|
| 447 |
+
$return[$theme_tmp] = 'Could not refresh upgrade transients, please reload website data';
|
| 448 |
+
}
|
| 449 |
}
|
| 450 |
}
|
|
|
|
| 451 |
return array(
|
| 452 |
'upgraded' => $return
|
| 453 |
);
|
| 538 |
function get_upgradable_plugins()
|
| 539 |
{
|
| 540 |
$current = $this->mmb_get_transient('update_plugins');
|
| 541 |
+
|
| 542 |
$upgradable_plugins = array();
|
| 543 |
if (!empty($current->response)) {
|
| 544 |
if (!function_exists('get_plugin_data'))
|
| 567 |
$upgrade_themes = array();
|
| 568 |
|
| 569 |
$current = $this->mmb_get_transient('update_themes');
|
| 570 |
+
if (!empty($current->response)) {
|
| 571 |
+
foreach ((array) $all_themes as $theme_template => $theme_data) {
|
| 572 |
+
if(isset($theme_data['Parent Theme']) && !empty($theme_data['Parent Theme']))
|
| 573 |
+
continue;
|
| 574 |
+
|
| 575 |
+
foreach ($current->response as $current_themes => $theme) {
|
| 576 |
if ($theme_data['Template'] == $current_themes) {
|
| 577 |
if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
|
| 578 |
$current->response[$current_themes]['name'] = $theme_data['Name'];
|
| 579 |
$current->response[$current_themes]['old_version'] = $theme_data['Version'];
|
| 580 |
$current->response[$current_themes]['theme_tmp'] = $theme_data['Template'];
|
| 581 |
+
$upgrade_themes[] = $current->response[$current_themes];
|
| 582 |
}
|
| 583 |
}
|
| 584 |
}
|
plugins/cleanup/cleanup.php
CHANGED
|
@@ -106,6 +106,7 @@ function mmb_handle_overhead($clear = false)
|
|
| 106 |
$query = 'SHOW TABLE STATUS FROM ' . DB_NAME;
|
| 107 |
$tables = $wpdb->get_results($wpdb->prepare($query), ARRAY_A);
|
| 108 |
$total_gain = 0;
|
|
|
|
| 109 |
foreach ($tables as $table) {
|
| 110 |
if (in_array($table['Engine'], array(
|
| 111 |
'MyISAM',
|
| 106 |
$query = 'SHOW TABLE STATUS FROM ' . DB_NAME;
|
| 107 |
$tables = $wpdb->get_results($wpdb->prepare($query), ARRAY_A);
|
| 108 |
$total_gain = 0;
|
| 109 |
+
$table_string = '';
|
| 110 |
foreach ($tables as $table) {
|
| 111 |
if (in_array($table['Engine'], array(
|
| 112 |
'MyISAM',
|
post.class.php
CHANGED
|
@@ -121,9 +121,17 @@ class MMB_Post extends MMB_Core
|
|
| 121 |
} else {
|
| 122 |
$no_thumb = $get_url[4];
|
| 123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
$file_name = basename($no_thumb);
|
| 125 |
$tmp_file = download_url($no_thumb);
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 128 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 129 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
|
@@ -195,6 +203,10 @@ class MMB_Post extends MMB_Core
|
|
| 195 |
$post_content = preg_replace($mmb_mp, $mmb_rp, $post_content);
|
| 196 |
}
|
| 197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
}
|
| 199 |
@unlink($tmp_file);
|
| 200 |
}
|
|
@@ -206,7 +218,16 @@ class MMB_Post extends MMB_Core
|
|
| 206 |
if (count($post_atta_img)) {
|
| 207 |
foreach ($post_atta_img as $img) {
|
| 208 |
$file_name = basename($img['src']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
$tmp_file = download_url($img['src']);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 211 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 212 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
|
@@ -242,6 +263,9 @@ class MMB_Post extends MMB_Core
|
|
| 242 |
}
|
| 243 |
}
|
| 244 |
|
|
|
|
|
|
|
|
|
|
| 245 |
}
|
| 246 |
@unlink($tmp_file);
|
| 247 |
}
|
|
@@ -272,7 +296,13 @@ class MMB_Post extends MMB_Core
|
|
| 272 |
// featured image
|
| 273 |
if ($post_featured_img != '') {
|
| 274 |
$file_name = basename($post_featured_img);
|
|
|
|
|
|
|
|
|
|
| 275 |
$tmp_file = download_url($post_featured_img);
|
|
|
|
|
|
|
|
|
|
| 276 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 277 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 278 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
|
@@ -294,6 +324,9 @@ class MMB_Post extends MMB_Core
|
|
| 294 |
$new_custom['_thumbnail_id'] = array(
|
| 295 |
$attach_id
|
| 296 |
);
|
|
|
|
|
|
|
|
|
|
| 297 |
}
|
| 298 |
@unlink($tmp_file);
|
| 299 |
}
|
| 121 |
} else {
|
| 122 |
$no_thumb = $get_url[4];
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
if(isset($upload['error'])){
|
| 126 |
+
return array('error' => $upload['error']);
|
| 127 |
+
}
|
| 128 |
$file_name = basename($no_thumb);
|
| 129 |
$tmp_file = download_url($no_thumb);
|
| 130 |
|
| 131 |
+
if(is_wp_error($tmp_file)){
|
| 132 |
+
return array('error' => $tmp_file->get_error_message());
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 136 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 137 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
| 203 |
$post_content = preg_replace($mmb_mp, $mmb_rp, $post_content);
|
| 204 |
}
|
| 205 |
}
|
| 206 |
+
} else {
|
| 207 |
+
@unlink($tmp_file);
|
| 208 |
+
return array('error' => "Cannot create attachment file in ".$attach_upload['path']." Please set correct permissions.");
|
| 209 |
+
|
| 210 |
}
|
| 211 |
@unlink($tmp_file);
|
| 212 |
}
|
| 218 |
if (count($post_atta_img)) {
|
| 219 |
foreach ($post_atta_img as $img) {
|
| 220 |
$file_name = basename($img['src']);
|
| 221 |
+
|
| 222 |
+
if(isset($upload['error'])){
|
| 223 |
+
return array('error' => $upload['error']);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
$tmp_file = download_url($img['src']);
|
| 227 |
+
if(is_wp_error($tmp_file)){
|
| 228 |
+
return array('error' => $tmp_file->get_error_message());
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 232 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 233 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
| 263 |
}
|
| 264 |
}
|
| 265 |
|
| 266 |
+
} else {
|
| 267 |
+
@unlink($tmp_file);
|
| 268 |
+
return array('error' => "Cannot create attachment file in ".$attach_upload['path']." Please set correct permissions.");
|
| 269 |
}
|
| 270 |
@unlink($tmp_file);
|
| 271 |
}
|
| 296 |
// featured image
|
| 297 |
if ($post_featured_img != '') {
|
| 298 |
$file_name = basename($post_featured_img);
|
| 299 |
+
if(isset($upload['error'])){
|
| 300 |
+
return array('error' => $upload['error']);
|
| 301 |
+
}
|
| 302 |
$tmp_file = download_url($post_featured_img);
|
| 303 |
+
if(is_wp_error($tmp_file)){
|
| 304 |
+
return array('error' => $tmp_file->get_error_message());
|
| 305 |
+
}
|
| 306 |
$attach_upload['url'] = $upload['url'] . '/' . $file_name;
|
| 307 |
$attach_upload['path'] = $upload['path'] . '/' . $file_name;
|
| 308 |
$renamed = @rename($tmp_file, $attach_upload['path']);
|
| 324 |
$new_custom['_thumbnail_id'] = array(
|
| 325 |
$attach_id
|
| 326 |
);
|
| 327 |
+
} else {
|
| 328 |
+
@unlink($tmp_file);
|
| 329 |
+
return array('error' => "Cannot create attachment file in ".$attach_upload['path']." Please set correct permissions.");
|
| 330 |
}
|
| 331 |
@unlink($tmp_file);
|
| 332 |
}
|
readme.txt
CHANGED
|
@@ -21,6 +21,7 @@ Main features:
|
|
| 21 |
* Bulk install themes and plugins to multiple sites at once
|
| 22 |
* Add sub-users (writers, staff..) to your account
|
| 23 |
* Bulk publish posts to multiple sites at once
|
|
|
|
| 24 |
* Install WordPress, clone or migrate a website to another domain
|
| 25 |
* Much, much more...
|
| 26 |
|
|
@@ -32,6 +33,18 @@ Check out [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs").
|
|
| 32 |
|
| 33 |
== Changelog ==
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
= 3.9.14 =
|
| 36 |
* Two factor authentication
|
| 37 |
* Run code tool
|
| 21 |
* Bulk install themes and plugins to multiple sites at once
|
| 22 |
* Add sub-users (writers, staff..) to your account
|
| 23 |
* Bulk publish posts to multiple sites at once
|
| 24 |
+
* SEO Statistics, track your keyword rankings
|
| 25 |
* Install WordPress, clone or migrate a website to another domain
|
| 26 |
* Much, much more...
|
| 27 |
|
| 33 |
|
| 34 |
== Changelog ==
|
| 35 |
|
| 36 |
+
= 3.9.16 =
|
| 37 |
+
* Option to "Run now" backup tasks
|
| 38 |
+
* Maintenance release with several bug fixes
|
| 39 |
+
|
| 40 |
+
= 3.9.15 =
|
| 41 |
+
* New: Full range of SEO Statistics now trackable for your websites (Google Page Rank and Page Speed, Backlinks and 20+ more)
|
| 42 |
+
* New: Google keyword rank tracking with history
|
| 43 |
+
* New: Uptime monitoring (5 min interval with email/SMS notification)
|
| 44 |
+
* New: Insights into server PHP error logs right in your dashboard
|
| 45 |
+
* New: Remote maintenance mode for your websites
|
| 46 |
+
* Fix: A bug when a completed backup was reported as failed
|
| 47 |
+
|
| 48 |
= 3.9.14 =
|
| 49 |
* Two factor authentication
|
| 50 |
* Run code tool
|
stats.class.php
CHANGED
|
@@ -282,46 +282,57 @@ class MMB_Stats extends MMB_Core
|
|
| 282 |
return $stats;
|
| 283 |
}
|
| 284 |
|
| 285 |
-
|
| 286 |
{
|
| 287 |
-
|
|
|
|
| 288 |
$errors = array();
|
| 289 |
if (isset($options['get']) && $options['get'] == true) {
|
| 290 |
if (function_exists('ini_get')) {
|
| 291 |
$logpath = ini_get('error_log');
|
| 292 |
if (!empty($logpath) && file_exists($logpath)) {
|
| 293 |
-
|
| 294 |
-
if ($logfile) {
|
| 295 |
$maxlines = 1;
|
| 296 |
$linesize = -4096;
|
| 297 |
$lines = array();
|
| 298 |
$line = true;
|
| 299 |
while ($line !== false) {
|
| 300 |
-
fseek($logfile, ($maxlines * $linesize), SEEK_END)
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
}
|
| 317 |
}
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
}
|
| 321 |
}
|
| 322 |
-
|
| 323 |
-
$stats['errors'] = $errors;
|
| 324 |
-
|
| 325 |
return $stats;
|
| 326 |
}
|
| 327 |
|
|
@@ -337,7 +348,8 @@ class MMB_Stats extends MMB_Core
|
|
| 337 |
|
| 338 |
if ($refresh == 'transient') {
|
| 339 |
$current = $this->mmb_get_transient('update_core');
|
| 340 |
-
if (isset($current->last_checked)) {
|
|
|
|
| 341 |
if (time() - $current->last_checked > 14400) {
|
| 342 |
@wp_version_check();
|
| 343 |
@wp_update_plugins();
|
|
@@ -355,10 +367,15 @@ class MMB_Stats extends MMB_Core
|
|
| 355 |
$stats['mysql_version'] = $wpdb->db_version();
|
| 356 |
$stats['wp_multisite'] = $this->mmb_multisite;
|
| 357 |
$stats['network_install'] = $this->network_admin_install;
|
|
|
|
| 358 |
|
| 359 |
-
if (!function_exists('get_filesystem_method'))
|
| 360 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
$stats['writable'] = $this->is_server_writable();
|
| 363 |
|
| 364 |
return $stats;
|
|
@@ -371,8 +388,8 @@ class MMB_Stats extends MMB_Core
|
|
| 371 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 372 |
include_once(ABSPATH . '/wp-admin/includes/update.php');
|
| 373 |
|
| 374 |
-
$stats
|
| 375 |
-
|
| 376 |
$num = extract($params);
|
| 377 |
if ($refresh == 'transient') {
|
| 378 |
$update_check = apply_filters('mwp_premium_update_check', $update_check);
|
|
@@ -622,8 +639,10 @@ class MMB_Stats extends MMB_Core
|
|
| 622 |
global $wpdb, $mmb_wp_version, $mmb_plugin_dir, $wp_version, $wp_local_package;
|
| 623 |
|
| 624 |
$mwp_notifications = get_option('mwp_notifications', true);
|
| 625 |
-
$updates = array();
|
| 626 |
|
|
|
|
|
|
|
|
|
|
| 627 |
if (is_array($mwp_notifications) && $mwp_notifications != false) {
|
| 628 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 629 |
include_once(ABSPATH . '/wp-admin/includes/update.php');
|
|
@@ -675,22 +694,39 @@ class MMB_Stats extends MMB_Core
|
|
| 675 |
$updates['backups'] = $backups;
|
| 676 |
}
|
| 677 |
|
| 678 |
-
if (!class_exists('WP_Http')) {
|
| 679 |
-
include_once(ABSPATH . WPINC . '/class-http.php');
|
| 680 |
-
}
|
| 681 |
|
| 682 |
if (!empty($updates)) {
|
| 683 |
-
$args
|
| 684 |
-
$args['body'] =
|
| 685 |
-
|
| 686 |
-
'notification_key' => $notification_key
|
| 687 |
-
);
|
| 688 |
-
$result = wp_remote_post($url, $args);
|
| 689 |
}
|
| 690 |
|
| 691 |
}
|
| 692 |
|
| 693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
}
|
| 695 |
|
| 696 |
|
|
@@ -709,5 +745,10 @@ class MMB_Stats extends MMB_Core
|
|
| 709 |
return $content;
|
| 710 |
}
|
| 711 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
}
|
| 713 |
?>
|
| 282 |
return $stats;
|
| 283 |
}
|
| 284 |
|
| 285 |
+
function get_errors($stats, $options = array())
|
| 286 |
{
|
| 287 |
+
$period = isset($options['days']) ? (int) $options['days'] * 86400 : 86400;
|
| 288 |
+
$maxerrors = isset($options['max']) ? (int) $options['max'] : 20;
|
| 289 |
$errors = array();
|
| 290 |
if (isset($options['get']) && $options['get'] == true) {
|
| 291 |
if (function_exists('ini_get')) {
|
| 292 |
$logpath = ini_get('error_log');
|
| 293 |
if (!empty($logpath) && file_exists($logpath)) {
|
| 294 |
+
$logfile = @fopen($logpath, 'r');
|
| 295 |
+
if ($logfile && filesize($logpath) > 0) {
|
| 296 |
$maxlines = 1;
|
| 297 |
$linesize = -4096;
|
| 298 |
$lines = array();
|
| 299 |
$line = true;
|
| 300 |
while ($line !== false) {
|
| 301 |
+
if( fseek($logfile, ($maxlines * $linesize), SEEK_END) !== -1){
|
| 302 |
+
$maxlines++;
|
| 303 |
+
if ($line) {
|
| 304 |
+
$line = fread($logfile, ($linesize * -1)) . $line;
|
| 305 |
+
|
| 306 |
+
foreach ((array) preg_split("/(\r|\n|\r\n)/U", $line) as $l) {
|
| 307 |
+
preg_match('/\[(.*)\]/Ui', $l, $match);
|
| 308 |
+
if (!empty($match)) {
|
| 309 |
+
$key = str_replace($match[0], '', $l);
|
| 310 |
+
if(!isset($errors[$key])){
|
| 311 |
+
$errors[$key] = 1;
|
| 312 |
+
} else {
|
| 313 |
+
$errors[$key] = $errors[$key] + 1;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
if ((strtotime($match[1]) < ((int) time() - $period)) || count($errors) >= $maxerrors) {
|
| 317 |
+
$line = false;
|
| 318 |
+
break;
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
} else
|
| 324 |
+
break;
|
| 325 |
}
|
| 326 |
}
|
| 327 |
+
if (!empty($errors)){
|
| 328 |
+
$stats['errors'] = $errors;
|
| 329 |
+
$stats['logpath'] = $logpath;
|
| 330 |
+
$stats['logsize'] = @filesize($logpath);
|
| 331 |
+
}
|
| 332 |
}
|
| 333 |
}
|
| 334 |
}
|
| 335 |
+
|
|
|
|
|
|
|
| 336 |
return $stats;
|
| 337 |
}
|
| 338 |
|
| 348 |
|
| 349 |
if ($refresh == 'transient') {
|
| 350 |
$current = $this->mmb_get_transient('update_core');
|
| 351 |
+
if (isset($current->last_checked) || get_option('mmb_forcerefresh')) {
|
| 352 |
+
update_option('mmb_forcerefresh', false);
|
| 353 |
if (time() - $current->last_checked > 14400) {
|
| 354 |
@wp_version_check();
|
| 355 |
@wp_update_plugins();
|
| 367 |
$stats['mysql_version'] = $wpdb->db_version();
|
| 368 |
$stats['wp_multisite'] = $this->mmb_multisite;
|
| 369 |
$stats['network_install'] = $this->network_admin_install;
|
| 370 |
+
$stats['network_install'] = $this->network_admin_install;
|
| 371 |
|
| 372 |
+
if ( !function_exists('get_filesystem_method') )
|
| 373 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
| 374 |
+
$mmode = get_option('mwp_maintenace_mode');
|
| 375 |
+
|
| 376 |
+
if( !empty($mmode) && isset($mmode['active']) && $mmode['active'] == true){
|
| 377 |
+
$stats['maintenance'] = true;
|
| 378 |
+
}
|
| 379 |
$stats['writable'] = $this->is_server_writable();
|
| 380 |
|
| 381 |
return $stats;
|
| 388 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 389 |
include_once(ABSPATH . '/wp-admin/includes/update.php');
|
| 390 |
|
| 391 |
+
$stats = $this->mmb_parse_action_params('get', $params, $this);
|
| 392 |
+
$update_check = array();
|
| 393 |
$num = extract($params);
|
| 394 |
if ($refresh == 'transient') {
|
| 395 |
$update_check = apply_filters('mwp_premium_update_check', $update_check);
|
| 639 |
global $wpdb, $mmb_wp_version, $mmb_plugin_dir, $wp_version, $wp_local_package;
|
| 640 |
|
| 641 |
$mwp_notifications = get_option('mwp_notifications', true);
|
|
|
|
| 642 |
|
| 643 |
+
$args = array();
|
| 644 |
+
$updates = array();
|
| 645 |
+
$send = 0;
|
| 646 |
if (is_array($mwp_notifications) && $mwp_notifications != false) {
|
| 647 |
include_once(ABSPATH . 'wp-includes/update.php');
|
| 648 |
include_once(ABSPATH . '/wp-admin/includes/update.php');
|
| 694 |
$updates['backups'] = $backups;
|
| 695 |
}
|
| 696 |
|
|
|
|
|
|
|
|
|
|
| 697 |
|
| 698 |
if (!empty($updates)) {
|
| 699 |
+
$args['body']['updates'] = $updates;
|
| 700 |
+
$args['body']['notification_key'] = $notification_key;
|
| 701 |
+
$send = 1;
|
|
|
|
|
|
|
|
|
|
| 702 |
}
|
| 703 |
|
| 704 |
}
|
| 705 |
|
| 706 |
|
| 707 |
+
$alert_data = get_option('mwp_pageview_alerts',true);
|
| 708 |
+
if(is_array($alert_data) && $alert_data['alert']){
|
| 709 |
+
$pageviews = get_option('user_hit_count');
|
| 710 |
+
$args['body']['alerts']['pageviews'] = $pageviews;
|
| 711 |
+
$args['body']['alerts']['site_id'] = $alert_data['site_id'];
|
| 712 |
+
if(!isset($url)){
|
| 713 |
+
$url = $alert_data['url'];
|
| 714 |
+
}
|
| 715 |
+
$send = 1;
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
if($send){
|
| 719 |
+
if (!class_exists('WP_Http')) {
|
| 720 |
+
include_once(ABSPATH . WPINC . '/class-http.php');
|
| 721 |
+
}
|
| 722 |
+
$result = wp_remote_post($url, $args);
|
| 723 |
+
|
| 724 |
+
if (is_array($result) && $result['body'] == 'mwp_delete_alert') {
|
| 725 |
+
delete_option('mwp_pageview_alerts');
|
| 726 |
+
}
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
|
| 730 |
}
|
| 731 |
|
| 732 |
|
| 745 |
return $content;
|
| 746 |
}
|
| 747 |
|
| 748 |
+
function set_alerts($args){
|
| 749 |
+
extract($args);
|
| 750 |
+
update_option('mwp_pageview_alerts',array('site_id' => $site_id,'alert' => $alert,'url' => $url));
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
}
|
| 754 |
?>
|
version
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
3.9.
|
| 1 |
+
3.9.16
|
