| @@ -1,10 +1,10 @@ | ||
| 1 | -<?php // phpcs:ignore | |
| 1 | +<?php | |
| 2 | 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.3 | |
| 3 | + * Plugin Name: WP Database Backup - Unlimited Database & Files Backup by 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: 7.4 | |
| 7 | 7 | * Author: Backup for WP |
| 8 | 8 | * Author URI: https://backupforwp.com/ |
| 9 | 9 | * Text Domain: wpdbbkp |
| 10 | 10 | * Domain Path: /lang |
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | * Domain Path: /lang |
| 11 | 11 | * |
| 12 | 12 | * This plugin helps you to create Database Backup easily. |
| 13 | 13 | * |
| 14 | - * License: GPL v3 | |
| 14 | + * License: GPL v2 | |
| 15 | 15 | * |
| 16 | 16 | * This program is free software: you can redistribute it and/or modify |
| 17 | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | 18 | * the Free Software Foundation, either version 3 of the License, or |
| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | * Main WPDatabaseBackup Class. |
| 38 | 38 | * |
| 39 | 39 | * @class WPDatabaseBackup |
| 40 | 40 | * |
| 41 | - * @version 1.1 | |
| 41 | + * @version 7.3 | |
| 42 | 42 | */ |
| 43 | 43 | final class WPDatabaseBackup { |
| 44 | 44 | |
| 45 | 45 | /** |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | * Plugin version |
| 47 | 47 | * |
| 48 | 48 | * @var string |
| 49 | 49 | */ |
| 50 | - public $version = '6.3'; | |
| 50 | + public $version = '7.4'; | |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Plugin instance |
| 54 | 54 | * |
| @@ -98,46 +98,60 @@ | ||
| 98 | 98 | define( 'WPDB_PATH', plugin_dir_path( __FILE__ ) ); |
| 99 | 99 | define( 'WPDB_ROOTPATH', str_replace( '\\', '/', ABSPATH ) ); |
| 100 | 100 | define( 'WPDB_VERSION', $this->version ); |
| 101 | 101 | define( 'WPDBPLUGIN_VERSION', WPDB_VERSION ); |
| 102 | - $wpdbbkp_backups_dir=get_option('wp_db_backup_backups_dir'); | |
| 103 | - if(!empty($wp_all_backup_backups_dir)){ | |
| 104 | - define( 'WPDB_BACKUPS_DIR',get_option('wp_db_backup_backups_dir')); | |
| 105 | - }else{ | |
| 106 | - define( 'WPDB_BACKUPS_DIR','db-backup'); | |
| 107 | - } | |
| 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 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Include Requred files and lib. |
| 112 | 112 | */ |
| 113 | - private function includes() { | |
| 113 | + private function includes() | |
| 114 | + { | |
| 114 | 115 | include_once 'includes/admin/mb-helper-functions.php'; |
| 115 | 116 | include_once 'includes/admin/class-wpdb-admin.php'; |
| 116 | 117 | include_once 'includes/admin/Destination/wp-backup-destination-upload-action.php'; |
| 117 | 118 | include_once 'includes/class-wpdbbackuplog.php'; |
| 118 | 119 | include_once 'includes/admin/filter.php'; |
| 119 | - include_once 'includes/admin/newsletter.php'; | |
| 120 | - //include_once 'includes/admin/ajax-create-full-backup.php'; | |
| 121 | - include_once 'includes/admin/cron-create-full-backup.php'; | |
| 122 | - include_once 'includes/log_generate.php'; | |
| 123 | - | |
| 120 | + include_once 'includes/admin/class-wpdbbkp-newsletter.php'; | |
| 121 | + include_once 'includes/features.php'; | |
| 122 | + $wp_db_incremental_backup = get_option('wp_db_incremental_backup'); | |
| 123 | + $wpdb_clouddrive_cd = get_option('wpdb_clouddrive_token', false); | |
| 124 | + $wp_db_backup_destination_bb = get_option('wp_db_backup_destination_bb', false); | |
| 125 | + if (($wp_db_incremental_backup == 1 && $wp_db_backup_destination_bb ==1 )|| ($wpdb_clouddrive_cd && !empty($wpdb_clouddrive_cd))) { | |
| 126 | + include_once 'includes/admin/cron-create-full-backup-incremental.php'; | |
| 127 | + } else { | |
| 128 | + include_once 'includes/admin/cron-create-full-backup.php'; | |
| 129 | + } | |
| 130 | + include_once 'includes/class-wpdbfullbackuplog.php'; | |
| 131 | + | |
| 124 | 132 | } |
| 125 | 133 | /** |
| 126 | 134 | * Installation setting at time of activation. |
| 127 | 135 | */ |
| 128 | 136 | public function installation($flag=1) { |
| 129 | - add_option( 'wp_db_backup_destination_FTP', 1 ); | |
| 130 | - add_option( 'wp_db_backup_destination_Email', 1 ); | |
| 131 | - add_option( 'wp_db_backup_destination_s3', 1 ); | |
| 132 | - add_option( 'wp_db_remove_local_backup', 0 ); | |
| 133 | - add_option('wp_db_backup_backup_type','complete'); | |
| 134 | - add_option('wp_db_backup_exclude_dir',"wp-content/backupwordpress-728d36f682-backups|.git|db-backup"); | |
| 135 | - add_option('wp_db_backup_backups_dir','db-backup'); | |
| 136 | - if($flag!=2) | |
| 137 | - { | |
| 138 | - add_option( 'wpdbbkp_activation_redirect', true); | |
| 139 | - } | |
| 137 | + add_option( 'wp_db_backup_destination_SFTP', 0 , '' , false ); | |
| 138 | + add_option( 'wp_db_backup_destination_FTP', 0 , '' , false ); | |
| 139 | + add_option( 'wp_db_backup_destination_Email',0 , '' , false ); | |
| 140 | + add_option( 'wp_db_backup_destination_s3', 0 , '' , false ); | |
| 141 | + add_option( 'wp_db_remove_local_backup', 0 , '' , false ); | |
| 142 | + add_option( 'wp_db_remove_on_uninstall', 0 , '' , false ); | |
| 143 | + add_option('wp_db_backup_backup_type','complete', '' , false ); | |
| 144 | + add_option('wp_db_backup_exclude_dir',"wp-content/backupwordpress-728d36f682-backups|.git|db-backup", '' , false ); | |
| 145 | + add_option('wp_db_backup_backups_dir','db-backup', '' , false ); | |
| 146 | + add_option('bb_last_backup_timestamp',0, '' , false ); | |
| 147 | + add_option('wp_db_backup_sftp_details',null, '' , false ); | |
| 148 | + | |
| 149 | + if($flag!=2){ | |
| 150 | + add_option( 'wpdbbkp_activation_redirect', true, '' , false ); | |
| 151 | + } | |
| 152 | + | |
| 153 | + $this->create_processed_files_table(); | |
| 140 | 154 | } |
| 141 | 155 | |
| 142 | 156 | /** |
| 143 | 157 | * Logger. |
| @@ -144,8 +158,31 @@ | ||
| 144 | 158 | */ |
| 145 | 159 | public function logger() { |
| 146 | 160 | _deprecated_function( 'Wpekaplugin->logger', '1.0', 'new WPDB_Logger()' ); |
| 147 | 161 | return new WPDB_Logger(); |
| 162 | + } | |
| 163 | + | |
| 164 | + public function create_processed_files_table() { | |
| 165 | + global $wpdb; | |
| 166 | + $table_name = $wpdb->prefix . 'wpdbbkp_processed_files'; | |
| 167 | + $charset_collate = $wpdb->get_charset_collate(); | |
| 168 | + | |
| 169 | + // Check if the table already exists | |
| 170 | + //phpcs:ignore -- Reason: Direct SQL execution is required here. | |
| 171 | + if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { | |
| 172 | + //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange | |
| 173 | + $sql = "CREATE TABLE $table_name ( | |
| 174 | + id mediumint(9) NOT NULL AUTO_INCREMENT, | |
| 175 | + file_path text NOT NULL, | |
| 176 | + processed_at TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 177 | + status ENUM('added', 'updated', 'deleted') DEFAULT 'added' NOT NULL, | |
| 178 | + PRIMARY KEY (id), | |
| 179 | + UNIQUE (file_path(250)) | |
| 180 | + ) $charset_collate;"; | |
| 181 | + | |
| 182 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); | |
| 183 | + dbDelta($sql); | |
| 184 | + } | |
| 148 | 185 | } |
| 149 | 186 | } |
| 150 | 187 | |
| 151 | 188 | endif; |