Backup plugin fixes.
git-svn-id: https://develop.svn.wordpress.org/trunk@3815 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8409e85f53
commit
7a7ee3d93c
@ -38,13 +38,13 @@ class wpdbBackup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function wpdbBackup() {
|
function wpdbBackup() {
|
||||||
|
|
||||||
add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
|
add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
|
||||||
|
|
||||||
$this->backup_dir = trailingslashit($this->backup_dir);
|
$this->backup_dir = trailingslashit($this->backup_dir);
|
||||||
$this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
|
$this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
|
||||||
|
|
||||||
if (isset($_POST['do_backup'])) {
|
if (isset($_POST['do_backup'])) {
|
||||||
|
if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
|
||||||
switch($_POST['do_backup']) {
|
switch($_POST['do_backup']) {
|
||||||
case 'backup':
|
case 'backup':
|
||||||
$this->perform_backup();
|
$this->perform_backup();
|
||||||
@ -54,19 +54,19 @@ class wpdbBackup {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif (isset($_GET['fragment'] )) {
|
} elseif (isset($_GET['fragment'] )) {
|
||||||
|
if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
|
||||||
add_action('init', array(&$this, 'init'));
|
add_action('init', array(&$this, 'init'));
|
||||||
} elseif (isset($_GET['backup'] )) {
|
} elseif (isset($_GET['backup'] )) {
|
||||||
|
if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
|
||||||
add_action('init', array(&$this, 'init'));
|
add_action('init', array(&$this, 'init'));
|
||||||
} else {
|
} else {
|
||||||
|
if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
|
||||||
add_action('admin_menu', array(&$this, 'admin_menu'));
|
add_action('admin_menu', array(&$this, 'admin_menu'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
global $user_level;
|
if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.'));
|
||||||
get_currentuserinfo();
|
|
||||||
|
|
||||||
if ($user_level < 9) die(__('Need higher user level.'));
|
|
||||||
|
|
||||||
if (isset($_GET['backup'])) {
|
if (isset($_GET['backup'])) {
|
||||||
$via = isset($_GET['via']) ? $_GET['via'] : 'http';
|
$via = isset($_GET['via']) ? $_GET['via'] : 'http';
|
||||||
@ -309,7 +309,7 @@ class wpdbBackup {
|
|||||||
|
|
||||||
$core_tables = $_POST['core_tables'];
|
$core_tables = $_POST['core_tables'];
|
||||||
$this->backup_file = $this->db_backup($core_tables, $also_backup);
|
$this->backup_file = $this->db_backup($core_tables, $also_backup);
|
||||||
if (FALSE !== $backup_file) {
|
if (FALSE !== $this->backup_file) {
|
||||||
if ('smtp' == $_POST['deliver']) {
|
if ('smtp' == $_POST['deliver']) {
|
||||||
$this->deliver_backup ($this->backup_file, $_POST['deliver'], $_POST['backup_recipient']);
|
$this->deliver_backup ($this->backup_file, $_POST['deliver'], $_POST['backup_recipient']);
|
||||||
} elseif ('http' == $_POST['deliver']) {
|
} elseif ('http' == $_POST['deliver']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user