Version Description
- set ftp Connection timeout to 10 sec
- fix bug for DB tables exclude
- DB Backup in mySQL Client encoding now
- Fixed missing ; in DB Backup
- Added tool DB Restore with automatic Blog Url/Path change
Download this release
Release Info
| Developer | danielhuesken |
| Plugin | |
| Version | 0.7.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.6.5 to 0.7.0
- app/css/options.css +4 -4
- app/dojob/after.php +1 -1
- app/dojob/db.php +11 -9
- app/dojob/destination-ftp.php +2 -2
- app/functions.php +1 -1
- app/options-edit.php +190 -0
- app/options-save.php +26 -21
- app/options-tools.php +32 -4
- app/tools/db_restore.php +85 -0
- backwpup.php +2 -2
- readme.txt +9 -5
app/css/options.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
.column-id {
|
| 2 |
-
width:
|
| 3 |
}
|
| 4 |
-
.column-runtime, .column-last, .column-next , .column-status{
|
| 5 |
-
width:
|
| 6 |
}
|
| 7 |
.column-type {
|
| 8 |
-
width:
|
| 9 |
}
|
| 10 |
.column-size {
|
| 11 |
width:75px;
|
| 1 |
.column-id {
|
| 2 |
+
width:40px;text-align:center;
|
| 3 |
}
|
| 4 |
+
.column-runtime, .column-last, .column-next , .column-status {
|
| 5 |
+
width:125px;
|
| 6 |
}
|
| 7 |
.column-type {
|
| 8 |
+
width:125px;
|
| 9 |
}
|
| 10 |
.column-size {
|
| 11 |
width:75px;
|
app/dojob/after.php
CHANGED
|
@@ -55,7 +55,7 @@ $jobs[$jobid]['lastrun']=$jobs[$jobid]['starttime'];
|
|
| 55 |
$jobs[$jobid]['lastruntime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
|
| 56 |
$jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
|
| 57 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
| 58 |
-
backwpup_joblog($logtime,sprintf(__('
|
| 59 |
//Write backupfile und worktime to log
|
| 60 |
$wpdb->update( $wpdb->backwpup_logs, array( 'worktime' => $jobs[$jobid]['lastruntime'], 'backupfile' => mysql_real_escape_string($backupfile)), array( 'logtime' => $logtime ));
|
| 61 |
?>
|
| 55 |
$jobs[$jobid]['lastruntime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
|
| 56 |
$jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
|
| 57 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
| 58 |
+
backwpup_joblog($logtime,sprintf(__('Job done in %1s sec.','backwpup'),$jobs[$jobid]['lastruntime']));
|
| 59 |
//Write backupfile und worktime to log
|
| 60 |
$wpdb->update( $wpdb->backwpup_logs, array( 'worktime' => $jobs[$jobid]['lastruntime'], 'backupfile' => mysql_real_escape_string($backupfile)), array( 'logtime' => $logtime ));
|
| 61 |
?>
|
app/dojob/db.php
CHANGED
|
@@ -16,21 +16,21 @@ function backwpup_dump_table($table,$status,$file) {
|
|
| 16 |
fwrite($file, "--\n\n");
|
| 17 |
fwrite($file, "DROP TABLE IF EXISTS `" . $table . "`;\n");
|
| 18 |
fwrite($file, "/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
| 19 |
-
fwrite($file, "/*!40101 SET character_set_client =
|
| 20 |
//Dump the table structure
|
| 21 |
$result=mysql_query("SHOW CREATE TABLE `".$table."`");
|
| 22 |
if ($sqlerr=mysql_error($wpdb->dbh)) {
|
| 23 |
-
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr,
|
| 24 |
return false;
|
| 25 |
}
|
| 26 |
$tablestruc=mysql_fetch_assoc($result);
|
| 27 |
-
fwrite($file, $tablestruc['Create Table']."
|
| 28 |
fwrite($file, "/*!40101 SET character_set_client = @saved_cs_client */;\n");
|
| 29 |
|
| 30 |
//take data of table
|
| 31 |
$result=mysql_query("SELECT * FROM `".$table."`");
|
| 32 |
if ($sqlerr=mysql_error($wpdb->dbh)) {
|
| 33 |
-
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr,
|
| 34 |
return false;
|
| 35 |
}
|
| 36 |
|
|
@@ -72,12 +72,13 @@ if (is_array($jobs[$jobid]['dbexclude'])) {
|
|
| 72 |
if (in_array($tablevalue,$jobs[$jobid]['dbexclude']))
|
| 73 |
unset($tables[$tablekey]);
|
| 74 |
}
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
if (sizeof($tables)>0) {
|
| 78 |
$result=$wpdb->get_results("SHOW TABLE STATUS FROM `".DB_NAME."`;", ARRAY_A); //get table status
|
| 79 |
if ($sqlerr=mysql_error($wpdb->dbh))
|
| 80 |
-
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr,
|
| 81 |
foreach($result as $statusdata) {
|
| 82 |
$status[$statusdata['Name']]=$statusdata;
|
| 83 |
}
|
|
@@ -93,16 +94,17 @@ if (sizeof($tables)>0) {
|
|
| 93 |
else
|
| 94 |
fwrite($file, "-- Blog URL: ".trailingslashit(get_option('siteurl'))."\n");
|
| 95 |
fwrite($file, "-- Blog ABSPATH: ".trailingslashit(ABSPATH)."\n");
|
|
|
|
| 96 |
fwrite($file, "-- Database Name: ".DB_NAME."\n");
|
| 97 |
fwrite($file, "-- Dump on: ".date('Y-m-d H:i:s')."\n");
|
| 98 |
fwrite($file, "-- ---------------------------------------------------------\n\n");
|
| 99 |
//for better import with mysql client
|
| 100 |
fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n");
|
| 101 |
-
fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS
|
| 102 |
fwrite($file, "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n");
|
| 103 |
-
fwrite($file, "/*!40101 SET NAMES
|
| 104 |
fwrite($file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
|
| 105 |
-
|
| 106 |
fwrite($file, "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
|
| 107 |
fwrite($file, "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n");
|
| 108 |
fwrite($file, "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n");
|
|
@@ -110,7 +112,7 @@ if (sizeof($tables)>0) {
|
|
| 110 |
//make table dumps
|
| 111 |
foreach($tables as $table) {
|
| 112 |
backwpup_joblog($logtime,__('Database table to Backup: ','backwpup').' '.$table);
|
| 113 |
-
backwpup_needfreememory(($status[$table]['Data_length']+$status[$table]['Index_length'])*1.3); //get
|
| 114 |
fwrite($file, backwpup_dump_table($table,$status[$table],$file));
|
| 115 |
}
|
| 116 |
//for better import with mysql client
|
| 16 |
fwrite($file, "--\n\n");
|
| 17 |
fwrite($file, "DROP TABLE IF EXISTS `" . $table . "`;\n");
|
| 18 |
fwrite($file, "/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
| 19 |
+
fwrite($file, "/*!40101 SET character_set_client = '".mysql_client_encoding()."' */;\n");
|
| 20 |
//Dump the table structure
|
| 21 |
$result=mysql_query("SHOW CREATE TABLE `".$table."`");
|
| 22 |
if ($sqlerr=mysql_error($wpdb->dbh)) {
|
| 23 |
+
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "SHOW CREATE TABLE `".$table."`"));
|
| 24 |
return false;
|
| 25 |
}
|
| 26 |
$tablestruc=mysql_fetch_assoc($result);
|
| 27 |
+
fwrite($file, $tablestruc['Create Table'].";\n");
|
| 28 |
fwrite($file, "/*!40101 SET character_set_client = @saved_cs_client */;\n");
|
| 29 |
|
| 30 |
//take data of table
|
| 31 |
$result=mysql_query("SELECT * FROM `".$table."`");
|
| 32 |
if ($sqlerr=mysql_error($wpdb->dbh)) {
|
| 33 |
+
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "SELECT * FROM `".$table."`"));
|
| 34 |
return false;
|
| 35 |
}
|
| 36 |
|
| 72 |
if (in_array($tablevalue,$jobs[$jobid]['dbexclude']))
|
| 73 |
unset($tables[$tablekey]);
|
| 74 |
}
|
| 75 |
+
sort($tables);
|
| 76 |
}
|
| 77 |
|
| 78 |
if (sizeof($tables)>0) {
|
| 79 |
$result=$wpdb->get_results("SHOW TABLE STATUS FROM `".DB_NAME."`;", ARRAY_A); //get table status
|
| 80 |
if ($sqlerr=mysql_error($wpdb->dbh))
|
| 81 |
+
backwpup_joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "SHOW TABLE STATUS FROM `".DB_NAME."`;"));
|
| 82 |
foreach($result as $statusdata) {
|
| 83 |
$status[$statusdata['Name']]=$statusdata;
|
| 84 |
}
|
| 94 |
else
|
| 95 |
fwrite($file, "-- Blog URL: ".trailingslashit(get_option('siteurl'))."\n");
|
| 96 |
fwrite($file, "-- Blog ABSPATH: ".trailingslashit(ABSPATH)."\n");
|
| 97 |
+
fwrite($file, "-- Table Prefix: ".$wpdb->prefix."\n");
|
| 98 |
fwrite($file, "-- Database Name: ".DB_NAME."\n");
|
| 99 |
fwrite($file, "-- Dump on: ".date('Y-m-d H:i:s')."\n");
|
| 100 |
fwrite($file, "-- ---------------------------------------------------------\n\n");
|
| 101 |
//for better import with mysql client
|
| 102 |
fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n");
|
| 103 |
+
fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n");
|
| 104 |
fwrite($file, "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n");
|
| 105 |
+
fwrite($file, "/*!40101 SET NAMES '".mysql_client_encoding()."' */;\n");
|
| 106 |
fwrite($file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
|
| 107 |
+
fwrite($file, "/*!40103 SET TIME_ZONE='".mysql_result(mysql_query("SELECT @@time_zone"),0)."' */;\n");
|
| 108 |
fwrite($file, "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
|
| 109 |
fwrite($file, "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n");
|
| 110 |
fwrite($file, "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n");
|
| 112 |
//make table dumps
|
| 113 |
foreach($tables as $table) {
|
| 114 |
backwpup_joblog($logtime,__('Database table to Backup: ','backwpup').' '.$table);
|
| 115 |
+
backwpup_needfreememory(($status[$table]['Data_length']+$status[$table]['Index_length'])*1.3); //get more memory if needed
|
| 116 |
fwrite($file, backwpup_dump_table($table,$status[$table],$file));
|
| 117 |
}
|
| 118 |
//for better import with mysql client
|
app/dojob/destination-ftp.php
CHANGED
|
@@ -40,14 +40,14 @@ if (!empty($jobs[$jobid]['ftphost']) and !empty($jobs[$jobid]['ftpuser']) and !e
|
|
| 40 |
list($ftphost,$ftpport)=split(':',$jobs[$jobid]['ftphost'],2);
|
| 41 |
|
| 42 |
if (function_exists('ftp_ssl_connect')) { //make SSL FTP connection
|
| 43 |
-
$ftp_conn_id = ftp_ssl_connect($ftphost,$ftpport);
|
| 44 |
if ($ftp_conn_id) {
|
| 45 |
backwpup_joblog($logtime,__('Connected by SSL to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
|
| 46 |
$type = ftp_systype($ftp_conn_id);
|
| 47 |
}
|
| 48 |
}
|
| 49 |
if (!$type) { //make normal FTP conection if SSL not work
|
| 50 |
-
$ftp_conn_id = ftp_connect($ftphost,$ftpport);
|
| 51 |
if ($ftp_conn_id) {
|
| 52 |
backwpup_joblog($logtime,__('Connected insecure to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
|
| 53 |
$type = ftp_systype($ftp_conn_id);
|
| 40 |
list($ftphost,$ftpport)=split(':',$jobs[$jobid]['ftphost'],2);
|
| 41 |
|
| 42 |
if (function_exists('ftp_ssl_connect')) { //make SSL FTP connection
|
| 43 |
+
$ftp_conn_id = ftp_ssl_connect($ftphost,$ftpport,10);
|
| 44 |
if ($ftp_conn_id) {
|
| 45 |
backwpup_joblog($logtime,__('Connected by SSL to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
|
| 46 |
$type = ftp_systype($ftp_conn_id);
|
| 47 |
}
|
| 48 |
}
|
| 49 |
if (!$type) { //make normal FTP conection if SSL not work
|
| 50 |
+
$ftp_conn_id = ftp_connect($ftphost,$ftpport,10);
|
| 51 |
if ($ftp_conn_id) {
|
| 52 |
backwpup_joblog($logtime,__('Connected insecure to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
|
| 53 |
$type = ftp_systype($ftp_conn_id);
|
app/functions.php
CHANGED
|
@@ -156,7 +156,7 @@ if ( !defined('ABSPATH') )
|
|
| 156 |
if ($file == BACKWPUP_PLUGIN_DIR.'/backwpup.php') {
|
| 157 |
$links[] = '<a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
|
| 158 |
$links[] = '<a href="http://wordpress.org/tags/backwpup/" target="_blank">' . __('Support') . '</a>';
|
| 159 |
-
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
|
| 160 |
}
|
| 161 |
return $links;
|
| 162 |
}
|
| 156 |
if ($file == BACKWPUP_PLUGIN_DIR.'/backwpup.php') {
|
| 157 |
$links[] = '<a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
|
| 158 |
$links[] = '<a href="http://wordpress.org/tags/backwpup/" target="_blank">' . __('Support') . '</a>';
|
| 159 |
+
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
|
| 160 |
}
|
| 161 |
return $links;
|
| 162 |
}
|
app/options-edit.php
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="wrap">
|
| 2 |
+
<div id="icon-tools" class="icon32"><br /></div>
|
| 3 |
+
<h2><?php _e('Edit BackWPup Job', 'backwpup'); ?></h2>
|
| 4 |
+
|
| 5 |
+
<form method="post" action="">
|
| 6 |
+
<input type="hidden" name="action" value="saveeditjob" />
|
| 7 |
+
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
| 8 |
+
<?php
|
| 9 |
+
wp_nonce_field('edit-job');
|
| 10 |
+
if (empty($jobs[$jobid]['type']))
|
| 11 |
+
$jobs[$jobid]['type']='DB+FILE';
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
if ($jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {
|
| 15 |
+
echo '<input type="hidden" name="backupdir" value="'.$jobs[$jobid]['backupdir'].'" />';
|
| 16 |
+
echo '<input type="hidden" name="maxbackups" value="'.$jobs[$jobid]['maxbackups'].'" />';
|
| 17 |
+
}
|
| 18 |
+
if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {
|
| 19 |
+
echo '<input type="hidden" name="fileexclude" value="'.$jobs[$jobid]['fileexclude'].'" />';
|
| 20 |
+
}
|
| 21 |
+
if ($jobs[$jobid]['type']=='FILE') {
|
| 22 |
+
if (is_array($jobs[$jobid]['dbexclude'])) {
|
| 23 |
+
foreach ($jobs[$jobid]['dbexclude'] as $table) {
|
| 24 |
+
echo '<input type="hidden" name="dbexclude[]" value="'.$table.'" />';
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
?>
|
| 31 |
+
|
| 32 |
+
<table class="form-table">
|
| 33 |
+
|
| 34 |
+
<tr valign="top">
|
| 35 |
+
<th scope="row"><label for="job_type"><?PHP _e('Job Type','backwpup'); ?></label></th>
|
| 36 |
+
<td>
|
| 37 |
+
<select name="type" id="job_type">
|
| 38 |
+
<?php
|
| 39 |
+
foreach (backwpup_backup_types() as $type) {
|
| 40 |
+
echo '<option value="'.$type.'"'.selected($type,$jobs[$jobid]['type'],false).'>'.backwpup_backup_types($type).'</option>';
|
| 41 |
+
}
|
| 42 |
+
?>
|
| 43 |
+
</select>
|
| 44 |
+
<input type="submit" name="change" class="button" value="<?php _e('Change', 'backwpup'); ?>" />
|
| 45 |
+
</td>
|
| 46 |
+
</tr>
|
| 47 |
+
|
| 48 |
+
<tr valign="top">
|
| 49 |
+
<th scope="row"><label for="jobname"><?PHP _e('Job Name','backwpup'); ?></label></th>
|
| 50 |
+
<td><input name="name" type="text" id="jobname" value="<?PHP echo $jobs[$jobid]['name'];?>" class="regular-text" /></td>
|
| 51 |
+
</tr>
|
| 52 |
+
|
| 53 |
+
<?PHP if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {?>
|
| 54 |
+
<tr valign="top">
|
| 55 |
+
<th scope="row"><label for="dbexclude"><?PHP _e('Exclude Databas Tabels:','backwpup'); ?></label></th><td>
|
| 56 |
+
<?php
|
| 57 |
+
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
| 58 |
+
if (!isset($jobs[$jobid]['dbexclude'])) { //def.
|
| 59 |
+
foreach ($tables as $table) {
|
| 60 |
+
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
| 61 |
+
$jobs[$jobid]['dbexclude'][]=$table;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
foreach ($tables as $table) {
|
| 65 |
+
if ($wpdb->backwpup_logs<>$table)
|
| 66 |
+
echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/> '.$table.'<br />';
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
?>
|
| 70 |
+
</td></tr>
|
| 71 |
+
<?PHP } ?>
|
| 72 |
+
<?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB+FILE') {?>
|
| 73 |
+
<?PHP if (!isset($jobs[$jobid]['backuproot'])) $jobs[$jobid]['backuproot']=true; if (!isset($jobs[$jobid]['backupcontent'])) $jobs[$jobid]['backupcontent']=true; if (!isset($jobs[$jobid]['backupplugins'])) $jobs[$jobid]['backupplugins']=true;?>
|
| 74 |
+
<tr valign="top">
|
| 75 |
+
<th scope="row"><label for="fileinclude"><?PHP _e('Backup Blog directorys','backwpup'); ?></label></th><td>
|
| 76 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backuproot'],true,true);?> name="backuproot" value="1"/> <?php _e('Blog root and WP Files','backwpup');?><br />
|
| 77 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupcontent'],true,true);?> name="backupcontent" value="1"/> <?php _e('Blog Content','backwpup');?><br />
|
| 78 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupplugins'],true,true);?> name="backupplugins" value="1"/> <?php _e('Blog Plugins','backwpup');?>
|
| 79 |
+
</td></tr>
|
| 80 |
+
|
| 81 |
+
<tr valign="top">
|
| 82 |
+
<th scope="row"><label for="dirinclude"><?PHP _e('Include directorys','backwpup'); ?></label></th><td>
|
| 83 |
+
<input name="dirinclude" type="text" value="<?PHP echo $jobs[$jobid]['dirinclude'];?>" class="regular-text" /><span class="description"><?PHP echo __('Separate with ,. Full Path like:','backwpup').' '.str_replace('\\','/',ABSPATH); ?></span>
|
| 84 |
+
</td></tr>
|
| 85 |
+
|
| 86 |
+
<tr valign="top">
|
| 87 |
+
<th scope="row"><label for="fileexclude"><?PHP _e('Exclude files/directorys','backwpup'); ?></label></th><td>
|
| 88 |
+
<input name="fileexclude" type="text" value="<?PHP echo $jobs[$jobid]['fileexclude'];?>" class="regular-text" /><span class="description"><?PHP _e('Separate with ,','backwpup') ?></span>
|
| 89 |
+
</td></tr>
|
| 90 |
+
<?PHP } ?>
|
| 91 |
+
|
| 92 |
+
<tr valign="top">
|
| 93 |
+
<th scope="row"><label for="jobname"><?PHP _e('Schedule','backwpup'); ?></label></th>
|
| 94 |
+
<td>
|
| 95 |
+
<?php
|
| 96 |
+
_e('Run Every:', 'backwpup');
|
| 97 |
+
echo '<select name="scheduleintervalteimes">';
|
| 98 |
+
for ($i=1;$i<=60;$i++) {
|
| 99 |
+
echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['scheduleintervalteimes'],false).'>'.$i.'</option>';
|
| 100 |
+
}
|
| 101 |
+
echo '</select>';
|
| 102 |
+
if (empty($jobs[$jobid]['scheduleintervaltype']))
|
| 103 |
+
$jobs[$jobid]['scheduleintervaltype']=3600;
|
| 104 |
+
echo '<select name="scheduleintervaltype">';
|
| 105 |
+
echo '<option value="60"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Min(s)','backwpup').'</option>';
|
| 106 |
+
echo '<option value="3600"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Houer(s)','backwpup').'</option>';
|
| 107 |
+
echo '<option value="86400"'.selected('86400',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Day(s)','backwpup').'</option>';
|
| 108 |
+
echo '</select><br />';
|
| 109 |
+
|
| 110 |
+
_e('Start Time:', 'backwpup');
|
| 111 |
+
if (empty($jobs[$jobid]['scheduletime']))
|
| 112 |
+
$jobs[$jobid]['scheduletime']=time();
|
| 113 |
+
|
| 114 |
+
echo '<select name="schedulehour">';
|
| 115 |
+
for ($i=0;$i<=23;$i++) {
|
| 116 |
+
echo '<option value="'.$i.'"'.selected($i,date('G',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
| 117 |
+
}
|
| 118 |
+
echo '</select>:';
|
| 119 |
+
echo '<select name="scheduleminute">';
|
| 120 |
+
for ($i=0;$i<=59;$i++) {
|
| 121 |
+
echo '<option value="'.$i.'"'.selected($i,date('i',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
| 122 |
+
}
|
| 123 |
+
echo '</select><br />';
|
| 124 |
+
_e('Start Date:', 'backwpup');
|
| 125 |
+
echo '<select name="scheduleday">';
|
| 126 |
+
for ($i=1;$i<=31;$i++) {
|
| 127 |
+
echo '<option value="'.$i.'"'.selected($i,date('j',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
| 128 |
+
}
|
| 129 |
+
echo '</select>.';
|
| 130 |
+
$month=array('1'=>__('January'),'2'=>__('February'),'3'=>__('March'),'4'=>__('April'),'5'=>__('May'),'6'=>__('June'),'7'=>__('July'),'8'=>__('August'),'9'=>__('September'),'10'=>__('October'),'11'=>__('November'),'12'=>__('December'));
|
| 131 |
+
echo '<select name="schedulemonth">';
|
| 132 |
+
for ($i=1;$i<=12;$i++) {
|
| 133 |
+
echo '<option value="'.$i.'"'.selected($i,date('n',$jobs[$jobid]['scheduletime']),false).'>'.$month[$i].'</option>';
|
| 134 |
+
}
|
| 135 |
+
echo '</select>.';
|
| 136 |
+
echo '<select name="scheduleyear">';
|
| 137 |
+
for ($i=date('Y')-1;$i<=date('Y')+3;$i++) {
|
| 138 |
+
echo '<option value="'.$i.'"'.selected($i,date('Y',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
| 139 |
+
}
|
| 140 |
+
echo '</select><br />';
|
| 141 |
+
?>
|
| 142 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['activated'],true); ?> name="activated" /> <?PHP _e('Activate scheduleing', 'backwpup'); ?>
|
| 143 |
+
</td>
|
| 144 |
+
</tr>
|
| 145 |
+
|
| 146 |
+
<?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE') {?>
|
| 147 |
+
<tr valign="top">
|
| 148 |
+
<?PHP if (empty($jobs[$jobid]['backupdir'])) $jobs[$jobid]['backupdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup/';?>
|
| 149 |
+
<th scope="row"><label for="backupdir"><?PHP _e('Save Backups to directory','backwpup'); ?></label></th>
|
| 150 |
+
<td><input name="backupdir" type="text" value="<?PHP echo $jobs[$jobid]['backupdir'];?>" class="regular-text" /><span class="description"><?PHP _e('Full Phath of Directory for Backup fiels','backwpup'); ?></span></td>
|
| 151 |
+
</tr>
|
| 152 |
+
<tr valign="top">
|
| 153 |
+
<th scope="row"><label for="maxbackups"><?PHP _e('Max. number of Backup Files','backwpup'); ?></label></th>
|
| 154 |
+
<td>
|
| 155 |
+
<input name="maxbackups" type="text" value="<?PHP echo $jobs[$jobid]['maxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('0=off','backwpup');?> <?PHP _e('Oldest files will deletet first.','backwpup');?></span>
|
| 156 |
+
</td>
|
| 157 |
+
</tr>
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
<tr valign="top">
|
| 161 |
+
<th scope="row"><label for="ftptransfer"><?PHP _e('Copy Backup to FTP Server','backwpup'); ?></label></th>
|
| 162 |
+
<td>
|
| 163 |
+
<?PHP _e('Ftp Hostname:','backwpup'); ?><input name="ftphost" type="text" value="<?PHP echo $jobs[$jobid]['ftphost'];?>" class="regular-text" /><br />
|
| 164 |
+
<?PHP _e('Ftp Username:','backwpup'); ?><input name="ftpuser" type="text" value="<?PHP echo $jobs[$jobid]['ftpuser'];?>" class="user" /><br />
|
| 165 |
+
<?PHP _e('Ftp Password:','backwpup'); ?><input name="ftppass" type="password" value="<?PHP echo base64_decode($jobs[$jobid]['ftppass']);?>" class="password" /><br />
|
| 166 |
+
<?PHP _e('Ftp directory:','backwpup'); ?><input name="ftpdir" type="text" value="<?PHP echo $jobs[$jobid]['ftpdir'];?>" class="regular-text" /><br />
|
| 167 |
+
<?PHP _e('Max Backup fieles on ftp:','backwpup'); ?><input name="ftpmaxbackups" type="text" value="<?PHP echo $jobs[$jobid]['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('0=off','backwpup');?></span><br />
|
| 168 |
+
</td>
|
| 169 |
+
</tr>
|
| 170 |
+
|
| 171 |
+
<?PHP } ?>
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
<tr valign="top">
|
| 175 |
+
<th scope="row"><label for="mailaddress"><?PHP _e('Send Mail to','backwpup'); ?></label></th>
|
| 176 |
+
<td><input name="mailaddress" type="text" value="<?PHP echo $jobs[$jobid]['mailaddress'];?>" class="regular-text" /><br />
|
| 177 |
+
<?PHP
|
| 178 |
+
if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE') {
|
| 179 |
+
echo __('Max Filesize for Backups via mail:','backwpup').'<input name="mailefilesize" type="text" value="'.$jobs[$jobid]['mailefilesize'].'" class="small-text" />MB <span class="description">'.__('0=send log only.','backwpup').'</span><br />';
|
| 180 |
+
}
|
| 181 |
+
?>
|
| 182 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['mailerroronly'],true); ?> name="mailerroronly" /> <?PHP _e('Send only mail on errors.','backwpup'); ?>
|
| 183 |
+
</td>
|
| 184 |
+
</tr>
|
| 185 |
+
|
| 186 |
+
</table>
|
| 187 |
+
<p class="submit">
|
| 188 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
| 189 |
+
</p>
|
| 190 |
+
</form>
|
app/options-save.php
CHANGED
|
@@ -122,7 +122,13 @@ case 'saveeditjob': //Save Job settings
|
|
| 122 |
$jobid=1;
|
| 123 |
}
|
| 124 |
}
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
$jobs[$jobid]['type']= $_POST['type'];
|
| 127 |
$jobs[$jobid]['name']= esc_html($_POST['name']);
|
| 128 |
$jobs[$jobid]['activated']= $_POST['activated']==1 ? true : false;
|
|
@@ -130,34 +136,33 @@ case 'saveeditjob': //Save Job settings
|
|
| 130 |
$jobs[$jobid]['scheduleintervaltype']=$_POST['scheduleintervaltype'];
|
| 131 |
$jobs[$jobid]['scheduleintervalteimes']=$_POST['scheduleintervalteimes'];
|
| 132 |
$jobs[$jobid]['scheduleinterval']=$_POST['scheduleintervaltype']*$_POST['scheduleintervalteimes'];
|
| 133 |
-
if (isset($_POST['backupdir']))
|
| 134 |
-
$jobs[$jobid]['backupdir']= untrailingslashit(str_replace('\\','/',stripslashes($_POST['backupdir'])));
|
| 135 |
-
if (isset($_POST['maxbackups']))
|
| 136 |
-
$jobs[$jobid]['maxbackups']=abs((int)$_POST['maxbackups']);
|
| 137 |
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
$
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 144 |
$jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
|
| 145 |
-
if (isset($_POST['dirinclude']))
|
| 146 |
$jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
$jobs[$jobid]['ftphost']=$_POST['ftphost'];
|
| 152 |
-
if (isset($_POST['ftpuser']))
|
| 153 |
$jobs[$jobid]['ftpuser']=$_POST['ftpuser'];
|
| 154 |
-
if (isset($_POST['ftppass']))
|
| 155 |
$jobs[$jobid]['ftppass']=base64_encode($_POST['ftppass']);
|
| 156 |
-
if (isset($_POST['ftpdir']))
|
| 157 |
$jobs[$jobid]['ftpdir']=str_replace('\\','/',stripslashes($_POST['ftpdir']));
|
| 158 |
-
if (isset($_POST['ftpmaxbackups']))
|
| 159 |
$jobs[$jobid]['ftpmaxbackups']=abs((int)$_POST['ftpmaxbackups']);
|
| 160 |
-
|
|
|
|
| 161 |
if (update_option('backwpup_jobs',$jobs))
|
| 162 |
$backwpup_message=str_replace('%1',$jobid,__('Job %1 settings saved', 'backwpup'));
|
| 163 |
|
| 122 |
$jobid=1;
|
| 123 |
}
|
| 124 |
}
|
| 125 |
+
|
| 126 |
+
if ($jobs[$jobid]['type']!=$_POST['type']) // set type to save
|
| 127 |
+
$savetype=$jobs[$jobid]['type'];
|
| 128 |
+
else
|
| 129 |
+
$savetype=$_POST['type'];
|
| 130 |
+
|
| 131 |
+
//All types
|
| 132 |
$jobs[$jobid]['type']= $_POST['type'];
|
| 133 |
$jobs[$jobid]['name']= esc_html($_POST['name']);
|
| 134 |
$jobs[$jobid]['activated']= $_POST['activated']==1 ? true : false;
|
| 136 |
$jobs[$jobid]['scheduleintervaltype']=$_POST['scheduleintervaltype'];
|
| 137 |
$jobs[$jobid]['scheduleintervalteimes']=$_POST['scheduleintervalteimes'];
|
| 138 |
$jobs[$jobid]['scheduleinterval']=$_POST['scheduleintervaltype']*$_POST['scheduleintervalteimes'];
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
| 140 |
+
$jobs[$jobid]['mailerroronly']= $_POST['mailerroronly']==1 ? true : false;
|
| 141 |
+
|
| 142 |
+
if ($savetype=='DB' or $savetype=='DB+FILE' or $savetype=='OPTIMIZE' or $savetype=='CHECK') {
|
| 143 |
+
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
| 144 |
+
}
|
| 145 |
+
if ($savetype=='DB' or $savetype=='DB+FILE') {
|
| 146 |
+
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
| 147 |
+
}
|
| 148 |
+
if ($savetype=='FILE' or $savetype=='DB+FILE') {
|
| 149 |
$jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
|
|
|
|
| 150 |
$jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
|
| 151 |
+
$jobs[$jobid]['backuproot']= $_POST['backuproot']==1 ? true : false;
|
| 152 |
+
$jobs[$jobid]['backupcontent']= $_POST['backupcontent']==1 ? true : false;
|
| 153 |
+
$jobs[$jobid]['backupplugins']= $_POST['backupplugins']==1 ? true : false;
|
| 154 |
+
}
|
| 155 |
+
if ($savetype=='DB' or $savetype=='DB+FILE' or $savetype=='FILE') {
|
| 156 |
+
$jobs[$jobid]['mailefilesize']=(float)$_POST['mailefilesize'];
|
| 157 |
+
$jobs[$jobid]['backupdir']= untrailingslashit(str_replace('\\','/',stripslashes($_POST['backupdir'])));
|
| 158 |
+
$jobs[$jobid]['maxbackups']=abs((int)$_POST['maxbackups']);
|
| 159 |
$jobs[$jobid]['ftphost']=$_POST['ftphost'];
|
|
|
|
| 160 |
$jobs[$jobid]['ftpuser']=$_POST['ftpuser'];
|
|
|
|
| 161 |
$jobs[$jobid]['ftppass']=base64_encode($_POST['ftppass']);
|
|
|
|
| 162 |
$jobs[$jobid]['ftpdir']=str_replace('\\','/',stripslashes($_POST['ftpdir']));
|
|
|
|
| 163 |
$jobs[$jobid]['ftpmaxbackups']=abs((int)$_POST['ftpmaxbackups']);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
if (update_option('backwpup_jobs',$jobs))
|
| 167 |
$backwpup_message=str_replace('%1',$jobid,__('Job %1 settings saved', 'backwpup'));
|
| 168 |
|
app/options-tools.php
CHANGED
|
@@ -17,11 +17,39 @@ if ( !defined('ABSPATH') )
|
|
| 17 |
<input type="hidden" name="action" value="tools" />
|
| 18 |
<input type="hidden" name="page" value="BackWPup" />
|
| 19 |
<?php wp_nonce_field('backwpup-tools'); ?>
|
| 20 |
-
|
| 21 |
<table class="form-table">
|
| 22 |
-
<tr
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
</table>
|
| 26 |
</form>
|
| 27 |
</div>
|
| 17 |
<input type="hidden" name="action" value="tools" />
|
| 18 |
<input type="hidden" name="page" value="BackWPup" />
|
| 19 |
<?php wp_nonce_field('backwpup-tools'); ?>
|
|
|
|
| 20 |
<table class="form-table">
|
| 21 |
+
<tr valign="top">
|
| 22 |
+
<th scope="row"><label for="sqlfile"><?PHP _e('Database restore','backwpup'); ?></label></th>
|
| 23 |
+
<td>
|
| 24 |
+
|
| 25 |
+
<?PHP
|
| 26 |
+
if ($_POST['dbrestore']==__('Restore', 'backwpup') and is_file($_POST['sqlfile'])) {
|
| 27 |
+
$sqlfile=$_POST['sqlfile'];
|
| 28 |
+
require('tools/db_restore.php');
|
| 29 |
+
} else {
|
| 30 |
+
if ( $dir = @opendir(ABSPATH)) {
|
| 31 |
+
$sqlfile="";
|
| 32 |
+
while (($file = readdir( $dir ) ) !== false ) {
|
| 33 |
+
if (strtolower(substr($file,-4))==".sql") {
|
| 34 |
+
$sqlfile=$file;
|
| 35 |
+
break;
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
@closedir( $dir );
|
| 39 |
+
}
|
| 40 |
+
if (!empty($sqlfile)) {
|
| 41 |
+
echo __('SQL File to restore:','backwpup').' '.trailingslashit(ABSPATH).$sqlfile."<br />";
|
| 42 |
+
?>
|
| 43 |
+
<input type="hidden" name="sqlfile" id="sqlfile" value="<?PHP echo trailingslashit(ABSPATH).$sqlfile;?>" class="regular-text" />
|
| 44 |
+
<input type="submit" name="dbrestore" class="button" value="<?php _e('Restore', 'backwpup'); ?>" />
|
| 45 |
+
<?PHP
|
| 46 |
+
} else {
|
| 47 |
+
echo __('Copy SQL file to restore in the Blog root dir to use restore.', 'backwpup')."<br />";
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
?>
|
| 51 |
+
</td>
|
| 52 |
+
</tr>
|
| 53 |
</table>
|
| 54 |
</form>
|
| 55 |
</div>
|
app/tools/db_restore.php
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?PHP
|
| 2 |
+
// don't load directly
|
| 3 |
+
if ( !defined('ABSPATH') )
|
| 4 |
+
die('-1');
|
| 5 |
+
|
| 6 |
+
ignore_user_abort(true);
|
| 7 |
+
|
| 8 |
+
if (empty($cfg['maxexecutiontime']))
|
| 9 |
+
$cfg['maxexecutiontime']=300;
|
| 10 |
+
set_time_limit($cfg['maxexecutiontime']); //300 is most webserver time limit.
|
| 11 |
+
|
| 12 |
+
//Vars
|
| 13 |
+
$oldblogabspath="";
|
| 14 |
+
$oldblogurl="";
|
| 15 |
+
$oldtabelprefix="";
|
| 16 |
+
$numcommands="";
|
| 17 |
+
$blogurl=trailingslashit(get_option('siteurl'));
|
| 18 |
+
$blogabspath=trailingslashit(ABSPATH);
|
| 19 |
+
|
| 20 |
+
$file = fopen ($sqlfile, "r");
|
| 21 |
+
while (!feof($file)){
|
| 22 |
+
$line = trim(fgets($file));
|
| 23 |
+
|
| 24 |
+
if (substr($line,0,12)=="-- Blog URL:")
|
| 25 |
+
$oldblogurl=trim(substr($line,13));
|
| 26 |
+
if (substr($line,0,16)=="-- Blog ABSPATH:")
|
| 27 |
+
$oldblogabspath=trim(substr($line,17));
|
| 28 |
+
if (substr($line,0,16)=="-- Table Prefix:") {
|
| 29 |
+
$oldtabelprefix=trim(substr($line,17));
|
| 30 |
+
if ($oldtabelprefix!=$wpdb->prefix and !empty($oldtabelprefix)) {
|
| 31 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('Pleace set <i>$table_prefix = \'%1$s\';</i> in wp-config.php','backwpup'), $oldtabelprefix)."<br />\n";
|
| 32 |
+
break;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
if (substr($line,0,2)=="--" or empty($line))
|
| 36 |
+
continue;
|
| 37 |
+
|
| 38 |
+
$line=str_replace("/*!40000","", $line);
|
| 39 |
+
$line=str_replace("/*!40101","", $line);
|
| 40 |
+
$line=str_replace("/*!40103","", $line);
|
| 41 |
+
$line=str_replace("/*!40014","", $line);
|
| 42 |
+
$line=str_replace("/*!40111","", $line);
|
| 43 |
+
$line=str_replace("*/;",";", trim($line));
|
| 44 |
+
|
| 45 |
+
if (substr($line,0,9)=="SET NAMES") {
|
| 46 |
+
$chrset=trim(str_replace("'","",substr($line,10,-1)));
|
| 47 |
+
if (function_exists("mysql_set_charset"))
|
| 48 |
+
mysql_set_charset($chrset);
|
| 49 |
+
if ((defined('DB_CHARSET') and $chrset!=DB_CHARSET) or ($chrset!=mysql_client_encoding())) {
|
| 50 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('Pleace set <i>define(\'DB_CHARSET\', \'%1$s\');</i> in wp-config.php','backwpup'), $chrset)."<br />\n";
|
| 51 |
+
break;
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
$command="";
|
| 56 |
+
if (";"==substr($line,-1)) {
|
| 57 |
+
$command=$rest.$line;
|
| 58 |
+
$rest="";
|
| 59 |
+
} else {
|
| 60 |
+
$rest.=$line;
|
| 61 |
+
}
|
| 62 |
+
if (!empty($command)) {
|
| 63 |
+
$result=mysql_query($command);
|
| 64 |
+
if ($sqlerr=mysql_error($wpdb->dbh)) {
|
| 65 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $command)."<br />\n";
|
| 66 |
+
}
|
| 67 |
+
$numcommands++;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
fclose($file);
|
| 71 |
+
echo sprintf(__('%1$s Database Querys done.','backwpup'),$numcommands).'<br />';
|
| 72 |
+
echo __('Make changes for Blogurl and ABSPATH if needed.','backwpup')."<br />";
|
| 73 |
+
if (!empty($oldblogurl) and $oldblogurl!=$blogurl) {
|
| 74 |
+
mysql_query("UPDATE wp_options SET option_value = replace(option_value, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');");
|
| 75 |
+
mysql_query("UPDATE wp_posts SET guid = replace(guid, '".untrailingslashit($oldblogurl)."','".untrailingslashit($blogurl)."');");
|
| 76 |
+
mysql_query("UPDATE wp_posts SET post_content = replace(post_content, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');");
|
| 77 |
+
}
|
| 78 |
+
if (!empty($oldblogabspath) and $oldblogabspath!=$blogabspath) {
|
| 79 |
+
mysql_query("UPDATE wp_options SET option_value = replace(option_value, '".untrailingslashit($oldblogabspath)."', '".untrailingslashit($blogabspath)."');");
|
| 80 |
+
}
|
| 81 |
+
echo __('Restore Done. Please delete the SQL file after Restore.','backwpup')."<br />";
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
?>
|
backwpup.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: BackWPup
|
|
| 4 |
Plugin URI: http://danielhuesken.de/portfolio/backwpup/
|
| 5 |
Description: Backup and more of your WordPress Blog Database and Files.
|
| 6 |
Author: Daniel Hüsken
|
| 7 |
-
Version: 0.
|
| 8 |
Author URI: http://danielhuesken.de
|
| 9 |
Text Domain: backwpup
|
| 10 |
Domain Path: /lang/
|
|
@@ -35,7 +35,7 @@ if ( !defined('ABSPATH') )
|
|
| 35 |
//Set plugin dirname
|
| 36 |
define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
|
| 37 |
//Set Plugin Version
|
| 38 |
-
define('BACKWPUP_VERSION', '0.
|
| 39 |
//BackWPup Log Table Name
|
| 40 |
global $wpdb;
|
| 41 |
$wpdb->backwpup_logs = $wpdb->prefix.'backwpup_logs';
|
| 4 |
Plugin URI: http://danielhuesken.de/portfolio/backwpup/
|
| 5 |
Description: Backup and more of your WordPress Blog Database and Files.
|
| 6 |
Author: Daniel Hüsken
|
| 7 |
+
Version: 0.7.0
|
| 8 |
Author URI: http://danielhuesken.de
|
| 9 |
Text Domain: backwpup
|
| 10 |
Domain Path: /lang/
|
| 35 |
//Set plugin dirname
|
| 36 |
define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
|
| 37 |
//Set Plugin Version
|
| 38 |
+
define('BACKWPUP_VERSION', '0.7.0');
|
| 39 |
//BackWPup Log Table Name
|
| 40 |
global $wpdb;
|
| 41 |
$wpdb->backwpup_logs = $wpdb->prefix.'backwpup_logs';
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: danielhuesken
|
|
| 3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8
|
| 4 |
Tags: backup, admin, file, Database, mysql, cron
|
| 5 |
Requires at least: 2.8
|
| 6 |
-
Tested up to: 2.8.
|
| 7 |
-
Stable tag: 0.
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
|
@@ -38,15 +38,19 @@ I can give no WARRANTY to any backups...
|
|
| 38 |
|
| 39 |
in the root folder of the zip Archive. <i>DBName</i>.sql
|
| 40 |
|
| 41 |
-
= Import with phpMyAdmin =
|
| 42 |
-
|
| 43 |
-
You must import the Database Dump with Charaktercoding:latin1
|
| 44 |
|
| 45 |
== Screenshots ==
|
| 46 |
|
| 47 |
1. Job Page
|
| 48 |
|
| 49 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
= 0.6.5 =
|
| 51 |
* Prevent direct file loading
|
| 52 |
* job working in iframe
|
| 3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8
|
| 4 |
Tags: backup, admin, file, Database, mysql, cron
|
| 5 |
Requires at least: 2.8
|
| 6 |
+
Tested up to: 2.8.4
|
| 7 |
+
Stable tag: 0.7.0
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
| 38 |
|
| 39 |
in the root folder of the zip Archive. <i>DBName</i>.sql
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
== Screenshots ==
|
| 43 |
|
| 44 |
1. Job Page
|
| 45 |
|
| 46 |
== Changelog ==
|
| 47 |
+
= 0.7.0 =
|
| 48 |
+
* set ftp Connection timeout to 10 sec
|
| 49 |
+
* fix bug for DB tables exclude
|
| 50 |
+
* DB Backup in mySQL Client encoding now
|
| 51 |
+
* Fixed missing ; in DB Backup
|
| 52 |
+
* Added tool DB Restore with automatic Blog Url/Path change
|
| 53 |
+
|
| 54 |
= 0.6.5 =
|
| 55 |
* Prevent direct file loading
|
| 56 |
* job working in iframe
|
