Version Description
- added File and DB size information
- removed "LOCK TABLE" in sql dumps
- fixed bug in automatic job abortion
- fixed bug in ABSPATH if it '/'
- fiexd bug in save settings
- fiexd bugs if no jobs exists
- added link to clear running jobs
Download this release
Release Info
Developer | danielhuesken |
Plugin | BackWPup – WordPress Backup Plugin |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.3.0 to 1.3.1
- app/backwpup_dojob.php +50 -33
- app/compatibility/list-table.php +2 -4
- app/css/options.css +3 -3
- app/functions.php +107 -44
- app/list-tables.php +46 -7
- app/options-save.php +32 -0
- backwpup.php +2 -2
- readme.txt +10 -1
app/backwpup_dojob.php
CHANGED
@@ -12,10 +12,7 @@ function backwpup_joberrorhandler($errno, $errstr, $errfile, $errline) {
|
|
12 |
if (!function_exists('memory_get_usage')) { // test if memory functions compiled in
|
13 |
$timestamp="<span style=\"background-color:c3c3c3;\" title=\"[Line: ".$errline."|File: ".basename($errfile)."\">".date_i18n('Y-m-d H:i.s').":</span> ";
|
14 |
} else {
|
15 |
-
|
16 |
-
$timestamp="<span style=\"background-color:c3c3c3;\" title=\"[Line: ".$errline."|File: ".basename($errfile)."|Mem: ".backwpup_formatBytes(@memory_get_usage())."|Mem Max: ".backwpup_formatBytes(@memory_get_peak_usage())."|Mem Limit: ".ini_get('memory_limit')."]\">".date_i18n('Y-m-d H:i.s').":</span> ";
|
17 |
-
else
|
18 |
-
$timestamp="<span style=\"background-color:c3c3c3;\" title=\"[Line: ".$errline."|File: ".basename($errfile)."|Mem: ".backwpup_formatBytes(@memory_get_usage(true))."|Mem Max: ".backwpup_formatBytes(@memory_get_peak_usage(true))."|Mem Limit: ".ini_get('memory_limit')."]\">".date_i18n('Y-m-d H:i.s').":</span> ";
|
19 |
}
|
20 |
|
21 |
switch ($errno) {
|
@@ -163,13 +160,29 @@ class backwpup_dojob {
|
|
163 |
set_error_handler('backwpup_joberrorhandler',E_ALL & ~E_NOTICE);
|
164 |
//find out if job already running and abort if
|
165 |
if ($jobs[$this->jobid]['starttime']>0 and empty($jobs[$this->jobid]['stoptime'])) {
|
166 |
-
if ($jobs[$this->jobid]['starttime']+600
|
167 |
trigger_error(__('Working Job will closed!!! And a new started!!!','backwpup'),E_USER_WARNING);
|
168 |
//old logfile end
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
} else {
|
174 |
trigger_error(sprintf(__('Job %1$s already running!!!','backwpup'),$this->job['name']),E_USER_ERROR);
|
175 |
return false;
|
@@ -178,8 +191,8 @@ class backwpup_dojob {
|
|
178 |
//Set job start settings
|
179 |
$jobs[$this->jobid]['starttime']=current_time('timestamp'); //set start time for job
|
180 |
$jobs[$this->jobid]['stoptime']=''; //Set stop time for job
|
181 |
-
$jobs[$this->jobid]['logfile']=$this->logdir.$this->logfile; //Set
|
182 |
-
$jobs[$this->jobid]['cronnextrun']=backwpup_cron_next($jobs[$this->jobid]['cron']);
|
183 |
update_option('backwpup_jobs',$jobs); //Save job Settings
|
184 |
//set waht to do
|
185 |
$this->todo=explode('+',$this->job['type']);
|
@@ -440,7 +453,6 @@ class backwpup_dojob {
|
|
440 |
fwrite($file, "--\n");
|
441 |
fwrite($file, "-- Dumping data for table $table\n");
|
442 |
fwrite($file, "--\n\n");
|
443 |
-
fwrite($file, "LOCK TABLES `".$table."` WRITE;\n\n");
|
444 |
if ($status['Engine']=='MyISAM')
|
445 |
fwrite($file, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
446 |
|
@@ -468,7 +480,6 @@ class backwpup_dojob {
|
|
468 |
}
|
469 |
if ($status['Engine']=='MyISAM')
|
470 |
fwrite($file, "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n");
|
471 |
-
fwrite($file, "UNLOCK TABLES;\n");
|
472 |
}
|
473 |
|
474 |
private function dump_db() {
|
@@ -640,21 +651,21 @@ class backwpup_dojob {
|
|
640 |
if ( in_array($file, array('.', '..','.svn') ) )
|
641 |
continue;
|
642 |
foreach ($excludes as $exclusion) { //exclude dirs and files
|
643 |
-
if (false !== stripos($folder
|
644 |
continue 2;
|
645 |
}
|
646 |
-
if ( is_dir( $folder
|
647 |
-
if (!in_array(trailingslashit($folder
|
648 |
-
$this->_file_list_folder( $folder
|
649 |
-
} elseif (is_file( $folder
|
650 |
-
if (is_readable($folder
|
651 |
-
$this->tempfilelist[]=$folder
|
652 |
-
$this->allfilesize=$this->allfilesize+filesize($folder
|
653 |
} else {
|
654 |
-
trigger_error(__('Can not read file:','backwpup').' '.$folder
|
655 |
}
|
656 |
} else {
|
657 |
-
trigger_error(__('Is not a file or directory:','backwpup').' '.$folder
|
658 |
}
|
659 |
}
|
660 |
@closedir( $dir );
|
@@ -676,15 +687,15 @@ class backwpup_dojob {
|
|
676 |
|
677 |
//File list for blog folders
|
678 |
if ($this->job['backuproot'])
|
679 |
-
$this->_file_list_folder(
|
680 |
if ($this->job['backupcontent'])
|
681 |
-
$this->_file_list_folder(
|
682 |
if ($this->job['backupplugins'])
|
683 |
-
$this->_file_list_folder(
|
684 |
if ($this->job['backupthemes'])
|
685 |
-
$this->_file_list_folder(
|
686 |
if ($this->job['backupuploads'])
|
687 |
-
$this->_file_list_folder(
|
688 |
|
689 |
//include dirs
|
690 |
if (!empty($this->job['dirinclude'])) {
|
@@ -693,21 +704,26 @@ class backwpup_dojob {
|
|
693 |
//Crate file list for includes
|
694 |
foreach($dirinclude as $dirincludevalue) {
|
695 |
if (is_dir($dirincludevalue))
|
696 |
-
$this->_file_list_folder(untrailingslashit(
|
697 |
}
|
698 |
}
|
699 |
|
700 |
$this->tempfilelist=array_unique($this->tempfilelist); //all files only one time in list
|
701 |
sort($this->tempfilelist);
|
702 |
-
|
703 |
-
|
704 |
-
|
|
|
|
|
|
|
|
|
|
|
705 |
$this->tempfilelist=array();
|
706 |
|
707 |
if (!is_array($this->filelist[0])) {
|
708 |
trigger_error(__('No files to Backup','backwpup'),E_USER_ERROR);
|
709 |
} else {
|
710 |
-
trigger_error(__('Size
|
711 |
}
|
712 |
|
713 |
}
|
@@ -1246,6 +1262,7 @@ class backwpup_dojob {
|
|
1246 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
1247 |
$jobs[$this->jobid]['lastruntime']=$jobs[$this->jobid]['stoptime']-$jobs[$this->jobid]['starttime'];
|
1248 |
$jobs[$this->jobid]['logfile']='';
|
|
|
1249 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
1250 |
$this->job['stoptime']=$jobs[$this->jobid]['stoptime'];
|
1251 |
$this->job['lastrun']=$jobs[$this->jobid]['lastrun'];
|
12 |
if (!function_exists('memory_get_usage')) { // test if memory functions compiled in
|
13 |
$timestamp="<span style=\"background-color:c3c3c3;\" title=\"[Line: ".$errline."|File: ".basename($errfile)."\">".date_i18n('Y-m-d H:i.s').":</span> ";
|
14 |
} else {
|
15 |
+
$timestamp="<span style=\"background-color:c3c3c3;\" title=\"[Line: ".$errline."|File: ".basename($errfile)."|Mem: ".backwpup_formatBytes(@memory_get_usage(true))."|Mem Max: ".backwpup_formatBytes(@memory_get_peak_usage(true))."|Mem Limit: ".ini_get('memory_limit')."]\">".date_i18n('Y-m-d H:i.s').":</span> ";
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
switch ($errno) {
|
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]['stoptime'])) {
|
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 |
+
if (is_file($jobs[$this->jobid]['logfile'])) {
|
167 |
+
$fd=fopen($jobs[$this->jobid]['logfile'],"a+");
|
168 |
+
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");
|
169 |
+
fputs($fd,"</body>\n</html>\n");
|
170 |
+
fclose($fd);
|
171 |
+
$logheader=backwpup_read_logheader($jobs[$this->jobid]['logfile']); //read waring count from log header
|
172 |
+
$logheader['errors']++;
|
173 |
+
//write new log header
|
174 |
+
$fd=@fopen($jobs[$this->jobid]['logfile'],"r+");
|
175 |
+
while (!feof($fd)) {
|
176 |
+
$line=@fgets($fd);
|
177 |
+
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
178 |
+
@fseek($fd,$filepos);
|
179 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_errors\" content=\"".$logheader['errors']."\" />",100)."\n");
|
180 |
+
break;
|
181 |
+
}
|
182 |
+
$filepos=ftell($fd);
|
183 |
+
}
|
184 |
+
@fclose($fd);
|
185 |
+
}
|
186 |
} else {
|
187 |
trigger_error(sprintf(__('Job %1$s already running!!!','backwpup'),$this->job['name']),E_USER_ERROR);
|
188 |
return false;
|
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
|
197 |
//set waht to do
|
198 |
$this->todo=explode('+',$this->job['type']);
|
453 |
fwrite($file, "--\n");
|
454 |
fwrite($file, "-- Dumping data for table $table\n");
|
455 |
fwrite($file, "--\n\n");
|
|
|
456 |
if ($status['Engine']=='MyISAM')
|
457 |
fwrite($file, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
458 |
|
480 |
}
|
481 |
if ($status['Engine']=='MyISAM')
|
482 |
fwrite($file, "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n");
|
|
|
483 |
}
|
484 |
|
485 |
private function dump_db() {
|
651 |
if ( in_array($file, array('.', '..','.svn') ) )
|
652 |
continue;
|
653 |
foreach ($excludes as $exclusion) { //exclude dirs and files
|
654 |
+
if (false !== stripos($folder.$file,$exclusion) and !empty($exclusion) and $exclusion!='/')
|
655 |
continue 2;
|
656 |
}
|
657 |
+
if ( is_dir( $folder.$file )) {
|
658 |
+
if (!in_array(trailingslashit($folder.$file),$excludedirs))
|
659 |
+
$this->_file_list_folder( trailingslashit($folder.$file), $levels - 1, $excludes);
|
660 |
+
} elseif (is_file( $folder.$file )) {
|
661 |
+
if (is_readable($folder.$file)) { //add file to filelist
|
662 |
+
$this->tempfilelist[]=$folder.$file;
|
663 |
+
$this->allfilesize=$this->allfilesize+filesize($folder.$file);
|
664 |
} else {
|
665 |
+
trigger_error(__('Can not read file:','backwpup').' '.$folder.$file,E_USER_WARNING);
|
666 |
}
|
667 |
} else {
|
668 |
+
trigger_error(__('Is not a file or directory:','backwpup').' '.$folder.$file,E_USER_WARNING);
|
669 |
}
|
670 |
}
|
671 |
@closedir( $dir );
|
687 |
|
688 |
//File list for blog folders
|
689 |
if ($this->job['backuproot'])
|
690 |
+
$this->_file_list_folder(trailingslashit(str_replace('\\','/',ABSPATH)),100,$backwpup_exclude,array_merge($this->job['backuprootexcludedirs'],backwpup_get_exclude_wp_dirs(ABSPATH)));
|
691 |
if ($this->job['backupcontent'])
|
692 |
+
$this->_file_list_folder(trailingslashit(str_replace('\\','/',WP_CONTENT_DIR)),100,$backwpup_exclude,array_merge($this->job['backupcontentexcludedirs'],backwpup_get_exclude_wp_dirs(WP_CONTENT_DIR)));
|
693 |
if ($this->job['backupplugins'])
|
694 |
+
$this->_file_list_folder(trailingslashit(str_replace('\\','/',WP_PLUGIN_DIR)),100,$backwpup_exclude,array_merge($this->job['backuppluginsexcludedirs'],backwpup_get_exclude_wp_dirs(WP_PLUGIN_DIR)));
|
695 |
if ($this->job['backupthemes'])
|
696 |
+
$this->_file_list_folder(trailingslashit(str_replace('\\','/',trailingslashit(WP_CONTENT_DIR).'themes')),100,$backwpup_exclude,array_merge($this->job['backupthemesexcludedirs'],backwpup_get_exclude_wp_dirs(trailingslashit(WP_CONTENT_DIR).'themes')));
|
697 |
if ($this->job['backupuploads'])
|
698 |
+
$this->_file_list_folder(trailingslashit(backwpup_get_upload_dir()),100,$backwpup_exclude,array_merge($this->job['backupuploadsexcludedirs'],backwpup_get_exclude_wp_dirs(backwpup_get_upload_dir())));
|
699 |
|
700 |
//include dirs
|
701 |
if (!empty($this->job['dirinclude'])) {
|
704 |
//Crate file list for includes
|
705 |
foreach($dirinclude as $dirincludevalue) {
|
706 |
if (is_dir($dirincludevalue))
|
707 |
+
$this->_file_list_folder(untrailingslashit($dirincludevalue),100,$backwpup_exclude);
|
708 |
}
|
709 |
}
|
710 |
|
711 |
$this->tempfilelist=array_unique($this->tempfilelist); //all files only one time in list
|
712 |
sort($this->tempfilelist);
|
713 |
+
//Check abs path
|
714 |
+
if (ABSPATH=='/' or ABSPATH=='')
|
715 |
+
$removepath='';
|
716 |
+
else
|
717 |
+
$removepath=trailingslashit(ABSPATH);
|
718 |
+
//make file list
|
719 |
+
foreach ($this->tempfilelist as $files)
|
720 |
+
$this->filelist[]=array(79001=>$files,79003=>str_replace($removepath,'',$files));
|
721 |
$this->tempfilelist=array();
|
722 |
|
723 |
if (!is_array($this->filelist[0])) {
|
724 |
trigger_error(__('No files to Backup','backwpup'),E_USER_ERROR);
|
725 |
} else {
|
726 |
+
trigger_error(__('Size of all files:','backwpup').' '.backwpup_formatBytes($this->allfilesize),E_USER_NOTICE);
|
727 |
}
|
728 |
|
729 |
}
|
1262 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
1263 |
$jobs[$this->jobid]['lastruntime']=$jobs[$this->jobid]['stoptime']-$jobs[$this->jobid]['starttime'];
|
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'];
|
app/compatibility/list-table.php
CHANGED
@@ -458,14 +458,14 @@ class WP_List_Table {
|
|
458 |
*
|
459 |
* @since 3.1.0
|
460 |
* @access protected
|
|
|
|
|
461 |
*/
|
462 |
function print_column_headers( $with_id = true ) {
|
463 |
$screen = $this->_screen;
|
464 |
|
465 |
list( $columns, $hidden, $sortable ) = $this->get_column_headers();
|
466 |
|
467 |
-
$styles = array();
|
468 |
-
|
469 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
470 |
|
471 |
if ( isset( $_GET['orderby'] ) )
|
@@ -485,8 +485,6 @@ class WP_List_Table {
|
|
485 |
if ( in_array( $column_key, $hidden ) )
|
486 |
$style = 'display:none;';
|
487 |
|
488 |
-
if ( isset( $styles[$screen->id] ) && isset( $styles[$screen->id][$column_key] ) )
|
489 |
-
$style .= ' ' . $styles[$screen->id][$column_key];
|
490 |
$style = ' style="' . $style . '"';
|
491 |
|
492 |
if ( 'cb' == $column_key )
|
458 |
*
|
459 |
* @since 3.1.0
|
460 |
* @access protected
|
461 |
+
*
|
462 |
+
* @param bool $with_id Wether to set the id attribute or not
|
463 |
*/
|
464 |
function print_column_headers( $with_id = true ) {
|
465 |
$screen = $this->_screen;
|
466 |
|
467 |
list( $columns, $hidden, $sortable ) = $this->get_column_headers();
|
468 |
|
|
|
|
|
469 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
470 |
|
471 |
if ( isset( $_GET['orderby'] ) )
|
485 |
if ( in_array( $column_key, $hidden ) )
|
486 |
$style = 'display:none;';
|
487 |
|
|
|
|
|
488 |
$style = ' style="' . $style . '"';
|
489 |
|
490 |
if ( 'cb' == $column_key )
|
app/css/options.css
CHANGED
@@ -1,11 +1,11 @@
|
|
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-
|
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 , .column-type {
|
5 |
width:125px;
|
6 |
}
|
7 |
+
.column-info {
|
8 |
+
width:175px;
|
9 |
}
|
10 |
.column-size {
|
11 |
width:75px;
|
app/functions.php
CHANGED
@@ -215,7 +215,7 @@ if ( !defined('ABSPATH') )
|
|
215 |
if (!isset($jobsettings['activated']) or !is_bool($jobsettings['activated']))
|
216 |
$jobsettings['activated']=false;
|
217 |
|
218 |
-
//upgrade
|
219 |
if (!isset($jobsettings['cron']) and isset($jobsettings['scheduletime']) and isset($jobsettings['scheduleintervaltype']) and isset($jobsettings['scheduleintervalteimes'])) { //Upgrade to cron string
|
220 |
if ($jobsettings['scheduleintervaltype']==60) { //Min
|
221 |
$jobsettings['cron']='*/'.$jobsettings['scheduleintervalteimes'].' * * * *';
|
@@ -226,15 +226,14 @@ if ( !defined('ABSPATH') )
|
|
226 |
if ($jobsettings['scheduleintervaltype']==86400) { //Days
|
227 |
$jobsettings['cron']=(date('i',$jobsettings['scheduletime'])*1).' '.date('G',$jobsettings['scheduletime']).' */'.$jobsettings['scheduleintervalteimes'].' * *';
|
228 |
}
|
229 |
-
$jobsettings['cronnextrun']=backwpup_cron_next($jobsettings['cron']);
|
230 |
}
|
231 |
|
232 |
if (!isset($jobsettings['cron']) or !is_string($jobsettings['cron']))
|
233 |
$jobsettings['cron']='0 3 * * *';
|
234 |
-
|
235 |
if (!isset($jobsettings['cronnextrun']) or !is_numeric($jobsettings['cronnextrun']))
|
236 |
-
$jobsettings['cronnextrun']=backwpup_cron_next($
|
237 |
-
|
238 |
if (!is_string($jobsettings['mailaddresslog']) or false === $pos=strpos($jobsettings['mailaddresslog'],'@') or false === strpos($jobsettings['mailaddresslog'],'.',$pos))
|
239 |
$jobsettings['mailaddresslog']=get_option('admin_email');
|
240 |
|
@@ -432,12 +431,10 @@ if ( !defined('ABSPATH') )
|
|
432 |
//On Plugin activate
|
433 |
function backwpup_plugin_activate() {
|
434 |
//remove old cron jobs
|
435 |
-
$jobs=get_option('backwpup_jobs');
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
440 |
-
}
|
441 |
}
|
442 |
}
|
443 |
wp_clear_scheduled_hook('backwpup_cron');
|
@@ -464,12 +461,10 @@ if ( !defined('ABSPATH') )
|
|
464 |
//on Plugin deaktivate
|
465 |
function backwpup_plugin_deactivate() {
|
466 |
//remove old cron jobs
|
467 |
-
$jobs=get_option('backwpup_jobs');
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
472 |
-
}
|
473 |
}
|
474 |
}
|
475 |
wp_clear_scheduled_hook('backwpup_cron');
|
@@ -499,10 +494,9 @@ if ( !defined('ABSPATH') )
|
|
499 |
return $schedules;
|
500 |
}
|
501 |
|
502 |
-
|
503 |
//cron work
|
504 |
function backwpup_cron() {
|
505 |
-
$jobs=get_option('backwpup_jobs');
|
506 |
foreach ($jobs as $jobid => $jobvalue) {
|
507 |
if (!$jobvalue['activated'])
|
508 |
continue;
|
@@ -635,24 +629,23 @@ if ( !defined('ABSPATH') )
|
|
635 |
} else {
|
636 |
echo '<i>'.__('none','backwpup').'</i><br />';
|
637 |
}
|
638 |
-
$jobs=get_option('backwpup_jobs');
|
639 |
echo '<strong>'.__('Scheduled Jobs:','backwpup').'</strong><br />';
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
echo date(get_option('date_format'),$jobvalue['cronnextrun']).' '.date(get_option('time_format'),$jobvalue['cronnextrun']);
|
649 |
-
}
|
650 |
-
echo ': <span>'.$jobvalue['name'].'</span></a><br />';
|
651 |
}
|
|
|
652 |
}
|
653 |
-
} else {
|
654 |
-
echo '<i>'.__('none','backwpup').'</i><br />';
|
655 |
}
|
|
|
|
|
|
|
656 |
}
|
657 |
|
658 |
//add dashboard widget
|
@@ -717,19 +710,92 @@ if ( !defined('ABSPATH') )
|
|
717 |
if (false !== stripos(backwpup_get_upload_dir(),$folder) and backwpup_get_upload_dir()!=$folder)
|
718 |
$excludedir[]=backwpup_get_upload_dir();
|
719 |
//Exclude Backup dirs
|
720 |
-
$jobs=get_option('backwpup_jobs');
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
$excludedir[]=trailingslashit(str_replace('\\','/',$jobsvale['backupdir']));
|
725 |
-
}
|
726 |
}
|
727 |
return $excludedir;
|
728 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
//ajax/normal get backup files and infos
|
731 |
function backwpup_get_backup_files() {
|
732 |
-
$jobs=get_option('backwpup_jobs'); //Load jobs
|
733 |
$filecounter=0;
|
734 |
$files=array();
|
735 |
$donefolders=array();
|
@@ -740,9 +806,6 @@ if ( !defined('ABSPATH') )
|
|
740 |
require_once(plugin_dir_path(__FILE__).'libs/rackspace/cloudfiles.php');
|
741 |
}
|
742 |
|
743 |
-
if (!is_array($jobs)) //return is Jobs empty
|
744 |
-
return false;
|
745 |
-
|
746 |
foreach ($jobs as $jobid => $jobvalue) { //go job by job
|
747 |
$jobvalue=backwpup_check_job_vars($jobvalue); //Check job values
|
748 |
$todo=explode('+',$jobvalue['type']); //only for backup jobs
|
@@ -1138,7 +1201,7 @@ if ( !defined('ABSPATH') )
|
|
1138 |
if (!is_writable($cfg['dirtemp'])) { // check Temp folder
|
1139 |
$message.=__('- Temp Folder not writeable:','backwpup') . ' '.$cfg['dirtemp'].'<br />';
|
1140 |
}
|
1141 |
-
$jobs=get_option('backwpup_jobs');
|
1142 |
foreach ($jobs as $jobid => $jobvalue) { //check for old cheduling
|
1143 |
if (isset($jobvalue['scheduletime']) and empty($jobvalue['cron']))
|
1144 |
$message.=__('- Please Check Scheduling time for Job:','backwpup') . ' '.$jobid.'. '.$jobvalue['name'].'<br />';
|
215 |
if (!isset($jobsettings['activated']) or !is_bool($jobsettings['activated']))
|
216 |
$jobsettings['activated']=false;
|
217 |
|
218 |
+
//upgrade old schedule
|
219 |
if (!isset($jobsettings['cron']) and isset($jobsettings['scheduletime']) and isset($jobsettings['scheduleintervaltype']) and isset($jobsettings['scheduleintervalteimes'])) { //Upgrade to cron string
|
220 |
if ($jobsettings['scheduleintervaltype']==60) { //Min
|
221 |
$jobsettings['cron']='*/'.$jobsettings['scheduleintervalteimes'].' * * * *';
|
226 |
if ($jobsettings['scheduleintervaltype']==86400) { //Days
|
227 |
$jobsettings['cron']=(date('i',$jobsettings['scheduletime'])*1).' '.date('G',$jobsettings['scheduletime']).' */'.$jobsettings['scheduleintervalteimes'].' * *';
|
228 |
}
|
|
|
229 |
}
|
230 |
|
231 |
if (!isset($jobsettings['cron']) or !is_string($jobsettings['cron']))
|
232 |
$jobsettings['cron']='0 3 * * *';
|
233 |
+
|
234 |
if (!isset($jobsettings['cronnextrun']) or !is_numeric($jobsettings['cronnextrun']))
|
235 |
+
$jobsettings['cronnextrun']=backwpup_cron_next($jobs[$jobid]['cron']);;
|
236 |
+
|
237 |
if (!is_string($jobsettings['mailaddresslog']) or false === $pos=strpos($jobsettings['mailaddresslog'],'@') or false === strpos($jobsettings['mailaddresslog'],'.',$pos))
|
238 |
$jobsettings['mailaddresslog']=get_option('admin_email');
|
239 |
|
431 |
//On Plugin activate
|
432 |
function backwpup_plugin_activate() {
|
433 |
//remove old cron jobs
|
434 |
+
$jobs=(array)get_option('backwpup_jobs');
|
435 |
+
foreach ($jobs as $jobid => $jobvalue) {
|
436 |
+
if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
437 |
+
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
|
|
|
|
438 |
}
|
439 |
}
|
440 |
wp_clear_scheduled_hook('backwpup_cron');
|
461 |
//on Plugin deaktivate
|
462 |
function backwpup_plugin_deactivate() {
|
463 |
//remove old cron jobs
|
464 |
+
$jobs=(array)get_option('backwpup_jobs');
|
465 |
+
foreach ($jobs as $jobid => $jobvalue) {
|
466 |
+
if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
467 |
+
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
|
|
|
|
468 |
}
|
469 |
}
|
470 |
wp_clear_scheduled_hook('backwpup_cron');
|
494 |
return $schedules;
|
495 |
}
|
496 |
|
|
|
497 |
//cron work
|
498 |
function backwpup_cron() {
|
499 |
+
$jobs=(array)get_option('backwpup_jobs');
|
500 |
foreach ($jobs as $jobid => $jobvalue) {
|
501 |
if (!$jobvalue['activated'])
|
502 |
continue;
|
629 |
} else {
|
630 |
echo '<i>'.__('none','backwpup').'</i><br />';
|
631 |
}
|
632 |
+
$jobs=(array)get_option('backwpup_jobs');
|
633 |
echo '<strong>'.__('Scheduled Jobs:','backwpup').'</strong><br />';
|
634 |
+
foreach ($jobs as $jobid => $jobvalue) {
|
635 |
+
if ($jobvalue['activated']) {
|
636 |
+
echo '<a href="'.wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job').'" title="'.__('Edit Job','backwpup').'">';
|
637 |
+
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
638 |
+
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
639 |
+
echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
640 |
+
} elseif ($jobvalue['activated']) {
|
641 |
+
echo date(get_option('date_format'),$jobvalue['cronnextrun']).' '.date(get_option('time_format'),$jobvalue['cronnextrun']);
|
|
|
|
|
|
|
642 |
}
|
643 |
+
echo ': <span>'.$jobvalue['name'].'</span></a><br />';
|
644 |
}
|
|
|
|
|
645 |
}
|
646 |
+
if (empty($jobs))
|
647 |
+
echo '<i>'.__('none','backwpup').'</i><br />';
|
648 |
+
|
649 |
}
|
650 |
|
651 |
//add dashboard widget
|
710 |
if (false !== stripos(backwpup_get_upload_dir(),$folder) and backwpup_get_upload_dir()!=$folder)
|
711 |
$excludedir[]=backwpup_get_upload_dir();
|
712 |
//Exclude Backup dirs
|
713 |
+
$jobs=(array)get_option('backwpup_jobs');
|
714 |
+
foreach($jobs as $jobsvale) {
|
715 |
+
if (!empty($jobsvale['backupdir']) and $jobsvale['backupdir']!='/')
|
716 |
+
$excludedir[]=trailingslashit(str_replace('\\','/',$jobsvale['backupdir']));
|
|
|
|
|
717 |
}
|
718 |
return $excludedir;
|
719 |
}
|
720 |
+
|
721 |
+
|
722 |
+
function backwpup_calc_db_size($jobvalues) {
|
723 |
+
global $wpdb;
|
724 |
+
$dbsize=array('size'=>0,'num'=>0,'rows'=>0);
|
725 |
+
$status=$wpdb->get_results("SHOW TABLE STATUS FROM `".DB_NAME."`;", ARRAY_A);
|
726 |
+
foreach($status as $tablekey => $tablevalue) {
|
727 |
+
if (!in_array($tablevalue['Name'],$jobvalues['dbexclude'])) {
|
728 |
+
$dbsize['size']=$dbsize['size']+$tablevalue["Data_length"]+$tablevalue["Index_length"];
|
729 |
+
$dbsize['num']++;
|
730 |
+
$dbsize['rows']=$dbsize['rows']+$tablevalue["Rows"];
|
731 |
+
}
|
732 |
+
}
|
733 |
+
return $dbsize;
|
734 |
+
}
|
735 |
+
|
736 |
|
737 |
+
function _backwpup_calc_file_size_file_list_folder( $folder = '', $levels = 100, $excludes=array(),$excludedirs=array()) {
|
738 |
+
global $backwpup_temp_files;
|
739 |
+
if ( !empty($folder) and $levels and $dir = @opendir( $folder )) {
|
740 |
+
while (($file = readdir( $dir ) ) !== false ) {
|
741 |
+
if ( in_array($file, array('.', '..','.svn') ) )
|
742 |
+
continue;
|
743 |
+
foreach ($excludes as $exclusion) { //exclude dirs and files
|
744 |
+
if (false !== stripos($folder.$file,$exclusion) and !empty($exclusion) and $exclusion!='/')
|
745 |
+
continue 2;
|
746 |
+
}
|
747 |
+
if ( @is_dir( $folder.$file )) {
|
748 |
+
if (!in_array(trailingslashit($folder.$file),$excludedirs))
|
749 |
+
_backwpup_calc_file_size_file_list_folder( trailingslashit($folder.$file), $levels - 1, $excludes);
|
750 |
+
} elseif (@is_file( $folder.$file )) {
|
751 |
+
if (@is_readable($folder.$file)) { //add file to filelist
|
752 |
+
$backwpup_temp_files['num']++;
|
753 |
+
$backwpup_temp_files['size']=$backwpup_temp_files['size']+filesize($folder.$file);
|
754 |
+
}
|
755 |
+
}
|
756 |
+
}
|
757 |
+
@closedir( $dir );
|
758 |
+
}
|
759 |
+
return $files;
|
760 |
+
}
|
761 |
+
|
762 |
+
function backwpup_calc_file_size($jobvalues) {
|
763 |
+
global $backwpup_temp_files;
|
764 |
+
$backwpup_temp_files=array('size'=>0,'num'=>0);
|
765 |
+
//Exclude Temp Files
|
766 |
+
$backwpup_exclude=explode(',',trim($jobvalues['fileexclude']));
|
767 |
+
$backwpup_exclude=array_unique($backwpup_exclude);
|
768 |
+
|
769 |
+
//File list for blog folders
|
770 |
+
if ($jobvalues['backuproot'])
|
771 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit(ABSPATH),100,$backwpup_exclude,array_merge($jobvalues['backuprootexcludedirs'],backwpup_get_exclude_wp_dirs(ABSPATH)));
|
772 |
+
if ($jobvalues['backupcontent'])
|
773 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit(WP_CONTENT_DIR),100,$backwpup_exclude,array_merge($jobvalues['backupcontentexcludedirs'],backwpup_get_exclude_wp_dirs(WP_CONTENT_DIR)));
|
774 |
+
if ($jobvalues['backupplugins'])
|
775 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit(WP_PLUGIN_DIR),100,$backwpup_exclude,array_merge($jobvalues['backuppluginsexcludedirs'],backwpup_get_exclude_wp_dirs(WP_PLUGIN_DIR)));
|
776 |
+
if ($jobvalues['backupthemes'])
|
777 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit(trailingslashit(WP_CONTENT_DIR).'themes'),100,$backwpup_exclude,array_merge($jobvalues['backupthemesexcludedirs'],backwpup_get_exclude_wp_dirs(trailingslashit(WP_CONTENT_DIR).'themes')));
|
778 |
+
if ($jobvalues['backupuploads'])
|
779 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit(backwpup_get_upload_dir()),100,$backwpup_exclude,array_merge($jobvalues['backupuploadsexcludedirs'],backwpup_get_exclude_wp_dirs(backwpup_get_upload_dir())));
|
780 |
+
|
781 |
+
//include dirs
|
782 |
+
if (!empty($jobvalues['dirinclude'])) {
|
783 |
+
$dirinclude=explode(',',$jobvalues['dirinclude']);
|
784 |
+
$dirinclude=array_unique($dirinclude);
|
785 |
+
//Crate file list for includes
|
786 |
+
foreach($dirinclude as $dirincludevalue) {
|
787 |
+
if (is_dir($dirincludevalue))
|
788 |
+
_backwpup_calc_file_size_file_list_folder(trailingslashit($dirincludevalue),100,$backwpup_exclude);
|
789 |
+
}
|
790 |
+
}
|
791 |
+
|
792 |
+
return $backwpup_temp_files;
|
793 |
+
|
794 |
+
}
|
795 |
+
|
796 |
//ajax/normal get backup files and infos
|
797 |
function backwpup_get_backup_files() {
|
798 |
+
$jobs=(array)get_option('backwpup_jobs'); //Load jobs
|
799 |
$filecounter=0;
|
800 |
$files=array();
|
801 |
$donefolders=array();
|
806 |
require_once(plugin_dir_path(__FILE__).'libs/rackspace/cloudfiles.php');
|
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
|
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']))
|
1207 |
$message.=__('- Please Check Scheduling time for Job:','backwpup') . ' '.$jobid.'. '.$jobvalue['name'].'<br />';
|
app/list-tables.php
CHANGED
@@ -23,7 +23,18 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
23 |
}
|
24 |
|
25 |
function prepare_items() {
|
|
|
26 |
$this->items=get_option('backwpup_jobs');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
function no_items() {
|
@@ -43,6 +54,7 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
43 |
$posts_columns['id'] = __('ID','backwpup');
|
44 |
$posts_columns['jobname'] = __('Job Name','backwpup');
|
45 |
$posts_columns['type'] = __('Type','backwpup');
|
|
|
46 |
$posts_columns['next'] = __('Next Run','backwpup');
|
47 |
$posts_columns['last'] = __('Last Run','backwpup');
|
48 |
return $posts_columns;
|
@@ -66,6 +78,7 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
66 |
}
|
67 |
|
68 |
function single_row( $jobid, $jobvalue, $style = '' ) {
|
|
|
69 |
list( $columns, $hidden ) = $this->get_column_headers();
|
70 |
$r = "<tr id='jodid-$jobid'$style>";
|
71 |
foreach ( $columns as $column_name => $column_display_name ) {
|
@@ -87,10 +100,14 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
87 |
case 'jobname':
|
88 |
$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>";
|
89 |
$actions = array();
|
90 |
-
$
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
$action_count = count($actions);
|
95 |
$i = 0;
|
96 |
$r .= '<br /><div class="row-actions">';
|
@@ -101,22 +118,44 @@ class BackWPup_Jobs_Table extends WP_List_Table {
|
|
101 |
}
|
102 |
$r .= '</div>';
|
103 |
$r .= '</td>';
|
104 |
-
break;
|
105 |
case 'type':
|
106 |
$r .= "<td $attributes>";
|
107 |
$r .= backwpup_backup_types($jobvalue['type'],false);
|
108 |
$r .= "</td>";
|
109 |
-
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
case 'next':
|
111 |
$r .= "<td $attributes>";
|
112 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
113 |
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
114 |
$r .= __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
115 |
-
} elseif (
|
116 |
$r .= date(get_option('date_format'),$jobvalue['cronnextrun']).'<br />'. date(get_option('time_format'),$jobvalue['cronnextrun']);
|
117 |
} else {
|
118 |
$r .= __('Inactive','backwpup');
|
119 |
}
|
|
|
|
|
|
|
120 |
$r .= "</td>";
|
121 |
break;
|
122 |
case 'last':
|
23 |
}
|
24 |
|
25 |
function prepare_items() {
|
26 |
+
global $mode;
|
27 |
$this->items=get_option('backwpup_jobs');
|
28 |
+
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
|
29 |
+
}
|
30 |
+
|
31 |
+
function pagination( $which ) {
|
32 |
+
global $mode;
|
33 |
+
|
34 |
+
parent::pagination( $which );
|
35 |
+
|
36 |
+
if ( 'top' == $which )
|
37 |
+
$this->view_switcher( $mode );
|
38 |
}
|
39 |
|
40 |
function no_items() {
|
54 |
$posts_columns['id'] = __('ID','backwpup');
|
55 |
$posts_columns['jobname'] = __('Job Name','backwpup');
|
56 |
$posts_columns['type'] = __('Type','backwpup');
|
57 |
+
$posts_columns['info'] = __('Information','backwpup');
|
58 |
$posts_columns['next'] = __('Next Run','backwpup');
|
59 |
$posts_columns['last'] = __('Last Run','backwpup');
|
60 |
return $posts_columns;
|
78 |
}
|
79 |
|
80 |
function single_row( $jobid, $jobvalue, $style = '' ) {
|
81 |
+
global $mode;
|
82 |
list( $columns, $hidden ) = $this->get_column_headers();
|
83 |
$r = "<tr id='jodid-$jobid'$style>";
|
84 |
foreach ( $columns as $column_name => $column_display_name ) {
|
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) . "\">" . __('Abort','backwpup') . "</a>";
|
110 |
+
}
|
111 |
$action_count = count($actions);
|
112 |
$i = 0;
|
113 |
$r .= '<br /><div class="row-actions">';
|
118 |
}
|
119 |
$r .= '</div>';
|
120 |
$r .= '</td>';
|
121 |
+
break;
|
122 |
case 'type':
|
123 |
$r .= "<td $attributes>";
|
124 |
$r .= backwpup_backup_types($jobvalue['type'],false);
|
125 |
$r .= "</td>";
|
126 |
+
break;
|
127 |
+
case 'info':
|
128 |
+
$r .= "<td $attributes>";
|
129 |
+
if (in_array('FILE',explode('+',$jobvalue['type']))) {
|
130 |
+
$files=backwpup_calc_file_size($jobvalue);
|
131 |
+
$r .= __("Files Size:","backwpup")." ".backwpup_formatBytes($files['size'])."<br />";
|
132 |
+
if ( 'excerpt' == $mode ) {
|
133 |
+
$r .= __("Files count:","backwpup")." ".$files['num']."<br />";
|
134 |
+
}
|
135 |
+
}
|
136 |
+
if (in_array('DB',explode('+',$jobvalue['type'])) or in_array('OPTIMIZE',explode('+',$jobvalue['type'])) or in_array('CHECK',explode('+',$jobvalue['type']))) {
|
137 |
+
$dbsize=backwpup_calc_db_size($jobvalue);
|
138 |
+
$r .= "DB Size: ".backwpup_formatBytes($dbsize['size'])."<br />";
|
139 |
+
if ( 'excerpt' == $mode ) {
|
140 |
+
$r .= __("DB Tables:","backwpup")." ".$dbsize['num']."<br />";
|
141 |
+
$r .= __("DB Rows:","backwpup")." ".$dbsize['rows']."<br />";
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$r .= "</td>";
|
145 |
+
break;
|
146 |
case 'next':
|
147 |
$r .= "<td $attributes>";
|
148 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
149 |
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
150 |
$r .= __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
151 |
+
} elseif ($jobvalue['activated']) {
|
152 |
$r .= date(get_option('date_format'),$jobvalue['cronnextrun']).'<br />'. date(get_option('time_format'),$jobvalue['cronnextrun']);
|
153 |
} else {
|
154 |
$r .= __('Inactive','backwpup');
|
155 |
}
|
156 |
+
if ( 'excerpt' == $mode ) {
|
157 |
+
$r .= '<br />'.__('<a href="http://wikipedia.org/wiki/Cron" target="_blank">Cron</a>:','backwpup').' '.$jobvalue['cron'];
|
158 |
+
}
|
159 |
$r .= "</td>";
|
160 |
break;
|
161 |
case 'last':
|
app/options-save.php
CHANGED
@@ -29,6 +29,38 @@ function backwpup_job_operations($action) {
|
|
29 |
$jobs[$newjobid]['activated']=false;
|
30 |
update_option('backwpup_jobs',$jobs);
|
31 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
34 |
|
29 |
$jobs[$newjobid]['activated']=false;
|
30 |
update_option('backwpup_jobs',$jobs);
|
31 |
break;
|
32 |
+
case 'clear': //Abort Job
|
33 |
+
$jobid = (int) $_GET['jobid'];
|
34 |
+
check_admin_referer('clear-job_'.$jobid);
|
35 |
+
$jobs=get_option('backwpup_jobs');
|
36 |
+
if (is_file($jobs[$jobid]['logfile'])) {
|
37 |
+
$fd=fopen($jobs[$jobid]['logfile'],"a+");
|
38 |
+
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 Cleand by User!!!','backwpup')."</span><br />\n");
|
39 |
+
fputs($fd,"</body>\n</html>\n");
|
40 |
+
fclose($fd);
|
41 |
+
$logheader=backwpup_read_logheader($jobs[$jobid]['logfile']); //read waring count from log header
|
42 |
+
$logheader['errors']++;
|
43 |
+
//write new log header
|
44 |
+
$fd=@fopen($jobs[$jobid]['logfile'],"r+");
|
45 |
+
while (!feof($fd)) {
|
46 |
+
$line=@fgets($fd);
|
47 |
+
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
48 |
+
@fseek($fd,$filepos);
|
49 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_errors\" content=\"".$logheader['errors']."\" />",100)."\n");
|
50 |
+
break;
|
51 |
+
}
|
52 |
+
$filepos=ftell($fd);
|
53 |
+
}
|
54 |
+
@fclose($fd);
|
55 |
+
}
|
56 |
+
$jobs[$jobid]['cronnextrun']=backwpup_cron_next($jobs[$jobid]['cron']);
|
57 |
+
$jobs[$jobid]['stoptime']=current_time('timestamp');
|
58 |
+
$jobs[$jobid]['lastrun']=$jobs[$jobid]['starttime'];
|
59 |
+
$jobs[$jobid]['lastruntime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
|
60 |
+
$jobs[$jobid]['starttime']='';
|
61 |
+
$jobs[$jobid]['logfile']='';
|
62 |
+
update_option('backwpup_jobs',$jobs);
|
63 |
+
break;
|
64 |
}
|
65 |
}
|
66 |
|
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.1
|
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.1');
|
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,15 @@ Place mail only little archives
|
|
82 |
1. Job Page
|
83 |
|
84 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
= 1.3.0 =
|
86 |
* added S3 new region codes for bucket creation
|
87 |
* added S3 REDUCED REDUNDANCY support on put Backups
|
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.1
|
8 |
|
9 |
Backup and more of your WordPress Blog Database and Files
|
10 |
|
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
|
88 |
+
* fixed bug in automatic job abortion
|
89 |
+
* fixed bug in ABSPATH if it '/'
|
90 |
+
* fiexd bug in save settings
|
91 |
+
* fiexd bugs if no jobs exists
|
92 |
+
* added link to clear running jobs
|
93 |
+
|
94 |
= 1.3.0 =
|
95 |
* added S3 new region codes for bucket creation
|
96 |
* added S3 REDUCED REDUNDANCY support on put Backups
|