Version Description
Download this release
Release Info
Developer | cssimmon |
Plugin | Backup and Restore WordPress – WPBackItUp Backup Plugin |
Version | 1.21.0 |
Comparing to | |
See all releases |
Code changes from version 1.20.0 to 1.21.0
- lib/includes/class-settings.php +26 -0
- lib/includes/class-usage.php +13 -8
- lib/includes/class-utility.php +19 -0
- lib/includes/class-wpbackitup-admin.php +3 -0
- lib/includes/job_backup.php +12 -4
- readme.txt +9 -1
- views/backup.php +2 -1
- wp-backitup.php +2 -2
lib/includes/class-settings.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Settings class to manage settings that are not included in a separate class
|
5 |
+
*
|
6 |
+
* @since 1.21
|
7 |
+
* @author WP BackItUp <wpbackitup@wpbackitup.com>
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class WPBackitup_Settings {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Get UUID for this site.
|
14 |
+
*
|
15 |
+
* @return mixed|string
|
16 |
+
*/
|
17 |
+
public static function get_site_id() {
|
18 |
+
$site_id = WPBackItUp_Utility::get_option('site_id',false);
|
19 |
+
if (false===$site_id) {
|
20 |
+
$site_id = WPBackItUp_Utility::generate_uuid4();
|
21 |
+
WPBackItUp_Utility::set_option('site_id',$site_id);
|
22 |
+
}
|
23 |
+
|
24 |
+
return $site_id;
|
25 |
+
}
|
26 |
+
}
|
lib/includes/class-usage.php
CHANGED
@@ -48,7 +48,7 @@ class WPBackItUp_Usage {
|
|
48 |
add_action( 'init', array( $this, 'schedule_events' ) );
|
49 |
add_action( 'wpbackitup_opt_into_tracking', array( $this, 'optin_usage_tracking' ) );
|
50 |
add_action( 'wpbackitup_opt_out_of_tracking', array( $this, 'optout_usage_tracking' ) );
|
51 |
-
add_action( 'wpbackitup_ut_event', array( $this, 'ut_event' ),10,
|
52 |
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
53 |
}
|
54 |
|
@@ -79,7 +79,7 @@ class WPBackItUp_Usage {
|
|
79 |
* @return void
|
80 |
* @throws Exception
|
81 |
*/
|
82 |
-
private function setup_data() {
|
83 |
|
84 |
try {
|
85 |
$data = array();
|
@@ -113,9 +113,9 @@ class WPBackItUp_Usage {
|
|
113 |
$active_plugins = get_option( 'active_plugins', array());
|
114 |
$inactive_plugins = array();
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
foreach ( $plugins as $key => $plugin ) {
|
121 |
if ( ! in_array( $plugin, $active_plugins ) ) {
|
@@ -130,7 +130,8 @@ class WPBackItUp_Usage {
|
|
130 |
$mu_plugins[]=$mu_key;
|
131 |
}
|
132 |
|
133 |
-
$data['
|
|
|
134 |
$data['active_plugins'] = $active_plugins;
|
135 |
$data['inactive_plugins'] = $inactive_plugins;
|
136 |
$data['mu_plugins'] = $mu_plugins;
|
@@ -163,9 +164,13 @@ class WPBackItUp_Usage {
|
|
163 |
* @return bool
|
164 |
* @throws Exception
|
165 |
*/
|
166 |
-
public function ut_event( $override = false, $ignore_last_checkin = false ) {
|
167 |
WPBackItUp_Logger::log_info($this->log_name,__METHOD__,'Begin:' . var_export($override,true) .':' . var_export($ignore_last_checkin,true) );
|
168 |
|
|
|
|
|
|
|
|
|
169 |
try {
|
170 |
|
171 |
//Check for user permission
|
@@ -191,7 +196,7 @@ class WPBackItUp_Usage {
|
|
191 |
|
192 |
$blocking=false;
|
193 |
if (true===WPBACKITUP__DEBUG) $blocking=true;
|
194 |
-
$this->setup_data();
|
195 |
$response = wp_remote_post( 'https://5bx6m4uwn0.execute-api.us-east-1.amazonaws.com/prd/utv2', array(
|
196 |
'method' => 'POST',
|
197 |
'timeout' => 8,
|
48 |
add_action( 'init', array( $this, 'schedule_events' ) );
|
49 |
add_action( 'wpbackitup_opt_into_tracking', array( $this, 'optin_usage_tracking' ) );
|
50 |
add_action( 'wpbackitup_opt_out_of_tracking', array( $this, 'optout_usage_tracking' ) );
|
51 |
+
add_action( 'wpbackitup_ut_event', array( $this, 'ut_event' ),10,3 );
|
52 |
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
53 |
}
|
54 |
|
79 |
* @return void
|
80 |
* @throws Exception
|
81 |
*/
|
82 |
+
private function setup_data($source) {
|
83 |
|
84 |
try {
|
85 |
$data = array();
|
113 |
$active_plugins = get_option( 'active_plugins', array());
|
114 |
$inactive_plugins = array();
|
115 |
|
116 |
+
//$current_path = dirname(plugin_basename(__FILE__));
|
117 |
+
//$current_root = current(explode("/",$current_path));
|
118 |
+
//$current_plugin=$current_root;
|
119 |
|
120 |
foreach ( $plugins as $key => $plugin ) {
|
121 |
if ( ! in_array( $plugin, $active_plugins ) ) {
|
130 |
$mu_plugins[]=$mu_key;
|
131 |
}
|
132 |
|
133 |
+
$data['site_id'] = WPBackitup_Settings::get_site_id();
|
134 |
+
$data['source'] = $source;
|
135 |
$data['active_plugins'] = $active_plugins;
|
136 |
$data['inactive_plugins'] = $inactive_plugins;
|
137 |
$data['mu_plugins'] = $mu_plugins;
|
164 |
* @return bool
|
165 |
* @throws Exception
|
166 |
*/
|
167 |
+
public function ut_event( $override = false, $ignore_last_checkin = false, $source='wpbackitup' ) {
|
168 |
WPBackItUp_Logger::log_info($this->log_name,__METHOD__,'Begin:' . var_export($override,true) .':' . var_export($ignore_last_checkin,true) );
|
169 |
|
170 |
+
// error_log('override:' .var_export($override,true));
|
171 |
+
// error_log('last_checkin:' .var_export($ignore_last_checkin,true));
|
172 |
+
// error_log('Source:' .var_export($source,true));
|
173 |
+
|
174 |
try {
|
175 |
|
176 |
//Check for user permission
|
196 |
|
197 |
$blocking=false;
|
198 |
if (true===WPBACKITUP__DEBUG) $blocking=true;
|
199 |
+
$this->setup_data($source);
|
200 |
$response = wp_remote_post( 'https://5bx6m4uwn0.execute-api.us-east-1.amazonaws.com/prd/utv2', array(
|
201 |
'method' => 'POST',
|
202 |
'timeout' => 8,
|
lib/includes/class-utility.php
CHANGED
@@ -336,5 +336,24 @@ class WPBackItUp_Utility {
|
|
336 |
else false;
|
337 |
}
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
|
336 |
else false;
|
337 |
}
|
338 |
|
339 |
+
/**
|
340 |
+
* generate UUID using WP function if exists
|
341 |
+
*
|
342 |
+
* @return string
|
343 |
+
*/
|
344 |
+
public static function generate_uuid4() {
|
345 |
+
if ( function_exists('wp_generate_uuid4')) {
|
346 |
+
return wp_generate_uuid4();
|
347 |
+
} else {
|
348 |
+
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
349 |
+
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
|
350 |
+
mt_rand( 0, 0xffff ),
|
351 |
+
mt_rand( 0, 0x0fff ) | 0x4000,
|
352 |
+
mt_rand( 0, 0x3fff ) | 0x8000,
|
353 |
+
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
|
354 |
+
);
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
}
|
359 |
|
lib/includes/class-wpbackitup-admin.php
CHANGED
@@ -523,6 +523,9 @@ class WPBackitup_Admin {
|
|
523 |
require_once( WPBACKITUP__PLUGIN_PATH . '/lib/includes/class-admin-notice.php' );
|
524 |
require_once( WPBACKITUP__PLUGIN_PATH . '/lib/includes/class-admin-notices.php' );
|
525 |
|
|
|
|
|
|
|
526 |
$languages_path = dirname(dirname(dirname( plugin_basename( __FILE__ )))) . '/languages/';
|
527 |
|
528 |
load_plugin_textdomain(
|
523 |
require_once( WPBACKITUP__PLUGIN_PATH . '/lib/includes/class-admin-notice.php' );
|
524 |
require_once( WPBACKITUP__PLUGIN_PATH . '/lib/includes/class-admin-notices.php' );
|
525 |
|
526 |
+
//Settings Class
|
527 |
+
require_once( WPBACKITUP__PLUGIN_PATH . '/lib/includes/class-settings.php' );
|
528 |
+
|
529 |
$languages_path = dirname(dirname(dirname( plugin_basename( __FILE__ )))) . '/languages/';
|
530 |
|
531 |
load_plugin_textdomain(
|
lib/includes/job_backup.php
CHANGED
@@ -1339,9 +1339,15 @@ function send_backup_notification_email($err, $success,$logs=array()) {
|
|
1339 |
|
1340 |
$processing_minutes = round($seconds / 60);
|
1341 |
$processing_seconds = $seconds % 60;
|
1342 |
-
|
|
|
|
|
|
|
|
|
1343 |
$message="";
|
1344 |
$message.="<p><img alt='WPBackItUp Logo' src='http://cdn.wpbackitup.com/images/wpbackitup_logo.png' /> <strong style='color:#005d8b; font-family:cambria,georgia,serif; font-size:14px; font-style:normal; font-weight:bold'>The Simplest Way to Backup Your WordPress Site</strong></p><br><br>";
|
|
|
|
|
1345 |
if($success)
|
1346 |
{
|
1347 |
//Don't send logs on success unless debug is on.
|
@@ -1349,11 +1355,11 @@ function send_backup_notification_email($err, $success,$logs=array()) {
|
|
1349 |
$logs=array();
|
1350 |
}
|
1351 |
|
1352 |
-
$subject = sprintf(__('%s - Backup completed successfully.', 'wp-backitup'),
|
1353 |
$message .= '<b>' . __('Your backup completed successfully.', 'wp-backitup') . '</b><br/><br/>';
|
1354 |
|
1355 |
} else {
|
1356 |
-
$subject = sprintf(__('%s - Backup did not complete successfully.', 'wp-backitup')
|
1357 |
$message .= '<b>' . __('Your backup did not complete successfully.', 'wp-backitup') . '</b><br/><br/>';
|
1358 |
}
|
1359 |
|
@@ -1361,7 +1367,7 @@ function send_backup_notification_email($err, $success,$logs=array()) {
|
|
1361 |
$local_start_datetime = get_date_from_gmt(date( 'Y-m-d H:i:s',$start_timestamp));
|
1362 |
$local_end_datetime = get_date_from_gmt(date( 'Y-m-d H:i:s',$end_timestamp));
|
1363 |
|
1364 |
-
$message .= sprintf(__('WordPress Site: <a href="%s" target="_blank"> %s </a><br/>', 'wp-backitup'), home_url(),
|
1365 |
$message .= __('Backup date:', 'wp-backitup') . ' ' . $local_start_datetime . '<br/>';
|
1366 |
$message .= __('Number of backups completed with WPBackItUp:', 'wp-backitup') . ' ' . $WPBackitup->backup_count() . '<br/>';
|
1367 |
|
@@ -1381,6 +1387,8 @@ function send_backup_notification_email($err, $success,$logs=array()) {
|
|
1381 |
$message .='<br/><br/>' . sprintf(__('Checkout %s for info about WPBackItUp and our other products.', 'wp-backitup'), WPBackItUp_Utility::get_anchor_with_utm('www.wpbackitup.com', '', 'notification+email', $term) ) . '<br/>';
|
1382 |
|
1383 |
|
|
|
|
|
1384 |
$notification_email = $WPBackitup->get_option('notification_email');
|
1385 |
if($notification_email)
|
1386 |
$utility->send_email($notification_email,$subject,$message,$logs);
|
1339 |
|
1340 |
$processing_minutes = round($seconds / 60);
|
1341 |
$processing_seconds = $seconds % 60;
|
1342 |
+
|
1343 |
+
$site_id = WPBackitup_Settings::get_site_id();
|
1344 |
+
$footer = sprintf('<img src="https://www.google-analytics.com/collect?v=1&t=event&tid=UA-41130863-2&cid=%s',$site_id);
|
1345 |
+
$footer .='&ec=email&ea=open&el=backup_notification&dp=%2Femail%2Fplugin&dt=backup%20notification" />' ;
|
1346 |
+
|
1347 |
$message="";
|
1348 |
$message.="<p><img alt='WPBackItUp Logo' src='http://cdn.wpbackitup.com/images/wpbackitup_logo.png' /> <strong style='color:#005d8b; font-family:cambria,georgia,serif; font-size:14px; font-style:normal; font-weight:bold'>The Simplest Way to Backup Your WordPress Site</strong></p><br><br>";
|
1349 |
+
$domain = parse_url( get_home_url(), PHP_URL_HOST );
|
1350 |
+
|
1351 |
if($success)
|
1352 |
{
|
1353 |
//Don't send logs on success unless debug is on.
|
1355 |
$logs=array();
|
1356 |
}
|
1357 |
|
1358 |
+
$subject = sprintf(__('%s - Backup completed successfully.', 'wp-backitup'), $domain);
|
1359 |
$message .= '<b>' . __('Your backup completed successfully.', 'wp-backitup') . '</b><br/><br/>';
|
1360 |
|
1361 |
} else {
|
1362 |
+
$subject = sprintf(__('%s - Backup did not complete successfully.', 'wp-backitup'),$domain);
|
1363 |
$message .= '<b>' . __('Your backup did not complete successfully.', 'wp-backitup') . '</b><br/><br/>';
|
1364 |
}
|
1365 |
|
1367 |
$local_start_datetime = get_date_from_gmt(date( 'Y-m-d H:i:s',$start_timestamp));
|
1368 |
$local_end_datetime = get_date_from_gmt(date( 'Y-m-d H:i:s',$end_timestamp));
|
1369 |
|
1370 |
+
$message .= sprintf(__('WordPress Site: <a href="%s" target="_blank"> %s </a><br/>', 'wp-backitup'), home_url(), $domain);
|
1371 |
$message .= __('Backup date:', 'wp-backitup') . ' ' . $local_start_datetime . '<br/>';
|
1372 |
$message .= __('Number of backups completed with WPBackItUp:', 'wp-backitup') . ' ' . $WPBackitup->backup_count() . '<br/>';
|
1373 |
|
1387 |
$message .='<br/><br/>' . sprintf(__('Checkout %s for info about WPBackItUp and our other products.', 'wp-backitup'), WPBackItUp_Utility::get_anchor_with_utm('www.wpbackitup.com', '', 'notification+email', $term) ) . '<br/>';
|
1388 |
|
1389 |
|
1390 |
+
$message.=$footer;
|
1391 |
+
|
1392 |
$notification_email = $WPBackitup->get_option('notification_email');
|
1393 |
if($notification_email)
|
1394 |
$utility->send_email($notification_email,$subject,$message,$logs);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: backup, backups, back up, backup plugin, database backup, multisite backup
|
|
4 |
Requires at least: 3.8.0
|
5 |
Requires PHP: 5.2.4
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.
|
8 |
Author URI: https://www.wpbackitup.com
|
9 |
Donate link: https://www.wpbackitup.com
|
10 |
License: GPLv2 or later
|
@@ -215,6 +215,14 @@ Our online documentation and full list of FAQs can be found at [support.wpbackit
|
|
215 |
|
216 |
|
217 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
= 1.20 =
|
219 |
*Release Date - June 1, 2018
|
220 |
|
4 |
Requires at least: 3.8.0
|
5 |
Requires PHP: 5.2.4
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.20.0
|
8 |
Author URI: https://www.wpbackitup.com
|
9 |
Donate link: https://www.wpbackitup.com
|
10 |
License: GPLv2 or later
|
215 |
|
216 |
|
217 |
== Changelog ==
|
218 |
+
= 1.21 =
|
219 |
+
*Release Date - June 5, 2018
|
220 |
+
|
221 |
+
* UPDATE: Update available backup list to show last 10 backups
|
222 |
+
* UPDATE: Update backup notification email to use domain instead of blog name
|
223 |
+
* UPDATE: Add settings class & add site id to ut
|
224 |
+
* UPDATE: Migrate premium code to separate repo
|
225 |
+
|
226 |
= 1.20 =
|
227 |
*Release Date - June 1, 2018
|
228 |
|
views/backup.php
CHANGED
@@ -52,7 +52,8 @@
|
|
52 |
|
53 |
scan_import_backups($backup_dir);
|
54 |
|
55 |
-
|
|
|
56 |
$backup_job_list = WPBackItUp_Job::get_jobs_by_status(WPBackItUp_Job::BACKUP,array(WPBackItUp_Job::ACTIVE,WPBackItUp_Job::COMPLETE,WPBackItUp_Job::ERROR),$backup_list_size);
|
57 |
//-------------------------
|
58 |
|
52 |
|
53 |
scan_import_backups($backup_dir);
|
54 |
|
55 |
+
//Show the last 10 if they exist
|
56 |
+
$backup_list_size=10;//$number_retained_archives;
|
57 |
$backup_job_list = WPBackItUp_Job::get_jobs_by_status(WPBackItUp_Job::BACKUP,array(WPBackItUp_Job::ACTIVE,WPBackItUp_Job::COMPLETE,WPBackItUp_Job::ERROR),$backup_list_size);
|
58 |
//-------------------------
|
59 |
|
wp-backitup.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
|
7 |
* Author: WPBackItUp
|
8 |
* Author URI: https://www.wpbackitup.com
|
9 |
-
* Version: 1.
|
10 |
* Text Domain: wp-backitup
|
11 |
*
|
12 |
* License: GPL3
|
@@ -32,7 +32,7 @@ define( 'WPBACKITUP__NAMESPACE', 'wp-backitup' );
|
|
32 |
define( 'WPBACKITUP__CLASSNAMESPACE', 'WPBackItUp' );
|
33 |
|
34 |
define( 'WPBACKITUP__MAJOR_VERSION', 1);
|
35 |
-
define( 'WPBACKITUP__MINOR_VERSION',
|
36 |
define( 'WPBACKITUP__MAINTENANCE_VERSION', 0); //Dont forget to update version in header on WP release
|
37 |
define( 'WPBACKITUP__BUILD_VERSION', 0); //Used for hotfix releases
|
38 |
|
6 |
* Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
|
7 |
* Author: WPBackItUp
|
8 |
* Author URI: https://www.wpbackitup.com
|
9 |
+
* Version: 1.21
|
10 |
* Text Domain: wp-backitup
|
11 |
*
|
12 |
* License: GPL3
|
32 |
define( 'WPBACKITUP__CLASSNAMESPACE', 'WPBackItUp' );
|
33 |
|
34 |
define( 'WPBACKITUP__MAJOR_VERSION', 1);
|
35 |
+
define( 'WPBACKITUP__MINOR_VERSION', 21);
|
36 |
define( 'WPBACKITUP__MAINTENANCE_VERSION', 0); //Dont forget to update version in header on WP release
|
37 |
define( 'WPBACKITUP__BUILD_VERSION', 0); //Used for hotfix releases
|
38 |
|