Version Description
- added changeble backup file prefix
- bug fixes
Download this release
Release Info
| Developer | danielhuesken |
| Plugin | |
| Version | 1.3.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.1 to 1.3.2
- app/backwpup_dojob.php +25 -30
- app/functions.php +8 -8
- app/list-tables.php +5 -5
- app/options-edit-job.php +15 -11
- app/options-save.php +4 -5
- app/options-settings.php +1 -1
- backwpup.php +2 -2
- readme.txt +5 -1
app/backwpup_dojob.php
CHANGED
|
@@ -123,7 +123,7 @@ class backwpup_dojob {
|
|
| 123 |
$this->jobid=$jobid; //set job id
|
| 124 |
$this->cfg=get_option('backwpup'); //load config
|
| 125 |
$jobs=get_option('backwpup_jobs'); //load jobdata
|
| 126 |
-
$this->job=backwpup_check_job_vars($jobs[$this->jobid]);//Set and check job settings
|
| 127 |
//set Logs Dir
|
| 128 |
$this->logdir=trailingslashit($this->cfg['dirlogs']);
|
| 129 |
if (empty($this->logdir) or $this->logdir=='/') {
|
|
@@ -159,30 +159,28 @@ class backwpup_dojob {
|
|
| 159 |
else
|
| 160 |
set_error_handler('backwpup_joberrorhandler',E_ALL & ~E_NOTICE);
|
| 161 |
//find out if job already running and abort if
|
| 162 |
-
if ($jobs[$this->jobid]['starttime']>0 and empty($jobs[$this->jobid]['
|
| 163 |
if ($jobs[$this->jobid]['starttime']+600<current_time('timestamp')) { //Abort old jo if work longer as 10 min. because websever has 300 sec timeout
|
| 164 |
trigger_error(__('Working Job will closed!!! And a new started!!!','backwpup'),E_USER_WARNING);
|
| 165 |
//old logfile end
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
break;
|
| 181 |
-
}
|
| 182 |
-
$filepos=ftell($fd);
|
| 183 |
}
|
| 184 |
-
|
| 185 |
}
|
|
|
|
| 186 |
} else {
|
| 187 |
trigger_error(sprintf(__('Job %1$s already running!!!','backwpup'),$this->job['name']),E_USER_ERROR);
|
| 188 |
return false;
|
|
@@ -190,7 +188,6 @@ class backwpup_dojob {
|
|
| 190 |
}
|
| 191 |
//Set job start settings
|
| 192 |
$jobs[$this->jobid]['starttime']=current_time('timestamp'); //set start time for job
|
| 193 |
-
$jobs[$this->jobid]['stoptime']=''; //Set stop time for job
|
| 194 |
$jobs[$this->jobid]['logfile']=$this->logdir.$this->logfile; //Set current logfile
|
| 195 |
$jobs[$this->jobid]['cronnextrun']=backwpup_cron_next($jobs[$this->jobid]['cron']); //set next run
|
| 196 |
update_option('backwpup_jobs',$jobs); //Save job Settings
|
|
@@ -213,7 +210,7 @@ class backwpup_dojob {
|
|
| 213 |
}
|
| 214 |
//set Backup file name only for jos that makes backups
|
| 215 |
if (in_array('FILE',$this->todo) or in_array('DB',$this->todo) or in_array('WPEXP',$this->todo))
|
| 216 |
-
$this->backupfile
|
| 217 |
//check max script execution tme
|
| 218 |
if (ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='on' or ini_get('safe_mode')=='1')
|
| 219 |
trigger_error(sprintf(__('PHP Safe Mode is on!!! Max exec time is %1$d sec.','backwpup'),ini_get('max_execution_time')),E_USER_WARNING);
|
|
@@ -979,7 +976,7 @@ class backwpup_dojob {
|
|
| 979 |
$backupfilelist=array();
|
| 980 |
if ($filelist=ftp_nlist($ftp_conn_id, $this->job['ftpdir'])) {
|
| 981 |
foreach($filelist as $files) {
|
| 982 |
-
if (
|
| 983 |
$backupfilelist[]=basename($files);
|
| 984 |
}
|
| 985 |
if (sizeof($backupfilelist)>0) {
|
|
@@ -1094,7 +1091,7 @@ class backwpup_dojob {
|
|
| 1094 |
foreach ($contents as $object) {
|
| 1095 |
$file=basename($object['name']);
|
| 1096 |
if ($this->job['awsdir'].$file == $object['name']) {//only in the folder and not in complete bucket
|
| 1097 |
-
if (
|
| 1098 |
$backupfilelist[]=$file;
|
| 1099 |
}
|
| 1100 |
}
|
|
@@ -1181,7 +1178,7 @@ class backwpup_dojob {
|
|
| 1181 |
foreach ($contents as $object) {
|
| 1182 |
$file=basename($object);
|
| 1183 |
if ($this->job['rscdir'].$file == $object) {//only in the folder and not in complete bucket
|
| 1184 |
-
if (
|
| 1185 |
$backupfilelist[]=$file;
|
| 1186 |
}
|
| 1187 |
}
|
|
@@ -1213,7 +1210,7 @@ class backwpup_dojob {
|
|
| 1213 |
if (!empty($this->job['maxbackups'])) {
|
| 1214 |
if ( $dir = @opendir($this->job['backupdir']) ) { //make file list
|
| 1215 |
while (($file = readdir($dir)) !== false ) {
|
| 1216 |
-
if (
|
| 1217 |
$backupfilelist[]=$file;
|
| 1218 |
}
|
| 1219 |
@closedir( $dir );
|
|
@@ -1258,13 +1255,11 @@ class backwpup_dojob {
|
|
| 1258 |
}
|
| 1259 |
|
| 1260 |
$jobs=get_option('backwpup_jobs');
|
| 1261 |
-
$jobs[$this->jobid]['stoptime']=current_time('timestamp');
|
| 1262 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
| 1263 |
-
$jobs[$this->jobid]['lastruntime']
|
| 1264 |
$jobs[$this->jobid]['logfile']='';
|
| 1265 |
$jobs[$this->jobid]['starttime']='';
|
| 1266 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
| 1267 |
-
$this->job['stoptime']=$jobs[$this->jobid]['stoptime'];
|
| 1268 |
$this->job['lastrun']=$jobs[$this->jobid]['lastrun'];
|
| 1269 |
$this->job['lastruntime']=$jobs[$this->jobid]['lastruntime'];
|
| 1270 |
trigger_error(sprintf(__('Job done in %1s sec.','backwpup'),$this->job['lastruntime']),E_USER_NOTICE);
|
|
@@ -1328,7 +1323,7 @@ class backwpup_dojob {
|
|
| 1328 |
$mailbody.=__("Errors:","backwpup")." ".$logdata['errors']."\n";
|
| 1329 |
if (!empty($logdata['warnings']))
|
| 1330 |
$mailbody.=__("Warnings:","backwpup")." ".$logdata['warnings']."\n";
|
| 1331 |
-
wp_mail($this->job['mailaddresslog'],__('BackWPup Log File from','backwpup').' '.date_i18n('Y-m-d H:i',$this->job['
|
| 1332 |
}
|
| 1333 |
}
|
| 1334 |
}
|
| 123 |
$this->jobid=$jobid; //set job id
|
| 124 |
$this->cfg=get_option('backwpup'); //load config
|
| 125 |
$jobs=get_option('backwpup_jobs'); //load jobdata
|
| 126 |
+
$this->job=backwpup_check_job_vars($jobs[$this->jobid],$this->jobid);//Set and check job settings
|
| 127 |
//set Logs Dir
|
| 128 |
$this->logdir=trailingslashit($this->cfg['dirlogs']);
|
| 129 |
if (empty($this->logdir) or $this->logdir=='/') {
|
| 159 |
else
|
| 160 |
set_error_handler('backwpup_joberrorhandler',E_ALL & ~E_NOTICE);
|
| 161 |
//find out if job already running and abort if
|
| 162 |
+
if ($jobs[$this->jobid]['starttime']>0 and !empty($jobs[$this->jobid]['logfile'])) {
|
| 163 |
if ($jobs[$this->jobid]['starttime']+600<current_time('timestamp')) { //Abort old jo if work longer as 10 min. because websever has 300 sec timeout
|
| 164 |
trigger_error(__('Working Job will closed!!! And a new started!!!','backwpup'),E_USER_WARNING);
|
| 165 |
//old logfile end
|
| 166 |
+
$fd=fopen($jobs[$this->jobid]['logfile'],"a+");
|
| 167 |
+
fputs($fd,"<span style=\"background-color:c3c3c3;\" title=\"[Line: ".__LINE__."|File: ".basename(__FILE__)."\">".date_i18n('Y-m-d H:i.s').":</span> <span style=\"background-color:red;\">".__('[ERROR]','backwpup')." ".__('Backup Aborted working to long!!!','backwpup')."</span><br />\n");
|
| 168 |
+
fputs($fd,"</body>\n</html>\n");
|
| 169 |
+
fclose($fd);
|
| 170 |
+
$logheader=backwpup_read_logheader($jobs[$this->jobid]['logfile']); //read waring count from log header
|
| 171 |
+
$logheader['errors']++;
|
| 172 |
+
//write new log header
|
| 173 |
+
$fd=@fopen($jobs[$this->jobid]['logfile'],"r+");
|
| 174 |
+
while (!feof($fd)) {
|
| 175 |
+
$line=@fgets($fd);
|
| 176 |
+
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
| 177 |
+
@fseek($fd,$filepos);
|
| 178 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_errors\" content=\"".$logheader['errors']."\" />",100)."\n");
|
| 179 |
+
break;
|
|
|
|
|
|
|
|
|
|
| 180 |
}
|
| 181 |
+
$filepos=ftell($fd);
|
| 182 |
}
|
| 183 |
+
@fclose($fd);
|
| 184 |
} else {
|
| 185 |
trigger_error(sprintf(__('Job %1$s already running!!!','backwpup'),$this->job['name']),E_USER_ERROR);
|
| 186 |
return false;
|
| 188 |
}
|
| 189 |
//Set job start settings
|
| 190 |
$jobs[$this->jobid]['starttime']=current_time('timestamp'); //set start time for job
|
|
|
|
| 191 |
$jobs[$this->jobid]['logfile']=$this->logdir.$this->logfile; //Set current logfile
|
| 192 |
$jobs[$this->jobid]['cronnextrun']=backwpup_cron_next($jobs[$this->jobid]['cron']); //set next run
|
| 193 |
update_option('backwpup_jobs',$jobs); //Save job Settings
|
| 210 |
}
|
| 211 |
//set Backup file name only for jos that makes backups
|
| 212 |
if (in_array('FILE',$this->todo) or in_array('DB',$this->todo) or in_array('WPEXP',$this->todo))
|
| 213 |
+
$this->backupfile=$this->job['fileprefix'].date_i18n('Y-m-d_H-i-s').$this->backupfileformat;
|
| 214 |
//check max script execution tme
|
| 215 |
if (ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='on' or ini_get('safe_mode')=='1')
|
| 216 |
trigger_error(sprintf(__('PHP Safe Mode is on!!! Max exec time is %1$d sec.','backwpup'),ini_get('max_execution_time')),E_USER_WARNING);
|
| 976 |
$backupfilelist=array();
|
| 977 |
if ($filelist=ftp_nlist($ftp_conn_id, $this->job['ftpdir'])) {
|
| 978 |
foreach($filelist as $files) {
|
| 979 |
+
if ($this->job['fileprefix'] == substr(basename($files),0,strlen($this->job['fileprefix'])) and $this->backupfileformat == substr(basename($files),-strlen($this->backupfileformat)))
|
| 980 |
$backupfilelist[]=basename($files);
|
| 981 |
}
|
| 982 |
if (sizeof($backupfilelist)>0) {
|
| 1091 |
foreach ($contents as $object) {
|
| 1092 |
$file=basename($object['name']);
|
| 1093 |
if ($this->job['awsdir'].$file == $object['name']) {//only in the folder and not in complete bucket
|
| 1094 |
+
if ($this->job['fileprefix'] == substr($file,0,strlen($this->job['fileprefix'])) and $this->backupfileformat == substr($file,-strlen($this->backupfileformat)))
|
| 1095 |
$backupfilelist[]=$file;
|
| 1096 |
}
|
| 1097 |
}
|
| 1178 |
foreach ($contents as $object) {
|
| 1179 |
$file=basename($object);
|
| 1180 |
if ($this->job['rscdir'].$file == $object) {//only in the folder and not in complete bucket
|
| 1181 |
+
if ($this->job['fileprefix'] == substr($file,0,strlen($this->job['fileprefix'])) and $this->backupfileformat == substr($file,-strlen($this->backupfileformat)))
|
| 1182 |
$backupfilelist[]=$file;
|
| 1183 |
}
|
| 1184 |
}
|
| 1210 |
if (!empty($this->job['maxbackups'])) {
|
| 1211 |
if ( $dir = @opendir($this->job['backupdir']) ) { //make file list
|
| 1212 |
while (($file = readdir($dir)) !== false ) {
|
| 1213 |
+
if ($this->job['fileprefix'] == substr($file,0,strlen($this->job['fileprefix'])) and $this->backupfileformat == substr($file,-strlen($this->backupfileformat)))
|
| 1214 |
$backupfilelist[]=$file;
|
| 1215 |
}
|
| 1216 |
@closedir( $dir );
|
| 1255 |
}
|
| 1256 |
|
| 1257 |
$jobs=get_option('backwpup_jobs');
|
|
|
|
| 1258 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
| 1259 |
+
$jobs[$this->jobid]['lastruntime']=current_time('timestamp')-$jobs[$this->jobid]['starttime'];
|
| 1260 |
$jobs[$this->jobid]['logfile']='';
|
| 1261 |
$jobs[$this->jobid]['starttime']='';
|
| 1262 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
|
|
|
| 1263 |
$this->job['lastrun']=$jobs[$this->jobid]['lastrun'];
|
| 1264 |
$this->job['lastruntime']=$jobs[$this->jobid]['lastruntime'];
|
| 1265 |
trigger_error(sprintf(__('Job done in %1s sec.','backwpup'),$this->job['lastruntime']),E_USER_NOTICE);
|
| 1323 |
$mailbody.=__("Errors:","backwpup")." ".$logdata['errors']."\n";
|
| 1324 |
if (!empty($logdata['warnings']))
|
| 1325 |
$mailbody.=__("Warnings:","backwpup")." ".$logdata['warnings']."\n";
|
| 1326 |
+
wp_mail($this->job['mailaddresslog'],__('BackWPup Log File from','backwpup').' '.date_i18n('Y-m-d H:i',$this->job['lastruntime']).': '.$this->job['name'] ,$mailbody,'',array($this->logdir.$this->logfile));
|
| 1327 |
}
|
| 1328 |
}
|
| 1329 |
}
|
app/functions.php
CHANGED
|
@@ -79,7 +79,7 @@ if ( !defined('ABSPATH') )
|
|
| 79 |
default:
|
| 80 |
echo "<div class=\"wrap\">";
|
| 81 |
echo "<div id=\"icon-tools\" class=\"icon32\"><br /></div>";
|
| 82 |
-
echo "<h2>".__('BackWPup', 'backwpup')." <a href=\"".wp_nonce_url('admin.php?page=BackWPup&subpage=edit
|
| 83 |
backwpup_option_submenues();
|
| 84 |
echo "<form id=\"posts-filter\" action=\"\" method=\"post\">";
|
| 85 |
echo "<input type=\"hidden\" name=\"page\" value=\"BackWPup\" />";
|
|
@@ -195,7 +195,7 @@ if ( !defined('ABSPATH') )
|
|
| 195 |
|
| 196 |
|
| 197 |
//Checking,upgrade and default job setting
|
| 198 |
-
function backwpup_check_job_vars($jobsettings) {
|
| 199 |
global $wpdb;
|
| 200 |
//check job type
|
| 201 |
if (!isset($jobsettings['type']) or !is_string($jobsettings['type']))
|
|
@@ -343,10 +343,13 @@ if ( !defined('ABSPATH') )
|
|
| 343 |
}
|
| 344 |
sort($jobsettings['backupuploadsexcludedirs']);
|
| 345 |
|
| 346 |
-
$fileformarts=array('.zip','.tar.gz','tar.bz2','.tar');
|
| 347 |
if (!isset($jobsettings['fileformart']) or !in_array($jobsettings['fileformart'],$fileformarts))
|
| 348 |
$jobsettings['fileformart']='.zip';
|
| 349 |
-
|
|
|
|
|
|
|
|
|
|
| 350 |
if (!isset($jobsettings['mailefilesize']) or !is_float($jobsettings['mailefilesize']))
|
| 351 |
$jobsettings['mailefilesize']=0;
|
| 352 |
|
|
@@ -807,7 +810,7 @@ if ( !defined('ABSPATH') )
|
|
| 807 |
}
|
| 808 |
|
| 809 |
foreach ($jobs as $jobid => $jobvalue) { //go job by job
|
| 810 |
-
$jobvalue=backwpup_check_job_vars($jobvalue); //Check job values
|
| 811 |
$todo=explode('+',$jobvalue['type']); //only for backup jobs
|
| 812 |
if (!in_array('FILE',$todo) and !in_array('DB',$todo) and !in_array('WPEXP',$todo))
|
| 813 |
continue;
|
|
@@ -1198,9 +1201,6 @@ if ( !defined('ABSPATH') )
|
|
| 1198 |
if (!is_writable($cfg['dirtemp'])) { // check Temp folder
|
| 1199 |
$message.=__('- Temp Folder not writeable:','backwpup') . ' '.$cfg['dirtemp'].'<br />';
|
| 1200 |
}
|
| 1201 |
-
if (!is_writable($cfg['dirtemp'])) { // check Temp folder
|
| 1202 |
-
$message.=__('- Temp Folder not writeable:','backwpup') . ' '.$cfg['dirtemp'].'<br />';
|
| 1203 |
-
}
|
| 1204 |
$jobs=(array)get_option('backwpup_jobs');
|
| 1205 |
foreach ($jobs as $jobid => $jobvalue) { //check for old cheduling
|
| 1206 |
if (isset($jobvalue['scheduletime']) and empty($jobvalue['cron']))
|
| 79 |
default:
|
| 80 |
echo "<div class=\"wrap\">";
|
| 81 |
echo "<div id=\"icon-tools\" class=\"icon32\"><br /></div>";
|
| 82 |
+
echo "<h2>".__('BackWPup', 'backwpup')." <a href=\"".wp_nonce_url('admin.php?page=BackWPup&subpage=edit', 'edit-job')."\" class=\"button add-new-h2\">".esc_html__('Add New')."</a></h2>";
|
| 83 |
backwpup_option_submenues();
|
| 84 |
echo "<form id=\"posts-filter\" action=\"\" method=\"post\">";
|
| 85 |
echo "<input type=\"hidden\" name=\"page\" value=\"BackWPup\" />";
|
| 195 |
|
| 196 |
|
| 197 |
//Checking,upgrade and default job setting
|
| 198 |
+
function backwpup_check_job_vars($jobsettings,$jobid='') {
|
| 199 |
global $wpdb;
|
| 200 |
//check job type
|
| 201 |
if (!isset($jobsettings['type']) or !is_string($jobsettings['type']))
|
| 343 |
}
|
| 344 |
sort($jobsettings['backupuploadsexcludedirs']);
|
| 345 |
|
| 346 |
+
$fileformarts=array('.zip','.tar.gz','.tar.bz2','.tar');
|
| 347 |
if (!isset($jobsettings['fileformart']) or !in_array($jobsettings['fileformart'],$fileformarts))
|
| 348 |
$jobsettings['fileformart']='.zip';
|
| 349 |
+
|
| 350 |
+
if (!isset($jobsettings['fileprefix']) or !is_string($jobsettings['fileprefix']))
|
| 351 |
+
$jobsettings['fileprefix']='backwpup_'.$jobid.'_';
|
| 352 |
+
|
| 353 |
if (!isset($jobsettings['mailefilesize']) or !is_float($jobsettings['mailefilesize']))
|
| 354 |
$jobsettings['mailefilesize']=0;
|
| 355 |
|
| 810 |
}
|
| 811 |
|
| 812 |
foreach ($jobs as $jobid => $jobvalue) { //go job by job
|
| 813 |
+
$jobvalue=backwpup_check_job_vars($jobvalue,$jobid); //Check job values
|
| 814 |
$todo=explode('+',$jobvalue['type']); //only for backup jobs
|
| 815 |
if (!in_array('FILE',$todo) and !in_array('DB',$todo) and !in_array('WPEXP',$todo))
|
| 816 |
continue;
|
| 1201 |
if (!is_writable($cfg['dirtemp'])) { // check Temp folder
|
| 1202 |
$message.=__('- Temp Folder not writeable:','backwpup') . ' '.$cfg['dirtemp'].'<br />';
|
| 1203 |
}
|
|
|
|
|
|
|
|
|
|
| 1204 |
$jobs=(array)get_option('backwpup_jobs');
|
| 1205 |
foreach ($jobs as $jobid => $jobvalue) { //check for old cheduling
|
| 1206 |
if (isset($jobvalue['scheduletime']) and empty($jobvalue['cron']))
|
app/list-tables.php
CHANGED
|
@@ -71,7 +71,7 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
| 71 |
function display_rows() {
|
| 72 |
$style = '';
|
| 73 |
foreach ( $this->items as $jobid => $jobvalue ) {
|
| 74 |
-
$jobvalue=backwpup_check_job_vars($jobvalue);//Set and check job settings
|
| 75 |
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
| 76 |
echo "\n\t", $this->single_row( $jobid, $jobvalue, $style );
|
| 77 |
}
|
|
@@ -100,13 +100,13 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
| 100 |
case 'jobname':
|
| 101 |
$r .= "<td $attributes><strong><a href=\"".wp_nonce_url('admin.php?page=BackWPup&subpage=edit&jobid='.$jobid, 'edit-job')."\" title=\"".__('Edit:','backwpup').$jobvalue['name']."\">".esc_html($jobvalue['name'])."</a></strong>";
|
| 102 |
$actions = array();
|
| 103 |
-
if (empty($jobvalue['logfile']) and empty($jobvalue['starttime'])) {
|
| 104 |
$actions['edit'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&subpage=edit&jobid='.$jobid, 'edit-job') . "\">" . __('Edit') . "</a>";
|
| 105 |
$actions['copy'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=copy&jobid='.$jobid, 'copy-job_'.$jobid) . "\">" . __('Copy','backwpup') . "</a>";
|
| 106 |
$actions['delete'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=delete&jobs[]='.$jobid, 'bulk-jobs') . "\" onclick=\"if ( confirm('" . esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
|
| 107 |
$actions['runnow'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&subpage=runnow&jobid='.$jobid, 'runnow-job_'.$jobid) . "\">" . __('Run Now','backwpup') . "</a>";
|
| 108 |
} else {
|
| 109 |
-
$actions['clear'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=clear&jobid='.$jobid, 'clear-job_'.$jobid) . "\">" . __('
|
| 110 |
}
|
| 111 |
$action_count = count($actions);
|
| 112 |
$i = 0;
|
|
@@ -145,7 +145,7 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
| 145 |
break;
|
| 146 |
case 'next':
|
| 147 |
$r .= "<td $attributes>";
|
| 148 |
-
if ($jobvalue['starttime']>0 and empty($jobvalue['
|
| 149 |
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
| 150 |
$r .= __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
| 151 |
} elseif ($jobvalue['activated']) {
|
|
@@ -424,7 +424,7 @@ class BackWPup_Backups_Table extends WP_List_Table {
|
|
| 424 |
$jobs=get_option('backwpup_jobs'); //Load jobs
|
| 425 |
foreach ( $this->items as $backup ) {
|
| 426 |
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
| 427 |
-
echo "\n\t", $this->single_row( $backup, backwpup_check_job_vars($jobs[$backup['jobid']]), $style );
|
| 428 |
}
|
| 429 |
}
|
| 430 |
|
| 71 |
function display_rows() {
|
| 72 |
$style = '';
|
| 73 |
foreach ( $this->items as $jobid => $jobvalue ) {
|
| 74 |
+
$jobvalue=backwpup_check_job_vars($jobvalue,$jobid);//Set and check job settings
|
| 75 |
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
| 76 |
echo "\n\t", $this->single_row( $jobid, $jobvalue, $style );
|
| 77 |
}
|
| 100 |
case 'jobname':
|
| 101 |
$r .= "<td $attributes><strong><a href=\"".wp_nonce_url('admin.php?page=BackWPup&subpage=edit&jobid='.$jobid, 'edit-job')."\" title=\"".__('Edit:','backwpup').$jobvalue['name']."\">".esc_html($jobvalue['name'])."</a></strong>";
|
| 102 |
$actions = array();
|
| 103 |
+
if (empty($jobvalue['logfile']) and !empty($jobvalue['starttime'])) {
|
| 104 |
$actions['edit'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&subpage=edit&jobid='.$jobid, 'edit-job') . "\">" . __('Edit') . "</a>";
|
| 105 |
$actions['copy'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=copy&jobid='.$jobid, 'copy-job_'.$jobid) . "\">" . __('Copy','backwpup') . "</a>";
|
| 106 |
$actions['delete'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=delete&jobs[]='.$jobid, 'bulk-jobs') . "\" onclick=\"if ( confirm('" . esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
|
| 107 |
$actions['runnow'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&subpage=runnow&jobid='.$jobid, 'runnow-job_'.$jobid) . "\">" . __('Run Now','backwpup') . "</a>";
|
| 108 |
} else {
|
| 109 |
+
$actions['clear'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=clear&jobid='.$jobid, 'clear-job_'.$jobid) . "\">" . __('Clear','backwpup') . "</a>";
|
| 110 |
}
|
| 111 |
$action_count = count($actions);
|
| 112 |
$i = 0;
|
| 145 |
break;
|
| 146 |
case 'next':
|
| 147 |
$r .= "<td $attributes>";
|
| 148 |
+
if ($jobvalue['starttime']>0 and !empty($jobvalue['logfile'])) {
|
| 149 |
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
| 150 |
$r .= __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
| 151 |
} elseif ($jobvalue['activated']) {
|
| 424 |
$jobs=get_option('backwpup_jobs'); //Load jobs
|
| 425 |
foreach ( $this->items as $backup ) {
|
| 426 |
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
| 427 |
+
echo "\n\t", $this->single_row( $backup, backwpup_check_job_vars($jobs[$backup['jobid']],$backup['jobid']), $style );
|
| 428 |
}
|
| 429 |
}
|
| 430 |
|
app/options-edit-job.php
CHANGED
|
@@ -5,9 +5,7 @@ if ( !defined('ABSPATH') )
|
|
| 5 |
|
| 6 |
check_admin_referer('edit-job');
|
| 7 |
global $wpdb;
|
| 8 |
-
$jobs=get_option('backwpup_jobs');
|
| 9 |
$jobid = (int) $_REQUEST['jobid'];
|
| 10 |
-
$jobvalue=backwpup_check_job_vars($jobs[$jobid]);
|
| 11 |
?>
|
| 12 |
<div class="wrap">
|
| 13 |
<div id="icon-tools" class="icon32"><br /></div>
|
|
@@ -18,7 +16,8 @@ $jobvalue=backwpup_check_job_vars($jobs[$jobid]);
|
|
| 18 |
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
| 19 |
<?php
|
| 20 |
wp_nonce_field('edit-job');
|
| 21 |
-
$
|
|
|
|
| 22 |
$todo=explode('+',$jobvalue['type']);
|
| 23 |
?>
|
| 24 |
|
|
@@ -157,22 +156,27 @@ $todo=explode('+',$jobvalue['type']);
|
|
| 157 |
</div>
|
| 158 |
|
| 159 |
<div id="fileformart" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
| 160 |
-
<h3 class="hndle"><span><?PHP _e('Backup File
|
| 161 |
<div class="inside">
|
|
|
|
|
|
|
|
|
|
| 162 |
<?PHP
|
| 163 |
if (function_exists('gzopen') or class_exists('ZipArchive'))
|
| 164 |
-
echo '<input class="radio" type="radio"'.checked('.zip',$jobvalue['fileformart'],false).' name="fileformart" value=".zip" />'.__('
|
| 165 |
else
|
| 166 |
-
echo '<input class="radio" type="radio"'.checked('.zip',$jobvalue['fileformart'],false).' name="fileformart" value=".zip" disabled="disabled" />'.__('
|
| 167 |
-
echo '<input class="radio" type="radio"'.checked('.tar',$jobvalue['fileformart'],false).' name="fileformart" value=".tar" />'.__('
|
| 168 |
if (function_exists('gzopen'))
|
| 169 |
-
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.gz" />'.__('
|
| 170 |
else
|
| 171 |
-
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.gz" disabled="disabled" />'.__('
|
| 172 |
if (function_exists('bzopen'))
|
| 173 |
-
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.bz2" />'.__('
|
| 174 |
else
|
| 175 |
-
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.bz2" disabled="disabled" />'.__('
|
|
|
|
|
|
|
| 176 |
?>
|
| 177 |
</div>
|
| 178 |
</div>
|
| 5 |
|
| 6 |
check_admin_referer('edit-job');
|
| 7 |
global $wpdb;
|
|
|
|
| 8 |
$jobid = (int) $_REQUEST['jobid'];
|
|
|
|
| 9 |
?>
|
| 10 |
<div class="wrap">
|
| 11 |
<div id="icon-tools" class="icon32"><br /></div>
|
| 16 |
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
| 17 |
<?php
|
| 18 |
wp_nonce_field('edit-job');
|
| 19 |
+
$jobs=get_option('backwpup_jobs');
|
| 20 |
+
$jobvalue=backwpup_check_job_vars($jobs[$jobid],$jobid);
|
| 21 |
$todo=explode('+',$jobvalue['type']);
|
| 22 |
?>
|
| 23 |
|
| 156 |
</div>
|
| 157 |
|
| 158 |
<div id="fileformart" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
| 159 |
+
<h3 class="hndle"><span><?PHP _e('Backup File','backwpup'); ?></span></h3>
|
| 160 |
<div class="inside">
|
| 161 |
+
<b><?PHP _e('File Prefix:','backwpup'); ?></b><br />
|
| 162 |
+
<input name="fileprefix" type="text" value="<?PHP echo $jobvalue['fileprefix'];?>" class="large-text" /><br />
|
| 163 |
+
<b><?PHP _e('File Formart:','backwpup'); ?></b><br />
|
| 164 |
<?PHP
|
| 165 |
if (function_exists('gzopen') or class_exists('ZipArchive'))
|
| 166 |
+
echo '<input class="radio" type="radio"'.checked('.zip',$jobvalue['fileformart'],false).' name="fileformart" value=".zip" />'.__('Zip','backwpup').'<br />';
|
| 167 |
else
|
| 168 |
+
echo '<input class="radio" type="radio"'.checked('.zip',$jobvalue['fileformart'],false).' name="fileformart" value=".zip" disabled="disabled" />'.__('Zip','backwpup').'<br />';
|
| 169 |
+
echo '<input class="radio" type="radio"'.checked('.tar',$jobvalue['fileformart'],false).' name="fileformart" value=".tar" />'.__('Tar','backwpup').'<br />';
|
| 170 |
if (function_exists('gzopen'))
|
| 171 |
+
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.gz" />'.__('Tar GZip','backwpup').'<br />';
|
| 172 |
else
|
| 173 |
+
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.gz" disabled="disabled" />'.__('Tar GZip','backwpup').'<br />';
|
| 174 |
if (function_exists('bzopen'))
|
| 175 |
+
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.bz2" />'.__('Tar BZip2','backwpup').'<br />';
|
| 176 |
else
|
| 177 |
+
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobvalue['fileformart'],false).' name="fileformart" value=".tar.bz2" disabled="disabled" />'.__('Tar BZip2','backwpup').'<br />';
|
| 178 |
+
_e('Example:','backwpup');
|
| 179 |
+
echo '<br /><i>'.$jobvalue['fileprefix'].date_i18n('Y-m-d_H-i-s').$jobvalue['fileformart'].'</i>';
|
| 180 |
?>
|
| 181 |
</div>
|
| 182 |
</div>
|
app/options-save.php
CHANGED
|
@@ -128,7 +128,7 @@ function backwpup_backups_operations($action) {
|
|
| 128 |
|
| 129 |
$num=0;
|
| 130 |
foreach ($deletebackups as $backups) {
|
| 131 |
-
$jobvalue=backwpup_check_job_vars($jobs[$backups['jobid']]); //Check job values
|
| 132 |
if ($backups['type']=='FOLDER') {
|
| 133 |
if (is_file($backups['file']))
|
| 134 |
unlink($backups['file']);
|
|
@@ -369,6 +369,7 @@ function backwpup_save_job() { //Save Job settings
|
|
| 369 |
$jobs[$jobid]['backupthemesexcludedirs']=(array)$_POST['backupthemesexcludedirs'];
|
| 370 |
$jobs[$jobid]['backupuploads']= $_POST['backupuploads']==1 ? true : false;
|
| 371 |
$jobs[$jobid]['backupuploadsexcludedirs']=(array)$_POST['backupuploadsexcludedirs'];
|
|
|
|
| 372 |
$jobs[$jobid]['fileformart']=$_POST['fileformart'];
|
| 373 |
$jobs[$jobid]['mailefilesize']=(float)$_POST['mailefilesize'];
|
| 374 |
$jobs[$jobid]['backupdir']=stripslashes($_POST['backupdir']);
|
|
@@ -397,7 +398,7 @@ function backwpup_save_job() { //Save Job settings
|
|
| 397 |
unset($jobs[$jobid]['scheduleintervalteimes']);
|
| 398 |
unset($jobs[$jobid]['scheduleinterval']);
|
| 399 |
|
| 400 |
-
$jobs[$jobid]=backwpup_check_job_vars($jobs[$jobid]); //check vars and set def.
|
| 401 |
|
| 402 |
if (!empty($_POST['newawsBucket']) and !empty($_POST['awsAccessKey']) and !empty($_POST['awsSecretKey'])) { //create new s3 bucket if needed
|
| 403 |
if (!class_exists('S3'))
|
|
@@ -424,10 +425,8 @@ function backwpup_save_job() { //Save Job settings
|
|
| 424 |
|
| 425 |
//save chages
|
| 426 |
update_option('backwpup_jobs',$jobs);
|
| 427 |
-
|
| 428 |
$backwpup_message.=str_replace('%1',$jobs[$jobid]['name'],__('Job \'%1\' changes saved.', 'backwpup')).' <a href="admin.php?page=BackWPup">'.__('Jobs overview.', 'backwpup').'</a>';
|
| 429 |
return $backwpup_message;
|
| 430 |
-
//go to job page
|
| 431 |
-
$_REQUEST['jobid']=$jobid;
|
| 432 |
}
|
| 433 |
?>
|
| 128 |
|
| 129 |
$num=0;
|
| 130 |
foreach ($deletebackups as $backups) {
|
| 131 |
+
$jobvalue=backwpup_check_job_vars($jobs[$backups['jobid']],$backups['jobid']); //Check job values
|
| 132 |
if ($backups['type']=='FOLDER') {
|
| 133 |
if (is_file($backups['file']))
|
| 134 |
unlink($backups['file']);
|
| 369 |
$jobs[$jobid]['backupthemesexcludedirs']=(array)$_POST['backupthemesexcludedirs'];
|
| 370 |
$jobs[$jobid]['backupuploads']= $_POST['backupuploads']==1 ? true : false;
|
| 371 |
$jobs[$jobid]['backupuploadsexcludedirs']=(array)$_POST['backupuploadsexcludedirs'];
|
| 372 |
+
$jobs[$jobid]['fileprefix']=$_POST['fileprefix'];
|
| 373 |
$jobs[$jobid]['fileformart']=$_POST['fileformart'];
|
| 374 |
$jobs[$jobid]['mailefilesize']=(float)$_POST['mailefilesize'];
|
| 375 |
$jobs[$jobid]['backupdir']=stripslashes($_POST['backupdir']);
|
| 398 |
unset($jobs[$jobid]['scheduleintervalteimes']);
|
| 399 |
unset($jobs[$jobid]['scheduleinterval']);
|
| 400 |
|
| 401 |
+
$jobs[$jobid]=backwpup_check_job_vars($jobs[$jobid],$jobid); //check vars and set def.
|
| 402 |
|
| 403 |
if (!empty($_POST['newawsBucket']) and !empty($_POST['awsAccessKey']) and !empty($_POST['awsSecretKey'])) { //create new s3 bucket if needed
|
| 404 |
if (!class_exists('S3'))
|
| 425 |
|
| 426 |
//save chages
|
| 427 |
update_option('backwpup_jobs',$jobs);
|
| 428 |
+
$_POST['jobid']=$jobid;
|
| 429 |
$backwpup_message.=str_replace('%1',$jobs[$jobid]['name'],__('Job \'%1\' changes saved.', 'backwpup')).' <a href="admin.php?page=BackWPup">'.__('Jobs overview.', 'backwpup').'</a>';
|
| 430 |
return $backwpup_message;
|
|
|
|
|
|
|
| 431 |
}
|
| 432 |
?>
|
app/options-settings.php
CHANGED
|
@@ -79,7 +79,7 @@ $cfg=get_option('backwpup');
|
|
| 79 |
<input name="dirtemp" type="text" value="<?PHP echo $cfg['dirtemp'];?>" class="large-text" /><br />
|
| 80 |
</div>
|
| 81 |
</div>
|
| 82 |
-
<input type="submit" name="
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
</div>
|
| 79 |
<input name="dirtemp" type="text" value="<?PHP echo $cfg['dirtemp'];?>" class="large-text" /><br />
|
| 80 |
</div>
|
| 81 |
</div>
|
| 82 |
+
<input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
</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.3.
|
| 8 |
Author URI: http://danielhuesken.de
|
| 9 |
Text Domain: backwpup
|
| 10 |
Domain Path: /lang/
|
|
@@ -34,7 +34,7 @@ if ( !defined('ABSPATH') )
|
|
| 34 |
//Set plugin dirname
|
| 35 |
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
| 36 |
//Set Plugin Version
|
| 37 |
-
define('BACKWPUP_VERSION', '1.3.
|
| 38 |
//load Text Domain
|
| 39 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
| 40 |
//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.3.2
|
| 8 |
Author URI: http://danielhuesken.de
|
| 9 |
Text Domain: backwpup
|
| 10 |
Domain Path: /lang/
|
| 34 |
//Set plugin dirname
|
| 35 |
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
| 36 |
//Set Plugin Version
|
| 37 |
+
define('BACKWPUP_VERSION', '1.3.2');
|
| 38 |
//load Text Domain
|
| 39 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
| 40 |
//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, xml, Rackspase, cloud, webdav
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.1.0
|
| 7 |
-
Stable tag: 1.3.
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
|
@@ -82,6 +82,10 @@ Place mail only little archives
|
|
| 82 |
1. Job Page
|
| 83 |
|
| 84 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
= 1.3.1 =
|
| 86 |
* added File and DB size information
|
| 87 |
* removed "LOCK TABLE" in sql dumps
|
| 4 |
Tags: backup, admin, file, Database, mysql, cron, ftp, S3, export, xml, Rackspase, cloud, webdav
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.1.0
|
| 7 |
+
Stable tag: 1.3.2
|
| 8 |
|
| 9 |
Backup and more of your WordPress Blog Database and Files
|
| 10 |
|
| 82 |
1. Job Page
|
| 83 |
|
| 84 |
== Changelog ==
|
| 85 |
+
= 1.3.2 =
|
| 86 |
+
* added changeble backup file prefix
|
| 87 |
+
* bug fixes
|
| 88 |
+
|
| 89 |
= 1.3.1 =
|
| 90 |
* added File and DB size information
|
| 91 |
* removed "LOCK TABLE" in sql dumps
|
