diff -r 34716fd837a4 -r be944660c56a wp/wp-content/plugins/wp-db-backup/wp-db-backup.php
--- a/wp/wp-content/plugins/wp-db-backup/wp-db-backup.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-content/plugins/wp-db-backup/wp-db-backup.php Wed Sep 21 18:19:35 2022 +0200
@@ -1,88 +1,96 @@
Tools → Backup to get started.
-Author: Austin Matzko
-Author URI: http://austinmatzko.com/
-Version: 2.3.3
+Author: Delicious Brains
+Author URI: https://deliciousbrains.com
+Version: 2.4
+Domain Path: /languages
Copyright 2018 Austin Matzko (email : austin at pressedcode.com)
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
-if ( ! defined('ABSPATH') ) {
- die('Please do not load this file directly.');
+if ( ! defined( 'ABSPATH' ) ) {
+ die( 'Please do not load this file directly.' );
}
-$rand = substr( md5( md5( DB_PASSWORD ) ), -5 );
-global $wpdbb_content_dir, $wpdbb_content_url;
-$wpdbb_content_dir = ( defined('WP_CONTENT_DIR') ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';
-$wpdbb_content_url = ( defined('WP_CONTENT_URL') ) ? WP_CONTENT_URL : get_option('siteurl') . '/wp-content';
-
-if ( ! defined('ROWS_PER_SEGMENT') ) {
- define('ROWS_PER_SEGMENT', 100);
+if ( ! defined( 'DBBWP_ROWS_PER_SEGMENT' ) ) {
+ define( 'DBBWP_ROWS_PER_SEGMENT', 100 );
}
/**
- * Set MOD_EVASIVE_OVERRIDE to true
- * and increase MOD_EVASIVE_DELAY
+ * Set DBBWP_MOD_EVASIVE_OVERRIDE to true
+ * and increase DBBWP_MOD_EVASIVE_DELAY
* if the backup stops prematurely.
*/
-// define('MOD_EVASIVE_OVERRIDE', false);
-if ( ! defined('MOD_EVASIVE_DELAY') ) {
- define('MOD_EVASIVE_DELAY', '500');
+// define('DBBWP_MOD_EVASIVE_OVERRIDE', false);
+if ( ! defined( 'DBBWP_MOD_EVASIVE_DELAY' ) ) {
+ define( 'DBBWP_MOD_EVASIVE_DELAY', '500' );
}
class wpdbBackup {
var $backup_complete = false;
- var $backup_file = '';
+ var $backup_file = '';
var $backup_filename;
var $core_table_names = array();
- var $errors = array();
+ var $errors = array();
var $basename;
var $page_url;
var $referer_check_key;
- var $version = '2.3.3';
+ var $version = '2.4';
function module_check() {
$mod_evasive = false;
- if ( defined( 'MOD_EVASIVE_OVERRIDE' ) && true === MOD_EVASIVE_OVERRIDE ) return true;
- if ( ! defined( 'MOD_EVASIVE_OVERRIDE' ) || false === MOD_EVASIVE_OVERRIDE ) return false;
- if ( function_exists('apache_get_modules') )
- foreach( (array) apache_get_modules() as $mod )
- if ( false !== strpos($mod,'mod_evasive') || false !== strpos($mod,'mod_dosevasive') )
+
+ if ( defined( 'DBBWP_MOD_EVASIVE_OVERRIDE' ) && true === DBBWP_MOD_EVASIVE_OVERRIDE ) {
+ return true;
+ }
+
+ if ( ! defined( 'DBBWP_MOD_EVASIVE_OVERRIDE' ) || false === DBBWP_MOD_EVASIVE_OVERRIDE ) {
+ return false;
+ }
+
+ if ( function_exists( 'apache_get_modules' ) ) {
+ foreach ( (array) apache_get_modules() as $mod ) {
+ if ( false !== strpos( $mod, 'mod_evasive' ) || false !== strpos( $mod, 'mod_dosevasive' ) ) {
return true;
+ }
+ }
+ }
+
return false;
}
function __construct() {
global $table_prefix, $wpdb;
- add_action('wp_ajax_save_backup_time', array(&$this, 'save_backup_time'));
- add_action('init', array(&$this, 'init_textdomain'));
- add_action('init', array(&$this, 'set_page_url'));
- add_action('admin_init', array(&$this, 'update_notice_action'));
- add_action('wp_db_backup_cron', array(&$this, 'cron_backup'));
- add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
- add_filter('cron_schedules', array(&$this, 'add_sched_options'));
- add_filter('wp_db_b_schedule_choices', array(&$this, 'schedule_choices'));
- $table_prefix = ( isset( $table_prefix ) ) ? $table_prefix : $wpdb->prefix;
- $datum = date("Ymd_B");
+ add_action( 'wp_ajax_save_backup_time', array( &$this, 'save_backup_time' ) );
+ add_action( 'init', array( &$this, 'init_textdomain' ) );
+ add_action( 'init', array( &$this, 'set_page_url' ) );
+ add_action( 'admin_notices', array( &$this, 'update_notice' ) );
+ add_action( 'wp_db_backup_cron', array( &$this, 'cron_backup' ) );
+ add_action( 'wp_cron_daily', array( &$this, 'wp_cron_daily' ) );
+ add_filter( 'cron_schedules', array( &$this, 'add_sched_options' ) );
+ add_filter( 'wp_db_b_schedule_choices', array( &$this, 'schedule_choices' ) );
+
+ $table_prefix = ( isset( $table_prefix ) ) ? $table_prefix : $wpdb->prefix;
+ $datum = date( 'Ymd_B' );
$this->backup_filename = DB_NAME . "_$table_prefix$datum.sql";
$possible_names = array(
@@ -99,150 +107,167 @@
'terms',
'term_taxonomy',
'term_relationships',
+ 'termmeta',
'users',
'usermeta',
);
- foreach( $possible_names as $name ) {
+ foreach ( $possible_names as $name ) {
if ( isset( $wpdb->{$name} ) ) {
$this->core_table_names[] = $wpdb->{$name};
}
}
- $requested_temp_dir = sanitize_text_field($_GET['wp_db_temp_dir']);
- $this->backup_dir = trailingslashit(apply_filters('wp_db_b_backup_dir', (isset($requested_temp_dir) && is_writable($requested_temp_dir)) ? $requested_temp_dir : get_temp_dir()));
- $this->basename = 'wp-db-backup';
+ $tmp_dir = get_temp_dir();
+
+ if ( isset( $_GET['wp_db_temp_dir'] ) ) {
+ $requested_dir = sanitize_text_field( $_GET['wp_db_temp_dir'] );
+ if ( is_writeable( $requested_dir ) ) {
+ $tmp_dir = $requested_dir;
+ }
+ }
+
+ $this->backup_dir = trailingslashit( apply_filters( 'wp_db_b_backup_dir', $tmp_dir ) );
+ $this->basename = 'wp-db-backup';
$this->referer_check_key = $this->basename . '-download_' . DB_NAME;
- if (isset($_POST['do_backup'])) {
- $this->wp_secure('fatal');
- check_admin_referer($this->referer_check_key);
- $this->can_user_backup('main');
+ if ( isset( $_POST['do_backup'] ) ) {
+ $this->wp_secure( 'fatal' );
+ check_admin_referer( $this->referer_check_key );
+ $this->can_user_backup( 'main' );
// save exclude prefs
- update_option('wp_db_backup_excs', array(
- 'revisions' => $this->get_revisions_to_exclude(),
- 'spam' => $this->get_spam_to_exclude()
- ));
- switch($_POST['do_backup']) {
- case 'backup':
- add_action('init', array(&$this, 'perform_backup'));
- break;
- case 'fragments':
- add_action('admin_menu', array(&$this, 'fragment_menu'));
- break;
+ update_option(
+ 'wp_db_backup_excs',
+ array(
+ 'revisions' => $this->get_revisions_to_exclude(),
+ 'spam' => $this->get_spam_to_exclude(),
+ )
+ );
+ switch ( $_POST['do_backup'] ) {
+ case 'backup':
+ add_action( 'init', array( &$this, 'perform_backup' ) );
+ break;
+ case 'fragments':
+ add_action( 'admin_menu', array( &$this, 'fragment_menu' ) );
+ break;
}
- } elseif (isset($_GET['fragment'] )) {
- $this->can_user_backup('frame');
- add_action('init', array(&$this, 'init'));
- } elseif (isset($_GET['backup'] )) {
+ } elseif ( isset( $_GET['fragment'] ) ) {
+ $this->can_user_backup( 'frame' );
+ add_action( 'init', array( &$this, 'init' ) );
+ } elseif ( isset( $_GET['backup'] ) ) {
$this->can_user_backup();
- add_action('init', array(&$this, 'init'));
+ add_action( 'init', array( &$this, 'init' ) );
} else {
- add_action('admin_menu', array(&$this, 'admin_menu'));
+ add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
}
}
function init() {
$this->can_user_backup();
- if (isset($_GET['backup'])) {
- $via = isset($_GET['via']) ? sanitize_text_field($_GET['via']) : 'http';
+ if ( isset( $_GET['backup'] ) ) {
+ $via = isset( $_GET['via'] ) ? sanitize_text_field( $_GET['via'] ) : 'http';
- $this->backup_file = sanitize_text_field($_GET['backup']);
- $this->validate_file($this->backup_file);
+ $this->backup_file = sanitize_text_field( $_GET['backup'] );
+ $this->validate_file( $this->backup_file );
- switch($via) {
- case 'smtp':
- case 'email':
- $success = $this->deliver_backup($this->backup_file, 'smtp', sanitize_text_field($_GET['recipient']), 'frame');
- $this->error_display( 'frame' );
- if ( $success ) {
- echo '
+ switch ( $via ) {
+ case 'smtp':
+ case 'email':
+ $success = $this->deliver_backup( $this->backup_file, 'smtp', sanitize_text_field( $_GET['recipient'] ), 'frame' );
+ $this->error_display( 'frame' );
+ if ( $success ) {
+ echo '
';
- }
- break;
- default:
- $success = $this->deliver_backup($this->backup_file, $via);
- echo $this->error_display( 'frame', false );
+ }
+ break;
+ default:
+ $success = $this->deliver_backup( $this->backup_file, $via );
+ echo $this->error_display( 'frame', false );
- if ( $success ) {
- echo '
+ if ( $success ) {
+ echo '
';
- }
+ }
}
exit;
}
- if (isset($_GET['fragment'] )) {
- list($table, $segment, $filename) = explode(':', sanitize_text_field($_GET['fragment']));
- $this->validate_file($filename);
- $this->backup_fragment($table, $segment, $filename);
+
+ if ( isset( $_GET['fragment'] ) ) {
+ list($table, $segment, $filename) = explode( ':', sanitize_text_field( $_GET['fragment'] ) );
+ $this->validate_file( $filename );
+ $this->backup_fragment( $table, $segment, $filename );
}
die();
}
function init_textdomain() {
- load_plugin_textdomain('wp-db-backup', str_replace(ABSPATH, '', dirname(__FILE__)), dirname(plugin_basename(__FILE__)));
+ load_plugin_textdomain(
+ 'wp-db-backup',
+ false,
+ dirname( plugin_basename( __FILE__ ) ) . '/languages'
+ );
}
function set_page_url() {
$query_args = array( 'page' => $this->basename );
- if ( function_exists('wp_create_nonce') )
- $query_args = array_merge( $query_args, array('_wpnonce' => wp_create_nonce($this->referer_check_key)) );
- $base = ( function_exists('site_url') ) ? site_url('', 'admin') : get_option('siteurl');
- $this->page_url = add_query_arg( $query_args, $base . '/wp-admin/edit.php');
+
+ if ( function_exists( 'wp_create_nonce' ) ) {
+ $query_args = array_merge( $query_args, array( '_wpnonce' => wp_create_nonce( $this->referer_check_key ) ) );
+ }
+
+ $base = ( function_exists( 'site_url' ) ) ? site_url( '', 'admin' ) : get_option( 'siteurl' );
+ $this->page_url = add_query_arg( $query_args, $base . '/wp-admin/edit.php' );
}
/*
* Add a link to back up your database when doing a core upgrade.
*/
- function update_notice_action() {
+ function update_notice() {
global $pagenow;
- if (
- (
- isset($_REQUEST['action'])
- && ('upgrade-core' == $_REQUEST['action'])
- )
- || (
- !empty($pagenow) && ('update-core.php' == $pagenow)
- )
- ) :
- ob_start(array(&$this, 'update_notice'));
- add_action('admin_footer', create_function('', 'ob_end_flush();'));
- endif;
- }
- function update_notice($text = '') {
- $pattern = '#(.*?
)#';
- $replace = '$1' . "\n
" . sprintf(__('Click here to back up your database using the WordPress Database Backup plugin. Note: WordPress Database Backup does not back up your files, just your database.', 'wp-db-backup'), 'tools.php?page=wp-db-backup') . "
+ here to back up your database using the WordPress Database Backup plugin. Note: WordPress Database Backup does not back up your files, just your database.', 'wp-db-backup' ),
+ esc_url( get_admin_url( null, 'tools.php?page=wp-db-backup' ) )
+ );
+ ?>
+