| @@ -1,101 +1,164 @@ | ||
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Plugin Name: WP Database Backup | |
| 4 | -Plugin URI:walkeprashant.wordpress.com/wp-database-backup | |
| 5 | -Description: This plugin helps you to create/restore wordpress database backup. (Tools->WP-DB-Backup) | |
| 6 | -Version: 1.1 | |
| 7 | -Author:Prashant Walke | |
| 8 | -Author URI:walkeprashant.wordpress.com | |
| 9 | - | |
| 10 | -This plugin helps you to create Database Backup easily. | |
| 11 | - | |
| 12 | -License: GPL v3 | |
| 13 | - | |
| 14 | -This program is free software: you can redistribute it and/or modify | |
| 15 | -it under the terms of the GNU General Public License as published by | |
| 16 | -the Free Software Foundation, either version 3 of the License, or | |
| 17 | -(at your option) any later version. | |
| 18 | - | |
| 19 | -This program is distributed in the hope that it will be useful, | |
| 20 | -but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 21 | -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 22 | -GNU General Public License for more details. | |
| 23 | - | |
| 24 | -You should have received a copy of the GNU General Public License | |
| 25 | -along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 26 | -*/ | |
| 27 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 28 | - exit; // Exit if accessed directly | |
| 29 | -} | |
| 30 | - | |
| 31 | -if ( ! class_exists( 'WPDatabaseBackup' ) ) : | |
| 32 | - | |
| 33 | -/** | |
| 34 | - * Main WPDatabaseBackup Class | |
| 35 | - * | |
| 36 | - * @class WPDatabaseBackup | |
| 37 | - * @version 1.1 | |
| 38 | - */ | |
| 39 | -final class WPDatabaseBackup { | |
| 40 | - | |
| 41 | - public $version = '1.1'; | |
| 42 | - | |
| 43 | - protected static $_instance = null; | |
| 44 | - | |
| 45 | - public $query = null; | |
| 46 | - | |
| 47 | - public static function instance() { | |
| 48 | - if ( is_null( self::$_instance ) ) { | |
| 49 | - self::$_instance = new self(); | |
| 50 | - } | |
| 51 | - return self::$_instance; | |
| 52 | - } | |
| 53 | - | |
| 54 | - public function __clone() { | |
| 55 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?' ), '1.0' ); | |
| 56 | - } | |
| 57 | - | |
| 58 | - public function __construct() { | |
| 59 | - // Define constants | |
| 60 | - $this->define_constants(); | |
| 61 | - // Include required files | |
| 62 | - $this->includes(); | |
| 63 | - | |
| 64 | - } | |
| 65 | - | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Define Constants | |
| 69 | - */ | |
| 70 | - private function define_constants() { | |
| 71 | - if ( ! defined( 'WPDB_PLUGIN_URL' ) ) | |
| 72 | - define( 'WPDB_PLUGIN_URL', WP_CONTENT_URL. '/plugins/wp-database-backup' ); | |
| 73 | - define( 'WPDB_PLUGIN_FILE', __FILE__ ); | |
| 74 | - define( 'WPDB_VERSION', $this->version ); | |
| 75 | - define( 'WPDBPLUGIN_VERSION', WPDB_VERSION ); // Backwards compat | |
| 76 | - } | |
| 77 | - | |
| 78 | - private function includes() { | |
| 79 | - include_once( 'includes/admin/class-wpdb-admin.php' ); | |
| 80 | - | |
| 81 | -} | |
| 82 | - | |
| 83 | - public function logger() { | |
| 84 | - _deprecated_function( 'Wpekaplugin->logger', '1.0', 'new WPDB_Logger()' ); | |
| 85 | - return new WPDB_Logger(); | |
| 86 | - } | |
| 87 | - | |
| 88 | - } | |
| 89 | - | |
| 90 | -endif; | |
| 91 | - | |
| 92 | -/** | |
| 93 | - * Returns the main instance of WP to prevent the need to use globals. | |
| 94 | - | |
| 95 | - */ | |
| 96 | -function WPDB() { | |
| 97 | - return WPDatabaseBackup::instance(); | |
| 98 | -} | |
| 99 | - | |
| 100 | -// Global for backwards compatibility. | |
| 101 | -$GLOBALS['wpdbplugin'] = WPDB(); | |
| 1 | +<?php // phpcs:ignore | |
| 2 | +/** | |
| 3 | + * Plugin Name: Backup For WP | |
| 4 | + * Plugin URI:https://wordpress.org/plugins/wp-database-backup | |
| 5 | + * Description: This plugin helps you to create/restore Unlimited WordPress Database & Files backup. | |
| 6 | + * Version: 6.11 | |
| 7 | + * Author: Backup for WP | |
| 8 | + * Author URI: https://backupforwp.com/ | |
| 9 | + * Text Domain: wpdbbkp | |
| 10 | + * Domain Path: /lang | |
| 11 | + * | |
| 12 | + * This plugin helps you to create Database Backup easily. | |
| 13 | + * | |
| 14 | + * License: GPL v3 | |
| 15 | + * | |
| 16 | + * This program is free software: you can redistribute it and/or modify | |
| 17 | + * it under the terms of the GNU General Public License as published by | |
| 18 | + * the Free Software Foundation, either version 3 of the License, or | |
| 19 | + * (at your option) any later version. | |
| 20 | + * | |
| 21 | + * This program is distributed in the hope that it will be useful, | |
| 22 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 23 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 24 | + * GNU General Public License for more details. | |
| 25 | + * | |
| 26 | + * You should have received a copy of the GNU General Public License | |
| 27 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 28 | + */ | |
| 29 | + | |
| 30 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 31 | + exit; // Exit if accessed directly. | |
| 32 | +} | |
| 33 | + | |
| 34 | +if ( ! class_exists( 'WPDatabaseBackup' ) ) : | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * Main WPDatabaseBackup Class. | |
| 38 | + * | |
| 39 | + * @class WPDatabaseBackup | |
| 40 | + * | |
| 41 | + * @version 1.1 | |
| 42 | + */ | |
| 43 | + final class WPDatabaseBackup { | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Plugin version | |
| 47 | + * | |
| 48 | + * @var string | |
| 49 | + */ | |
| 50 | + public $version = '6.11'; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * Plugin instance | |
| 54 | + * | |
| 55 | + * @var object | |
| 56 | + */ | |
| 57 | + protected static $instance = null; | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Create Instance. | |
| 61 | + */ | |
| 62 | + public static function instance() { | |
| 63 | + if ( is_null( self::$instance ) ) { | |
| 64 | + self::$instance = new self(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + return self::$instance; | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Clone. | |
| 72 | + */ | |
| 73 | + public function __clone() { | |
| 74 | + _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '1.0' ); | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Construct. | |
| 79 | + */ | |
| 80 | + public function __construct() { | |
| 81 | + // Define constants. | |
| 82 | + $this->define_constants(); | |
| 83 | + register_activation_hook( __FILE__, array( $this, 'installation' ) ); | |
| 84 | + $this->installation(2); | |
| 85 | + // Include required files. | |
| 86 | + $this->includes(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * Define Constants. | |
| 91 | + */ | |
| 92 | + private function define_constants() { | |
| 93 | + if ( ! defined( 'WPDB_PLUGIN_URL' ) ) { | |
| 94 | + define( 'WPDB_PLUGIN_URL', WP_CONTENT_URL . '/plugins/wp-database-backup' ); | |
| 95 | + } | |
| 96 | + define( 'WPDB_PLUGIN_FILE', __FILE__ ); | |
| 97 | + define('WP_BACKUP_PLUGIN_FILE',__FILE__ ); | |
| 98 | + define( 'WPDB_PATH', plugin_dir_path( __FILE__ ) ); | |
| 99 | + define( 'WPDB_ROOTPATH', str_replace( '\\', '/', ABSPATH ) ); | |
| 100 | + define( 'WPDB_VERSION', $this->version ); | |
| 101 | + define( 'WPDBPLUGIN_VERSION', WPDB_VERSION ); | |
| 102 | + $wp_all_backup_backups_dir=get_option('wp_db_backup_backups_dir'); | |
| 103 | + if(!empty($wp_all_backup_backups_dir)){ | |
| 104 | + define( 'WPDB_BACKUPS_DIR',$wp_all_backup_backups_dir); | |
| 105 | + }else{ | |
| 106 | + define( 'WPDB_BACKUPS_DIR','db-backup'); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Include Requred files and lib. | |
| 112 | + */ | |
| 113 | + private function includes() { | |
| 114 | + include_once 'includes/admin/mb-helper-functions.php'; | |
| 115 | + include_once 'includes/admin/class-wpdb-admin.php'; | |
| 116 | + include_once 'includes/admin/Destination/wp-backup-destination-upload-action.php'; | |
| 117 | + include_once 'includes/class-wpdbbackuplog.php'; | |
| 118 | + include_once 'includes/admin/filter.php'; | |
| 119 | + include_once 'includes/admin/newsletter.php'; | |
| 120 | + include_once 'includes/admin/cron-create-full-backup.php'; | |
| 121 | + include_once 'includes/log_generate.php'; | |
| 122 | + | |
| 123 | + } | |
| 124 | + /** | |
| 125 | + * Installation setting at time of activation. | |
| 126 | + */ | |
| 127 | + public function installation($flag=1) { | |
| 128 | + add_option( 'wp_db_backup_destination_SFTP', 0 ,false); | |
| 129 | + add_option( 'wp_db_backup_destination_FTP', 0 ,false); | |
| 130 | + add_option( 'wp_db_backup_destination_Email', 0,false); | |
| 131 | + add_option( 'wp_db_backup_destination_s3', 0 ,false); | |
| 132 | + add_option( 'wp_db_remove_local_backup', 0 ,false); | |
| 133 | + add_option( 'wp_db_remove_on_uninstall', 0 ,false); | |
| 134 | + add_option('wp_db_backup_backup_type','complete',false); | |
| 135 | + add_option('wp_db_backup_exclude_dir',"wp-content/backupwordpress-728d36f682-backups|.git|db-backup",false); | |
| 136 | + add_option('wp_db_backup_backups_dir','db-backup',false); | |
| 137 | + add_option('bb_last_backup_timestamp',0,false); | |
| 138 | + add_option('wp_db_backup_sftp_details',null,false); | |
| 139 | + | |
| 140 | + if($flag!=2){ | |
| 141 | + add_option( 'wpdbbkp_activation_redirect', true,false); | |
| 142 | + } | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * Logger. | |
| 147 | + */ | |
| 148 | + public function logger() { | |
| 149 | + _deprecated_function( 'Wpekaplugin->logger', '1.0', 'new WPDB_Logger()' ); | |
| 150 | + return new WPDB_Logger(); | |
| 151 | + } | |
| 152 | + } | |
| 153 | + | |
| 154 | +endif; | |
| 155 | + | |
| 156 | +/** | |
| 157 | + * Returns the main instance of WP to prevent the need to use globals. | |
| 158 | + */ | |
| 159 | +function wpdb() { | |
| 160 | + return WPDatabaseBackup::instance(); | |
| 161 | +} | |
| 162 | + | |
| 163 | +// Global for backwards compatibility. | |
| 164 | +$GLOBALS['wpdbplugin'] = wpdb(); | |