Version Description
Please, keep your Dropbox Backup and Restore plugin up-to-date.
Download this release
Release Info
Developer | backup-dropbox |
Plugin | Backup & Restore Dropbox |
Version | 1.4.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.7.1
- dropbox-backup.php +1 -1
- functions/wpadm.php +5 -1
- libs/wpadm.server.main.class.php +13 -3
- methods/class-wpadm-method-backup.php +11 -2
- methods/class-wpadm-method-full-backup-dropbox.php +11 -2
- methods/class-wpadm-method-local-backup.php +15 -2
- modules/class-wpadm-command-factory.php +36 -33
- modules/class-wpadm-mysqldump.php +1 -1
- modules/class-wpadm-running.php +3 -3
- modules/restore-class.php +225 -58
- readme.txt +28 -15
- template/wpadm_show_backup.php +3 -7
dropbox-backup.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Dropbox Backup & Restore
|
4 |
Description: Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
|
5 |
-
Version: 1.4.7
|
6 |
Text Domain: dropbox-backup
|
7 |
Domain Path: /languages/
|
8 |
*/
|
2 |
/*
|
3 |
Plugin Name: Dropbox Backup & Restore
|
4 |
Description: Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
|
5 |
+
Version: 1.4.7.1
|
6 |
Text Domain: dropbox-backup
|
7 |
Domain Path: /languages/
|
8 |
*/
|
functions/wpadm.php
CHANGED
@@ -16,7 +16,11 @@ if ( ! function_exists( 'wpadm_run' )) {
|
|
16 |
if ($_SERVER['SERVER_ADDR'] != $user_ip && $_SERVER['HTTP_USER_AGENT'] != 'dropbox-backup user-agent') {
|
17 |
WPAdm_Running::init_params_default(false);
|
18 |
}
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
echo '<wpadm>' . wpadm_pack($wpadm->getResult()->toArray()) . '</wpadm>';
|
21 |
exit;
|
22 |
}
|
16 |
if ($_SERVER['SERVER_ADDR'] != $user_ip && $_SERVER['HTTP_USER_AGENT'] != 'dropbox-backup user-agent') {
|
17 |
WPAdm_Running::init_params_default(false);
|
18 |
}
|
19 |
+
$params = wpadm_unpack($_POST[$request_name]);
|
20 |
+
if ( isset($params['type']) ) {
|
21 |
+
wpadm_class::$type = $params['type'];
|
22 |
+
}
|
23 |
+
$wpadm = new WPAdm_Core($params, $pl, $dir);
|
24 |
echo '<wpadm>' . wpadm_pack($wpadm->getResult()->toArray()) . '</wpadm>';
|
25 |
exit;
|
26 |
}
|
libs/wpadm.server.main.class.php
CHANGED
@@ -241,9 +241,18 @@
|
|
241 |
|
242 |
$d = str_replace('\\', '/', $d);
|
243 |
$tmp = explode('/', $d);
|
244 |
-
|
|
|
|
|
|
|
|
|
245 |
unset($tmp[0]);
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
247 |
if (strpos($d2, 'cache') !== false && isset($tmp[0])&& !in_array($tmp[0], array('plugins', 'themes')) ) {
|
248 |
return array();
|
249 |
}
|
@@ -536,10 +545,11 @@
|
|
536 |
$res = self::setResponse($data);
|
537 |
}
|
538 |
}
|
|
|
539 |
if (isset($res['url']) && !empty($res['url'])) {
|
540 |
header("Location: " . $res['url']);
|
541 |
} else {
|
542 |
-
header("Location: " .
|
543 |
}
|
544 |
}
|
545 |
|
241 |
|
242 |
$d = str_replace('\\', '/', $d);
|
243 |
$tmp = explode('/', $d);
|
244 |
+
if (function_exists('mb_strtolower')) {
|
245 |
+
$d1 = mb_strtolower($tmp[0]);
|
246 |
+
} else {
|
247 |
+
$d1 = strtolower($tmp[0]);
|
248 |
+
}
|
249 |
unset($tmp[0]);
|
250 |
+
if (function_exists('mb_strtolower')) {
|
251 |
+
$d2 = mb_strtolower(implode('/', $tmp));
|
252 |
+
} else {
|
253 |
+
$d2 = strtolower(implode('/', $tmp));
|
254 |
+
}
|
255 |
+
|
256 |
if (strpos($d2, 'cache') !== false && isset($tmp[0])&& !in_array($tmp[0], array('plugins', 'themes')) ) {
|
257 |
return array();
|
258 |
}
|
545 |
$res = self::setResponse($data);
|
546 |
}
|
547 |
}
|
548 |
+
|
549 |
if (isset($res['url']) && !empty($res['url'])) {
|
550 |
header("Location: " . $res['url']);
|
551 |
} else {
|
552 |
+
header("Location: " . $_SERVER['HTTP_REFERER'] );
|
553 |
}
|
554 |
}
|
555 |
|
methods/class-wpadm-method-backup.php
CHANGED
@@ -403,9 +403,18 @@ if (!class_exists('WPadm_Method_Backup')) {
|
|
403 |
|
404 |
$d = str_replace('\\', '/', $d);
|
405 |
$tmp = explode('/', $d);
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
407 |
unset($tmp[0]);
|
408 |
-
|
|
|
|
|
|
|
|
|
409 |
// if (strpos($d1, 'cache') !== false || ($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)) {
|
410 |
// if (($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)
|
411 |
// || ($d1 == 'wp-content' || !in_array($tmp[0], array('plugins', 'themes')))
|
403 |
|
404 |
$d = str_replace('\\', '/', $d);
|
405 |
$tmp = explode('/', $d);
|
406 |
+
if (function_exists('mb_strtolower')) {
|
407 |
+
$d1 = mb_strtolower($tmp[0]);
|
408 |
+
} else {
|
409 |
+
$d1 = strtolower($tmp[0]);
|
410 |
+
}
|
411 |
+
|
412 |
unset($tmp[0]);
|
413 |
+
if (function_exists('mb_strtolower')) {
|
414 |
+
$d2 = mb_strtolower(implode('/', $tmp));
|
415 |
+
} else {
|
416 |
+
$d2 = strtolower(implode('/', $tmp));
|
417 |
+
}
|
418 |
// if (strpos($d1, 'cache') !== false || ($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)) {
|
419 |
// if (($d1 == 'wp-includes' && strpos($d2, 'cache') !== false)
|
420 |
// || ($d1 == 'wp-content' || !in_array($tmp[0], array('plugins', 'themes')))
|
methods/class-wpadm-method-full-backup-dropbox.php
CHANGED
@@ -433,9 +433,18 @@ if (!class_exists('WPadm_Method_Full_Backup_Dropbox')) {
|
|
433 |
|
434 |
$d = str_replace('\\', '/', $d);
|
435 |
$tmp = explode('/', $d);
|
436 |
-
|
|
|
|
|
|
|
|
|
|
|
437 |
unset($tmp[0]);
|
438 |
-
|
|
|
|
|
|
|
|
|
439 |
if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
|
440 |
WPAdm_Core::log('Skip dir(cache) ' . $directory);
|
441 |
return array();
|
433 |
|
434 |
$d = str_replace('\\', '/', $d);
|
435 |
$tmp = explode('/', $d);
|
436 |
+
|
437 |
+
if (function_exists('mb_strtolower')) {
|
438 |
+
$d1 = mb_strtolower($tmp[0]);
|
439 |
+
} else {
|
440 |
+
$d1 = strtolower($tmp[0]);
|
441 |
+
}
|
442 |
unset($tmp[0]);
|
443 |
+
if (function_exists('mb_strtolower')) {
|
444 |
+
$d2 = mb_strtolower(implode('/', $tmp));
|
445 |
+
} else {
|
446 |
+
$d2 = strtolower(implode('/', $tmp));
|
447 |
+
}
|
448 |
if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
|
449 |
WPAdm_Core::log('Skip dir(cache) ' . $directory);
|
450 |
return array();
|
methods/class-wpadm-method-local-backup.php
CHANGED
@@ -499,9 +499,22 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
|
|
499 |
|
500 |
$d = str_replace('\\', '/', $d);
|
501 |
$tmp = explode('/', $d);
|
502 |
-
|
|
|
|
|
|
|
|
|
503 |
unset($tmp[0]);
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
|
506 |
WPAdm_Core::log(__('Skip of Cache-Folder ','dropbox-backup') . $directory);
|
507 |
return array();
|
499 |
|
500 |
$d = str_replace('\\', '/', $d);
|
501 |
$tmp = explode('/', $d);
|
502 |
+
if (function_exists('mb_strtolower')) {
|
503 |
+
$d1 = mb_strtolower($tmp[0]);
|
504 |
+
} else {
|
505 |
+
$d1 = strtolower($tmp[0]);
|
506 |
+
}
|
507 |
unset($tmp[0]);
|
508 |
+
if (function_exists('mb_strtolower')) {
|
509 |
+
$d2 = mb_strtolower(implode('/', $tmp));
|
510 |
+
} else {
|
511 |
+
$d2 = strtolower(implode('/', $tmp));
|
512 |
+
}
|
513 |
+
|
514 |
+
if (stripos($d2, 'cache') !== false ) {
|
515 |
+
WPAdm_Core::log( __('Skip of Cache-Folder ','dropbox-backup') . $directory);
|
516 |
+
return array();
|
517 |
+
}
|
518 |
if (strpos($d2, 'cache') !== false && isset($tmp[0]) && !in_array($tmp[0], array('plugins', 'themes')) ) {
|
519 |
WPAdm_Core::log(__('Skip of Cache-Folder ','dropbox-backup') . $directory);
|
520 |
return array();
|
modules/class-wpadm-command-factory.php
CHANGED
@@ -1,34 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
|
4 |
-
|
5 |
-
if (!class_exists('WPAdm_Command_Factory')) {
|
6 |
-
class WPAdm_Command_Factory {
|
7 |
-
/**
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
static function getCommand($com = '') {
|
12 |
-
if (!preg_match("|[a-zA-Z0-9_]|", $com)) {
|
13 |
-
return null;
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
$
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
34 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPAdm_Command_Factory
|
4 |
+
*/
|
5 |
+
if (!class_exists('WPAdm_Command_Factory')) {
|
6 |
+
class WPAdm_Command_Factory {
|
7 |
+
/**
|
8 |
+
* @param string $com
|
9 |
+
* @return command
|
10 |
+
*/
|
11 |
+
static function getCommand($com = '') {
|
12 |
+
if (!preg_match("|[a-zA-Z0-9_]|", $com)) {
|
13 |
+
return null;
|
14 |
+
}
|
15 |
+
if (function_exists('mb_strtolower')) {
|
16 |
+
$com = mb_strtolower($com);
|
17 |
+
} else {
|
18 |
+
$com = strtolower($com);
|
19 |
+
}
|
20 |
+
$tmp = explode('_', $com);
|
21 |
+
$class_file = WPAdm_Core::getPluginDir() . "/commands/class-wpadm-command-" . str_replace('_', '-', $com) . ".php";
|
22 |
+
|
23 |
+
if (file_exists($class_file)) {
|
24 |
+
require_once $class_file;
|
25 |
+
foreach($tmp as $k=>$v) {
|
26 |
+
$tmp[$k] = ucfirst($v);
|
27 |
+
}
|
28 |
+
$com = implode('_', $tmp);
|
29 |
+
|
30 |
+
$class_name = "WPAdm_Command_{$com}";
|
31 |
+
return new $class_name();
|
32 |
+
}
|
33 |
+
|
34 |
+
return null;
|
35 |
+
}
|
36 |
+
}
|
37 |
}
|
modules/class-wpadm-mysqldump.php
CHANGED
@@ -112,7 +112,7 @@ if (!class_exists('WPAdm_Mysqldump')) {
|
|
112 |
$res = $link->query("REPAIR TABLE {$row['Name']};");
|
113 |
if ($res == 1) {
|
114 |
$proc_data = WPAdm_Running::getCommandResultData('repair');
|
115 |
-
$proc_data['repair'][$
|
116 |
WPAdm_Running::setCommandResultData('repair', $proc_data);
|
117 |
} else {
|
118 |
$this->setError($link->last_error);
|
112 |
$res = $link->query("REPAIR TABLE {$row['Name']};");
|
113 |
if ($res == 1) {
|
114 |
$proc_data = WPAdm_Running::getCommandResultData('repair');
|
115 |
+
$proc_data['repair'][$row['Name']] = 1;
|
116 |
WPAdm_Running::setCommandResultData('repair', $proc_data);
|
117 |
} else {
|
118 |
$this->setError($link->last_error);
|
modules/class-wpadm-running.php
CHANGED
@@ -79,6 +79,7 @@ if (!class_exists('WPAdm_Running')) {
|
|
79 |
if ($command && self::is_stop() ) {
|
80 |
WPAdm_Core::$cron = false;
|
81 |
wpadm_class::$type = 'full';
|
|
|
82 |
//$time_load = ini_get("max_execution_time");
|
83 |
//WPAdm_Core::log('proccess is work ' . $time_load . 'sec');
|
84 |
/*if ($time_load != 0) {
|
@@ -89,9 +90,8 @@ if (!class_exists('WPAdm_Running')) {
|
|
89 |
self::run(60);
|
90 |
|
91 |
if ( self::checkLock() ) {
|
92 |
-
|
93 |
$core = new WPAdm_Core($command, 'full_backup_dropbox', DRBBACKUP_BASE_DIR);
|
94 |
-
|
95 |
if ($result['result'] == 'success') {
|
96 |
self::delCommand($command['method']);
|
97 |
set_transient('drb_running', 0, 60 * 5);
|
@@ -266,7 +266,7 @@ if (!class_exists('WPAdm_Running')) {
|
|
266 |
$data = wpadm_unpack( file_get_contents( $path . "/$command" ) );
|
267 |
return $data;
|
268 |
}
|
269 |
-
|
270 |
return array();
|
271 |
}
|
272 |
}
|
79 |
if ($command && self::is_stop() ) {
|
80 |
WPAdm_Core::$cron = false;
|
81 |
wpadm_class::$type = 'full';
|
82 |
+
|
83 |
//$time_load = ini_get("max_execution_time");
|
84 |
//WPAdm_Core::log('proccess is work ' . $time_load . 'sec');
|
85 |
/*if ($time_load != 0) {
|
90 |
self::run(60);
|
91 |
|
92 |
if ( self::checkLock() ) {
|
|
|
93 |
$core = new WPAdm_Core($command, 'full_backup_dropbox', DRBBACKUP_BASE_DIR);
|
94 |
+
if (!is_bool( $core->getResult() ) && is_object( $core->getResult() ) && ( $result = $core->getResult()->toArray(true) ) ) {
|
95 |
if ($result['result'] == 'success') {
|
96 |
self::delCommand($command['method']);
|
97 |
set_transient('drb_running', 0, 60 * 5);
|
266 |
$data = wpadm_unpack( file_get_contents( $path . "/$command" ) );
|
267 |
return $data;
|
268 |
}
|
269 |
+
|
270 |
return array();
|
271 |
}
|
272 |
}
|
modules/restore-class.php
CHANGED
@@ -1,5 +1,17 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
5 |
if (!class_exists('dbr_gui')) {
|
@@ -11,32 +23,40 @@ if (!class_exists('dbr_gui')) {
|
|
11 |
if (!class_exists('dbr_database')) {
|
12 |
class dbr_database {
|
13 |
private static $connect = null;
|
|
|
14 |
private static $db = null;
|
15 |
-
|
16 |
public static $error = '';
|
17 |
public static $db_params = '';
|
18 |
|
19 |
|
20 |
private static function getWpMysqlParams()
|
21 |
{
|
22 |
-
$
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
$
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
self::$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
return $db_params;
|
42 |
}
|
@@ -50,16 +70,36 @@ if (!class_exists('dbr_database')) {
|
|
50 |
if ( !defined('WP_CONTENT_DIR') )
|
51 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
if (strpos(self::$db_params['host'], ':') !== false) {
|
54 |
$host = explode(":", self::$db_params['host']);
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
}
|
65 |
public static function db_insert($table, $vars = array())
|
@@ -143,14 +183,25 @@ if (!class_exists('dbr_database')) {
|
|
143 |
return self::returnArray($query, $limit, $res_type, $keys_array, $value_array);
|
144 |
}
|
145 |
public static function query($stmt)
|
146 |
-
{
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
148 |
if ( $res === false ) {
|
149 |
-
|
|
|
|
|
|
|
|
|
150 |
}
|
|
|
151 |
if ($res !== false and preg_match("/^INSERT/i", ltrim($stmt))) {
|
152 |
return self::lastID(self::$connect);
|
153 |
}
|
|
|
154 |
return $res;
|
155 |
}
|
156 |
/**
|
@@ -159,12 +210,19 @@ if (!class_exists('dbr_database')) {
|
|
159 |
*/
|
160 |
public static function lastID($lastlink)
|
161 |
{
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
}
|
164 |
public static function num($res)
|
165 |
{
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
168 |
}
|
169 |
private static function returnArray($query, $limit = 1, $res_type = '', $key = "", $value = "")
|
170 |
{
|
@@ -212,7 +270,12 @@ if (!class_exists('dbr_database')) {
|
|
212 |
} elseif( defined('MYSQLI_BOTH') && empty( $res_type ) ) {
|
213 |
$res_type = MYSQLI_BOTH;
|
214 |
}
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
216 |
}
|
217 |
|
218 |
public static function value_keys($array_from, $key = "", $value = "")
|
@@ -301,6 +364,22 @@ if ( !class_exists('dbr_helper') ) {
|
|
301 |
|
302 |
private static $cron_is_work = 60;
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
public static function setError($txt)
|
305 |
{
|
306 |
throw new Exception($txt);
|
@@ -311,7 +390,7 @@ if ( !class_exists('dbr_helper') ) {
|
|
311 |
$res = true;
|
312 |
$file = DBP_PATH_TMP . '/cron-restore.data';
|
313 |
if (file_exists($file)) {
|
314 |
-
$cron = dbr_helper::unpack( file_get_contents($file) );
|
315 |
if (empty($time)) {
|
316 |
if (isset($cron['finish'])) {
|
317 |
$res = true;
|
@@ -322,12 +401,12 @@ if ( !class_exists('dbr_helper') ) {
|
|
322 |
}
|
323 |
} else {
|
324 |
$cron[$type] = $time;
|
325 |
-
file_put_contents($file, dbr_helper::pack($cron) );
|
326 |
}
|
327 |
} else {
|
328 |
if (!empty($time)) {
|
329 |
$cron[$type] = $time;
|
330 |
-
file_put_contents($file, dbr_helper::pack($cron) );
|
331 |
}
|
332 |
$res = false;
|
333 |
}
|
@@ -393,20 +472,20 @@ if ( !class_exists('dbr_helper') ) {
|
|
393 |
}
|
394 |
$data = array();
|
395 |
if (file_exists(DBP_PATH_TMP . '/' . $command )) {
|
396 |
-
$data = self::unpack(file_get_contents( DBP_PATH_TMP . '/' . $command ) );
|
397 |
}
|
398 |
if (!empty($key)) {
|
399 |
$data[$key] = $value;
|
400 |
} else {
|
401 |
$data = $value;
|
402 |
}
|
403 |
-
file_put_contents(DBP_PATH_TMP . '/' . $command, self::pack($data) );
|
404 |
}
|
405 |
|
406 |
public static function getCommand($command, $key = '')
|
407 |
{
|
408 |
if (file_exists(DBP_PATH_TMP . '/' . $command)) {
|
409 |
-
$tmp = dbr_helper::unpack( file_get_contents(DBP_PATH_TMP . '/' . $command) );
|
410 |
if (!empty($key) && isset($tmp[$key])) {
|
411 |
return $tmp[$key];
|
412 |
} else {
|
@@ -448,7 +527,7 @@ if ( !class_exists('dbr_log') ) {
|
|
448 |
if (!empty($txt)) {
|
449 |
dbr_helper::mkdir(DBP_PATH_TMP);
|
450 |
$log_file = DBP_PATH_TMP . '/log-restore.log';
|
451 |
-
file_put_contents($log_file, date("Y-m-d H:i:s") ."\t{$class}\t{$txt}\n", FILE_APPEND);
|
452 |
}
|
453 |
}
|
454 |
|
@@ -463,7 +542,7 @@ if ( !class_exists('dbr_log') ) {
|
|
463 |
file_put_contents($log2, $log);
|
464 |
$log = str_replace($text, "", $log);
|
465 |
} else {
|
466 |
-
file_put_contents($log2, $log);
|
467 |
}
|
468 |
$log = explode("\n", $log);
|
469 |
krsort($log);
|
@@ -556,22 +635,27 @@ if ( !class_exists('dbr_methods') ) {
|
|
556 |
$sql .= $char_new;
|
557 |
} else {
|
558 |
$is_sql = true;
|
559 |
-
if ( strpos($sql, '_transient_timeout_drb_running')
|
560 |
$is_sql = false;
|
561 |
}
|
562 |
-
if ( strpos($sql, '_transient_drb_running')
|
563 |
$is_sql = false;
|
564 |
}
|
565 |
-
if ( strpos($sql, PREFIX_BACKUP_ . "_commands")
|
566 |
$is_sql = false;
|
567 |
}
|
568 |
-
if ( strpos($sql, PREFIX_BACKUP_ . "proccess-command")
|
569 |
$is_sql = false;
|
570 |
}
|
571 |
if ($is_sql) {
|
572 |
-
$
|
|
|
|
|
|
|
|
|
|
|
573 |
}
|
574 |
-
if ( $ress === false || !empty( dbr_database::$error )) {
|
575 |
if (stripos(dbr_database::$error, 'duplicate entry') === false) {
|
576 |
dbr_helper::setError('MySQL Error: ' . dbr_database::$error );
|
577 |
break;
|
@@ -614,7 +698,7 @@ if ( !class_exists('dbr_methods') ) {
|
|
614 |
if (!empty($file_md5)) {
|
615 |
|
616 |
if (file_exists($file_md5)) {
|
617 |
-
$this->md5_info = explode ("\n", file_get_contents( $file_md5 ) ); // delemiter \t (1 - file name, 2 - md5_file, 3 - zip file)
|
618 |
dbr_helper::setCommand('md5_info-restore', $this->md5_info);
|
619 |
dbr_helper::is_work(time(), 'start');
|
620 |
} else {
|
@@ -638,9 +722,9 @@ if ( !class_exists('dbr_methods') ) {
|
|
638 |
dbr_helper::is_work(time(), 'start');
|
639 |
if ( empty( $this->md5_info ) ) {
|
640 |
$this->md5_info = dbr_helper::getCommand('md5_info-restore');
|
641 |
-
}
|
642 |
$zip_database = dbr_helper::getCommand('zip-database');
|
643 |
-
if (
|
644 |
$while = true;
|
645 |
while($while) {
|
646 |
$file_info = array_pop($this->md5_info);
|
@@ -648,9 +732,27 @@ if ( !class_exists('dbr_methods') ) {
|
|
648 |
$info = explode("\t", $file_info);
|
649 |
if (isset($info[2])) {
|
650 |
$zip_database = $info;
|
651 |
-
dbr_helper::setCommand('zip-database
|
652 |
$while = false;
|
653 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
}
|
655 |
}
|
656 |
}
|
@@ -662,18 +764,78 @@ if ( !class_exists('dbr_methods') ) {
|
|
662 |
if (file_exists($file) && filesize($file) > 0) {
|
663 |
$archive = new PclZip($file);
|
664 |
$unzip = $archive->extract(
|
|
|
665 |
PCLZIP_OPT_PATH, ABSPATH,
|
666 |
PCLZIP_OPT_REPLACE_NEWER /// extracted all files & databasedump
|
667 |
);
|
668 |
if ($unzip== 0) {
|
669 |
dbr_helper::setError("Error during extracting of archive: " . $archive->errorInfo(true) );
|
670 |
}
|
671 |
-
if (strpos($file, $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
$archive = new PclZip($file);
|
673 |
-
$base_path = dbr_helper::getBasePath($zip_database[1]); // dump in directory website archive
|
674 |
$unzip = $archive->extract(PCLZIP_OPT_PATH, ABSPATH,
|
675 |
PCLZIP_OPT_REPLACE_NEWER,
|
676 |
-
PCLZIP_OPT_BY_EREG, "mysqldump.sql
|
677 |
);
|
678 |
if ($unzip== 0) {
|
679 |
dbr_helper::setError("Error during extracting of dump/database from archive: " . $archive->errorInfo(true) );
|
@@ -862,7 +1024,7 @@ if (!class_exists('dbr_route')) {
|
|
862 |
$setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1);
|
863 |
$this->setting = dbr_helper::unpack( $setting['option_value'] );
|
864 |
if (file_exists(DROPBOX_BACKUP_DIR_BACKUP . '/local-key')) {
|
865 |
-
$key_values = dbr_helper::unpack( file_get_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key') );
|
866 |
}
|
867 |
if ($_POST['key'] == $this->setting['restore-key'] || ( isset($key_values['key']) && $_POST['key'] == $key_values['key'] ) ) {
|
868 |
$methods = new dbr_methods();
|
@@ -882,7 +1044,12 @@ if (!class_exists('dbr_route')) {
|
|
882 |
|
883 |
if (isset($_POST['type-backup']) && $_POST['type-backup'] == 'restore') {
|
884 |
if ( !dbr_helper::is_work() && dbr_helper::getCommand('restore-backup') ) {
|
885 |
-
|
|
|
|
|
|
|
|
|
|
|
886 |
}
|
887 |
} else {
|
888 |
dbr_helper::is_work(time(), 'start');
|
@@ -939,7 +1106,7 @@ if (!class_exists('dbr_route')) {
|
|
939 |
$files = glob($plugin_dir . '/*.php');
|
940 |
$n = count($files);
|
941 |
for($i = 0; $i < $n; $i++) {
|
942 |
-
$plugin = file_get_contents($files[$i]);
|
943 |
if (preg_match("/version: ([0-9\.]+)/i", $plugin, $data)) {
|
944 |
if (isset($data[1]) && !empty($data[1])) {
|
945 |
$this->plugins[$folder]['Version'] = $data[1];
|
1 |
<?php
|
2 |
|
3 |
+
if (!function_exists('dbr_extract_func')) {
|
4 |
+
function dbr_extract_func($p_event, &$p_header)
|
5 |
+
{
|
6 |
+
if (stripos($p_header['filename'], 'wp-config.php') !== false) {
|
7 |
+
return 0;
|
8 |
+
}
|
9 |
+
if (stripos($p_header['filename'], 'dropbox-backup') !== false) {
|
10 |
+
return 0;
|
11 |
+
}
|
12 |
+
return 1;
|
13 |
+
}
|
14 |
+
}
|
15 |
|
16 |
|
17 |
if (!class_exists('dbr_gui')) {
|
23 |
if (!class_exists('dbr_database')) {
|
24 |
class dbr_database {
|
25 |
private static $connect = null;
|
26 |
+
private static $is_mysqli = true;
|
27 |
private static $db = null;
|
28 |
+
public static $db_prefix = '';
|
29 |
public static $error = '';
|
30 |
public static $db_params = '';
|
31 |
|
32 |
|
33 |
private static function getWpMysqlParams()
|
34 |
{
|
35 |
+
$configs = dbr_helper::getCommand('db-settings');
|
36 |
+
if ($configs === false) {
|
37 |
+
$db_params = array(
|
38 |
+
'password' => 'DB_PASSWORD',
|
39 |
+
'db' => 'DB_NAME',
|
40 |
+
'user' => 'DB_USER',
|
41 |
+
'host' => 'DB_HOST',
|
42 |
+
'charset' => 'DB_CHARSET',
|
43 |
+
);
|
44 |
+
|
45 |
+
$r = "/define\([\s]{0,}'(.*)'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/";
|
46 |
+
preg_match_all($r, @file_get_contents(ABSPATH . "wp-config.php"), $m);
|
47 |
+
preg_match("/table_prefix[\s]{0,}=[\s]{0,}[\"']{1}(.*)[\"']{1}/U", @file_get_contents(ABSPATH . "wp-config.php"), $pr);
|
48 |
+
$params = array_combine($m[1], $m[2]);
|
49 |
+
foreach($db_params as $k => $p) {
|
50 |
+
$db_params[$k] = $params[$p];
|
51 |
+
}
|
52 |
+
self::$db_params = $db_params;
|
53 |
+
if (isset($pr[1])) {
|
54 |
+
self::$db_prefix = $pr[1];
|
55 |
+
}
|
56 |
+
} else {
|
57 |
+
self::$db_params = $configs;
|
58 |
+
$db_params = self::$db_params;
|
59 |
+
self::$db_prefix = dbr_helper::getCommand('db-settings-prefix');
|
60 |
}
|
61 |
return $db_params;
|
62 |
}
|
70 |
if ( !defined('WP_CONTENT_DIR') )
|
71 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
72 |
|
73 |
+
if (function_exists('mysqli_connect')) {
|
74 |
+
self::$is_mysqli = true;
|
75 |
+
} else {
|
76 |
+
self::$is_mysqli = false;
|
77 |
+
}
|
78 |
+
|
79 |
if (strpos(self::$db_params['host'], ':') !== false) {
|
80 |
$host = explode(":", self::$db_params['host']);
|
81 |
+
if (self::$is_mysqli) {
|
82 |
+
self::$connect = mysqli_connect($host[0], self::$db_params['user'], self::$db_params['password'], self::$db_params['db'], $host[1]) or die(mysqli_error());
|
83 |
+
mysqli_set_charset(self::$connect, self::$db_params['charset']) or die(mysql_error());
|
84 |
+
} else {
|
85 |
+
self::$connect = mysql_connect($host[0], self::$db_params['user'], self::$db_params['password'], self::$db_params['db'], $host[1]) or die(mysql_error());
|
86 |
+
mysql_set_charset(self::$connect, self::$db_params['charset']) or die(mysql_error());
|
87 |
+
}
|
88 |
+
} else {
|
89 |
+
if (self::$is_mysqli) {
|
90 |
+
self::$connect = mysqli_connect(self::$db_params['host'], self::$db_params['user'], self::$db_params['password']) or die(mysqli_error());
|
91 |
+
mysqli_set_charset(self::$connect, self::$db_params['charset']) or die(mysqli_error());
|
92 |
+
mysqli_select_db(self::$connect, self::$db_params['db']) or die(mysqli_error());
|
93 |
+
} else {
|
94 |
+
self::$connect = @mysql_connect(self::$db_params['host'], self::$db_params['user'], self::$db_params['password']) or die(mysql_error());
|
95 |
+
mysql_set_charset(self::$db_params['charset'], self::$connect) or die(mysql_error());
|
96 |
+
mysql_select_db(self::$db_params['db'], self::$connect) or die(mysql_error());
|
97 |
+
}
|
98 |
+
}
|
99 |
+
if (self::$connect) {
|
100 |
+
dbr_helper::setCommand('db-settings', self::$db_params);
|
101 |
+
dbr_helper::setCommand('db-settings-prefix', self::$db_prefix);
|
102 |
+
}
|
103 |
}
|
104 |
}
|
105 |
public static function db_insert($table, $vars = array())
|
183 |
return self::returnArray($query, $limit, $res_type, $keys_array, $value_array);
|
184 |
}
|
185 |
public static function query($stmt)
|
186 |
+
{
|
187 |
+
if (self::$is_mysqli) {
|
188 |
+
$res = mysqli_query(self::$connect, $stmt);
|
189 |
+
} else {
|
190 |
+
$res = mysql_query($stmt, self::$connect );
|
191 |
+
}
|
192 |
+
|
193 |
if ( $res === false ) {
|
194 |
+
if (self::$is_mysqli) {
|
195 |
+
self::$error = mysqli_error(self::$connect);
|
196 |
+
} else {
|
197 |
+
self::$error = mysql_error(self::$connect);
|
198 |
+
}
|
199 |
}
|
200 |
+
|
201 |
if ($res !== false and preg_match("/^INSERT/i", ltrim($stmt))) {
|
202 |
return self::lastID(self::$connect);
|
203 |
}
|
204 |
+
|
205 |
return $res;
|
206 |
}
|
207 |
/**
|
210 |
*/
|
211 |
public static function lastID($lastlink)
|
212 |
{
|
213 |
+
if (self::$is_mysqli) {
|
214 |
+
return mysqli_insert_id($lastlink);
|
215 |
+
} else {
|
216 |
+
return mysql_insert_id($lastlink);
|
217 |
+
}
|
218 |
}
|
219 |
public static function num($res)
|
220 |
{
|
221 |
+
if (self::$is_mysqli) {
|
222 |
+
return mysqli_num_rows($res);
|
223 |
+
} else {
|
224 |
+
return mysql_num_rows($res);
|
225 |
+
}
|
226 |
}
|
227 |
private static function returnArray($query, $limit = 1, $res_type = '', $key = "", $value = "")
|
228 |
{
|
270 |
} elseif( defined('MYSQLI_BOTH') && empty( $res_type ) ) {
|
271 |
$res_type = MYSQLI_BOTH;
|
272 |
}
|
273 |
+
if (self::$is_mysqli) {
|
274 |
+
return mysqli_fetch_array($res, $res_type);
|
275 |
+
} else {
|
276 |
+
return mysql_fetch_array($res, $res_type);
|
277 |
+
}
|
278 |
+
|
279 |
}
|
280 |
|
281 |
public static function value_keys($array_from, $key = "", $value = "")
|
364 |
|
365 |
private static $cron_is_work = 60;
|
366 |
|
367 |
+
public static function is_writable($file_dir = '')
|
368 |
+
{
|
369 |
+
if (!empty($file_dir)) {
|
370 |
+
if (is_dir($file_dir)) {
|
371 |
+
@file_put_contents($file_dir . "/test.file", 'test writable');
|
372 |
+
if ( file_exists($file_dir . "/test.file") && is_writable($file_dir . "/test.file") && filesize($file_dir . "/test.file") > 0 ) {
|
373 |
+
return true;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
if (file_exists($file_dir) && is_file($file_dir)) {
|
377 |
+
return is_writable($file_dir);
|
378 |
+
}
|
379 |
+
}
|
380 |
+
return false;
|
381 |
+
}
|
382 |
+
|
383 |
public static function setError($txt)
|
384 |
{
|
385 |
throw new Exception($txt);
|
390 |
$res = true;
|
391 |
$file = DBP_PATH_TMP . '/cron-restore.data';
|
392 |
if (file_exists($file)) {
|
393 |
+
$cron = dbr_helper::unpack( @file_get_contents($file) );
|
394 |
if (empty($time)) {
|
395 |
if (isset($cron['finish'])) {
|
396 |
$res = true;
|
401 |
}
|
402 |
} else {
|
403 |
$cron[$type] = $time;
|
404 |
+
@file_put_contents($file, dbr_helper::pack($cron) );
|
405 |
}
|
406 |
} else {
|
407 |
if (!empty($time)) {
|
408 |
$cron[$type] = $time;
|
409 |
+
@file_put_contents($file, dbr_helper::pack($cron) );
|
410 |
}
|
411 |
$res = false;
|
412 |
}
|
472 |
}
|
473 |
$data = array();
|
474 |
if (file_exists(DBP_PATH_TMP . '/' . $command )) {
|
475 |
+
$data = self::unpack(@file_get_contents( DBP_PATH_TMP . '/' . $command ) );
|
476 |
}
|
477 |
if (!empty($key)) {
|
478 |
$data[$key] = $value;
|
479 |
} else {
|
480 |
$data = $value;
|
481 |
}
|
482 |
+
@file_put_contents(DBP_PATH_TMP . '/' . $command, self::pack($data) );
|
483 |
}
|
484 |
|
485 |
public static function getCommand($command, $key = '')
|
486 |
{
|
487 |
if (file_exists(DBP_PATH_TMP . '/' . $command)) {
|
488 |
+
$tmp = dbr_helper::unpack( @file_get_contents(DBP_PATH_TMP . '/' . $command) );
|
489 |
if (!empty($key) && isset($tmp[$key])) {
|
490 |
return $tmp[$key];
|
491 |
} else {
|
527 |
if (!empty($txt)) {
|
528 |
dbr_helper::mkdir(DBP_PATH_TMP);
|
529 |
$log_file = DBP_PATH_TMP . '/log-restore.log';
|
530 |
+
@file_put_contents($log_file, date("Y-m-d H:i:s") ."\t{$class}\t{$txt}\n", FILE_APPEND);
|
531 |
}
|
532 |
}
|
533 |
|
542 |
file_put_contents($log2, $log);
|
543 |
$log = str_replace($text, "", $log);
|
544 |
} else {
|
545 |
+
@file_put_contents($log2, $log);
|
546 |
}
|
547 |
$log = explode("\n", $log);
|
548 |
krsort($log);
|
635 |
$sql .= $char_new;
|
636 |
} else {
|
637 |
$is_sql = true;
|
638 |
+
if ( strpos($sql, '_transient_timeout_drb_running') !== false ) {
|
639 |
$is_sql = false;
|
640 |
}
|
641 |
+
if ( strpos($sql, '_transient_drb_running') !== false ) {
|
642 |
$is_sql = false;
|
643 |
}
|
644 |
+
if ( strpos($sql, PREFIX_BACKUP_ . "_commands") !== false ) {
|
645 |
$is_sql = false;
|
646 |
}
|
647 |
+
if ( strpos($sql, PREFIX_BACKUP_ . "proccess-command") !== false ) {
|
648 |
$is_sql = false;
|
649 |
}
|
650 |
if ($is_sql) {
|
651 |
+
$arr_sql = dbr_helper::getCommand('sql-restore');
|
652 |
+
if ( !isset( $arr_sql[md5($sql)] ) || $arr_sql === false ) {
|
653 |
+
$ress = dbr_database::query( $sql );
|
654 |
+
$arr_sql[md5($sql)] = 1;
|
655 |
+
dbr_helper::setCommand('sql-restore', $arr_sql);
|
656 |
+
}
|
657 |
}
|
658 |
+
if (isset($ress) && ( $ress === false || !empty( dbr_database::$error ) ) ) {
|
659 |
if (stripos(dbr_database::$error, 'duplicate entry') === false) {
|
660 |
dbr_helper::setError('MySQL Error: ' . dbr_database::$error );
|
661 |
break;
|
698 |
if (!empty($file_md5)) {
|
699 |
|
700 |
if (file_exists($file_md5)) {
|
701 |
+
$this->md5_info = explode ("\n", @file_get_contents( $file_md5 ) ); // delemiter \t (1 - file name, 2 - md5_file, 3 - zip file)
|
702 |
dbr_helper::setCommand('md5_info-restore', $this->md5_info);
|
703 |
dbr_helper::is_work(time(), 'start');
|
704 |
} else {
|
722 |
dbr_helper::is_work(time(), 'start');
|
723 |
if ( empty( $this->md5_info ) ) {
|
724 |
$this->md5_info = dbr_helper::getCommand('md5_info-restore');
|
725 |
+
}
|
726 |
$zip_database = dbr_helper::getCommand('zip-database');
|
727 |
+
if (!$zip_database) {
|
728 |
$while = true;
|
729 |
while($while) {
|
730 |
$file_info = array_pop($this->md5_info);
|
732 |
$info = explode("\t", $file_info);
|
733 |
if (isset($info[2])) {
|
734 |
$zip_database = $info;
|
735 |
+
dbr_helper::setCommand('zip-database', $zip_database);
|
736 |
$while = false;
|
737 |
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
}
|
741 |
+
$zip_config = dbr_helper::getCommand('zip-config');
|
742 |
+
if (!$zip_config) {
|
743 |
+
$md5_info = dbr_helper::getCommand('md5_info-restore');
|
744 |
+
$while = true;
|
745 |
+
if($md5_info) {
|
746 |
+
while($while) {
|
747 |
+
$file_info = array_shift($md5_info);
|
748 |
+
if (strpos($file_info, 'wp-config.php') !== false) {
|
749 |
+
$info = explode("\t", $file_info);
|
750 |
+
if (isset($info[2])) {
|
751 |
+
$zip_config = $info;
|
752 |
+
dbr_helper::setCommand('zip-config', $zip_config);
|
753 |
+
$while = false;
|
754 |
+
}
|
755 |
+
}
|
756 |
}
|
757 |
}
|
758 |
}
|
764 |
if (file_exists($file) && filesize($file) > 0) {
|
765 |
$archive = new PclZip($file);
|
766 |
$unzip = $archive->extract(
|
767 |
+
PCLZIP_CB_PRE_EXTRACT, 'dbr_extract_func',
|
768 |
PCLZIP_OPT_PATH, ABSPATH,
|
769 |
PCLZIP_OPT_REPLACE_NEWER /// extracted all files & databasedump
|
770 |
);
|
771 |
if ($unzip== 0) {
|
772 |
dbr_helper::setError("Error during extracting of archive: " . $archive->errorInfo(true) );
|
773 |
}
|
774 |
+
if ($zip_config && strpos($file, $zip_config[2]) !== false) {
|
775 |
+
dbr_helper::is_work(time(), 'start');
|
776 |
+
if ( dbr_helper::is_writable(ABSPATH . 'wp-config.php') === false) {
|
777 |
+
dbr_helper::setError( "File 'wp-config.php' is not writable" );
|
778 |
+
}
|
779 |
+
$archive = new PclZip($file);
|
780 |
+
$unzip = $archive->extract(PCLZIP_OPT_BY_EREG, "/wp-config.php$/",
|
781 |
+
PCLZIP_OPT_PATH, ABSPATH,
|
782 |
+
PCLZIP_OPT_REPLACE_NEWER
|
783 |
+
);
|
784 |
+
if ($unzip == 0) {
|
785 |
+
dbr_helper::setError("Error during extracting of database config from archive: " . $archive->errorInfo(true) );
|
786 |
+
}
|
787 |
+
$db_params = array(
|
788 |
+
'password' => 'DB_PASSWORD',
|
789 |
+
'db' => 'DB_NAME',
|
790 |
+
'user' => 'DB_USER',
|
791 |
+
'host' => 'DB_HOST',
|
792 |
+
'charset' => 'DB_CHARSET',
|
793 |
+
);
|
794 |
+
|
795 |
+
$r = "/define\([\s]{0,}['\"]{1}(.*)['\"]{1}[\s]{0,},[\s]{0,}['\"]{1}(.*)['\"]{1}[\s]{0,}\)/";
|
796 |
+
$config = @file_get_contents(ABSPATH . "wp-config.php");
|
797 |
+
preg_match_all($r, $config, $m);
|
798 |
+
$params = array_combine( $m[1], $m[2] );
|
799 |
+
$change_config = false;
|
800 |
+
foreach($db_params as $k => $p) {
|
801 |
+
$db_params[$k] = $params[$p];
|
802 |
+
if (dbr_database::$db_params[$k] != $db_params[$k]) {
|
803 |
+
$change_config = true;
|
804 |
+
}
|
805 |
+
}
|
806 |
+
if ($change_config) {
|
807 |
+
dbr_log::log('Configure file "wp-config.php" was started');
|
808 |
+
$patterns = array();
|
809 |
+
$patterns[0] = "/define\('DB_PASSWORD', '(.*)'\)/";
|
810 |
+
$patterns[1] = "/define\('DB_NAME', '(.*)'\)/";
|
811 |
+
$patterns[2] = "/define\('DB_USER', '(.*)'\)/";
|
812 |
+
$patterns[3] = "/define\('DB_HOST', '(.*)'\)/";
|
813 |
+
$patterns[4] = "/define\('DB_CHARSET', '(.*)'\)/";
|
814 |
+
|
815 |
+
$replacements = array();
|
816 |
+
$replacements[0] = "define('DB_PASSWORD', '" . dbr_database::$db_params['password'] . "')";
|
817 |
+
$replacements[1] = "define('DB_NAME', '" . dbr_database::$db_params['db'] . "')";
|
818 |
+
$replacements[2] = "define('DB_USER', '" . dbr_database::$db_params['user'] . "')";
|
819 |
+
$replacements[3] = "define('DB_HOST', '" . dbr_database::$db_params['host'] . "')";
|
820 |
+
$replacements[4] = "define('DB_CHARSET', '" . dbr_database::$db_params['charset'] . "')";
|
821 |
+
|
822 |
+
$config = preg_replace($patterns, $replacements, $config);
|
823 |
+
|
824 |
+
$config = preg_replace("/table_prefix[\s]{0,}=[\s]{0,}[\"']{1}(.*)[\"']{1}/U", "table_prefix = '" . dbr_database::$db_prefix . "'", $config);
|
825 |
+
|
826 |
+
$write = @file_put_contents(ABSPATH . "wp-config.php", $config);
|
827 |
+
|
828 |
+
if (!$write) {
|
829 |
+
dbr_helper::setError( "File 'wp-config.php' is not writable" );
|
830 |
+
}
|
831 |
+
dbr_log::log('Configure file "wp-config.php" was successfully');
|
832 |
+
}
|
833 |
+
}
|
834 |
+
if ($zip_database && strpos($file, $zip_database[2]) !== false) {
|
835 |
$archive = new PclZip($file);
|
|
|
836 |
$unzip = $archive->extract(PCLZIP_OPT_PATH, ABSPATH,
|
837 |
PCLZIP_OPT_REPLACE_NEWER,
|
838 |
+
PCLZIP_OPT_BY_EREG, "/mysqldump.sql$/"
|
839 |
);
|
840 |
if ($unzip== 0) {
|
841 |
dbr_helper::setError("Error during extracting of dump/database from archive: " . $archive->errorInfo(true) );
|
1024 |
$setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1);
|
1025 |
$this->setting = dbr_helper::unpack( $setting['option_value'] );
|
1026 |
if (file_exists(DROPBOX_BACKUP_DIR_BACKUP . '/local-key')) {
|
1027 |
+
$key_values = dbr_helper::unpack( @file_get_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key') );
|
1028 |
}
|
1029 |
if ($_POST['key'] == $this->setting['restore-key'] || ( isset($key_values['key']) && $_POST['key'] == $key_values['key'] ) ) {
|
1030 |
$methods = new dbr_methods();
|
1044 |
|
1045 |
if (isset($_POST['type-backup']) && $_POST['type-backup'] == 'restore') {
|
1046 |
if ( !dbr_helper::is_work() && dbr_helper::getCommand('restore-backup') ) {
|
1047 |
+
$http = 'http://';
|
1048 |
+
if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443 ) {
|
1049 |
+
$http = 'https://';
|
1050 |
+
}
|
1051 |
+
$key = isset($this->setting['restore-key']) && !empty($this->setting['restore-key']) ? $this->setting['restore-key'] : $key_values['key'];
|
1052 |
+
dbr_api::post($http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], array('key' => $key, 'method' => 'restore'), array('timelimit' => 5) );
|
1053 |
}
|
1054 |
} else {
|
1055 |
dbr_helper::is_work(time(), 'start');
|
1106 |
$files = glob($plugin_dir . '/*.php');
|
1107 |
$n = count($files);
|
1108 |
for($i = 0; $i < $n; $i++) {
|
1109 |
+
$plugin = @file_get_contents($files[$i]);
|
1110 |
if (preg_match("/version: ([0-9\.]+)/i", $plugin, $data)) {
|
1111 |
if (isset($data[1]) && !empty($data[1])) {
|
1112 |
$this->plugins[$folder]['Version'] = $data[1];
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Backup & Restore Dropbox ===
|
2 |
Plugin Name: Backup & Restore Dropbox
|
3 |
-
Version: 1.4.7
|
4 |
Donate link: http://www.wpadm.com/donate
|
5 |
URI: http://www.wpadm.com/dropbox-backup
|
6 |
Tags: dropbox, backup, dropbox backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, synchronize, clone, duplicate, move, web page backup, site, site backup, back up, cloud, Cloud Files, cloud backup, db backup, dump, german, migrate, multisite, German, schedule, storage, time, upload, data bank, zip, archive, backups, restore, db, recover, recovery, restoration, wp backup, wordpress backup, wordpress backup to dropbox, plugin wordpress backup, wpadm, wpadm.com, website, website backup, website back up, wp backup, wordpress backup, scheduled backup, backup scheduler, tool, backup tool
|
7 |
Requires at least: 3.9
|
8 |
-
Tested up to: 4.
|
9 |
Stable tag: trunk
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -37,7 +37,7 @@ please, make a [support request](http://www.wpadm.com/support/) first!
|
|
37 |
* Supports backup on "Low Memory" Hosting or Server;
|
38 |
* Possibility to make Dropbox backup and restore interface hidden with all listed backups (only Admins can access the backup plugin page);
|
39 |
* Automatic database optimization before backup (can be switched in plugin settings);
|
40 |
-
* Database or Table repair functionality before backup
|
41 |
* Administrate ALL of Backups for ALL of your sites from one place – WPAdm-account (Account is FREE);
|
42 |
|
43 |
**Account creation is optional, but we suggest to do this.<br /> Why create [www.wpadm.com](http://www.wpadm.com/) account?**<br />
|
@@ -94,16 +94,17 @@ After downloading the ZIP file of the Dropbox back up and restoration plugin,
|
|
94 |
<br />
|
95 |
*If the installation does not succeed, please contact http://www.wpadm.com support staff or refer to your system administrator.*<br />
|
96 |
|
|
|
97 |
|
98 |
-
Dropbox Backup Plugin have a settings section on WordPress plugin page.
|
99 |
-
If you need help with the plugin or you want to report a bug, so please, also refer to http://www.wpadm.com/support/
|
100 |
|
101 |
== Other ==
|
102 |
|
103 |
= Very easy and secure Dropbox Backup and Restoration (website / web page restore from backup) =
|
104 |
|
105 |
-
|
106 |
-
DropBox Backup is a new plugin, so we tried to provide a bug-free plugin/widget. We are maintain this project.
|
107 |
|
108 |
Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
|
109 |
our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
|
@@ -391,14 +392,26 @@ Please, keep your Dropbox Backup and Restore plugin up-to-date.
|
|
391 |
|
392 |
**Rev.** / **Description** <br />
|
393 |
|
394 |
-
|
395 |
-
@
|
396 |
-
@
|
397 |
-
@
|
398 |
-
@
|
399 |
-
@
|
400 |
-
@
|
401 |
-
@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
@1390219 Dropbox backup and restore fixes.<br />
|
403 |
@1390174 "Dropbox Backup & restore" - add new version(1.4.6.1). Repairing database.<br />
|
404 |
@1360807 Update of form view.<br />
|
1 |
=== Backup & Restore Dropbox ===
|
2 |
Plugin Name: Backup & Restore Dropbox
|
3 |
+
Version: 1.4.7.1
|
4 |
Donate link: http://www.wpadm.com/donate
|
5 |
URI: http://www.wpadm.com/dropbox-backup
|
6 |
Tags: dropbox, backup, dropbox backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, synchronize, clone, duplicate, move, web page backup, site, site backup, back up, cloud, Cloud Files, cloud backup, db backup, dump, german, migrate, multisite, German, schedule, storage, time, upload, data bank, zip, archive, backups, restore, db, recover, recovery, restoration, wp backup, wordpress backup, wordpress backup to dropbox, plugin wordpress backup, wpadm, wpadm.com, website, website backup, website back up, wp backup, wordpress backup, scheduled backup, backup scheduler, tool, backup tool
|
7 |
Requires at least: 3.9
|
8 |
+
Tested up to: 4.6.1
|
9 |
Stable tag: trunk
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
37 |
* Supports backup on "Low Memory" Hosting or Server;
|
38 |
* Possibility to make Dropbox backup and restore interface hidden with all listed backups (only Admins can access the backup plugin page);
|
39 |
* Automatic database optimization before backup (can be switched in plugin settings);
|
40 |
+
* Database or Table repair functionality before backup;
|
41 |
* Administrate ALL of Backups for ALL of your sites from one place – WPAdm-account (Account is FREE);
|
42 |
|
43 |
**Account creation is optional, but we suggest to do this.<br /> Why create [www.wpadm.com](http://www.wpadm.com/) account?**<br />
|
94 |
<br />
|
95 |
*If the installation does not succeed, please contact http://www.wpadm.com support staff or refer to your system administrator.*<br />
|
96 |
|
97 |
+
To backup website on Dropbox, you need connect a backup plugin to your dropbox account. It's easy to do, but if you need help about "how to connect my backup plugin to dropbox account?", please refer, to FAQ page of backup plugin.
|
98 |
|
99 |
+
Dropbox Backup Plugin have a settings section on WordPress backup plugin page.
|
100 |
+
If you need help with the backup plugin or you want to report a bug, so please, also refer to http://www.wpadm.com/support/
|
101 |
|
102 |
== Other ==
|
103 |
|
104 |
= Very easy and secure Dropbox Backup and Restoration (website / web page restore from backup) =
|
105 |
|
106 |
+
Useful additional functions can be found at www.wpadm.com in the User profile.
|
107 |
+
DropBox Backup is a new plugin, so we tried to provide a bug-free backup plugin/widget. We are maintain this project.
|
108 |
|
109 |
Information about privacy: AFTER the user has been registered at WPAdm service AND has confirmed their registration,
|
110 |
our plugin will get the minimum requirements of php and mysql configuration, version and language of wordpress.
|
392 |
|
393 |
**Rev.** / **Description** <br />
|
394 |
|
395 |
+
Plugin "Dropbox backup & restore" - successfully tested up to 4.6.1
|
396 |
+
@1492054 regex of parse db data
|
397 |
+
@1484886 Misspelling + taags are not visible
|
398 |
+
@1484831 Explanation about dropbox connection after plugin installation.
|
399 |
+
@1476739 test up to 4.6
|
400 |
+
@1474653 updated function of restore
|
401 |
+
@1471067 "Dropbox Backup & restore" - parse for db data
|
402 |
+
@1463460 Restore connections to DB with use of mysqli or mysql. Automate DB …
|
403 |
+
@1459117 change notice form
|
404 |
+
@1455954 update Changelog
|
405 |
+
To restore connect to the database will be also used mysqli or mysql. The database connection type will be selected automatically.<br />
|
406 |
+
During restoring process: the config file of WordPress wp-config.php will use config of new website configuration to connect to the database.<br />
|
407 |
+
@1448769 "Dropbox backup & restore" - added tmp folder for library pclzip, deleted files tmp for pclzip<br />
|
408 |
+
@1442461 "Dropbox backup & restore" - Show as Item in "Admin bar"<br />
|
409 |
+
@1438063 "Dropbox backup & restore" new version(1.4.7) added - stop button, bugs fixed, update styles, process restore to connect mysql, process bar, update processes on creating mysqldump, archive files<br />
|
410 |
+
@1427803 "Dropbox backup & restore" - update a view notice <br />
|
411 |
+
@1420446 Changed<br />
|
412 |
+
@1407804 "Dropbox backup & restore" new version(1.4.4) added - check permission of backup folder<br />
|
413 |
+
@1400462 filter for ajax text(html)<br />
|
414 |
+
@1393861 Dropbox backup and restore tested up to WordPress 4.5<br />
|
415 |
@1390219 Dropbox backup and restore fixes.<br />
|
416 |
@1390174 "Dropbox Backup & restore" - add new version(1.4.6.1). Repairing database.<br />
|
417 |
@1360807 Update of form view.<br />
|
template/wpadm_show_backup.php
CHANGED
@@ -534,17 +534,12 @@
|
|
534 |
jQuery(".title-status").css('display', 'none');
|
535 |
jQuery("#logs-form").show("slow");
|
536 |
jQuery("#action-buttons").css('margin-top', '8px');
|
|
|
537 |
jQuery.ajax({
|
538 |
type: "POST",
|
539 |
// url: ajaxurl,
|
540 |
url: '<?php echo plugins_url('/modules/restore-class.php', dirname(__FILE__) ); ?>',
|
541 |
data: data_backup,
|
542 |
-
beforeSend: function(){
|
543 |
-
process_flag = 1
|
544 |
-
processBar('restore');
|
545 |
-
showTime();
|
546 |
-
|
547 |
-
},
|
548 |
success: function(data){
|
549 |
if (data.result == 'success') {
|
550 |
process_flag = 0;
|
@@ -560,7 +555,8 @@
|
|
560 |
jQuery('.title-status').html(str);
|
561 |
}
|
562 |
} else if (data.result == 'work'){
|
563 |
-
|
|
|
564 |
} else {
|
565 |
process_flag = 0;
|
566 |
jQuery('.title-logs').css('display', 'none');
|
534 |
jQuery(".title-status").css('display', 'none');
|
535 |
jQuery("#logs-form").show("slow");
|
536 |
jQuery("#action-buttons").css('margin-top', '8px');
|
537 |
+
process_flag = 1
|
538 |
jQuery.ajax({
|
539 |
type: "POST",
|
540 |
// url: ajaxurl,
|
541 |
url: '<?php echo plugins_url('/modules/restore-class.php', dirname(__FILE__) ); ?>',
|
542 |
data: data_backup,
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
success: function(data){
|
544 |
if (data.result == 'success') {
|
545 |
process_flag = 0;
|
555 |
jQuery('.title-status').html(str);
|
556 |
}
|
557 |
} else if (data.result == 'work'){
|
558 |
+
processBar('restore');
|
559 |
+
showTime();
|
560 |
} else {
|
561 |
process_flag = 0;
|
562 |
jQuery('.title-logs').css('display', 'none');
|