Version Description
- fixed bugs in DB restore
- use WP functions to get plugin dirs
Download this release
Release Info
Developer | danielhuesken |
Plugin | BackWPup – WordPress Backup Plugin |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- app/functions.php +14 -14
- app/options-runnow-iframe.php +2 -4
- app/tools/db_restore.php +19 -6
- backwpup.php +5 -5
- readme.txt +5 -1
app/functions.php
CHANGED
@@ -19,8 +19,8 @@ if ( !defined('ABSPATH') )
|
|
19 |
case 'tools':
|
20 |
break;
|
21 |
case 'runnow':
|
22 |
-
add_action('load-'.$hook, '
|
23 |
-
add_action('admin_head-'.$hook, '
|
24 |
break;
|
25 |
case 'view_log':
|
26 |
break;
|
@@ -58,32 +58,32 @@ if ( !defined('ABSPATH') )
|
|
58 |
$jobs=get_option('backwpup_jobs');
|
59 |
$jobid = (int) $_REQUEST['jobid'];
|
60 |
check_admin_referer('edit-job');
|
61 |
-
require_once(
|
62 |
break;
|
63 |
case 'logs':
|
64 |
$cfg=get_option('backwpup');
|
65 |
-
require_once(
|
66 |
break;
|
67 |
case 'settings':
|
68 |
$cfg=get_option('backwpup');
|
69 |
-
require_once(
|
70 |
break;
|
71 |
case 'tools':
|
72 |
-
require_once(
|
73 |
break;
|
74 |
case 'runnow':
|
75 |
$jobid = (int) $_GET['jobid'];
|
76 |
check_admin_referer('runnow-job_' . $jobid);
|
77 |
$jobs=get_option('backwpup_jobs');
|
78 |
-
require_once(
|
79 |
break;
|
80 |
case 'view_log':
|
81 |
check_admin_referer('view-log_'.basename($_GET['logfile']));
|
82 |
-
require_once(
|
83 |
break;
|
84 |
default:
|
85 |
$jobs=get_option('backwpup_jobs');
|
86 |
-
require_once(
|
87 |
break;
|
88 |
}
|
89 |
}
|
@@ -97,7 +97,7 @@ if ( !defined('ABSPATH') )
|
|
97 |
wp_enqueue_style('BackWpup',plugins_url('css/options.css',__FILE__),'',BACKWPUP_VERSION,'screen');
|
98 |
wp_enqueue_script('BackWpupOptions',plugins_url('js/options.js',__FILE__),'',BACKWPUP_VERSION,true);
|
99 |
//For save Options
|
100 |
-
require_once(
|
101 |
}
|
102 |
|
103 |
//delete Otions
|
@@ -162,7 +162,7 @@ if ( !defined('ABSPATH') )
|
|
162 |
|
163 |
//add links on plugins page
|
164 |
function backwpup_plugin_links($links, $file) {
|
165 |
-
if ($file ==
|
166 |
$links[] = '<a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
|
167 |
$links[] = '<a href="http://wordpress.org/tags/backwpup/" target="_blank">' . __('Support') . '</a>';
|
168 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
|
@@ -338,14 +338,14 @@ if ( !defined('ABSPATH') )
|
|
338 |
}
|
339 |
|
340 |
//turn cache off
|
341 |
-
function
|
342 |
echo "<meta http-equiv=\"expires\" content=\"0\" />\n";
|
343 |
echo "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n";
|
344 |
echo "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n";
|
345 |
}
|
346 |
|
347 |
|
348 |
-
function
|
349 |
header("Expires: 0");
|
350 |
header("Cache-Control: no-cache, must-revalidate");
|
351 |
header("Pragma: no-cache");
|
@@ -363,7 +363,7 @@ if ( !defined('ABSPATH') )
|
|
363 |
add_action('admin_menu', 'backwpup_menu_entry');
|
364 |
//Additional links on the plugin page
|
365 |
if (current_user_can(10))
|
366 |
-
add_filter('plugin_action_links_'.
|
367 |
if (current_user_can('install_plugins'))
|
368 |
add_filter('plugin_row_meta', 'backwpup_plugin_links',10,2);
|
369 |
//add cron intervals
|
19 |
case 'tools':
|
20 |
break;
|
21 |
case 'runnow':
|
22 |
+
add_action('load-'.$hook, 'backwpup_send_no_cache_header');
|
23 |
+
add_action('admin_head-'.$hook, 'backwpup_meta_no_cache');
|
24 |
break;
|
25 |
case 'view_log':
|
26 |
break;
|
58 |
$jobs=get_option('backwpup_jobs');
|
59 |
$jobid = (int) $_REQUEST['jobid'];
|
60 |
check_admin_referer('edit-job');
|
61 |
+
require_once(plugin_dir_path(__FILE__).'options-jobs.php');
|
62 |
break;
|
63 |
case 'logs':
|
64 |
$cfg=get_option('backwpup');
|
65 |
+
require_once(plugin_dir_path(__FILE__).'options-logs.php');
|
66 |
break;
|
67 |
case 'settings':
|
68 |
$cfg=get_option('backwpup');
|
69 |
+
require_once(plugin_dir_path(__FILE__).'options-settings.php');
|
70 |
break;
|
71 |
case 'tools':
|
72 |
+
require_once(plugin_dir_path(__FILE__).'options-tools.php');
|
73 |
break;
|
74 |
case 'runnow':
|
75 |
$jobid = (int) $_GET['jobid'];
|
76 |
check_admin_referer('runnow-job_' . $jobid);
|
77 |
$jobs=get_option('backwpup_jobs');
|
78 |
+
require_once(plugin_dir_path(__FILE__).'options-runnow.php');
|
79 |
break;
|
80 |
case 'view_log':
|
81 |
check_admin_referer('view-log_'.basename($_GET['logfile']));
|
82 |
+
require_once(plugin_dir_path(__FILE__).'options-view_log.php');
|
83 |
break;
|
84 |
default:
|
85 |
$jobs=get_option('backwpup_jobs');
|
86 |
+
require_once(plugin_dir_path(__FILE__).'options.php');
|
87 |
break;
|
88 |
}
|
89 |
}
|
97 |
wp_enqueue_style('BackWpup',plugins_url('css/options.css',__FILE__),'',BACKWPUP_VERSION,'screen');
|
98 |
wp_enqueue_script('BackWpupOptions',plugins_url('js/options.js',__FILE__),'',BACKWPUP_VERSION,true);
|
99 |
//For save Options
|
100 |
+
require_once(plugin_dir_path(__FILE__).'options-save.php');
|
101 |
}
|
102 |
|
103 |
//delete Otions
|
162 |
|
163 |
//add links on plugins page
|
164 |
function backwpup_plugin_links($links, $file) {
|
165 |
+
if ($file == BACKWPUP_PLUGIN_BASEDIR.'/backwpup.php') {
|
166 |
$links[] = '<a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
|
167 |
$links[] = '<a href="http://wordpress.org/tags/backwpup/" target="_blank">' . __('Support') . '</a>';
|
168 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
|
338 |
}
|
339 |
|
340 |
//turn cache off
|
341 |
+
function backwpup_meta_no_cache() {
|
342 |
echo "<meta http-equiv=\"expires\" content=\"0\" />\n";
|
343 |
echo "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n";
|
344 |
echo "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n";
|
345 |
}
|
346 |
|
347 |
|
348 |
+
function backwpup_send_no_cache_header() {
|
349 |
header("Expires: 0");
|
350 |
header("Cache-Control: no-cache, must-revalidate");
|
351 |
header("Pragma: no-cache");
|
363 |
add_action('admin_menu', 'backwpup_menu_entry');
|
364 |
//Additional links on the plugin page
|
365 |
if (current_user_can(10))
|
366 |
+
add_filter('plugin_action_links_'.BACKWPUP_PLUGIN_BASEDIR.'/backwpup.php', 'backwpup_plugin_options_link');
|
367 |
if (current_user_can('install_plugins'))
|
368 |
add_filter('plugin_row_meta', 'backwpup_plugin_links',10,2);
|
369 |
//add cron intervals
|
app/options-runnow-iframe.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
if (is_dir($_GET['ABSPATH']) and is_numeric($_GET['jobid'])) {
|
3 |
require_once($_GET['ABSPATH'].'/wp-load.php'); /** Setup WordPress environment */
|
4 |
check_admin_referer('dojob-now_' . (int)$_GET['jobid']);
|
5 |
-
|
6 |
ignore_user_abort(true);
|
7 |
// flush any buffers and send the headers
|
8 |
@apache_setenv('no-gzip', 1);
|
@@ -14,9 +14,7 @@ if (is_dir($_GET['ABSPATH']) and is_numeric($_GET['jobid'])) {
|
|
14 |
?>
|
15 |
<html>
|
16 |
<head>
|
17 |
-
|
18 |
-
<meta http-equiv="pragma" content="no-cache">
|
19 |
-
<meta http-equiv="cache-control" content="no-cache">
|
20 |
<title><?PHP _e('Do Job','backwpup'); ?></title>
|
21 |
</head>
|
22 |
<body style="font-family:monospace;font-size:12px;white-space:nowrap;">
|
2 |
if (is_dir($_GET['ABSPATH']) and is_numeric($_GET['jobid'])) {
|
3 |
require_once($_GET['ABSPATH'].'/wp-load.php'); /** Setup WordPress environment */
|
4 |
check_admin_referer('dojob-now_' . (int)$_GET['jobid']);
|
5 |
+
backwpup_send_no_cache_header();
|
6 |
ignore_user_abort(true);
|
7 |
// flush any buffers and send the headers
|
8 |
@apache_setenv('no-gzip', 1);
|
14 |
?>
|
15 |
<html>
|
16 |
<head>
|
17 |
+
<?PHP backwpup_meta_no_cache(); ?>
|
|
|
|
|
18 |
<title><?PHP _e('Do Job','backwpup'); ?></title>
|
19 |
</head>
|
20 |
<body style="font-family:monospace;font-size:12px;white-space:nowrap;">
|
app/tools/db_restore.php
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
// don't load directly
|
3 |
if ( !defined('ABSPATH') )
|
4 |
die('-1');
|
5 |
-
|
|
|
|
|
6 |
ignore_user_abort(true);
|
7 |
|
8 |
@set_time_limit(0); //300 is most webserver time limit.
|
@@ -12,7 +14,10 @@ $oldblogabspath="";
|
|
12 |
$oldblogurl="";
|
13 |
$oldtabelprefix="";
|
14 |
$numcommands="";
|
15 |
-
|
|
|
|
|
|
|
16 |
$blogabspath=trailingslashit(ABSPATH);
|
17 |
|
18 |
$file = fopen ($sqlfile, "r");
|
@@ -69,12 +74,20 @@ fclose($file);
|
|
69 |
echo sprintf(__('%1$s Database Querys done.','backwpup'),$numcommands).'<br />';
|
70 |
echo __('Make changes for Blogurl and ABSPATH if needed.','backwpup')."<br />";
|
71 |
if (!empty($oldblogurl) and $oldblogurl!=$blogurl) {
|
72 |
-
mysql_query("UPDATE
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
if (!empty($oldblogabspath) and $oldblogabspath!=$blogabspath) {
|
77 |
-
mysql_query("UPDATE
|
|
|
|
|
78 |
}
|
79 |
echo __('Restore Done. Please delete the SQL file after Restore.','backwpup')."<br />";
|
80 |
|
2 |
// don't load directly
|
3 |
if ( !defined('ABSPATH') )
|
4 |
die('-1');
|
5 |
+
|
6 |
+
global $wpdb;
|
7 |
+
|
8 |
ignore_user_abort(true);
|
9 |
|
10 |
@set_time_limit(0); //300 is most webserver time limit.
|
14 |
$oldblogurl="";
|
15 |
$oldtabelprefix="";
|
16 |
$numcommands="";
|
17 |
+
if (defined(WP_SITEURL))
|
18 |
+
$blogurl=trailingslashit(WP_SITEURL);
|
19 |
+
else
|
20 |
+
$blogurl=trailingslashit(get_option('siteurl'));
|
21 |
$blogabspath=trailingslashit(ABSPATH);
|
22 |
|
23 |
$file = fopen ($sqlfile, "r");
|
74 |
echo sprintf(__('%1$s Database Querys done.','backwpup'),$numcommands).'<br />';
|
75 |
echo __('Make changes for Blogurl and ABSPATH if needed.','backwpup')."<br />";
|
76 |
if (!empty($oldblogurl) and $oldblogurl!=$blogurl) {
|
77 |
+
mysql_query("UPDATE ".$wpdb->prefix."options SET option_value = replace(option_value, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');");
|
78 |
+
if ($sqlerr=mysql_error())
|
79 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "UPDATE ".$wpdb->prefix."options SET option_value = replace(option_value, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');")."<br />\n";
|
80 |
+
mysql_query("UPDATE ".$wpdb->prefix."posts SET guid = replace(guid, '".untrailingslashit($oldblogurl)."','".untrailingslashit($blogurl)."');");
|
81 |
+
if ($sqlerr=mysql_error())
|
82 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "UPDATE ".$wpdb->prefix."posts SET guid = replace(guid, '".untrailingslashit($oldblogurl)."','".untrailingslashit($blogurl)."');")."<br />\n";
|
83 |
+
mysql_query("UPDATE ".$wpdb->prefix."posts SET post_content = replace(post_content, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');");
|
84 |
+
if ($sqlerr=mysql_error())
|
85 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "UPDATE ".$wpdb->prefix."posts SET post_content = replace(post_content, '".untrailingslashit($oldblogurl)."', '".untrailingslashit($blogurl)."');")."<br />\n";
|
86 |
}
|
87 |
if (!empty($oldblogabspath) and $oldblogabspath!=$blogabspath) {
|
88 |
+
mysql_query("UPDATE ".$wpdb->prefix."options SET option_value = replace(option_value, '".untrailingslashit($oldblogabspath)."', '".untrailingslashit($blogabspath)."');");
|
89 |
+
if ($sqlerr=mysql_error())
|
90 |
+
echo __('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "UPDATE ".$wpdb->prefix."options SET option_value = replace(option_value, '".untrailingslashit($oldblogabspath)."', '".untrailingslashit($blogabspath)."');")."<br />\n";
|
91 |
}
|
92 |
echo __('Restore Done. Please delete the SQL file after Restore.','backwpup')."<br />";
|
93 |
|
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/
|
@@ -33,13 +33,13 @@ if ( !defined('ABSPATH') )
|
|
33 |
die('-1');
|
34 |
|
35 |
//Set plugin dirname
|
36 |
-
define('
|
37 |
//Set Plugin Version
|
38 |
-
define('BACKWPUP_VERSION', '1.0.
|
39 |
//load Text Domain
|
40 |
-
load_plugin_textdomain('backwpup', false,
|
41 |
//Load functions file
|
42 |
-
require_once(
|
43 |
//Plugin activate
|
44 |
register_activation_hook(__FILE__, 'backwpup_plugin_activate');
|
45 |
//Plugin deactivate
|
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.4
|
8 |
Author URI: http://danielhuesken.de
|
9 |
Text Domain: backwpup
|
10 |
Domain Path: /lang/
|
33 |
die('-1');
|
34 |
|
35 |
//Set plugin dirname
|
36 |
+
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
37 |
//Set Plugin Version
|
38 |
+
define('BACKWPUP_VERSION', '1.0.4');
|
39 |
//load Text Domain
|
40 |
+
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
41 |
//Load functions file
|
42 |
+
require_once(plugin_dir_path(__FILE__).'app/functions.php');
|
43 |
//Plugin activate
|
44 |
register_activation_hook(__FILE__, 'backwpup_plugin_activate');
|
45 |
//Plugin deactivate
|
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,10 @@ Pleace mail only littele archives
|
|
81 |
1. Job Page
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
|
|
|
|
84 |
= 1.0.3 =
|
85 |
* hopfuly fixed a chche problem on runnow
|
86 |
|
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.4
|
8 |
|
9 |
Backup and more of your WordPress Blog Database and Files
|
10 |
|
81 |
1. Job Page
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 1.0.4 =
|
85 |
+
* fixed bugs in DB restore
|
86 |
+
* use WP functions to get plugin dirs
|
87 |
+
|
88 |
= 1.0.3 =
|
89 |
* hopfuly fixed a chche problem on runnow
|
90 |
|