Version Description
- change s3 class to hide warnigs
- add option to make MySQL INSERTs shorter (smaler dump file size.)
- add requerments checks
- ajaxed S3 bucket selection in job settings
- add S3 Buckt can made in job settings
Download this release
Release Info
| Developer | danielhuesken |
| Plugin | |
| Version | 1.0.9 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.8 to 1.0.9
- app/backwpup_dojob.php +25 -17
- app/functions.php +33 -8
- app/js/options.js +30 -2
- app/libs/S3.php +1 -1
- app/options-jobs.php +28 -16
- app/options-save.php +17 -0
- app/options-tools.php +1 -22
- backwpup.php +2 -2
- readme.txt +8 -1
app/backwpup_dojob.php
CHANGED
|
@@ -133,18 +133,19 @@ class backwpup_dojob {
|
|
| 133 |
$this->backupfileformat=$this->job['fileformart'];
|
| 134 |
//set Temp Dir
|
| 135 |
$this->tempdir=trailingslashit($this->cfg['dirtemp']);
|
| 136 |
-
if (empty($this->tempdir) or $this->tempdir=='/')
|
| 137 |
-
$
|
| 138 |
-
$this->tempdir=str_replace('\\','/',get_temp_dir().'backwpup-'.$rand.'/');
|
| 139 |
-
}
|
| 140 |
//set Backup Dir
|
| 141 |
$this->backupdir=trailingslashit($this->job['backupdir']);
|
| 142 |
-
if (empty($this->backupdir) or $this->backupdir=='/')
|
| 143 |
$this->backupdir=$this->tempdir;
|
|
|
|
| 144 |
//set Logs Dir
|
| 145 |
$this->logdir=trailingslashit($this->cfg['dirlogs']);
|
| 146 |
-
if (empty($this->logdir) or $this->logdir=='/')
|
| 147 |
-
$
|
|
|
|
|
|
|
| 148 |
//set Backup file name only for jos that makes backups
|
| 149 |
if (in_array('FILE',$this->todo) or in_array('DB',$this->todo) or in_array('WPEXP',$this->todo))
|
| 150 |
$this->backupfile='backwpup_'.$this->jobid.'_'.date_i18n('Y-m-d_H-i-s').$this->backupfileformat;
|
|
@@ -171,10 +172,10 @@ class backwpup_dojob {
|
|
| 171 |
//PHP Error handling
|
| 172 |
set_error_handler("backwpup_joberrorhandler"); //set function for PHP error handling
|
| 173 |
//check dirs
|
| 174 |
-
if (
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
//check max script execution tme
|
| 179 |
if (!ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='off' or ini_get('safe_mode')=='0') {
|
| 180 |
set_time_limit(0); //300 is most webserver time limit. 0= max time
|
|
@@ -417,7 +418,8 @@ class backwpup_dojob {
|
|
| 417 |
$keys = array();
|
| 418 |
$values = array();
|
| 419 |
foreach($data as $key => $value) {
|
| 420 |
-
|
|
|
|
| 421 |
if($value === NULL) // Make Value NULL to string NULL
|
| 422 |
$value = "NULL";
|
| 423 |
elseif($value === "" or $value === false) // if empty or false Value make "" as Value
|
|
@@ -427,7 +429,11 @@ class backwpup_dojob {
|
|
| 427 |
$values[] = $value;
|
| 428 |
}
|
| 429 |
// make data dump
|
| 430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
}
|
| 432 |
if ($status['Engine']=='MyISAM')
|
| 433 |
fwrite($file, "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n");
|
|
@@ -612,8 +618,9 @@ class backwpup_dojob {
|
|
| 612 |
|
| 613 |
if (!empty($this->job['fileexclude']))
|
| 614 |
$backwpup_exclude=explode(',',trim($this->job['fileexclude']));
|
| 615 |
-
//Exclude Temp
|
| 616 |
-
$backwpup_exclude[]=$this->tempdir;
|
|
|
|
| 617 |
//Exclude Backup dirs
|
| 618 |
$jobs=get_option('backwpup_jobs');
|
| 619 |
foreach($jobs as $jobsvale) {
|
|
@@ -1002,10 +1009,11 @@ class backwpup_dojob {
|
|
| 1002 |
return false;
|
| 1003 |
}
|
| 1004 |
|
| 1005 |
-
if (!class_exists('S3'))
|
|
|
|
| 1006 |
|
| 1007 |
$s3 = new S3($this->job['awsAccessKey'], $this->job['awsSecretKey'], $this->job['awsSSL']);
|
| 1008 |
-
|
| 1009 |
if (in_array($this->job['awsBucket'],$s3->listBuckets())) {
|
| 1010 |
trigger_error(__('Connected to S3 Bucket:','backwpup').' '.$this->job['awsBucket'],E_USER_NOTICE);
|
| 1011 |
//Transfer Backup to S3
|
| 133 |
$this->backupfileformat=$this->job['fileformart'];
|
| 134 |
//set Temp Dir
|
| 135 |
$this->tempdir=trailingslashit($this->cfg['dirtemp']);
|
| 136 |
+
if (empty($this->tempdir) or $this->tempdir=='/')
|
| 137 |
+
$this->tempdir=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'uploads/';
|
|
|
|
|
|
|
| 138 |
//set Backup Dir
|
| 139 |
$this->backupdir=trailingslashit($this->job['backupdir']);
|
| 140 |
+
if (empty($this->backupdir) or $this->backupdir=='/') {
|
| 141 |
$this->backupdir=$this->tempdir;
|
| 142 |
+
}
|
| 143 |
//set Logs Dir
|
| 144 |
$this->logdir=trailingslashit($this->cfg['dirlogs']);
|
| 145 |
+
if (empty($this->logdir) or $this->logdir=='/') {
|
| 146 |
+
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 147 |
+
$this->logdir=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'backwpup-'.$rand.'-logs/';
|
| 148 |
+
}
|
| 149 |
//set Backup file name only for jos that makes backups
|
| 150 |
if (in_array('FILE',$this->todo) or in_array('DB',$this->todo) or in_array('WPEXP',$this->todo))
|
| 151 |
$this->backupfile='backwpup_'.$this->jobid.'_'.date_i18n('Y-m-d_H-i-s').$this->backupfileformat;
|
| 172 |
//PHP Error handling
|
| 173 |
set_error_handler("backwpup_joberrorhandler"); //set function for PHP error handling
|
| 174 |
//check dirs
|
| 175 |
+
if ($this->backupdir!=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'uploads/') {
|
| 176 |
+
if (!$this->_check_folders($this->backupdir))
|
| 177 |
+
return false;
|
| 178 |
+
}
|
| 179 |
//check max script execution tme
|
| 180 |
if (!ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='off' or ini_get('safe_mode')=='0') {
|
| 181 |
set_time_limit(0); //300 is most webserver time limit. 0= max time
|
| 418 |
$keys = array();
|
| 419 |
$values = array();
|
| 420 |
foreach($data as $key => $value) {
|
| 421 |
+
if (!$this->job['dbshortinsert'])
|
| 422 |
+
$keys[] = "`".str_replace("�", "��", $key)."`"; // Add key to key list
|
| 423 |
if($value === NULL) // Make Value NULL to string NULL
|
| 424 |
$value = "NULL";
|
| 425 |
elseif($value === "" or $value === false) // if empty or false Value make "" as Value
|
| 429 |
$values[] = $value;
|
| 430 |
}
|
| 431 |
// make data dump
|
| 432 |
+
if ($this->job['dbshortinsert'])
|
| 433 |
+
fwrite($file, "INSERT INTO `".$table."` VALUES ( ".implode(", ",$values)." );\n");
|
| 434 |
+
else
|
| 435 |
+
fwrite($file, "INSERT INTO `".$table."` ( ".implode(", ",$keys)." )\n\tVALUES ( ".implode(", ",$values)." );\n");
|
| 436 |
+
|
| 437 |
}
|
| 438 |
if ($status['Engine']=='MyISAM')
|
| 439 |
fwrite($file, "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n");
|
| 618 |
|
| 619 |
if (!empty($this->job['fileexclude']))
|
| 620 |
$backwpup_exclude=explode(',',trim($this->job['fileexclude']));
|
| 621 |
+
//Exclude Temp Files
|
| 622 |
+
$backwpup_exclude[]=$this->tempdir.DB_NAME.'.sql';
|
| 623 |
+
$backwpup_exclude[]=$this->tempdir.'wordpress.' . date( 'Y-m-d' ) . '.xml';
|
| 624 |
//Exclude Backup dirs
|
| 625 |
$jobs=get_option('backwpup_jobs');
|
| 626 |
foreach($jobs as $jobsvale) {
|
| 1009 |
return false;
|
| 1010 |
}
|
| 1011 |
|
| 1012 |
+
if (!class_exists('S3'))
|
| 1013 |
+
require_once('libs/S3.php');
|
| 1014 |
|
| 1015 |
$s3 = new S3($this->job['awsAccessKey'], $this->job['awsSecretKey'], $this->job['awsSSL']);
|
| 1016 |
+
|
| 1017 |
if (in_array($this->job['awsBucket'],$s3->listBuckets())) {
|
| 1018 |
trigger_error(__('Connected to S3 Bucket:','backwpup').' '.$this->job['awsBucket'],E_USER_NOTICE);
|
| 1019 |
//Transfer Backup to S3
|
app/functions.php
CHANGED
|
@@ -135,11 +135,11 @@ if ( !defined('ABSPATH') )
|
|
| 135 |
if (empty($cfg['maxlogs'])) $cfg['maxlogs']=0;
|
| 136 |
if (empty($cfg['dirtemp'])) {
|
| 137 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 138 |
-
$cfg['dirtemp']=str_replace('\\','/',
|
| 139 |
}
|
| 140 |
if (empty($cfg['dirlogs'])) {
|
| 141 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 142 |
-
$cfg['dirlogs']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup-'.$rand.'
|
| 143 |
}
|
| 144 |
update_option('backwpup',$cfg);
|
| 145 |
}
|
|
@@ -191,13 +191,12 @@ if ( !defined('ABSPATH') )
|
|
| 191 |
//DoJob
|
| 192 |
function backwpup_dojob($args) {
|
| 193 |
global $backwpup_logfile;
|
| 194 |
-
if (is_array($args))
|
| 195 |
extract($args, EXTR_SKIP );
|
| 196 |
-
|
| 197 |
$jobid=$args;
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
require_once(ABSPATH . 'wp-admin/includes/file.php'); //for get_tempdir();
|
| 201 |
require_once('backwpup_dojob.php');
|
| 202 |
$dojob= new backwpup_dojob($jobid);
|
| 203 |
unset($dojob);
|
|
@@ -355,7 +354,31 @@ if ( !defined('ABSPATH') )
|
|
| 355 |
header("Pragma: no-cache");
|
| 356 |
header("Cache-Control: post-check=0, pre-check=0");
|
| 357 |
}
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
// add all action and so on only if plugin loaded.
|
| 361 |
function backwpup_init() {
|
|
@@ -377,6 +400,8 @@ if ( !defined('ABSPATH') )
|
|
| 377 |
//add Dashboard widget
|
| 378 |
if (current_user_can(10))
|
| 379 |
add_action('wp_dashboard_setup', 'backwpup_add_dashboard');
|
|
|
|
|
|
|
| 380 |
}
|
| 381 |
|
| 382 |
?>
|
| 135 |
if (empty($cfg['maxlogs'])) $cfg['maxlogs']=0;
|
| 136 |
if (empty($cfg['dirtemp'])) {
|
| 137 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 138 |
+
$cfg['dirtemp']=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'uploads/';
|
| 139 |
}
|
| 140 |
if (empty($cfg['dirlogs'])) {
|
| 141 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 142 |
+
$cfg['dirlogs']=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'/backwpup-'.$rand.'-logs/';
|
| 143 |
}
|
| 144 |
update_option('backwpup',$cfg);
|
| 145 |
}
|
| 191 |
//DoJob
|
| 192 |
function backwpup_dojob($args) {
|
| 193 |
global $backwpup_logfile;
|
| 194 |
+
if (is_array($args)) //cron gifes no complete array back!!!
|
| 195 |
extract($args, EXTR_SKIP );
|
| 196 |
+
else
|
| 197 |
$jobid=$args;
|
| 198 |
+
if (empty($jobid))
|
| 199 |
+
return false;
|
|
|
|
| 200 |
require_once('backwpup_dojob.php');
|
| 201 |
$dojob= new backwpup_dojob($jobid);
|
| 202 |
unset($dojob);
|
| 354 |
header("Pragma: no-cache");
|
| 355 |
header("Cache-Control: post-check=0, pre-check=0");
|
| 356 |
}
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
function backwpup_get_aws_buckets() {
|
| 360 |
+
require_once('libs/s3.php');
|
| 361 |
+
if (empty($_POST['awsAccessKey'])) {
|
| 362 |
+
echo '<span id="awsBucket" style="color:red;">'.__('Missing Access Key ID!','backwpup').'</span>';
|
| 363 |
+
die();
|
| 364 |
+
}
|
| 365 |
+
if (empty($_POST['awsSecretKey'])) {
|
| 366 |
+
echo '<span id="awsBucket" style="color:red;">'.__('Missing Secret Access Key!','backwpup').'</span>';
|
| 367 |
+
die();
|
| 368 |
+
}
|
| 369 |
+
$s3 = new S3($_POST['awsAccessKey'], $_POST['awsSecretKey'], false);
|
| 370 |
+
$buckets=@$s3->listBuckets();
|
| 371 |
+
if (!is_array($buckets)) {
|
| 372 |
+
echo '<span id="awsBucket" style="color:red;">'.__('No Buckets found! Or wrong Keys!','backwpup').'</span>';
|
| 373 |
+
die();
|
| 374 |
+
}
|
| 375 |
+
echo '<select name="awsBucket" id="awsBucket">';
|
| 376 |
+
foreach ($buckets as $bucket) {
|
| 377 |
+
echo "<option ".selected(strtolower($_POST['selected']),strtolower($bucket),false).">".$bucket."</option>";
|
| 378 |
+
}
|
| 379 |
+
echo '</select>';
|
| 380 |
+
die();
|
| 381 |
+
}
|
| 382 |
|
| 383 |
// add all action and so on only if plugin loaded.
|
| 384 |
function backwpup_init() {
|
| 400 |
//add Dashboard widget
|
| 401 |
if (current_user_can(10))
|
| 402 |
add_action('wp_dashboard_setup', 'backwpup_add_dashboard');
|
| 403 |
+
// add ajax function
|
| 404 |
+
add_action('wp_ajax_backwpup_get_aws_buckets', 'backwpup_get_aws_buckets');
|
| 405 |
}
|
| 406 |
|
| 407 |
?>
|
app/js/options.js
CHANGED
|
@@ -15,10 +15,16 @@ jQuery(document).ready( function($) {
|
|
| 15 |
$('#tomail').hide();
|
| 16 |
}
|
| 17 |
if ( true == $('#jobtype-select-DB').attr('checked') || true == $('#jobtype-select-CHECK').attr('checked') || true == $('#jobtype-select-OPTIMIZE').attr('checked')) {
|
| 18 |
-
$('#
|
| 19 |
} else {
|
| 20 |
-
$('#
|
| 21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
if ( true == $('#jobtype-select-FILE').attr('checked')) {
|
| 23 |
$('#filebackup').show();
|
| 24 |
} else {
|
|
@@ -39,6 +45,28 @@ jQuery(document).ready( function($) {
|
|
| 39 |
}
|
| 40 |
});
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
if ( $('#title').val() == '' )
|
| 43 |
$('#title').siblings('#title-prompt-text').css('visibility', '');
|
| 44 |
$('#title-prompt-text').click(function(){
|
| 15 |
$('#tomail').hide();
|
| 16 |
}
|
| 17 |
if ( true == $('#jobtype-select-DB').attr('checked') || true == $('#jobtype-select-CHECK').attr('checked') || true == $('#jobtype-select-OPTIMIZE').attr('checked')) {
|
| 18 |
+
$('#databasejobs').show();
|
| 19 |
} else {
|
| 20 |
+
$('#databasejobs').hide();
|
| 21 |
}
|
| 22 |
+
if ( true == $('#jobtype-select-DB').attr('checked')) {
|
| 23 |
+
$('#dbshortinsert').show();
|
| 24 |
+
} else {
|
| 25 |
+
$('#dbshortinsert').hide();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
if ( true == $('#jobtype-select-FILE').attr('checked')) {
|
| 29 |
$('#filebackup').show();
|
| 30 |
} else {
|
| 45 |
}
|
| 46 |
});
|
| 47 |
|
| 48 |
+
function awsgetbucket() {
|
| 49 |
+
var awsAccessKey = $('#awsAccessKey').val();
|
| 50 |
+
var awsSecretKey = $('#awsSecretKey').val();
|
| 51 |
+
var awsBucket = $('#awsBucketselected').val();
|
| 52 |
+
var data = {
|
| 53 |
+
action: 'backwpup_get_aws_buckets',
|
| 54 |
+
awsAccessKey: awsAccessKey,
|
| 55 |
+
awsSecretKey: awsSecretKey,
|
| 56 |
+
selected: awsBucket
|
| 57 |
+
};
|
| 58 |
+
$.post(ajaxurl, data, function(response) {
|
| 59 |
+
$('#awsBucket').remove();
|
| 60 |
+
$('#awsBucketselected').after(response);
|
| 61 |
+
});
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
awsgetbucket();
|
| 65 |
+
$('#awsAccessKey').change(function() {awsgetbucket();});
|
| 66 |
+
$('#awsSecretKey').change(function() {awsgetbucket();});
|
| 67 |
+
|
| 68 |
+
$('#reloadbuckets').onClick(awsgetbucket());
|
| 69 |
+
|
| 70 |
if ( $('#title').val() == '' )
|
| 71 |
$('#title').siblings('#title-prompt-text').css('visibility', '');
|
| 72 |
$('#title-prompt-text').click(function(){
|
app/libs/S3.php
CHANGED
|
@@ -1253,7 +1253,7 @@ final class S3Request {
|
|
| 1253 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
|
| 1254 |
curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback'));
|
| 1255 |
curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback'));
|
| 1256 |
-
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
| 1257 |
|
| 1258 |
// Request types
|
| 1259 |
switch ($this->verb) {
|
| 1253 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
|
| 1254 |
curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback'));
|
| 1255 |
curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback'));
|
| 1256 |
+
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
| 1257 |
|
| 1258 |
// Request types
|
| 1259 |
switch ($this->verb) {
|
app/options-jobs.php
CHANGED
|
@@ -110,11 +110,17 @@ $todo=explode('+',$jobs[$jobid]['type']);
|
|
| 110 |
$jobs[$jobid]['fileformart']='.zip';
|
| 111 |
if (function_exists('gzopen') or class_exists('ZipArchive'))
|
| 112 |
echo '<input class="radio" type="radio"'.checked('.zip',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".zip" />'.__('ZIP (.zip)','backwpup').'<br />';
|
|
|
|
|
|
|
| 113 |
echo '<input class="radio" type="radio"'.checked('.tar',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar" />'.__('TAR (.tar)','backwpup').'<br />';
|
| 114 |
if (function_exists('gzopen'))
|
| 115 |
-
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.gz"/>'.__('TAR GZIP (.tar.gz)','backwpup').'<br />';
|
|
|
|
|
|
|
| 116 |
if (function_exists('bzopen'))
|
| 117 |
-
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.bz2"/>'.__('TAR BZIP2 (.tar.bz2)','backwpup').'<br />';
|
|
|
|
|
|
|
| 118 |
?>
|
| 119 |
</div>
|
| 120 |
</div>
|
|
@@ -146,7 +152,7 @@ $todo=explode('+',$jobs[$jobid]['type']);
|
|
| 146 |
</div>
|
| 147 |
</div>
|
| 148 |
|
| 149 |
-
<div id="
|
| 150 |
<h3 class="hndle"><span><?PHP _e('Database Jobs','backwpup'); ?></span></h3>
|
| 151 |
<div class="inside">
|
| 152 |
|
|
@@ -167,7 +173,7 @@ $todo=explode('+',$jobs[$jobid]['type']);
|
|
| 167 |
}
|
| 168 |
?>
|
| 169 |
</div><br />
|
| 170 |
-
|
| 171 |
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['maintenance'],true,true);?> name="maintenance" value="1"/> <?php _e('Set Blog Maintenance Mode on Database Operations','backwpup');?><br />
|
| 172 |
</div>
|
| 173 |
</div>
|
|
@@ -205,7 +211,7 @@ $todo=explode('+',$jobs[$jobid]['type']);
|
|
| 205 |
<?PHP
|
| 206 |
if (empty($jobs[$jobid]['backupdir'])) {
|
| 207 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 208 |
-
$jobs[$jobid]['backupdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup-'.$rand;
|
| 209 |
}
|
| 210 |
if (!is_numeric($jobs[$jobid]['maxbackups']))
|
| 211 |
$jobs[$jobid]['maxbackups']=0;
|
|
@@ -235,17 +241,23 @@ $todo=explode('+',$jobs[$jobid]['type']);
|
|
| 235 |
<div id="toamazon" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
| 236 |
<h3 class="hndle"><span><?PHP _e('Backup to Amazon S3','backwpup'); ?></span></h3>
|
| 237 |
<div class="inside">
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
</div>
|
| 250 |
</div>
|
| 251 |
|
| 110 |
$jobs[$jobid]['fileformart']='.zip';
|
| 111 |
if (function_exists('gzopen') or class_exists('ZipArchive'))
|
| 112 |
echo '<input class="radio" type="radio"'.checked('.zip',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".zip" />'.__('ZIP (.zip)','backwpup').'<br />';
|
| 113 |
+
else
|
| 114 |
+
echo '<input class="radio" type="radio"'.checked('.zip',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".zip" disabled="disabled" />'.__('ZIP (.zip)','backwpup').'<br />';
|
| 115 |
echo '<input class="radio" type="radio"'.checked('.tar',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar" />'.__('TAR (.tar)','backwpup').'<br />';
|
| 116 |
if (function_exists('gzopen'))
|
| 117 |
+
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.gz" />'.__('TAR GZIP (.tar.gz)','backwpup').'<br />';
|
| 118 |
+
else
|
| 119 |
+
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.gz" disabled="disabled" />'.__('TAR GZIP (.tar.gz)','backwpup').'<br />';
|
| 120 |
if (function_exists('bzopen'))
|
| 121 |
+
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.bz2" />'.__('TAR BZIP2 (.tar.bz2)','backwpup').'<br />';
|
| 122 |
+
else
|
| 123 |
+
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.bz2" disabled="disabled" />'.__('TAR BZIP2 (.tar.bz2)','backwpup').'<br />';
|
| 124 |
?>
|
| 125 |
</div>
|
| 126 |
</div>
|
| 152 |
</div>
|
| 153 |
</div>
|
| 154 |
|
| 155 |
+
<div id="databasejobs" class="postbox" <?PHP if (!in_array("CHECK",$todo) and !in_array("DB",$todo) and !in_array("OPTIMIZE",$todo)) echo 'style="display:none;"';?>>
|
| 156 |
<h3 class="hndle"><span><?PHP _e('Database Jobs','backwpup'); ?></span></h3>
|
| 157 |
<div class="inside">
|
| 158 |
|
| 173 |
}
|
| 174 |
?>
|
| 175 |
</div><br />
|
| 176 |
+
<span id="dbshortinsert" <?PHP if (!in_array("DB",$todo)) echo 'style="display:none;"';?>><input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['dbshortinsert'],true,true);?> name="dbshortinsert" value="1"/> <?php _e('Use short INSERTs instat of full (with keys)','backwpup');?><br /></span>
|
| 177 |
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['maintenance'],true,true);?> name="maintenance" value="1"/> <?php _e('Set Blog Maintenance Mode on Database Operations','backwpup');?><br />
|
| 178 |
</div>
|
| 179 |
</div>
|
| 211 |
<?PHP
|
| 212 |
if (empty($jobs[$jobid]['backupdir'])) {
|
| 213 |
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 214 |
+
$jobs[$jobid]['backupdir']=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'/backwpup-'.$rand;
|
| 215 |
}
|
| 216 |
if (!is_numeric($jobs[$jobid]['maxbackups']))
|
| 217 |
$jobs[$jobid]['maxbackups']=0;
|
| 241 |
<div id="toamazon" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
| 242 |
<h3 class="hndle"><span><?PHP _e('Backup to Amazon S3','backwpup'); ?></span></h3>
|
| 243 |
<div class="inside">
|
| 244 |
+
<?PHP if (!(extension_loaded('curl') or @dl(PHP_SHLIB_SUFFIX == 'so' ? 'curl.so' : 'php_curl.dll'))) {
|
| 245 |
+
echo "<b>".__('curl Support required','backwpup')."</b>";
|
| 246 |
+
} else { ?>
|
| 247 |
+
<b><?PHP _e('Access Key ID:','backwpup'); ?></b><br />
|
| 248 |
+
<input id="awsAccessKey" name="awsAccessKey" type="text" value="<?PHP echo $jobs[$jobid]['awsAccessKey'];?>" class="large-text" /><br />
|
| 249 |
+
<b><?PHP _e('Secret Access Key:','backwpup'); ?></b><br />
|
| 250 |
+
<input id="awsSecretKey" name="awsSecretKey" type="text" value="<?PHP echo $jobs[$jobid]['awsSecretKey'];?>" class="large-text" /><br />
|
| 251 |
+
<b><?PHP _e('Bucket:','backwpup'); ?></b><br />
|
| 252 |
+
<input id="awsBucketselected" name="awsBucketselected" type="hidden" value="<?PHP echo $jobs[$jobid]['awsBucket'];?>" />
|
| 253 |
+
<span id="awsBucket" style="color:red;"><?PHP _e('Get Buckets:','backwpup'); ?></span>
|
| 254 |
+
<?PHP _e('Create Bucket:','backwpup'); ?><input name="newawsBucket" type="text" value="" class="text" /> <select name="awsRegion" title="<?php _e('Bucket Region', 'backwpup'); ?>"><option value=""><?php _e('US', 'backwpup'); ?></option><option value="EU"><?php _e('EU', 'backwpup'); ?></option></select><br />
|
| 255 |
+
<b><?PHP _e('Directory in Bucket:','backwpup'); ?></b><br />
|
| 256 |
+
<input name="awsdir" type="text" value="<?PHP echo $jobs[$jobid]['awsdir'];?>" class="large-text" /><br />
|
| 257 |
+
<?PHP if (!is_numeric($jobs[$jobid]['awsmaxbackups'])) $jobs[$jobid]['awsmaxbackups']=0; ?>
|
| 258 |
+
<?PHP _e('Max. Backup Files inn Bucket Folder:','backwpup'); ?><input name="awsmaxbackups" type="text" size="3" value="<?PHP echo $jobs[$jobid]['awsmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will deleted first.)','backwpup');?></span><br />
|
| 259 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['awsSSL'],true); ?> name="awsSSL" /> <?PHP _e('Use SSL connection.','backwpup'); ?><br />
|
| 260 |
+
<?PHP } ?>
|
| 261 |
</div>
|
| 262 |
</div>
|
| 263 |
|
app/options-save.php
CHANGED
|
@@ -65,6 +65,14 @@ case 'savecfg': //Save config form Setings page
|
|
| 65 |
$cfg['maxlogs']=abs((int)$_POST['maxlogs']);
|
| 66 |
$cfg['dirlogs']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirlogs'])))));
|
| 67 |
$cfg['dirtemp']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirtemp'])))));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
if (update_option('backwpup',$cfg))
|
| 69 |
$backwpup_message=__('Settings saved', 'backwpup');
|
| 70 |
$_REQUEST['action']='settings';
|
|
@@ -136,6 +144,7 @@ case 'saveeditjob': //Save Job settings
|
|
| 136 |
$jobs[$jobid]['mailaddresslog']=sanitize_email($_POST['mailaddresslog']);
|
| 137 |
$jobs[$jobid]['mailerroronly']= $_POST['mailerroronly']==1 ? true : false;
|
| 138 |
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
|
|
|
| 139 |
$jobs[$jobid]['maintenance']= $_POST['maintenance']==1 ? true : false;
|
| 140 |
$jobs[$jobid]['fileexclude']=str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['fileexclude']))));
|
| 141 |
$jobs[$jobid]['dirinclude']=str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirinclude']))));
|
|
@@ -161,6 +170,14 @@ case 'saveeditjob': //Save Job settings
|
|
| 161 |
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
| 162 |
$jobs[$jobid]['awsmaxbackups']=abs((int)$_POST['awsmaxbackups']);
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
//save chages
|
| 165 |
update_option('backwpup_jobs',$jobs);
|
| 166 |
|
| 65 |
$cfg['maxlogs']=abs((int)$_POST['maxlogs']);
|
| 66 |
$cfg['dirlogs']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirlogs'])))));
|
| 67 |
$cfg['dirtemp']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirtemp'])))));
|
| 68 |
+
//set def. folders
|
| 69 |
+
if (empty($cfg['dirtemp']) or $cfg['dirtemp']=='/')
|
| 70 |
+
$cfg['dirtemp']=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'uploads/';
|
| 71 |
+
if (empty($cfg['dirlogs']) or $cfg['dirlogs']=='/') {
|
| 72 |
+
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
| 73 |
+
$cfg['dirlogs']=str_replace('\\','/',trailingslashit(WP_CONTENT_DIR)).'backwpup-'.$rand.'-logs/';
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
if (update_option('backwpup',$cfg))
|
| 77 |
$backwpup_message=__('Settings saved', 'backwpup');
|
| 78 |
$_REQUEST['action']='settings';
|
| 144 |
$jobs[$jobid]['mailaddresslog']=sanitize_email($_POST['mailaddresslog']);
|
| 145 |
$jobs[$jobid]['mailerroronly']= $_POST['mailerroronly']==1 ? true : false;
|
| 146 |
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
| 147 |
+
$jobs[$jobid]['dbshortinsert']=$_POST['dbshortinsert']==1 ? true : false;
|
| 148 |
$jobs[$jobid]['maintenance']= $_POST['maintenance']==1 ? true : false;
|
| 149 |
$jobs[$jobid]['fileexclude']=str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['fileexclude']))));
|
| 150 |
$jobs[$jobid]['dirinclude']=str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['dirinclude']))));
|
| 170 |
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
| 171 |
$jobs[$jobid]['awsmaxbackups']=abs((int)$_POST['awsmaxbackups']);
|
| 172 |
|
| 173 |
+
if (!empty($_POST['newawsBucket']) and !empty($_POST['awsAccessKey']) and !empty($_POST['awsSecretKey'])) { //create new s3 bucket if needed
|
| 174 |
+
if (!class_exists('S3'))
|
| 175 |
+
require_once('libs/S3.php');
|
| 176 |
+
$s3 = new S3($_POST['awsAccessKey'], $_POST['awsSecretKey'], false);
|
| 177 |
+
@$s3->putBucket($_POST['newawsBucket'], S3::ACL_PRIVATE, $_POST['awsRegion']);
|
| 178 |
+
$jobs[$jobid]['awsBucket']=$_POST['newawsBucket'];
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
//save chages
|
| 182 |
update_option('backwpup_jobs',$jobs);
|
| 183 |
|
app/options-tools.php
CHANGED
|
@@ -61,28 +61,7 @@ if ( !defined('ABSPATH') )
|
|
| 61 |
?>
|
| 62 |
</div>
|
| 63 |
</div>
|
| 64 |
-
|
| 65 |
-
<div id="createbucket" class="postbox">
|
| 66 |
-
<h3 class="hndle"><span><?PHP _e('Create Amazon S3 Bucket','backwpup'); ?></span></h3>
|
| 67 |
-
<div class="inside">
|
| 68 |
-
<?PHP
|
| 69 |
-
if ($_POST['awsbucketcreate']==__('Create', 'backwpup') and !empty($_POST['awsAccessKey']) and !empty($_POST['awsSecretKey']) and !empty($_POST['awsBucket'])) {
|
| 70 |
-
if (!class_exists('S3')) require_once 'libs/S3.php';
|
| 71 |
-
$s3 = new S3($_POST['awsAccessKey'], $_POST['awsSecretKey'], false);
|
| 72 |
-
if ($s3->putBucket($_POST['awsBucket'], S3::ACL_PRIVATE, $_POST['awsRegion']))
|
| 73 |
-
echo __('Amazone S3 Bucket created.', 'backwpup')."<br />";
|
| 74 |
-
else
|
| 75 |
-
echo __('Can not create Amazon S3 Bucket.', 'backwpup')."<br />";
|
| 76 |
-
|
| 77 |
-
}
|
| 78 |
-
?>
|
| 79 |
-
<b><?php _e('Access Key ID:', 'backwpup'); ?></b><br /><input type="text" name="awsAccessKey" id="awsAccessKey" value="<?PHP echo $_POST['awsAccessKey'];?>" class="large-text" /><br />
|
| 80 |
-
<b><?php _e('Secret Access Key:', 'backwpup'); ?></b><br /><input type="text" name="awsSecretKey" id="awsSecretKey" value="<?PHP echo $_POST['awsSecretKey'];?>" class="large-text" /><br />
|
| 81 |
-
<b><?php _e('Bucket Name:', 'backwpup'); ?></b><br /><input type="text" name="awsBucket" id="awsBucket" value="<?PHP echo $_POST['awsBucket'];?>" class="large-text" /><br />
|
| 82 |
-
<b><?php _e('Bucket Region:', 'backwpup'); ?></b><br /><select name="awsRegion"><option value=""><?php _e('US', 'backwpup'); ?></option><option value="EU"><?php _e('Europe', 'backwpup'); ?></option></select><br />
|
| 83 |
-
<input type="submit" name="awsbucketcreate" class="button-primary" value="<?php _e('Create', 'backwpup'); ?>" />
|
| 84 |
-
</div>
|
| 85 |
-
</div>
|
| 86 |
</div>
|
| 87 |
</div>
|
| 88 |
</div>
|
| 61 |
?>
|
| 62 |
</div>
|
| 63 |
</div>
|
| 64 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
</div>
|
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: 1.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_BASEDIR', dirname(plugin_basename(__FILE__)));
|
| 37 |
//Set Plugin Version
|
| 38 |
-
define('BACKWPUP_VERSION', '1.0.
|
| 39 |
//load Text Domain
|
| 40 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
| 41 |
//Load functions file
|
| 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: 1.0.9
|
| 8 |
Author URI: http://danielhuesken.de
|
| 9 |
Text Domain: backwpup
|
| 10 |
Domain Path: /lang/
|
| 35 |
//Set plugin dirname
|
| 36 |
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
| 37 |
//Set Plugin Version
|
| 38 |
+
define('BACKWPUP_VERSION', '1.0.9');
|
| 39 |
//load Text Domain
|
| 40 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
| 41 |
//Load functions file
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=danie
|
|
| 4 |
Tags: backup, admin, file, Database, mysql, cron, ftp, S3, export
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.0.0
|
| 7 |
-
Stable tag: 1.0.
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
|
@@ -81,6 +81,13 @@ Pleace mail only littele archives
|
|
| 81 |
1. Job Page
|
| 82 |
|
| 83 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
= 1.0.8 =
|
| 85 |
* fix temp backup file not deleted if no destination folder
|
| 86 |
* some folder fixes
|
| 4 |
Tags: backup, admin, file, Database, mysql, cron, ftp, S3, export
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.0.0
|
| 7 |
+
Stable tag: 1.0.9
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
| 81 |
1. Job Page
|
| 82 |
|
| 83 |
== Changelog ==
|
| 84 |
+
= 1.0.9 =
|
| 85 |
+
* change s3 class to hide warnigs
|
| 86 |
+
* add option to make MySQL INSERTs shorter (smaler dump file size.)
|
| 87 |
+
* add requerments checks
|
| 88 |
+
* ajaxed S3 bucket selection in job settings
|
| 89 |
+
* add S3 Buckt can made in job settings
|
| 90 |
+
|
| 91 |
= 1.0.8 =
|
| 92 |
* fix temp backup file not deleted if no destination folder
|
| 93 |
* some folder fixes
|
