Version Description
- New feature: Bulk add links to blogroll
- New feature: Manual backups to email address
- New feature: Backup requirements check (under Manage Backups)
- New feature: Popup menu for groups allowing to show dashboard for that group only
- New feature: Favorite list for plugins and themes for later quick installation to multiple blogs
- New feature: Invite friends
- Fixed: problem with backups and write permissions when upload dir was wrongly set
- Fixed: problem adding sites where WordPress is installed in a folder
- Fixed: 408 error message problem when adding site
- Fixed: site time out problems when adding site
- Fixed: problems with some WP plugins (WP Sentinel)
- Fixed: problems with upgrade notifications
Download this release
Release Info
Developer | freediver |
Plugin | ManageWP Worker |
Version | 3.8.8 |
Comparing to | |
See all releases |
Code changes from version 3.8.7 to 3.8.8
- backup.class.php +194 -184
- comment.class.php +1 -1
- core.class.php +15 -2
- helper.class.php +46 -18
- init.php +105 -20
- installer.class.php +53 -20
- link.class.php +39 -0
- plugins/cleanup/cleanup.php +100 -104
- plugins/search/search.php +65 -61
- post.class.php +16 -0
- readme.txt +15 -1
- stats.class.php +117 -37
- version +1 -1
backup.class.php
CHANGED
@@ -14,43 +14,33 @@ class MMB_Backup extends MMB_Core
|
|
14 |
{
|
15 |
function __construct()
|
16 |
{
|
17 |
-
$upload_dir = wp_upload_dir();
|
18 |
-
$sec_string = md5('mmb-worker');
|
19 |
-
$file = "/$sec_string/backups";
|
20 |
-
$file_path = $upload_dir['basedir'] . $file;
|
21 |
-
file_put_contents($file_path . '/index.php', '');
|
22 |
-
if (!file_exists($file_path)) {
|
23 |
-
if (!mkdir($file_path, 0755, true))
|
24 |
-
return array(
|
25 |
-
'error' => 'Permission denied, make sure you have write permission to wp-content folder.'
|
26 |
-
);
|
27 |
-
}
|
28 |
parent::__construct();
|
29 |
}
|
30 |
|
31 |
function backup($args)
|
32 |
-
{
|
33 |
-
|
34 |
-
|
35 |
//type like manual, weekly, daily
|
36 |
$type = $args['type'];
|
37 |
-
//what like full
|
38 |
$what = $args['what'];
|
|
|
39 |
if (trim($type) == '')
|
40 |
$type = 'manual'; //default
|
41 |
-
|
42 |
-
$upload_dir = wp_upload_dir();
|
43 |
$sec_string = md5('mmb-worker');
|
44 |
-
$file = "/$sec_string/
|
45 |
-
$file_path =
|
46 |
-
|
|
|
47 |
if (!file_exists($file_path)) {
|
48 |
if (!mkdir($file_path, 0755, true))
|
49 |
return array(
|
50 |
'error' => 'Permission denied, make sure you have write permission to wp-content folder.'
|
51 |
);
|
52 |
}
|
53 |
-
|
|
|
54 |
if (trim($what) == 'full') {
|
55 |
//take wp-content backup
|
56 |
$content_backup = $this->backup_wpcontent($type);
|
@@ -80,7 +70,8 @@ class MMB_Backup extends MMB_Core
|
|
80 |
|
81 |
// Get previous backup in tmp
|
82 |
$worker_options = get_option('mmb-worker');
|
83 |
-
|
|
|
84 |
|
85 |
if (rename($worker_options['backups'][$type]['path'], $tmp_file)) {
|
86 |
@unlink($worker_options['backups'][$type]['path']);
|
@@ -95,31 +86,21 @@ class MMB_Backup extends MMB_Core
|
|
95 |
"",
|
96 |
"-"
|
97 |
), $site_name);
|
98 |
-
$backup_file = $file_path . '/' . $site_name . '_' . $type . '_' . $what . '_' . date('Y-m-d') . '.zip';
|
99 |
|
100 |
-
|
|
|
|
|
|
|
101 |
$archive = new PclZip($backup_file);
|
102 |
}
|
103 |
|
104 |
if (trim($what) == 'full') {
|
105 |
$htaccess_path = ABSPATH . ".htaccess";
|
106 |
$wp_config_path = ABSPATH . "wp-config.php";
|
107 |
-
if ($this->
|
108 |
$command = "zip $backup_file -j $content_backup[path] -j $db_backup[path] -j $htaccess_path -j $wp_config_path";
|
109 |
ob_start();
|
110 |
-
|
111 |
-
case 'passthru':
|
112 |
-
passthru($command, $err);
|
113 |
-
break;
|
114 |
-
case 'exec':
|
115 |
-
exec($command);
|
116 |
-
break;
|
117 |
-
case 'system':
|
118 |
-
system($command);
|
119 |
-
break;
|
120 |
-
default:
|
121 |
-
break;
|
122 |
-
}
|
123 |
ob_get_clean();
|
124 |
} else {
|
125 |
$result = $archive->add($content_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
|
@@ -130,22 +111,10 @@ class MMB_Backup extends MMB_Core
|
|
130 |
}
|
131 |
|
132 |
} elseif (trim($what) == 'db') {
|
133 |
-
if ($this->
|
134 |
$command = "zip $backup_file -j $db_backup[path]";
|
135 |
ob_start();
|
136 |
-
|
137 |
-
case 'passthru':
|
138 |
-
passthru($command, $err);
|
139 |
-
break;
|
140 |
-
case 'exec':
|
141 |
-
exec($command);
|
142 |
-
break;
|
143 |
-
case 'system':
|
144 |
-
system($command);
|
145 |
-
break;
|
146 |
-
default:
|
147 |
-
break;
|
148 |
-
}
|
149 |
ob_get_clean();
|
150 |
} else {
|
151 |
$result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
|
@@ -165,7 +134,9 @@ class MMB_Backup extends MMB_Core
|
|
165 |
@unlink($tmp_file);
|
166 |
@unlink($content_backup['path']);
|
167 |
@unlink($db_backup['path']);
|
168 |
-
|
|
|
|
|
169 |
$worker_options = get_option('mmb-worker');
|
170 |
//remove old file
|
171 |
if ($worker_options['backups'][$type]['path'] != $backup_file) {
|
@@ -176,43 +147,31 @@ class MMB_Backup extends MMB_Core
|
|
176 |
$worker_options['backups'][$type]['url'] = $backup_url;
|
177 |
update_option('mmb-worker', $worker_options);
|
178 |
|
|
|
179 |
//Everything went fine, return backup url to master
|
180 |
return $worker_options['backups'][$type]['url'];
|
181 |
}
|
182 |
|
183 |
function backup_wpcontent($type)
|
184 |
{
|
185 |
-
$upload_dir = wp_upload_dir();
|
186 |
$sec_string = md5('mmb-worker');
|
187 |
-
$file = '/' . $sec_string . '/
|
188 |
-
$file_path =
|
189 |
-
|
|
|
190 |
chdir(WP_CONTENT_DIR);
|
191 |
-
$command = "zip -r $file_path 'plugins/' 'themes/' 'uploads/' -x '
|
192 |
ob_start();
|
193 |
-
|
194 |
-
case 'passthru':
|
195 |
-
passthru($command, $err);
|
196 |
-
break;
|
197 |
-
case 'exec':
|
198 |
-
exec($command);
|
199 |
-
break;
|
200 |
-
case 'system':
|
201 |
-
system($command);
|
202 |
-
break;
|
203 |
-
default:
|
204 |
-
break;
|
205 |
-
}
|
206 |
ob_get_clean();
|
207 |
-
|
208 |
-
|
209 |
-
return array(
|
210 |
'path' => $file_path,
|
211 |
'url' => $file_url
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
return false;
|
216 |
|
217 |
} else {
|
218 |
require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
@@ -221,9 +180,9 @@ class MMB_Backup extends MMB_Core
|
|
221 |
$result = $archive->add(WP_CONTENT_DIR . '/themes', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
|
222 |
$result = $archive->add(WP_CONTENT_DIR . '/uploads', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
|
223 |
|
224 |
-
$result = $archive->delete(PCLZIP_OPT_BY_NAME,
|
225 |
if ($result) {
|
226 |
-
$file_url =
|
227 |
return array(
|
228 |
'path' => $file_path,
|
229 |
'url' => $file_url
|
@@ -238,7 +197,7 @@ class MMB_Backup extends MMB_Core
|
|
238 |
function backup_db($type)
|
239 |
{
|
240 |
$mysqldump_exists = $this->check_mysqldump();
|
241 |
-
if (is_array($mysqldump_exists)
|
242 |
$result = $this->backup_db_dump($type, $mysqldump_exists);
|
243 |
|
244 |
} else {
|
@@ -251,29 +210,15 @@ class MMB_Backup extends MMB_Core
|
|
251 |
function backup_db_dump($type, $paths)
|
252 |
{
|
253 |
global $wpdb;
|
254 |
-
$upload_dir = wp_upload_dir();
|
255 |
$sec_string = md5('mmb-worker');
|
256 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
257 |
|
258 |
-
$file =
|
259 |
-
$file_url =
|
260 |
|
261 |
$command = $brace . $paths['mysqldump'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
|
262 |
ob_start();
|
263 |
-
$
|
264 |
-
switch ($func) {
|
265 |
-
case 'passthru':
|
266 |
-
passthru($command, $error);
|
267 |
-
break;
|
268 |
-
case 'exec':
|
269 |
-
exec($command);
|
270 |
-
break;
|
271 |
-
case 'system':
|
272 |
-
system($command);
|
273 |
-
break;
|
274 |
-
default:
|
275 |
-
break;
|
276 |
-
}
|
277 |
ob_get_clean();
|
278 |
|
279 |
if ($error) {
|
@@ -296,13 +241,12 @@ class MMB_Backup extends MMB_Core
|
|
296 |
{
|
297 |
global $wpdb;
|
298 |
$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
299 |
-
$upload_dir = wp_upload_dir();
|
300 |
$sec_string = md5('mmb-worker');
|
301 |
-
$zip_file = '/' . $sec_string . '/
|
302 |
-
$zip_file_path =
|
303 |
|
304 |
-
$file =
|
305 |
-
$file_url =
|
306 |
|
307 |
foreach ($tables as $table) {
|
308 |
//drop exixting table
|
@@ -356,40 +300,27 @@ class MMB_Backup extends MMB_Core
|
|
356 |
}
|
357 |
|
358 |
function restore($args)
|
359 |
-
{
|
360 |
-
|
361 |
$type = $args['type'];
|
362 |
if (trim($type) == '') {
|
363 |
return false;
|
364 |
}
|
|
|
365 |
// Set paths
|
366 |
-
$upload_dir = wp_upload_dir();
|
367 |
$sec_string = md5('mmb-worker');
|
368 |
-
$backup_dir = "/$sec_string/backups";
|
369 |
$file = "/$sec_string/restore";
|
370 |
-
$file_path =
|
371 |
-
$backup_path =
|
372 |
-
|
373 |
-
|
374 |
-
if ($type != 'weekly' && $type != 'daily') {
|
375 |
-
// Download backup file from master
|
376 |
-
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
377 |
-
$tmp_file = download_url($type);
|
378 |
-
$backup_file = $backup_path . "/" . basename($type);
|
379 |
-
if (rename($tmp_file, $backup_file)) {
|
380 |
-
@unlink($tmp_file);
|
381 |
-
} else {
|
382 |
-
$backup_file = $tmp_file;
|
383 |
-
}
|
384 |
-
|
385 |
-
} else {
|
386 |
-
// Getting file from worker
|
387 |
-
$backup_file = $worker_options['backups'][$type]['path'];
|
388 |
-
}
|
389 |
|
|
|
|
|
|
|
390 |
|
391 |
-
if ($backup_file) {
|
392 |
-
if ($this->
|
393 |
if (!mkdir($file_path))
|
394 |
return array(
|
395 |
'error' => 'Failed to create restore folder.'
|
@@ -398,20 +329,7 @@ class MMB_Backup extends MMB_Core
|
|
398 |
chdir($file_path);
|
399 |
$command = "unzip -o $backup_file";
|
400 |
ob_start();
|
401 |
-
|
402 |
-
switch ($func) {
|
403 |
-
case 'passthru':
|
404 |
-
passthru($command, $err);
|
405 |
-
break;
|
406 |
-
case 'exec':
|
407 |
-
exec($command);
|
408 |
-
break;
|
409 |
-
case 'system':
|
410 |
-
system($command);
|
411 |
-
break;
|
412 |
-
default:
|
413 |
-
break;
|
414 |
-
}
|
415 |
ob_get_clean();
|
416 |
|
417 |
} else {
|
@@ -445,6 +363,10 @@ class MMB_Backup extends MMB_Core
|
|
445 |
}
|
446 |
}
|
447 |
|
|
|
|
|
|
|
|
|
448 |
$this->delete_temp_dir($file_path);
|
449 |
} else {
|
450 |
return array(
|
@@ -461,24 +383,12 @@ class MMB_Backup extends MMB_Core
|
|
461 |
$content_file = glob($file_path . "/*.zip");
|
462 |
$wp_config_file = glob($file_path . "/wp-config.php");
|
463 |
$htaccess_file = glob($file_path . "/.htaccess");
|
464 |
-
if ($this->
|
465 |
chdir(WP_CONTENT_DIR);
|
466 |
$con_file = $content_file[0];
|
467 |
$command = "unzip -o $con_file";
|
468 |
ob_start();
|
469 |
-
|
470 |
-
case 'passthru':
|
471 |
-
passthru($command, $err);
|
472 |
-
break;
|
473 |
-
case 'exec':
|
474 |
-
exec($command);
|
475 |
-
break;
|
476 |
-
case 'system':
|
477 |
-
system($command);
|
478 |
-
break;
|
479 |
-
default:
|
480 |
-
break;
|
481 |
-
}
|
482 |
ob_get_clean();
|
483 |
} else {
|
484 |
$archive = new PclZip($content_file[0]);
|
@@ -503,25 +413,13 @@ class MMB_Backup extends MMB_Core
|
|
503 |
|
504 |
$mysqldump = $this->check_mysqldump();
|
505 |
|
506 |
-
if (is_array($mysqldump)
|
507 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
508 |
|
509 |
foreach (glob($file_path . '/*.sql') as $filename) {
|
510 |
$command = $brace . $mysqldump['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $filename . $brace;
|
511 |
ob_start();
|
512 |
-
|
513 |
-
case 'passthru':
|
514 |
-
passthru($command, $error);
|
515 |
-
break;
|
516 |
-
case 'exec':
|
517 |
-
exec($command);
|
518 |
-
break;
|
519 |
-
case 'system':
|
520 |
-
system($command);
|
521 |
-
break;
|
522 |
-
default:
|
523 |
-
break;
|
524 |
-
}
|
525 |
ob_get_clean();
|
526 |
break;
|
527 |
}
|
@@ -617,9 +515,9 @@ class MMB_Backup extends MMB_Core
|
|
617 |
$paths['mysqldump'] = 'mysqldump.exe';
|
618 |
}
|
619 |
} else {
|
620 |
-
if (
|
621 |
-
$paths['mysql'] =
|
622 |
-
$paths['mysqldump'] =
|
623 |
} else {
|
624 |
$paths['mysql'] = 'mysql';
|
625 |
$paths['mysqldump'] = 'mysqldump';
|
@@ -636,32 +534,144 @@ class MMB_Backup extends MMB_Core
|
|
636 |
return $paths;
|
637 |
}
|
638 |
|
639 |
-
//Check if
|
640 |
function check_sys()
|
641 |
{
|
642 |
-
if (function_exists('
|
643 |
-
return '
|
644 |
|
645 |
if (function_exists('system'))
|
646 |
return 'system';
|
647 |
|
648 |
-
if (function_exists('
|
649 |
-
return '
|
650 |
|
651 |
return false;
|
652 |
|
653 |
}
|
654 |
|
655 |
-
function
|
656 |
{
|
657 |
-
|
658 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
}
|
660 |
|
661 |
-
function
|
662 |
{
|
663 |
-
|
664 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
}
|
666 |
|
667 |
}
|
14 |
{
|
15 |
function __construct()
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
parent::__construct();
|
18 |
}
|
19 |
|
20 |
function backup($args)
|
21 |
+
{
|
22 |
+
@ini_set('memory_limit', '300M');
|
23 |
+
@set_time_limit(300);
|
24 |
//type like manual, weekly, daily
|
25 |
$type = $args['type'];
|
26 |
+
//what like full or only db
|
27 |
$what = $args['what'];
|
28 |
+
|
29 |
if (trim($type) == '')
|
30 |
$type = 'manual'; //default
|
|
|
|
|
31 |
$sec_string = md5('mmb-worker');
|
32 |
+
$file = "/$sec_string/mwp_backups";
|
33 |
+
$file_path = WP_CONTENT_DIR . $file;
|
34 |
+
@ini_set('memory_limit', '300M');
|
35 |
+
@set_time_limit(300);
|
36 |
if (!file_exists($file_path)) {
|
37 |
if (!mkdir($file_path, 0755, true))
|
38 |
return array(
|
39 |
'error' => 'Permission denied, make sure you have write permission to wp-content folder.'
|
40 |
);
|
41 |
}
|
42 |
+
file_put_contents($file_path . '/index.php', ''); //safe
|
43 |
+
|
44 |
if (trim($what) == 'full') {
|
45 |
//take wp-content backup
|
46 |
$content_backup = $this->backup_wpcontent($type);
|
70 |
|
71 |
// Get previous backup in tmp
|
72 |
$worker_options = get_option('mmb-worker');
|
73 |
+
|
74 |
+
$tmp_file = WP_CONTENT_DIR . '/' . basename($worker_options['backups'][$type]['path']);
|
75 |
|
76 |
if (rename($worker_options['backups'][$type]['path'], $tmp_file)) {
|
77 |
@unlink($worker_options['backups'][$type]['path']);
|
86 |
"",
|
87 |
"-"
|
88 |
), $site_name);
|
|
|
89 |
|
90 |
+
$hash = md5(time());
|
91 |
+
$backup_file = $file_path . '/' . $site_name . '_' . $type . '_' . $what . '_' . date('Y-m-d') .'_'.$hash. '.zip';
|
92 |
+
|
93 |
+
if ($this->mmb_exec('which zip') == false) {
|
94 |
$archive = new PclZip($backup_file);
|
95 |
}
|
96 |
|
97 |
if (trim($what) == 'full') {
|
98 |
$htaccess_path = ABSPATH . ".htaccess";
|
99 |
$wp_config_path = ABSPATH . "wp-config.php";
|
100 |
+
if ($this->mmb_exec('which zip')) {
|
101 |
$command = "zip $backup_file -j $content_backup[path] -j $db_backup[path] -j $htaccess_path -j $wp_config_path";
|
102 |
ob_start();
|
103 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
ob_get_clean();
|
105 |
} else {
|
106 |
$result = $archive->add($content_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
|
111 |
}
|
112 |
|
113 |
} elseif (trim($what) == 'db') {
|
114 |
+
if ($this->mmb_exec('which zip')) {
|
115 |
$command = "zip $backup_file -j $db_backup[path]";
|
116 |
ob_start();
|
117 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
ob_get_clean();
|
119 |
} else {
|
120 |
$result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
|
134 |
@unlink($tmp_file);
|
135 |
@unlink($content_backup['path']);
|
136 |
@unlink($db_backup['path']);
|
137 |
+
|
138 |
+
$backup_url = WP_CONTENT_URL . $file . '/' . $site_name . '_' . $type . '_' . $what . '_' . date('Y-m-d') .'_'.$hash. '.zip';
|
139 |
+
|
140 |
$worker_options = get_option('mmb-worker');
|
141 |
//remove old file
|
142 |
if ($worker_options['backups'][$type]['path'] != $backup_file) {
|
147 |
$worker_options['backups'][$type]['url'] = $backup_url;
|
148 |
update_option('mmb-worker', $worker_options);
|
149 |
|
150 |
+
|
151 |
//Everything went fine, return backup url to master
|
152 |
return $worker_options['backups'][$type]['url'];
|
153 |
}
|
154 |
|
155 |
function backup_wpcontent($type)
|
156 |
{
|
|
|
157 |
$sec_string = md5('mmb-worker');
|
158 |
+
$file = '/' . $sec_string . '/mwp_backups/wp-content_' . date('Y-m-d') . '.zip';
|
159 |
+
$file_path = WP_CONTENT_DIR . $file;
|
160 |
+
|
161 |
+
if ($this->mmb_exec('which zip')) {
|
162 |
chdir(WP_CONTENT_DIR);
|
163 |
+
$command = "zip -r $file_path 'plugins/' 'themes/' 'uploads/' -x '" . $sec_string . "/*'";
|
164 |
ob_start();
|
165 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
ob_get_clean();
|
167 |
+
$file_url = WP_CONTENT_URL . $file;
|
168 |
+
return array(
|
|
|
169 |
'path' => $file_path,
|
170 |
'url' => $file_url
|
171 |
+
);
|
172 |
+
|
173 |
+
//@unlink($file_path);
|
174 |
+
//return false;
|
175 |
|
176 |
} else {
|
177 |
require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
180 |
$result = $archive->add(WP_CONTENT_DIR . '/themes', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
|
181 |
$result = $archive->add(WP_CONTENT_DIR . '/uploads', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
|
182 |
|
183 |
+
$result = $archive->delete(PCLZIP_OPT_BY_NAME, $sec_string . '/');
|
184 |
if ($result) {
|
185 |
+
$file_url = WP_CONTENT_URL . $file;
|
186 |
return array(
|
187 |
'path' => $file_path,
|
188 |
'url' => $file_url
|
197 |
function backup_db($type)
|
198 |
{
|
199 |
$mysqldump_exists = $this->check_mysqldump();
|
200 |
+
if (is_array($mysqldump_exists)) {
|
201 |
$result = $this->backup_db_dump($type, $mysqldump_exists);
|
202 |
|
203 |
} else {
|
210 |
function backup_db_dump($type, $paths)
|
211 |
{
|
212 |
global $wpdb;
|
|
|
213 |
$sec_string = md5('mmb-worker');
|
214 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
215 |
|
216 |
+
$file = WP_CONTENT_DIR . '/' . DB_NAME . '.sql';
|
217 |
+
$file_url = WP_CONTENT_URL . '/' . DB_NAME . '.sql';
|
218 |
|
219 |
$command = $brace . $paths['mysqldump'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
|
220 |
ob_start();
|
221 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
ob_get_clean();
|
223 |
|
224 |
if ($error) {
|
241 |
{
|
242 |
global $wpdb;
|
243 |
$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
|
|
244 |
$sec_string = md5('mmb-worker');
|
245 |
+
$zip_file = '/' . $sec_string . '/mwp_backups/db_' . date('Y-m-d') . '.zip';
|
246 |
+
$zip_file_path = WP_CONTENT_DIR . $zip_file;
|
247 |
|
248 |
+
$file = WP_CONTENT_DIR . '/' . DB_NAME . '.sql';
|
249 |
+
$file_url = WP_CONTENT_URL . '/' . DB_NAME . '.sql';
|
250 |
|
251 |
foreach ($tables as $table) {
|
252 |
//drop exixting table
|
300 |
}
|
301 |
|
302 |
function restore($args)
|
303 |
+
{
|
304 |
+
|
305 |
$type = $args['type'];
|
306 |
if (trim($type) == '') {
|
307 |
return false;
|
308 |
}
|
309 |
+
|
310 |
// Set paths
|
|
|
311 |
$sec_string = md5('mmb-worker');
|
|
|
312 |
$file = "/$sec_string/restore";
|
313 |
+
$file_path = WP_CONTENT_DIR . $file; //restore path - temporary
|
314 |
+
$backup_path = WP_CONTENT_DIR;
|
315 |
+
@ini_set('memory_limit', '300M');
|
316 |
+
@set_time_limit(300);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
+
// Getting file from worker
|
319 |
+
$worker_options = get_option('mmb-worker');
|
320 |
+
$backup_file = $worker_options['backups'][$type]['path'];
|
321 |
|
322 |
+
if ($backup_file && file_exists($backup_file)) {
|
323 |
+
if ($this->mmb_exec('which unzip')) {
|
324 |
if (!mkdir($file_path))
|
325 |
return array(
|
326 |
'error' => 'Failed to create restore folder.'
|
329 |
chdir($file_path);
|
330 |
$command = "unzip -o $backup_file";
|
331 |
ob_start();
|
332 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
ob_get_clean();
|
334 |
|
335 |
} else {
|
363 |
}
|
364 |
}
|
365 |
|
366 |
+
if($del_backup_later)
|
367 |
+
{
|
368 |
+
@unlink($backup_file);
|
369 |
+
}
|
370 |
$this->delete_temp_dir($file_path);
|
371 |
} else {
|
372 |
return array(
|
383 |
$content_file = glob($file_path . "/*.zip");
|
384 |
$wp_config_file = glob($file_path . "/wp-config.php");
|
385 |
$htaccess_file = glob($file_path . "/.htaccess");
|
386 |
+
if ($this->mmb_exec('which unzip')) {
|
387 |
chdir(WP_CONTENT_DIR);
|
388 |
$con_file = $content_file[0];
|
389 |
$command = "unzip -o $con_file";
|
390 |
ob_start();
|
391 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
ob_get_clean();
|
393 |
} else {
|
394 |
$archive = new PclZip($content_file[0]);
|
413 |
|
414 |
$mysqldump = $this->check_mysqldump();
|
415 |
|
416 |
+
if (is_array($mysqldump)) {
|
417 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
418 |
|
419 |
foreach (glob($file_path . '/*.sql') as $filename) {
|
420 |
$command = $brace . $mysqldump['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $filename . $brace;
|
421 |
ob_start();
|
422 |
+
$this->mmb_exec($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
ob_get_clean();
|
424 |
break;
|
425 |
}
|
515 |
$paths['mysqldump'] = 'mysqldump.exe';
|
516 |
}
|
517 |
} else {
|
518 |
+
if ($this->check_sys()) {
|
519 |
+
$paths['mysql'] = $this->mmb_exec('which mysql');
|
520 |
+
$paths['mysqldump'] = $this->mmb_exec('which mysqldump');
|
521 |
} else {
|
522 |
$paths['mysql'] = 'mysql';
|
523 |
$paths['mysqldump'] = 'mysqldump';
|
534 |
return $paths;
|
535 |
}
|
536 |
|
537 |
+
//Check if exec, system, shell_exec functions exist
|
538 |
function check_sys()
|
539 |
{
|
540 |
+
if (function_exists('exec'))
|
541 |
+
return 'exec';
|
542 |
|
543 |
if (function_exists('system'))
|
544 |
return 'system';
|
545 |
|
546 |
+
if (function_exists('shell_exec'))
|
547 |
+
return 'shell_exec';
|
548 |
|
549 |
return false;
|
550 |
|
551 |
}
|
552 |
|
553 |
+
function mmb_exec($command)
|
554 |
{
|
555 |
+
if($command == '')
|
556 |
+
return false;
|
557 |
+
|
558 |
+
if (function_exists('exec'))
|
559 |
+
{
|
560 |
+
return @exec($command);
|
561 |
+
}
|
562 |
+
elseif (function_exists('system'))
|
563 |
+
{
|
564 |
+
return @system($command);
|
565 |
+
}
|
566 |
+
elseif (function_exists('shell_exec'))
|
567 |
+
{
|
568 |
+
return @shell_exec($command);
|
569 |
+
}
|
570 |
+
else
|
571 |
+
{
|
572 |
+
return false;
|
573 |
+
}
|
574 |
}
|
575 |
|
576 |
+
function email_backup($args)
|
577 |
{
|
578 |
+
$email = $args['email'];
|
579 |
+
$what = $args['email'];
|
580 |
+
$type = $args['type'];
|
581 |
+
$worker_options = get_option('mmb-worker');
|
582 |
+
$backup_file = $worker_options['backups'][$type]['path'];
|
583 |
+
if(file_exists($backup_file) && $email)
|
584 |
+
{
|
585 |
+
$attachments = array($backup_file);
|
586 |
+
$headers = 'From: ManageWP <wordpress@managewp.com>' . "\r\n";
|
587 |
+
$subject = "Backup - " . $type ." - " . date('Y-m-d');
|
588 |
+
ob_start();
|
589 |
+
wp_mail($email, $subject, '', $headers, $attachments);
|
590 |
+
ob_end_clean();
|
591 |
+
}
|
592 |
+
|
593 |
+
}
|
594 |
+
|
595 |
+
function check_backup_compat()
|
596 |
+
{
|
597 |
+
$reqs = array();
|
598 |
+
if ( strpos($_SERVER['DOCUMENT_ROOT'], '/') === 0 ) {
|
599 |
+
$reqs['Server OS']['status'] = 'Linux (or compatible)';
|
600 |
+
$reqs['Server OS']['pass'] = true;
|
601 |
+
} else {
|
602 |
+
$reqs['Server OS']['status'] = 'Windows';
|
603 |
+
$reqs['Server OS']['pass'] = false;
|
604 |
+
$pass = false;
|
605 |
+
}
|
606 |
+
$reqs['PHP Version']['status'] = phpversion();
|
607 |
+
if ( (float) phpversion() >= 5.1 ) {
|
608 |
+
$reqs['PHP Version']['pass'] = true;
|
609 |
+
} else {
|
610 |
+
$reqs['PHP Version']['pass'] = false;
|
611 |
+
$pass = false;
|
612 |
+
}
|
613 |
+
|
614 |
+
if(is_writable(WP_CONTENT_DIR))
|
615 |
+
{
|
616 |
+
$reqs['Backup Folder']['status'] = "writable";
|
617 |
+
$reqs['Backup Folder']['pass'] = true;
|
618 |
+
}
|
619 |
+
else
|
620 |
+
{
|
621 |
+
$reqs['Backup Folder']['status'] = "not writable";
|
622 |
+
$reqs['Backup Folder']['pass'] = true;
|
623 |
+
}
|
624 |
+
|
625 |
+
if($func = $this->check_sys())
|
626 |
+
{
|
627 |
+
$reqs['Execute Function']['status'] =$func;
|
628 |
+
$reqs['Execute Function']['pass'] = true;
|
629 |
+
}
|
630 |
+
else
|
631 |
+
{
|
632 |
+
$reqs['Execute Function']['status'] = "not found";
|
633 |
+
$reqs['Execute Function']['info'] = "(will try with PHP)";
|
634 |
+
$reqs['Execute Function']['pass'] = false;
|
635 |
+
}
|
636 |
+
|
637 |
+
if($this->mmb_exec('which zip'))
|
638 |
+
{
|
639 |
+
$reqs['Zip']['status'] = "enabled";
|
640 |
+
$reqs['Zip']['pass'] = true;
|
641 |
+
}
|
642 |
+
else
|
643 |
+
{
|
644 |
+
$reqs['Zip']['status'] = "not found";
|
645 |
+
$reqs['Zip']['info'] = "(will try with PHP pclZip class)";
|
646 |
+
$reqs['Zip']['pass'] = false;
|
647 |
+
}
|
648 |
+
|
649 |
+
if($this->mmb_exec('which unzip'))
|
650 |
+
{
|
651 |
+
$reqs['Unzip']['status'] = "enabled";
|
652 |
+
$reqs['Unzip']['pass'] = true;
|
653 |
+
}
|
654 |
+
else
|
655 |
+
{
|
656 |
+
$reqs['Unzip']['status'] = "not found";
|
657 |
+
$reqs['Unzip']['info'] = "(will try with PHP pclZip class)";
|
658 |
+
$reqs['Unzip']['pass'] = false;
|
659 |
+
}
|
660 |
+
if(is_array($this->check_mysqldump()))
|
661 |
+
{
|
662 |
+
$reqs['MySQL Dump']['status'] = "enabled";
|
663 |
+
$reqs['MySQL Dump']['pass'] = true;
|
664 |
+
}
|
665 |
+
else
|
666 |
+
{
|
667 |
+
$reqs['MySQL Dump']['status'] = "not found";
|
668 |
+
$reqs['MySQL Dump']['info'] = "(will try PHP)";
|
669 |
+
$reqs['MySQL Dump']['pass'] = false;
|
670 |
+
}
|
671 |
+
|
672 |
+
|
673 |
+
|
674 |
+
return $reqs;
|
675 |
}
|
676 |
|
677 |
}
|
comment.class.php
CHANGED
@@ -32,7 +32,7 @@ class MMB_Comment extends MMB_Core
|
|
32 |
$status_sql = 'spam';
|
33 |
elseif ( 'trash' == $status )
|
34 |
$status_sql = 'trash';
|
35 |
-
$sql = "update ".$wpdb->prefix."comments set comment_approved = '$status_sql' where
|
36 |
$success = $wpdb->query($sql);
|
37 |
|
38 |
|
32 |
$status_sql = 'spam';
|
33 |
elseif ( 'trash' == $status )
|
34 |
$status_sql = 'trash';
|
35 |
+
$sql = "update ".$wpdb->prefix."comments set comment_approved = '$status_sql' where comment_ID = '$comment_id'";
|
36 |
$success = $wpdb->query($sql);
|
37 |
|
38 |
|
core.class.php
CHANGED
@@ -220,6 +220,19 @@ class MMB_Core extends MMB_Helper
|
|
220 |
return $this->backup_instance;
|
221 |
}
|
222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
function get_installer_instance()
|
224 |
{
|
225 |
if (!isset($this->installer_instance)) {
|
@@ -294,7 +307,7 @@ class MMB_Core extends MMB_Helper
|
|
294 |
include_once ABSPATH . 'wp-admin/includes/template.php';
|
295 |
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
296 |
|
297 |
-
if ((
|
298 |
return array(
|
299 |
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details for automatic upgrades.</a></a>'
|
300 |
);
|
@@ -354,7 +367,7 @@ class MMB_Core extends MMB_Helper
|
|
354 |
}
|
355 |
|
356 |
if ($_GET['auto_login']) {
|
357 |
-
wp_redirect(
|
358 |
exit();
|
359 |
}
|
360 |
}
|
220 |
return $this->backup_instance;
|
221 |
}
|
222 |
|
223 |
+
/**
|
224 |
+
* Gets an instance of links class
|
225 |
+
*
|
226 |
+
*/
|
227 |
+
function get_link_instance()
|
228 |
+
{
|
229 |
+
if (!isset($this->link_instance)) {
|
230 |
+
$this->link_instance = new MMB_Link();
|
231 |
+
}
|
232 |
+
|
233 |
+
return $this->link_instance;
|
234 |
+
}
|
235 |
+
|
236 |
function get_installer_instance()
|
237 |
{
|
238 |
if (!isset($this->installer_instance)) {
|
307 |
include_once ABSPATH . 'wp-admin/includes/template.php';
|
308 |
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
309 |
|
310 |
+
if (!$this->is_server_writable()) {
|
311 |
return array(
|
312 |
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details for automatic upgrades.</a></a>'
|
313 |
);
|
367 |
}
|
368 |
|
369 |
if ($_GET['auto_login']) {
|
370 |
+
wp_redirect(get_option('siteurl') . "/wp-admin/" . $where);
|
371 |
exit();
|
372 |
}
|
373 |
}
|
helper.class.php
CHANGED
@@ -76,26 +76,37 @@ class MMB_Helper
|
|
76 |
* @param string $option_name
|
77 |
* @return mixed
|
78 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
function mmb_get_transient($option_name)
|
80 |
{
|
81 |
if (trim($option_name) == '') {
|
82 |
return FALSE;
|
83 |
}
|
84 |
|
85 |
-
global $mmb_wp_version
|
86 |
|
87 |
if (version_compare($mmb_wp_version, '2.8.0', '<')) {
|
88 |
return get_option($option_name);
|
89 |
} else if (version_compare($mmb_wp_version, '3.0.0', '<')) {
|
90 |
-
|
91 |
-
return get_transient($option_name);
|
92 |
-
else
|
93 |
-
return get_option('_transient_' . $option_name);
|
94 |
} else {
|
95 |
-
|
96 |
-
return get_site_transient($option_name);
|
97 |
-
else
|
98 |
-
return get_option('_site_transient_' . $option_name);
|
99 |
}
|
100 |
}
|
101 |
|
@@ -110,15 +121,9 @@ class MMB_Helper
|
|
110 |
if (version_compare($mmb_wp_version, '2.8.0', '<')) {
|
111 |
delete_option($option_name);
|
112 |
} else if (version_compare($mmb_wp_version, '3.0.0', '<')) {
|
113 |
-
|
114 |
-
delete_transient($option_name);
|
115 |
-
else
|
116 |
-
delete_option('_transient_' . $option_name);
|
117 |
} else {
|
118 |
-
|
119 |
-
delete_site_transient($option_name);
|
120 |
-
else
|
121 |
-
delete_option('_site_transient_' . $option_name);
|
122 |
}
|
123 |
}
|
124 |
|
@@ -293,7 +298,7 @@ class MMB_Helper
|
|
293 |
function mmb_get_error($error_object)
|
294 |
{
|
295 |
if (!is_wp_error($error_object)) {
|
296 |
-
return $error_object != '' ? $error_object : '
|
297 |
} else {
|
298 |
$errors = array();
|
299 |
foreach ($error_object->error_data as $error_key => $error_string) {
|
@@ -303,6 +308,29 @@ class MMB_Helper
|
|
303 |
}
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
}
|
308 |
?>
|
76 |
* @param string $option_name
|
77 |
* @return mixed
|
78 |
*/
|
79 |
+
|
80 |
+
function mmb_set_transient($option_name = false, $data = false){
|
81 |
+
|
82 |
+
if (!$option_name || !$data) {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
global $mmb_wp_version;
|
86 |
+
|
87 |
+
if (version_compare($mmb_wp_version, '2.8.0', '<')) {
|
88 |
+
update_option($option_name, $data);
|
89 |
+
} else if (version_compare($mmb_wp_version, '3.0.0', '<')) {
|
90 |
+
update_option('_transient_' . $option_name, $data);
|
91 |
+
} else {
|
92 |
+
update_option('_site_transient_' . $option_name, $data);
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
function mmb_get_transient($option_name)
|
97 |
{
|
98 |
if (trim($option_name) == '') {
|
99 |
return FALSE;
|
100 |
}
|
101 |
|
102 |
+
global $mmb_wp_version;
|
103 |
|
104 |
if (version_compare($mmb_wp_version, '2.8.0', '<')) {
|
105 |
return get_option($option_name);
|
106 |
} else if (version_compare($mmb_wp_version, '3.0.0', '<')) {
|
107 |
+
return get_option('_transient_' . $option_name);
|
|
|
|
|
|
|
108 |
} else {
|
109 |
+
return get_option('_site_transient_' . $option_name);
|
|
|
|
|
|
|
110 |
}
|
111 |
}
|
112 |
|
121 |
if (version_compare($mmb_wp_version, '2.8.0', '<')) {
|
122 |
delete_option($option_name);
|
123 |
} else if (version_compare($mmb_wp_version, '3.0.0', '<')) {
|
124 |
+
delete_option('_transient_' . $option_name);
|
|
|
|
|
|
|
125 |
} else {
|
126 |
+
delete_option('_site_transient_' . $option_name);
|
|
|
|
|
|
|
127 |
}
|
128 |
}
|
129 |
|
298 |
function mmb_get_error($error_object)
|
299 |
{
|
300 |
if (!is_wp_error($error_object)) {
|
301 |
+
return $error_object != '' ? $error_object : '';
|
302 |
} else {
|
303 |
$errors = array();
|
304 |
foreach ($error_object->error_data as $error_key => $error_string) {
|
308 |
}
|
309 |
}
|
310 |
|
311 |
+
function is_server_writable(){
|
312 |
+
if((!defined('FTP_HOST') || !defined('FTP_USER') || !defined('FTP_PASS')) && (get_filesystem_method(array(), false) != 'direct'))
|
313 |
+
return false;
|
314 |
+
else
|
315 |
+
return true;
|
316 |
+
}
|
317 |
+
|
318 |
+
function mmb_download_url($url, $file_name)
|
319 |
+
{
|
320 |
+
if (function_exists('fopen') && function_exists('ini_get') && ini_get('allow_url_fopen') == true && ($destination = @fopen($file_name, 'wb')) && ($source = @fopen($url, "r")) ) {
|
321 |
+
|
322 |
+
|
323 |
+
while ($a = @fread($source, 1024* 1024)) {
|
324 |
+
@fwrite($destination, $a);
|
325 |
+
}
|
326 |
+
|
327 |
+
fclose($source);
|
328 |
+
fclose($destination);
|
329 |
+
} else
|
330 |
+
if (!fsockopen_download($url, $file_name))
|
331 |
+
die('Error downloading file ' . $url);
|
332 |
+
return $file_name;
|
333 |
+
}
|
334 |
|
335 |
}
|
336 |
?>
|
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
|
6 |
Author: Prelovac Media
|
7 |
-
Version: 3.8.
|
8 |
Author URI: http://www.prelovac.com
|
9 |
*/
|
10 |
|
@@ -20,7 +20,7 @@ Author URI: http://www.prelovac.com
|
|
20 |
**************************************************************/
|
21 |
|
22 |
|
23 |
-
define('MMB_WORKER_VERSION', '3.8.
|
24 |
|
25 |
global $wpdb, $mmb_plugin_dir, $mmb_plugin_url;
|
26 |
|
@@ -36,6 +36,7 @@ $mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
|
|
36 |
$mmb_actions = array(
|
37 |
'remove_site' => 'mmb_remove_site',
|
38 |
'get_stats' => 'mmb_stats_get',
|
|
|
39 |
'backup' => 'mmb_backup_now',
|
40 |
'restore' => 'mmb_restore_now',
|
41 |
'optimize_tables' => 'mmb_optimize_tables',
|
@@ -43,9 +44,13 @@ $mmb_actions = array(
|
|
43 |
'create_post' => 'mmb_post_create',
|
44 |
'update_worker' => 'mmb_update_worker_plugin',
|
45 |
'change_comment_status' => 'mmb_change_comment_status',
|
|
|
46 |
'get_comment_stats' => 'mmb_comment_stats_get',
|
47 |
'install_addon' => 'mmb_install_addon',
|
48 |
-
'do_upgrade' => 'mmb_do_upgrade'
|
|
|
|
|
|
|
49 |
);
|
50 |
|
51 |
require_once("$mmb_plugin_dir/helper.class.php");
|
@@ -55,9 +60,9 @@ require_once("$mmb_plugin_dir/comment.class.php");
|
|
55 |
require_once("$mmb_plugin_dir/stats.class.php");
|
56 |
require_once("$mmb_plugin_dir/backup.class.php");
|
57 |
require_once("$mmb_plugin_dir/installer.class.php");
|
|
|
58 |
require_once("$mmb_plugin_dir/api.php");
|
59 |
|
60 |
-
|
61 |
require_once("$mmb_plugin_dir/plugins/search/search.php");
|
62 |
require_once("$mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
63 |
|
@@ -151,8 +156,8 @@ function mmb_add_site($params)
|
|
151 |
if ($verify == 1) {
|
152 |
$mmb_core->set_master_public_key($public_key);
|
153 |
$mmb_core->set_worker_message_id($id);
|
154 |
-
|
155 |
-
mmb_response($mmb_core->
|
156 |
} else if ($verify == 0) {
|
157 |
mmb_response('Invalid message signature. Please contact us if you see this message often.', false);
|
158 |
} else {
|
@@ -166,7 +171,8 @@ function mmb_add_site($params)
|
|
166 |
$mmb_core->set_random_signature($random_key);
|
167 |
$mmb_core->set_worker_message_id($id);
|
168 |
$mmb_core->set_master_public_key($public_key);
|
169 |
-
|
|
|
170 |
} else
|
171 |
mmb_response('Please deactivate & activate ManageWP Worker plugin on your site, then re-add the site to your dashboard.', false);
|
172 |
}
|
@@ -206,44 +212,89 @@ function mmb_remove_site($params)
|
|
206 |
function mmb_stats_get($params)
|
207 |
{
|
208 |
global $mmb_core;
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
}
|
211 |
|
212 |
//post
|
213 |
function mmb_post_create($params)
|
214 |
{
|
215 |
global $mmb_core;
|
216 |
-
$
|
|
|
217 |
if (is_int($return))
|
218 |
mmb_response($return, true);
|
219 |
else
|
220 |
mmb_response($return, false);
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
|
|
223 |
//comments
|
224 |
function mmb_change_comment_status($params)
|
225 |
{
|
226 |
|
227 |
global $mmb_core;
|
228 |
-
$
|
|
|
229 |
//mmb_response($return, true);
|
230 |
-
if ($return)
|
231 |
-
|
232 |
-
|
|
|
233 |
mmb_response('Comment not updated', false);
|
234 |
}
|
235 |
function mmb_comment_stats_get($params)
|
236 |
{
|
237 |
global $mmb_core;
|
238 |
-
|
|
|
239 |
}
|
240 |
|
241 |
//backup
|
242 |
function mmb_backup_now($params)
|
243 |
{
|
244 |
global $mmb_core;
|
|
|
|
|
245 |
|
246 |
-
$return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
if (is_array($return) && array_key_exists('error', $return))
|
249 |
mmb_response($return['error'], false);
|
@@ -255,7 +306,8 @@ function mmb_backup_now($params)
|
|
255 |
function mmb_optimize_tables($params)
|
256 |
{
|
257 |
global $mmb_core;
|
258 |
-
$
|
|
|
259 |
if ($return)
|
260 |
mmb_response($return, true);
|
261 |
else
|
@@ -265,7 +317,8 @@ function mmb_optimize_tables($params)
|
|
265 |
function mmb_restore_now($params)
|
266 |
{
|
267 |
global $mmb_core;
|
268 |
-
$
|
|
|
269 |
if (is_array($return) && array_key_exists('error', $return))
|
270 |
mmb_response($return['error'], false);
|
271 |
else
|
@@ -289,7 +342,8 @@ function mmb_wp_checkversion($params)
|
|
289 |
function mmb_search_posts_by_term($params)
|
290 |
{
|
291 |
global $mmb_core;
|
292 |
-
$
|
|
|
293 |
|
294 |
if ($return) {
|
295 |
mmb_response(serialize($return), true);
|
@@ -301,15 +355,46 @@ function mmb_search_posts_by_term($params)
|
|
301 |
function mmb_install_addon($params)
|
302 |
{
|
303 |
global $mmb_core;
|
304 |
-
$
|
|
|
305 |
mmb_response($return, true);
|
306 |
|
307 |
}
|
308 |
function mmb_do_upgrade($params)
|
309 |
{
|
310 |
global $mmb_core, $mmb_upgrading;
|
311 |
-
|
|
|
312 |
mmb_response($return, true);
|
313 |
|
314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
?>
|
4 |
Plugin URI: http://managewp.com/
|
5 |
Description: Manage all your blogs from one dashboard
|
6 |
Author: Prelovac Media
|
7 |
+
Version: 3.8.8
|
8 |
Author URI: http://www.prelovac.com
|
9 |
*/
|
10 |
|
20 |
**************************************************************/
|
21 |
|
22 |
|
23 |
+
define('MMB_WORKER_VERSION', '3.8.8');
|
24 |
|
25 |
global $wpdb, $mmb_plugin_dir, $mmb_plugin_url;
|
26 |
|
36 |
$mmb_actions = array(
|
37 |
'remove_site' => 'mmb_remove_site',
|
38 |
'get_stats' => 'mmb_stats_get',
|
39 |
+
'get_stats_notification' => 'mmb_get_stats_notification',
|
40 |
'backup' => 'mmb_backup_now',
|
41 |
'restore' => 'mmb_restore_now',
|
42 |
'optimize_tables' => 'mmb_optimize_tables',
|
44 |
'create_post' => 'mmb_post_create',
|
45 |
'update_worker' => 'mmb_update_worker_plugin',
|
46 |
'change_comment_status' => 'mmb_change_comment_status',
|
47 |
+
'change_post_status' => 'mmb_change_post_status',
|
48 |
'get_comment_stats' => 'mmb_comment_stats_get',
|
49 |
'install_addon' => 'mmb_install_addon',
|
50 |
+
'do_upgrade' => 'mmb_do_upgrade',
|
51 |
+
'add_link' => 'mmb_add_link',
|
52 |
+
'email_backup' => 'mmb_email_backup',
|
53 |
+
'check_backup_compat' => 'mmb_check_backup_compat'
|
54 |
);
|
55 |
|
56 |
require_once("$mmb_plugin_dir/helper.class.php");
|
60 |
require_once("$mmb_plugin_dir/stats.class.php");
|
61 |
require_once("$mmb_plugin_dir/backup.class.php");
|
62 |
require_once("$mmb_plugin_dir/installer.class.php");
|
63 |
+
require_once("$mmb_plugin_dir/link.class.php");
|
64 |
require_once("$mmb_plugin_dir/api.php");
|
65 |
|
|
|
66 |
require_once("$mmb_plugin_dir/plugins/search/search.php");
|
67 |
require_once("$mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
68 |
|
156 |
if ($verify == 1) {
|
157 |
$mmb_core->set_master_public_key($public_key);
|
158 |
$mmb_core->set_worker_message_id($id);
|
159 |
+
$mmb_core->get_stats_instance();
|
160 |
+
mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
|
161 |
} else if ($verify == 0) {
|
162 |
mmb_response('Invalid message signature. Please contact us if you see this message often.', false);
|
163 |
} else {
|
171 |
$mmb_core->set_random_signature($random_key);
|
172 |
$mmb_core->set_worker_message_id($id);
|
173 |
$mmb_core->set_master_public_key($public_key);
|
174 |
+
$mmb_core->get_stats_instance();
|
175 |
+
mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
|
176 |
} else
|
177 |
mmb_response('Please deactivate & activate ManageWP Worker plugin on your site, then re-add the site to your dashboard.', false);
|
178 |
}
|
212 |
function mmb_stats_get($params)
|
213 |
{
|
214 |
global $mmb_core;
|
215 |
+
$mmb_core->get_stats_instance();
|
216 |
+
mmb_response($mmb_core->stats_instance->get($params), true);
|
217 |
+
}
|
218 |
+
function mmb_get_stats_notification($params)
|
219 |
+
{
|
220 |
+
global $mmb_core;
|
221 |
+
$mmb_core->get_stats_instance();
|
222 |
+
$stat = $mmb_core->stats_instance->get_stats_notification($params);
|
223 |
+
mmb_response($stat, true);
|
224 |
}
|
225 |
|
226 |
//post
|
227 |
function mmb_post_create($params)
|
228 |
{
|
229 |
global $mmb_core;
|
230 |
+
$mmb_core->get_post_instance();
|
231 |
+
$return = $mmb_core->post_instance->create($params);
|
232 |
if (is_int($return))
|
233 |
mmb_response($return, true);
|
234 |
else
|
235 |
mmb_response($return, false);
|
236 |
}
|
237 |
+
function mmb_change_post_status($params)
|
238 |
+
{
|
239 |
+
global $mmb_core;
|
240 |
+
$mmb_core->get_post_instance();
|
241 |
+
$return = $mmb_core->post_instance->change_status($params);
|
242 |
+
//mmb_response($return, true);
|
243 |
|
244 |
+
}
|
245 |
//comments
|
246 |
function mmb_change_comment_status($params)
|
247 |
{
|
248 |
|
249 |
global $mmb_core;
|
250 |
+
$mmb_core->get_comment_instance();
|
251 |
+
$return = $mmb_core->comment_instance->change_status($params);
|
252 |
//mmb_response($return, true);
|
253 |
+
if ($return){
|
254 |
+
$mmb_core->get_stats_instance();
|
255 |
+
mmb_response($mmb_core->stats_instance->get_comments_stats($params), true);
|
256 |
+
}else
|
257 |
mmb_response('Comment not updated', false);
|
258 |
}
|
259 |
function mmb_comment_stats_get($params)
|
260 |
{
|
261 |
global $mmb_core;
|
262 |
+
$mmb_core->get_stats_instance();
|
263 |
+
mmb_response($mmb_core->stats_instance->get_comments_stats($params), true);
|
264 |
}
|
265 |
|
266 |
//backup
|
267 |
function mmb_backup_now($params)
|
268 |
{
|
269 |
global $mmb_core;
|
270 |
+
$mmb_core->get_backup_instance();
|
271 |
+
$return = $mmb_core->backup_instance->backup($params);
|
272 |
|
273 |
+
if (is_array($return) && array_key_exists('error', $return))
|
274 |
+
mmb_response($return['error'], false);
|
275 |
+
else {
|
276 |
+
mmb_response($return, true);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
function mmb_email_backup($params)
|
281 |
+
{
|
282 |
+
global $mmb_core;
|
283 |
+
$mmb_core->get_backup_instance();
|
284 |
+
$return = $mmb_core->backup_instance->email_backup($params);
|
285 |
+
|
286 |
+
if (is_array($return) && array_key_exists('error', $return))
|
287 |
+
mmb_response($return['error'], false);
|
288 |
+
else {
|
289 |
+
mmb_response($return, true);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
function mmb_check_backup_compat($params)
|
294 |
+
{
|
295 |
+
global $mmb_core;
|
296 |
+
$mmb_core->get_backup_instance();
|
297 |
+
$return = $mmb_core->backup_instance->check_backup_compat($params);
|
298 |
|
299 |
if (is_array($return) && array_key_exists('error', $return))
|
300 |
mmb_response($return['error'], false);
|
306 |
function mmb_optimize_tables($params)
|
307 |
{
|
308 |
global $mmb_core;
|
309 |
+
$mmb_core->get_backup_instance();
|
310 |
+
$return = $mmb_core->backup_instance->optimize_tables();
|
311 |
if ($return)
|
312 |
mmb_response($return, true);
|
313 |
else
|
317 |
function mmb_restore_now($params)
|
318 |
{
|
319 |
global $mmb_core;
|
320 |
+
$mmb_core->get_backup_instance();
|
321 |
+
$return = $mmb_core->backup_instance->restore($params);
|
322 |
if (is_array($return) && array_key_exists('error', $return))
|
323 |
mmb_response($return['error'], false);
|
324 |
else
|
342 |
function mmb_search_posts_by_term($params)
|
343 |
{
|
344 |
global $mmb_core;
|
345 |
+
$mmb_core->get_search_instance();
|
346 |
+
$return = $mmb_core->search_instance->search_posts_by_term($params);
|
347 |
|
348 |
if ($return) {
|
349 |
mmb_response(serialize($return), true);
|
355 |
function mmb_install_addon($params)
|
356 |
{
|
357 |
global $mmb_core;
|
358 |
+
$mmb_core->get_installer_instance();
|
359 |
+
$return = $mmb_core->installer_instance->install_remote_file($params);
|
360 |
mmb_response($return, true);
|
361 |
|
362 |
}
|
363 |
function mmb_do_upgrade($params)
|
364 |
{
|
365 |
global $mmb_core, $mmb_upgrading;
|
366 |
+
$mmb_core->get_installer_instance();
|
367 |
+
$return = $mmb_core->installer_instance->do_upgrade($params);
|
368 |
mmb_response($return, true);
|
369 |
|
370 |
}
|
371 |
+
|
372 |
+
function mmb_add_link($params)
|
373 |
+
{
|
374 |
+
global $mmb_core;
|
375 |
+
$mmb_core->get_link_instance();
|
376 |
+
$return = $mmb_core->link_instance->add_link($params);
|
377 |
+
if (is_array($return) && array_key_exists('error', $return))
|
378 |
+
|
379 |
+
mmb_response($return['error'], false);
|
380 |
+
else {
|
381 |
+
mmb_response($return, true);
|
382 |
+
}
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
function mmb_iframe_plugins_fix($update_actions)
|
387 |
+
{
|
388 |
+
foreach($update_actions as $key => $action)
|
389 |
+
{
|
390 |
+
$update_actions[$key] = str_replace('target="_parent"','',$action);
|
391 |
+
}
|
392 |
+
|
393 |
+
return $update_actions;
|
394 |
+
|
395 |
+
}
|
396 |
+
|
397 |
+
add_filter('install_plugin_complete_actions','mmb_iframe_plugins_fix');
|
398 |
+
|
399 |
+
|
400 |
?>
|
installer.class.php
CHANGED
@@ -21,7 +21,7 @@ class MMB_Installer extends MMB_Core
|
|
21 |
include_once(ABSPATH . 'wp-admin/includes/theme.php');
|
22 |
include_once(ABSPATH . 'wp-admin/includes/misc.php');
|
23 |
include_once(ABSPATH . 'wp-admin/includes/template.php');
|
24 |
-
include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
|
25 |
|
26 |
global $wp_filesystem;
|
27 |
if (!$wp_filesystem)
|
@@ -90,6 +90,7 @@ class MMB_Installer extends MMB_Core
|
|
90 |
}
|
91 |
}
|
92 |
ob_clean();
|
|
|
93 |
return $install_info;
|
94 |
}
|
95 |
|
@@ -98,7 +99,7 @@ class MMB_Installer extends MMB_Core
|
|
98 |
if($params == null || empty($params))
|
99 |
return array('failed' => 'No upgrades passed.');
|
100 |
|
101 |
-
if ((
|
102 |
return array(
|
103 |
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details</a></a>'
|
104 |
);
|
@@ -109,10 +110,12 @@ class MMB_Installer extends MMB_Core
|
|
109 |
$upgrade_plugins = isset($params['upgrade_plugins']) ? $params['upgrade_plugins'] : array();
|
110 |
$upgrade_themes = isset($params['upgrade_themes']) ? $params['upgrade_themes'] : array();
|
111 |
|
|
|
112 |
$upgrades = array();
|
113 |
if(!empty($core_upgrade)){
|
114 |
$upgrades['core'] = $this->upgrade_core($core_upgrade);
|
115 |
}
|
|
|
116 |
if(!empty($upgrade_plugins)){
|
117 |
$plugin_files = array();
|
118 |
foreach($upgrade_plugins as $plugin){
|
@@ -120,7 +123,7 @@ class MMB_Installer extends MMB_Core
|
|
120 |
}
|
121 |
|
122 |
$upgrades['plugins'] = $this->upgrade_plugins($plugin_files);
|
123 |
-
|
124 |
}
|
125 |
|
126 |
if(!empty($upgrade_themes)){
|
@@ -133,6 +136,7 @@ class MMB_Installer extends MMB_Core
|
|
133 |
$this->mmb_maintenance_mode(false);
|
134 |
}
|
135 |
ob_clean();
|
|
|
136 |
return $upgrades;
|
137 |
}
|
138 |
|
@@ -142,9 +146,26 @@ class MMB_Installer extends MMB_Core
|
|
142 |
*/
|
143 |
function upgrade_core($current)
|
144 |
{
|
145 |
-
|
146 |
global $mmb_wp_version, $wp_filesystem;
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
// Is an update available?
|
150 |
if (!isset($current->response) || $current->response == 'latest')
|
@@ -196,7 +217,7 @@ class MMB_Installer extends MMB_Core
|
|
196 |
);
|
197 |
ob_end_flush();
|
198 |
return array(
|
199 |
-
'upgraded' => '
|
200 |
);
|
201 |
}
|
202 |
|
@@ -206,20 +227,24 @@ class MMB_Installer extends MMB_Core
|
|
206 |
return array(
|
207 |
'error' => 'No plugin files for upgrade.'
|
208 |
);
|
209 |
-
|
210 |
if (class_exists('Plugin_Upgrader') && class_exists('Bulk_Plugin_Upgrader_Skin')) {
|
|
|
|
|
|
|
211 |
$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
|
212 |
$result = $upgrader->bulk_upgrade($plugins);
|
213 |
-
|
214 |
if (!empty($result)) {
|
215 |
foreach ($result as $plugin_slug => $plugin_info) {
|
216 |
-
$data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_slug);
|
217 |
if (!$plugin_info || is_wp_error($plugin_info)) {
|
218 |
-
$return
|
219 |
} else {
|
220 |
-
$
|
|
|
221 |
}
|
222 |
}
|
|
|
223 |
ob_end_clean();
|
224 |
return array(
|
225 |
'upgraded' => $return
|
@@ -232,7 +257,7 @@ class MMB_Installer extends MMB_Core
|
|
232 |
} else {
|
233 |
ob_end_clean();
|
234 |
return array(
|
235 |
-
'error' => 'WordPress update required first'
|
236 |
);
|
237 |
}
|
238 |
}
|
@@ -242,23 +267,27 @@ class MMB_Installer extends MMB_Core
|
|
242 |
return array(
|
243 |
'error' => 'No theme files for upgrade.'
|
244 |
);
|
245 |
-
|
246 |
if (class_exists('Theme_Upgrader') && class_exists('Bulk_Theme_Upgrader_Skin')) {
|
247 |
-
$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
|
248 |
|
|
|
|
|
|
|
249 |
$result = $upgrader->bulk_upgrade($themes);
|
250 |
|
251 |
-
$
|
252 |
if (!empty($result)) {
|
253 |
-
foreach ($result as $theme_tmp => $
|
254 |
-
if (is_wp_error($
|
255 |
-
$
|
256 |
} else {
|
257 |
-
$
|
|
|
258 |
}
|
259 |
}
|
|
|
260 |
return array(
|
261 |
-
'upgraded' =>
|
262 |
);
|
263 |
} else
|
264 |
return array(
|
@@ -278,8 +307,12 @@ class MMB_Installer extends MMB_Core
|
|
278 |
$upgradable_plugins = array();
|
279 |
if (!empty($current->response)) {
|
280 |
foreach ($current->response as $plugin_path => $plugin_data) {
|
|
|
|
|
|
|
281 |
if (!function_exists('get_plugin_data'))
|
282 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
|
|
283 |
$data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
|
284 |
|
285 |
$current->response[$plugin_path]->name = $data['Name'];
|
21 |
include_once(ABSPATH . 'wp-admin/includes/theme.php');
|
22 |
include_once(ABSPATH . 'wp-admin/includes/misc.php');
|
23 |
include_once(ABSPATH . 'wp-admin/includes/template.php');
|
24 |
+
@include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
|
25 |
|
26 |
global $wp_filesystem;
|
27 |
if (!$wp_filesystem)
|
90 |
}
|
91 |
}
|
92 |
ob_clean();
|
93 |
+
$this->mmb_maintenance_mode(false);
|
94 |
return $install_info;
|
95 |
}
|
96 |
|
99 |
if($params == null || empty($params))
|
100 |
return array('failed' => 'No upgrades passed.');
|
101 |
|
102 |
+
if (!$this->is_server_writable()) {
|
103 |
return array(
|
104 |
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details</a></a>'
|
105 |
);
|
110 |
$upgrade_plugins = isset($params['upgrade_plugins']) ? $params['upgrade_plugins'] : array();
|
111 |
$upgrade_themes = isset($params['upgrade_themes']) ? $params['upgrade_themes'] : array();
|
112 |
|
113 |
+
|
114 |
$upgrades = array();
|
115 |
if(!empty($core_upgrade)){
|
116 |
$upgrades['core'] = $this->upgrade_core($core_upgrade);
|
117 |
}
|
118 |
+
|
119 |
if(!empty($upgrade_plugins)){
|
120 |
$plugin_files = array();
|
121 |
foreach($upgrade_plugins as $plugin){
|
123 |
}
|
124 |
|
125 |
$upgrades['plugins'] = $this->upgrade_plugins($plugin_files);
|
126 |
+
|
127 |
}
|
128 |
|
129 |
if(!empty($upgrade_themes)){
|
136 |
$this->mmb_maintenance_mode(false);
|
137 |
}
|
138 |
ob_clean();
|
139 |
+
$this->mmb_maintenance_mode(false);
|
140 |
return $upgrades;
|
141 |
}
|
142 |
|
146 |
*/
|
147 |
function upgrade_core($current)
|
148 |
{
|
149 |
+
ob_start();
|
150 |
global $mmb_wp_version, $wp_filesystem;
|
151 |
+
|
152 |
+
if(!class_exists('WP_Upgrader')){
|
153 |
+
include_once(ABSPATH.'wp-admin/includes/update.php');
|
154 |
+
if(function_exists('wp_update_core')){
|
155 |
+
$update = wp_update_core($current);
|
156 |
+
if(is_wp_error($update)){
|
157 |
+
return array(
|
158 |
+
'error' => $this->mmb_get_error($update)
|
159 |
+
);
|
160 |
+
}
|
161 |
+
else
|
162 |
+
return array(
|
163 |
+
'upgraded' => ' Upgraded successfully.'
|
164 |
+
);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
$upgrader = new WP_Upgrader();
|
169 |
|
170 |
// Is an update available?
|
171 |
if (!isset($current->response) || $current->response == 'latest')
|
217 |
);
|
218 |
ob_end_flush();
|
219 |
return array(
|
220 |
+
'upgraded' => 'Upgraded successfully.'
|
221 |
);
|
222 |
}
|
223 |
|
227 |
return array(
|
228 |
'error' => 'No plugin files for upgrade.'
|
229 |
);
|
230 |
+
$return = array();
|
231 |
if (class_exists('Plugin_Upgrader') && class_exists('Bulk_Plugin_Upgrader_Skin')) {
|
232 |
+
|
233 |
+
$current_plugins = $this->mmb_get_transient('update_plugins');
|
234 |
+
|
235 |
$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
|
236 |
$result = $upgrader->bulk_upgrade($plugins);
|
237 |
+
|
238 |
if (!empty($result)) {
|
239 |
foreach ($result as $plugin_slug => $plugin_info) {
|
|
|
240 |
if (!$plugin_info || is_wp_error($plugin_info)) {
|
241 |
+
$return[$plugin_slug] = $this->mmb_get_error($plugin_info);
|
242 |
} else {
|
243 |
+
unset($current_plugins->response[$plugin_slug]);
|
244 |
+
$return[$plugin_slug] = 1;
|
245 |
}
|
246 |
}
|
247 |
+
$this->mmb_set_transient('update_plugins', $current_plugins);
|
248 |
ob_end_clean();
|
249 |
return array(
|
250 |
'upgraded' => $return
|
257 |
} else {
|
258 |
ob_end_clean();
|
259 |
return array(
|
260 |
+
'error' => 'WordPress update required first.'
|
261 |
);
|
262 |
}
|
263 |
}
|
267 |
return array(
|
268 |
'error' => 'No theme files for upgrade.'
|
269 |
);
|
270 |
+
|
271 |
if (class_exists('Theme_Upgrader') && class_exists('Bulk_Theme_Upgrader_Skin')) {
|
|
|
272 |
|
273 |
+
$current_themes = $this->mmb_get_transient('update_themes');
|
274 |
+
|
275 |
+
$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
|
276 |
$result = $upgrader->bulk_upgrade($themes);
|
277 |
|
278 |
+
$return = array();
|
279 |
if (!empty($result)) {
|
280 |
+
foreach ($result as $theme_tmp => $theme_info) {
|
281 |
+
if (is_wp_error($theme_info) || !$theme_info) {
|
282 |
+
$return[$theme_tmp] = $this->mmb_get_error($theme_info);
|
283 |
} else {
|
284 |
+
unset($current_themes->response[$theme_tmp]);
|
285 |
+
$return[$theme_tmp] = 1;
|
286 |
}
|
287 |
}
|
288 |
+
$this->mmb_set_transient('update_themes', $current_themes);
|
289 |
return array(
|
290 |
+
'upgraded' => $return
|
291 |
);
|
292 |
} else
|
293 |
return array(
|
307 |
$upgradable_plugins = array();
|
308 |
if (!empty($current->response)) {
|
309 |
foreach ($current->response as $plugin_path => $plugin_data) {
|
310 |
+
if($plugin_path == 'worker/init.php')
|
311 |
+
continue;
|
312 |
+
|
313 |
if (!function_exists('get_plugin_data'))
|
314 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
315 |
+
|
316 |
$data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
|
317 |
|
318 |
$current->response[$plugin_path]->name = $data['Name'];
|
link.class.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*************************************************************
|
3 |
+
*
|
4 |
+
* link.class.php
|
5 |
+
*
|
6 |
+
* Add Links
|
7 |
+
*
|
8 |
+
*
|
9 |
+
* Copyright (c) 2011 Prelovac Media
|
10 |
+
* www.prelovac.com
|
11 |
+
**************************************************************/
|
12 |
+
|
13 |
+
class MMB_Link extends MMB_Core
|
14 |
+
{
|
15 |
+
function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_link($args)
|
21 |
+
{
|
22 |
+
extract($args);
|
23 |
+
|
24 |
+
$params['link_url'] = esc_html($url);
|
25 |
+
$params['link_url'] = esc_url($params['link_url']);
|
26 |
+
$params['link_name'] = esc_html($name);
|
27 |
+
$params['link_id'] = '';
|
28 |
+
$params['link_description'] = $description;
|
29 |
+
|
30 |
+
if(!function_exists(wp_insert_link))
|
31 |
+
include_once (ABSPATH . 'wp-admin/includes/bookmark.php');
|
32 |
+
|
33 |
+
$is_success = wp_insert_link($params);
|
34 |
+
|
35 |
+
return $is_success ? true : array('error' => 'Failed to add link');
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
?>
|
plugins/cleanup/cleanup.php
CHANGED
@@ -3,88 +3,84 @@
|
|
3 |
*
|
4 |
*
|
5 |
*
|
6 |
-
* ManageWP Worker Plugin
|
7 |
*
|
8 |
*
|
9 |
* Copyright (c) 2011 Prelovac Media
|
10 |
* www.prelovac.com
|
11 |
**************************************************************/
|
12 |
|
13 |
-
add_filter('mmb_stats_filter', mmb_get_extended_info);
|
14 |
-
|
15 |
-
|
16 |
-
function mmb_get_extended_info($stats)
|
17 |
-
{
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
/* Revisions */
|
25 |
|
26 |
mmb_add_action('cleanup_delete', 'cleanup_delete_worker');
|
27 |
-
|
28 |
-
function cleanup_delete_worker($params = array())
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
mmb_response($return_array, true);
|
66 |
}
|
67 |
-
|
68 |
-
function mmb_num_revisions()
|
69 |
-
{
|
70 |
global $wpdb;
|
71 |
-
$sql
|
72 |
$num_revisions = $wpdb->get_var($wpdb->prepare($sql));
|
73 |
return $num_revisions;
|
74 |
}
|
75 |
|
76 |
-
function mmb_select_all_revisions()
|
77 |
-
{
|
78 |
global $wpdb;
|
79 |
-
$sql
|
80 |
$revisions = $wpdb->get_results($wpdb->prepare($sql));
|
81 |
return $revisions;
|
82 |
}
|
83 |
|
84 |
-
function mmb_delete_all_revisions()
|
85 |
-
{
|
86 |
global $wpdb;
|
87 |
-
$sql
|
88 |
$revisions = $wpdb->query($wpdb->prepare($sql));
|
89 |
return $revisions;
|
90 |
}
|
@@ -95,43 +91,44 @@ function mmb_delete_all_revisions()
|
|
95 |
|
96 |
function mmb_get_overhead()
|
97 |
{
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
function mmb_clear_overhead()
|
121 |
{
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
}
|
136 |
|
137 |
|
@@ -140,25 +137,24 @@ function mmb_clear_overhead()
|
|
140 |
|
141 |
function mmb_num_spam_comments()
|
142 |
{
|
143 |
-
|
144 |
-
|
145 |
-
$num_spams =
|
146 |
return $num_spams;
|
147 |
}
|
148 |
|
149 |
function mmb_delete_spam_comments()
|
150 |
{
|
151 |
-
|
152 |
-
|
153 |
-
$spams = $wpdb->query($wpdb->prepare($sql));
|
154 |
return $sql;
|
155 |
}
|
156 |
|
157 |
|
158 |
-
function mmb_get_spam_comments()
|
159 |
-
{
|
160 |
global $wpdb;
|
161 |
-
$sql
|
162 |
$spams = $wpdb->get_results($wpdb->prepare($sql));
|
163 |
return $spams;
|
164 |
}
|
3 |
*
|
4 |
*
|
5 |
*
|
6 |
+
* ManageWP Worker Plugin
|
7 |
*
|
8 |
*
|
9 |
* Copyright (c) 2011 Prelovac Media
|
10 |
* www.prelovac.com
|
11 |
**************************************************************/
|
12 |
|
13 |
+
add_filter('mmb_stats_filter', mmb_get_extended_info);
|
14 |
+
|
15 |
+
|
16 |
+
function mmb_get_extended_info($stats)
|
17 |
+
{
|
18 |
+
$stats['num_revisions'] = mmb_num_revisions();
|
19 |
+
$stats['overhead'] = mmb_get_overhead();
|
20 |
+
$stats['num_spam_comments'] = mmb_num_spam_comments();
|
21 |
+
return $stats;
|
22 |
+
}
|
23 |
+
|
24 |
+
/* Revisions */
|
25 |
|
26 |
mmb_add_action('cleanup_delete', 'cleanup_delete_worker');
|
27 |
+
|
28 |
+
function cleanup_delete_worker($params = array()){
|
29 |
+
global $mmb_core;
|
30 |
+
|
31 |
+
$params_array = explode('_', $params['actions']);
|
32 |
+
$return_array = array();
|
33 |
+
foreach ($params_array as $param){
|
34 |
+
switch ($param){
|
35 |
+
case 'revision' :
|
36 |
+
if(mmb_delete_all_revisions()){
|
37 |
+
$return_array['revision'] = 'Revisions deleted.';
|
38 |
+
}else{
|
39 |
+
$return_array['revision'] = 'Revisions not deleted.';
|
40 |
+
}
|
41 |
+
break;
|
42 |
+
case 'overhead' :
|
43 |
+
if(mmb_clear_overhead()){
|
44 |
+
$return_array['overhead'] = 'Overhead cleared.';
|
45 |
+
}else{
|
46 |
+
$return_array['overhead'] = 'Overhead not cleared.';
|
47 |
+
}
|
48 |
+
break;
|
49 |
+
case 'comment' :
|
50 |
+
if(mmb_delete_spam_comments()){
|
51 |
+
$return_array['comment'] = 'Comments deleted';
|
52 |
+
}else{
|
53 |
+
$return_array['comment'] = 'Comments not deleted';
|
54 |
+
}
|
55 |
+
break;
|
56 |
+
default:
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
unset($params);
|
63 |
+
|
64 |
+
mmb_response($return_array, true);
|
|
|
65 |
}
|
66 |
+
|
67 |
+
function mmb_num_revisions() {
|
|
|
68 |
global $wpdb;
|
69 |
+
$sql = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'";
|
70 |
$num_revisions = $wpdb->get_var($wpdb->prepare($sql));
|
71 |
return $num_revisions;
|
72 |
}
|
73 |
|
74 |
+
function mmb_select_all_revisions() {
|
|
|
75 |
global $wpdb;
|
76 |
+
$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'revision'";
|
77 |
$revisions = $wpdb->get_results($wpdb->prepare($sql));
|
78 |
return $revisions;
|
79 |
}
|
80 |
|
81 |
+
function mmb_delete_all_revisions() {
|
|
|
82 |
global $wpdb;
|
83 |
+
$sql = "DELETE a,b,c FROM $wpdb->posts a LEFT JOIN $wpdb->term_relationships b ON (a.ID = b.object_id) LEFT JOIN $wpdb->postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'";
|
84 |
$revisions = $wpdb->query($wpdb->prepare($sql));
|
85 |
return $revisions;
|
86 |
}
|
91 |
|
92 |
function mmb_get_overhead()
|
93 |
{
|
94 |
+
global $wpdb, $mmb_core;
|
95 |
+
$tot_data = 0;
|
96 |
+
$tot_idx = 0;
|
97 |
+
$tot_all = 0;
|
98 |
+
$query = 'SHOW TABLE STATUS FROM '. DB_NAME;
|
99 |
+
$tables = $wpdb->get_results($query,ARRAY_A);
|
100 |
+
foreach($tables as $table)
|
101 |
+
{
|
102 |
+
$tot_data = $table['Data_length'];
|
103 |
+
$tot_idx = $table['Index_length'];
|
104 |
+
$total = $tot_data + $tot_idx;
|
105 |
+
$total = $total / 1024 ;
|
106 |
+
$total = round ($total,3);
|
107 |
+
$gain= $table['Data_free'];
|
108 |
+
$gain = $gain / 1024 ;
|
109 |
+
$total_gain += $gain;
|
110 |
+
$gain = round ($gain,3);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
return round($total_gain,3);
|
115 |
}
|
116 |
|
117 |
function mmb_clear_overhead()
|
118 |
{
|
119 |
+
global $wpdb;
|
120 |
+
$tables = $wpdb->get_col("SHOW TABLES");
|
121 |
+
foreach ($tables as $table_name) {
|
122 |
+
$table_string .= $table_name . ",";
|
123 |
+
}
|
124 |
+
$table_string = substr($table_string,0,strlen($table_string)-1); //remove last ,
|
125 |
+
|
126 |
+
$table_string = rtrim($table_string);
|
127 |
+
|
128 |
+
$query = "OPTIMIZE TABLE $table_string";
|
129 |
+
|
130 |
+
$optimize = $wpdb->query($query);
|
131 |
+
return $optimize ? true : false;
|
132 |
}
|
133 |
|
134 |
|
137 |
|
138 |
function mmb_num_spam_comments()
|
139 |
{
|
140 |
+
global $wpdb;
|
141 |
+
$sql = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'spam'";
|
142 |
+
$num_spams = $wpdb->get_var($wpdb->prepare($sql));
|
143 |
return $num_spams;
|
144 |
}
|
145 |
|
146 |
function mmb_delete_spam_comments()
|
147 |
{
|
148 |
+
global $wpdb;
|
149 |
+
$sql = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'";
|
150 |
+
$spams = $wpdb->query($wpdb->prepare($sql));
|
151 |
return $sql;
|
152 |
}
|
153 |
|
154 |
|
155 |
+
function mmb_get_spam_comments() {
|
|
|
156 |
global $wpdb;
|
157 |
+
$sql = "SELECT * FROM $wpdb->comments as a LEFT JOIN $wpdb->commentmeta as b WHERE a.comment_ID = b.comment_id AND a.comment_approved = 'spam'";
|
158 |
$spams = $wpdb->get_results($wpdb->prepare($sql));
|
159 |
return $spams;
|
160 |
}
|
plugins/search/search.php
CHANGED
@@ -10,20 +10,20 @@
|
|
10 |
* www.prelovac.com
|
11 |
**************************************************************/
|
12 |
|
13 |
-
mmb_add_action('search_posts_by_term', 'search_posts_by_term');
|
14 |
-
|
15 |
-
function search_posts_by_term($params = false)
|
16 |
-
{
|
17 |
-
global $wpdb, $current_user;
|
18 |
-
|
19 |
-
|
20 |
-
$num_posts = 10;
|
21 |
-
$num_content_char = 30;
|
22 |
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
FROM $wpdb->posts
|
28 |
WHERE $wpdb->posts.post_status = 'publish'
|
29 |
AND ($wpdb->posts.post_title LIKE '%$term_base%'
|
@@ -31,54 +31,58 @@ function search_posts_by_term($params = false)
|
|
31 |
ORDER BY $wpdb->posts.post_modified DESC
|
32 |
LIMIT 0, $num_posts
|
33 |
";
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
-
mmb_response($ret_posts, true);
|
81 |
-
|
82 |
-
}
|
83 |
|
84 |
?>
|
10 |
* www.prelovac.com
|
11 |
**************************************************************/
|
12 |
|
13 |
+
mmb_add_action('search_posts_by_term', 'search_posts_by_term');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
function search_posts_by_term($params = false){
|
16 |
+
|
17 |
+
global $wpdb, $current_user;
|
18 |
+
|
19 |
+
|
20 |
+
$num_posts = 10;
|
21 |
+
$num_content_char = 30;
|
22 |
+
|
23 |
+
$term_orig = trim($params['search_term']);
|
24 |
+
$term_base= addslashes(trim($params['search_term']));
|
25 |
+
|
26 |
+
$query = "SELECT *
|
27 |
FROM $wpdb->posts
|
28 |
WHERE $wpdb->posts.post_status = 'publish'
|
29 |
AND ($wpdb->posts.post_title LIKE '%$term_base%'
|
31 |
ORDER BY $wpdb->posts.post_modified DESC
|
32 |
LIMIT 0, $num_posts
|
33 |
";
|
34 |
+
|
35 |
+
$posts_array = $wpdb->get_results($query);
|
36 |
+
|
37 |
+
$ret_posts = array();
|
38 |
+
|
39 |
+
foreach($posts_array as $post){
|
40 |
+
//highlight searched term
|
41 |
+
|
42 |
+
if (substr_count(strtolower($post->post_title), strtolower($term_orig))){
|
43 |
+
$str_position_start = strpos(strtolower($post->post_title), strtolower($term_orig));
|
44 |
+
|
45 |
+
$post->post_title = substr($post->post_title, 0, $str_position_start).'<b>'.
|
46 |
+
substr($post->post_title, $str_position_start, strlen($term_orig)).'</b>'.
|
47 |
+
substr($post->post_title, $str_position_start + strlen($term_orig));
|
48 |
+
|
49 |
+
}
|
50 |
+
$post->post_content = html_entity_decode($post->post_content);
|
51 |
+
|
52 |
+
$post->post_content = strip_tags($post->post_content);
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
if (substr_count(strtolower($post->post_content), strtolower($term_orig))){
|
57 |
+
$str_position_start = strpos(strtolower($post->post_content), strtolower($term_orig));
|
58 |
+
|
59 |
+
$start = $str_position_start > $num_content_char ? $str_position_start - $num_content_char: 0;
|
60 |
+
$first_len = $str_position_start > $num_content_char? $num_content_char : $str_position_start;
|
61 |
+
|
62 |
+
$start_substring = $start>0 ? '...' : '';
|
63 |
+
$post->post_content = $start_substring . substr($post->post_content, $start, $first_len).'<b>'.
|
64 |
+
substr($post->post_content, $str_position_start, strlen($term_orig)).'</b>'.
|
65 |
+
substr($post->post_content, $str_position_start + strlen($term_orig), $num_content_char) . '...';
|
66 |
+
|
67 |
+
|
68 |
+
}else{
|
69 |
+
$post->post_content = substr($post->post_content,0, 50). '...';
|
70 |
+
}
|
71 |
+
|
72 |
+
$ret_posts[] = array(
|
73 |
+
'ID' => $post->ID
|
74 |
+
,'post_permalink' => get_permalink($post->ID)
|
75 |
+
,'post_date' => $post->post_date
|
76 |
+
,'post_title' => $post->post_title
|
77 |
+
,'post_content' => $post->post_content
|
78 |
+
,'post_modified' => $post->post_modified
|
79 |
+
,'comment_count' => $post->comment_count
|
80 |
+
|
81 |
+
|
82 |
+
);
|
83 |
+
}
|
84 |
+
mmb_response($ret_posts, true);
|
85 |
+
|
86 |
}
|
|
|
|
|
|
|
87 |
|
88 |
?>
|
post.class.php
CHANGED
@@ -320,5 +320,21 @@ class MMB_Post extends MMB_Core
|
|
320 |
return $post_id;
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
324 |
?>
|
320 |
return $post_id;
|
321 |
}
|
322 |
|
323 |
+
|
324 |
+
function change_status($args)
|
325 |
+
{
|
326 |
+
|
327 |
+
global $wpdb;
|
328 |
+
$post_id = $args['post_id'];
|
329 |
+
$status = $args['status'];
|
330 |
+
$success = false;
|
331 |
+
|
332 |
+
if(in_array($status, array('draft', 'publish', 'trash'))){
|
333 |
+
$sql = "update ".$wpdb->prefix."posts set post_status = '$status' where ID = '$post_id'";
|
334 |
+
$success = $wpdb->query($sql);
|
335 |
+
}
|
336 |
+
|
337 |
+
return $success;
|
338 |
+
}
|
339 |
}
|
340 |
?>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: freediver
|
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
4 |
Tags: managewp, managewp worker, admin, manage blogs, multi blog manager, manage multiple blogs, remote blog management
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
ManageWP Worker plugin allows you to remotely manage your blogs from one dashboard.
|
@@ -29,6 +29,20 @@ API for developers available at [ManageWP.com/API](http://managewp.com/api "Mana
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
= 3.8.7 =
|
33 |
* Fixed 408 error when adding sites
|
34 |
* Added support for IDN domains
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
4 |
Tags: managewp, managewp worker, admin, manage blogs, multi blog manager, manage multiple blogs, remote blog management
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.1.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
ManageWP Worker plugin allows you to remotely manage your blogs from one dashboard.
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 3.8.8 =
|
33 |
+
* New feature: Bulk add links to blogroll
|
34 |
+
* New feature: Manual backups to email address
|
35 |
+
* New feature: Backup requirements check (under �Manage Backups�)
|
36 |
+
* New feature: Popup menu for groups allowing to show dashboard for that group only
|
37 |
+
* New feature: Favorite list for plugins and themes for later quick installation to multiple blogs
|
38 |
+
* New feature: Invite friends
|
39 |
+
* Fixed: problem with backups and write permissions when upload dir was wrongly set
|
40 |
+
* Fixed: problem adding sites where WordPress is installed in a folder
|
41 |
+
* Fixed: 408 error message problem when adding site
|
42 |
+
* Fixed: site time out problems when adding site
|
43 |
+
* Fixed: problems with some WP plugins (WP Sentinel)
|
44 |
+
* Fixed: problems with upgrade notifications
|
45 |
+
|
46 |
= 3.8.7 =
|
47 |
* Fixed 408 error when adding sites
|
48 |
* Added support for IDN domains
|
stats.class.php
CHANGED
@@ -29,13 +29,15 @@ class MMB_Stats extends MMB_Core
|
|
29 |
$stats = array();
|
30 |
|
31 |
//define constants
|
32 |
-
$num_pending_comments =
|
33 |
$num_approved_comments = 3;
|
34 |
$num_spam_comments = 0;
|
35 |
$num_draft_comments = 0;
|
36 |
$num_trash_comments = 0;
|
37 |
-
|
38 |
require_once(ABSPATH . '/wp-admin/includes/update.php');
|
|
|
|
|
39 |
|
40 |
$stats['worker_version'] = MMB_WORKER_VERSION;
|
41 |
$stats['wordpress_version'] = $mmb_wp_version;
|
@@ -58,9 +60,9 @@ class MMB_Stats extends MMB_Core
|
|
58 |
}
|
59 |
$stats['hit_counter'] = get_option('user_hit_count');
|
60 |
|
61 |
-
|
62 |
-
$stats['upgradable_themes'] = $this->
|
63 |
-
$stats['upgradable_plugins'] = $this->
|
64 |
|
65 |
$pending_comments = get_comments('status=hold&number=' . $num_pending_comments);
|
66 |
foreach ($pending_comments as &$comment) {
|
@@ -84,46 +86,122 @@ class MMB_Stats extends MMB_Core
|
|
84 |
|
85 |
foreach ($all_posts as $id => $recent_post) {
|
86 |
$recent = new stdClass();
|
87 |
-
$recent->post_permalink = get_permalink($
|
88 |
$recent->ID = $recent_post->ID;
|
89 |
$recent->post_date = $recent_post->post_date;
|
90 |
$recent->post_title = $recent_post->post_title;
|
91 |
$recent->post_modified = $recent_post->post_modified;
|
92 |
-
$recent->comment_count = $recent_post->comment_count;
|
93 |
-
$recent->post_permalink = $recent_post->post_permalink;
|
94 |
-
|
95 |
-
|
96 |
$recent_posts[] = $recent;
|
97 |
}
|
98 |
-
|
99 |
-
|
100 |
-
$
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
if (!function_exists('get_filesystem_method'))
|
116 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
117 |
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
} else
|
121 |
-
$stats['
|
122 |
|
123 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
|
|
|
|
|
|
|
|
125 |
return $stats;
|
126 |
}
|
|
|
|
|
127 |
function get_comments_stats(){
|
128 |
$num_pending_comments = 3;
|
129 |
$num_approved_comments = 3;
|
@@ -157,17 +235,14 @@ class MMB_Stats extends MMB_Core
|
|
157 |
$stats['worker_version'] = MMB_WORKER_VERSION;
|
158 |
$stats['site_title'] = get_bloginfo('name');
|
159 |
$stats['site_tagline'] = get_bloginfo('description');
|
160 |
-
$stats['
|
161 |
|
162 |
|
163 |
if (!function_exists('get_filesystem_method'))
|
164 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
} else
|
169 |
-
$stats['writable'] = true;
|
170 |
-
|
171 |
return $stats;
|
172 |
}
|
173 |
|
@@ -176,7 +251,7 @@ class MMB_Stats extends MMB_Core
|
|
176 |
{
|
177 |
if ($fix_count || (!is_admin() && !MMB_Stats::detect_bots())) {
|
178 |
$date = date('Y-m-d');
|
179 |
-
$user_hit_count = get_option('user_hit_count');
|
180 |
if (!$user_hit_count) {
|
181 |
$user_hit_count[$date] = 1;
|
182 |
update_option('user_hit_count', $user_hit_count);
|
@@ -208,7 +283,7 @@ class MMB_Stats extends MMB_Core
|
|
208 |
$user_hit_count[$date] = 0;
|
209 |
}
|
210 |
if (!$fix_count)
|
211 |
-
$user_hit_count[$date]
|
212 |
|
213 |
if (count($user_hit_count) > 14) {
|
214 |
$shifted = @array_shift($user_hit_count);
|
@@ -294,4 +369,9 @@ class MMB_Stats extends MMB_Core
|
|
294 |
}
|
295 |
|
296 |
}
|
|
|
|
|
|
|
|
|
|
|
297 |
?>
|
29 |
$stats = array();
|
30 |
|
31 |
//define constants
|
32 |
+
$num_pending_comments = 20;
|
33 |
$num_approved_comments = 3;
|
34 |
$num_spam_comments = 0;
|
35 |
$num_draft_comments = 0;
|
36 |
$num_trash_comments = 0;
|
37 |
+
|
38 |
require_once(ABSPATH . '/wp-admin/includes/update.php');
|
39 |
+
|
40 |
+
|
41 |
|
42 |
$stats['worker_version'] = MMB_WORKER_VERSION;
|
43 |
$stats['wordpress_version'] = $mmb_wp_version;
|
60 |
}
|
61 |
$stats['hit_counter'] = get_option('user_hit_count');
|
62 |
|
63 |
+
$this->get_installer_instance();
|
64 |
+
$stats['upgradable_themes'] = $this->installer_instance->get_upgradable_themes();
|
65 |
+
$stats['upgradable_plugins'] = $this->installer_instance->get_upgradable_plugins();
|
66 |
|
67 |
$pending_comments = get_comments('status=hold&number=' . $num_pending_comments);
|
68 |
foreach ($pending_comments as &$comment) {
|
86 |
|
87 |
foreach ($all_posts as $id => $recent_post) {
|
88 |
$recent = new stdClass();
|
89 |
+
$recent->post_permalink = get_permalink($recent_post->ID);
|
90 |
$recent->ID = $recent_post->ID;
|
91 |
$recent->post_date = $recent_post->post_date;
|
92 |
$recent->post_title = $recent_post->post_title;
|
93 |
$recent->post_modified = $recent_post->post_modified;
|
94 |
+
$recent->comment_count = $recent_post->comment_count;
|
|
|
|
|
|
|
95 |
$recent_posts[] = $recent;
|
96 |
}
|
97 |
+
|
98 |
+
|
99 |
+
$all_drafts = get_posts('post_status=draft&numberposts=3&orderby=modified&order=desc');
|
100 |
+
$stats['draft_count'] = count($all_drafts);
|
101 |
+
$recent_drafts = array();
|
102 |
+
foreach ($all_drafts as $id => $recent_draft) {
|
103 |
+
$recent = new stdClass();
|
104 |
+
$recent->post_permalink = get_permalink($recent_draft->ID);
|
105 |
+
$recent->ID = $recent_draft->ID;
|
106 |
+
$recent->post_date = $recent_draft->post_date;
|
107 |
+
$recent->post_title = $recent_draft->post_title;
|
108 |
+
$recent->post_modified = $recent_draft->post_modified;
|
109 |
+
|
110 |
+
$recent_drafts[] = $recent;
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
$all_pages_published = get_pages('post_status=publish&numberposts=3&orderby=modified&order=desc');
|
115 |
+
$stats['published_pages_count'] = count($all_pages_published);
|
116 |
+
$recent_pages_published = array();
|
117 |
+
|
118 |
+
foreach ((array)$all_pages_published as $id => $recent_page_published) {
|
119 |
+
|
120 |
+
$recent = new stdClass();
|
121 |
+
$recent->post_permalink = get_permalink($recent_page_published->ID);
|
122 |
+
|
123 |
+
$recent->ID = $recent_page_published->ID;
|
124 |
+
$recent->post_date = $recent_page_published->post_date;
|
125 |
+
$recent->post_title = $recent_page_published->post_title;
|
126 |
+
$recent->post_modified = $recent_page_published->post_modified;
|
127 |
+
|
128 |
+
$recent_posts[] = $recent;
|
129 |
}
|
130 |
+
usort($recent_posts, 'cmp_posts_worker');
|
131 |
+
$stats['posts'] = array_slice($recent_posts, 0, 3);
|
132 |
+
|
133 |
+
$all_pages_drafts = get_pages('post_status=draft&numberposts=3&orderby=modified&order=desc');
|
134 |
+
$stats['draft_pages_count'] = count($all_pages_drafts);
|
135 |
+
$recent_pages_drafts = array();
|
136 |
+
foreach ((array)$all_pages_drafts as $id => $recent_pages_draft) {
|
137 |
+
$recent = new stdClass();
|
138 |
+
$recent->post_permalink = get_permalink($recent_pages_draft->ID);
|
139 |
+
$recent->ID = $recent_pages_draft->ID;
|
140 |
+
$recent->post_date = $recent_pages_draft->post_date;
|
141 |
+
$recent->post_title = $recent_pages_draft->post_title;
|
142 |
+
$recent->post_modified = $recent_pages_draft->post_modified;
|
143 |
+
|
144 |
+
$recent_drafts[] = $recent;
|
145 |
+
}
|
146 |
+
$stats['drafts'] = array_slice($recent_drafts, 0, 3);
|
147 |
+
usort($recent_drafts, 'cmp_posts_worker');
|
148 |
+
|
149 |
|
150 |
if (!function_exists('get_filesystem_method'))
|
151 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
152 |
|
153 |
+
$stats['writable'] = $this->is_server_writable();
|
154 |
+
|
155 |
+
$stats = apply_filters('mmb_stats_filter', $stats);
|
156 |
+
return $stats;
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_stats_notification($params)
|
160 |
+
{
|
161 |
+
|
162 |
+
global $mmb_wp_version, $mmb_plugin_dir;
|
163 |
+
$stats = array();
|
164 |
+
|
165 |
+
//define constants
|
166 |
+
$num_pending_comments = 1000;
|
167 |
+
|
168 |
+
|
169 |
+
require_once(ABSPATH . '/wp-admin/includes/update.php');
|
170 |
+
|
171 |
+
$stats['worker_version'] = MMB_WORKER_VERSION;
|
172 |
+
$stats['wordpress_version'] = $mmb_wp_version;
|
173 |
+
|
174 |
+
$updates = $this->mmb_get_transient('update_core');
|
175 |
+
|
176 |
+
if ($updates->updates[0]->response == 'development' || version_compare($mmb_wp_version, $updates->updates[0]->current, '<')) {
|
177 |
+
$updates->updates[0]->current_version = $mmb_wp_version;
|
178 |
+
$stats['core_updates'] = $updates->updates[0];
|
179 |
} else
|
180 |
+
$stats['core_updates'] = false;
|
181 |
|
182 |
+
$mmb_user_hits = get_option('user_hit_count');
|
183 |
+
if (is_array($mmb_user_hits)) {
|
184 |
+
end($mmb_user_hits);
|
185 |
+
$last_key_date = key($mmb_user_hits);
|
186 |
+
$current_date = date('Y-m-d');
|
187 |
+
if ($last_key_date != $curent_date)
|
188 |
+
$this->set_hit_count(true);
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
$this->get_theme_instance();
|
193 |
+
$this->get_plugin_instance();
|
194 |
+
$stats['upgradable_themes'] = $this->theme_instance->get_upgradable_themes();
|
195 |
+
$stats['upgradable_plugins'] = $this->plugin_instance->get_upgradable_plugins();
|
196 |
|
197 |
+
$pending_comments = get_comments('status=hold&number=' . $num_pending_comments);
|
198 |
+
|
199 |
+
$stats['comments_pending'] = count($pending_comments);
|
200 |
+
|
201 |
return $stats;
|
202 |
}
|
203 |
+
|
204 |
+
|
205 |
function get_comments_stats(){
|
206 |
$num_pending_comments = 3;
|
207 |
$num_approved_comments = 3;
|
235 |
$stats['worker_version'] = MMB_WORKER_VERSION;
|
236 |
$stats['site_title'] = get_bloginfo('name');
|
237 |
$stats['site_tagline'] = get_bloginfo('description');
|
238 |
+
$stats['site_home'] = get_option('home');
|
239 |
|
240 |
|
241 |
if (!function_exists('get_filesystem_method'))
|
242 |
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
243 |
|
244 |
+
$stats['writable'] = $this->is_server_writable();
|
245 |
+
|
|
|
|
|
|
|
246 |
return $stats;
|
247 |
}
|
248 |
|
251 |
{
|
252 |
if ($fix_count || (!is_admin() && !MMB_Stats::detect_bots())) {
|
253 |
$date = date('Y-m-d');
|
254 |
+
$user_hit_count = (array) get_option('user_hit_count');
|
255 |
if (!$user_hit_count) {
|
256 |
$user_hit_count[$date] = 1;
|
257 |
update_option('user_hit_count', $user_hit_count);
|
283 |
$user_hit_count[$date] = 0;
|
284 |
}
|
285 |
if (!$fix_count)
|
286 |
+
$user_hit_count[$date] = ((int)$user_hit_count[$date] ) + 1;
|
287 |
|
288 |
if (count($user_hit_count) > 14) {
|
289 |
$shifted = @array_shift($user_hit_count);
|
369 |
}
|
370 |
|
371 |
}
|
372 |
+
|
373 |
+
function cmp_posts_worker($a, $b)
|
374 |
+
{
|
375 |
+
return ($a->post_modified < $b->post_modified);
|
376 |
+
}
|
377 |
?>
|
version
CHANGED
@@ -1 +1 @@
|
|
1 |
-
3.8.
|
1 |
+
3.8.8
|