Version Description
25/Oct/2017 =
FEATURE: Warn the user if their .htaccess seems to contain a redirect (or any other reference) to the old site after migration.
FEATURE: When importing a database, warn the user if the current MySQL server does not support a used collation, and offer to replace it
FIX: Saving of S3 settings had taken a dislike to buckets beginning with a capital 'B'
FIX: UpdraftCentral users' module was failing to handle loading a very large number of users
TWEAK: Allows the installation and/or activation of the WP-Optimize plugin from UpdraftCentral
TWEAK: Add multisite attribute to the error response object for the create user, delete user and edit user actions.
TWEAK: All remote storage methods are ported over to using configuration templates internally
TWEAK: Include a method to add a manifest file inside each backup archive
TWEAK: All code relating to the now-dead Dropbox APIv1 removed (N.B. If you've not updated UpdraftPlus since November 2016 and were using Dropbox, it won't be working - https://blogs.dropbox.com/developers/2017/09/api-v1-shutdown-details/)
TWEAK: Prevent a PHP log notice upon database backup restore when using Google Drive without a client ID
TWEAK: Prevent the final 'Restore' button being pressed a second time
TWEAK: Improvements to the UpdraftCentral wizard
TWEAK: Update to trunk version of plugin updater (paid versions), restoring the ability to work on older WP versions (3.8 and before)
TWEAK: Add lbakut_activity_log to the list of large log tables
TWEAK: Updater in paid versions now requests JSON as response format for responses when claiming entitlements
TWEAK: Resolve: Backup labels could end up with extraneous slashes in output
TWEAK: Updater in paid versions can now receive and process update information in respond to entitlement claim - one less HTTP round-trip
TWEAK: Improve Google Cloud authentication success message for bucket name is not defined
TWEAK: UpdraftVault commands now pass an instance identifier
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.13.12 |
Comparing to | |
See all releases |
Code changes from version 1.13.11 to 1.13.12
- admin.php +634 -424
- backup.php +484 -270
- central/bootstrap.php +36 -25
- central/commands.php +1 -1
- central/listener.php +4 -4
- central/modules/analytics.php +1 -1
- central/modules/comments.php +1 -1
- central/modules/core.php +33 -18
- central/modules/plugin.php +184 -0
- central/modules/updates.php +4 -4
- central/modules/updraftvault.php +0 -42
- central/modules/users.php +125 -57
- class-updraftplus.php +339 -74
- css/admin.css +10 -4
- css/admin.min.css +1 -1
- css/admin.min.css.map +1 -1
- images/addons-images/backblaze.png +0 -0
- images/notices/metaslider_logo.png +0 -0
- includes/Dropbox/API.php +0 -594
- includes/Dropbox/Exception.php +0 -28
- includes/Dropbox/OAuth/Consumer/ConsumerAbstract.php +0 -433
- includes/Dropbox/OAuth/Consumer/Curl.php +0 -249
- includes/Dropbox/OAuth/Consumer/WordPress.php +0 -80
- includes/Dropbox/OAuth/Storage/Encrypter.php +0 -109
- includes/Dropbox/OAuth/Storage/StorageInterface.php +0 -30
- includes/Dropbox/OAuth/Storage/WordPress.php +0 -195
- includes/Dropbox2/OAuth/Consumer/ConsumerAbstract.php +3 -1
- includes/Dropbox2/OAuth/Consumer/Curl.php +2 -1
- includes/class-commands.php +28 -14
- includes/class-wpadmin-commands.php +69 -0
- includes/handlebars/LICENSE +1 -1
- includes/handlebars/handlebars.js +3 -3
- includes/handlebars/handlebars.min.js +3 -3
- includes/handlebars/handlebars.runtime.js +3 -3
- includes/handlebars/handlebars.runtime.min.js +3 -3
- includes/updraft-admin.js +129 -91
- includes/updraft-admin.min.js +3 -3
- includes/updraftplus-notices.php +1 -1
- includes/updraftvault.php +46 -0
- languages/updraftplus-af.po +1203 -1122
- languages/updraftplus-ar.mo +0 -0
- languages/updraftplus-ar.po +431 -343
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if (!defined
|
4 |
|
5 |
// Admin-area code lives here. This gets called in admin_menu, earlier than admin_init
|
6 |
|
@@ -15,6 +15,8 @@ class UpdraftPlus_Admin {
|
|
15 |
|
16 |
private $backups_instance_ids;
|
17 |
|
|
|
|
|
18 |
public function __construct() {
|
19 |
$this->admin_init();
|
20 |
}
|
@@ -31,14 +33,15 @@ class UpdraftPlus_Admin {
|
|
31 |
return $path;
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
public function get_templates_dir() {
|
35 |
return apply_filters('updraftplus_templates_dir', $this->wp_normalize_path(UPDRAFTPLUS_DIR.'/templates'));
|
36 |
}
|
37 |
|
38 |
-
public function get_templates_url() {
|
39 |
-
return apply_filters('updraftplus_templates_url', UPDRAFTPLUS_DIR.'/templates');
|
40 |
-
}
|
41 |
-
|
42 |
private function register_template_directories() {
|
43 |
|
44 |
$template_directories = array();
|
@@ -118,11 +121,17 @@ class UpdraftPlus_Admin {
|
|
118 |
$clientid = $storage_options['clientid'];
|
119 |
$token = empty($storage_options['token']) ? '' : $storage_options['token'];
|
120 |
}
|
121 |
-
if (!empty($clientid) && '' == $token)
|
|
|
|
|
|
|
122 |
unset($clientid);
|
123 |
unset($token);
|
124 |
} else {
|
125 |
-
if (empty($storage_options['user_id']))
|
|
|
|
|
|
|
126 |
}
|
127 |
}
|
128 |
}
|
@@ -140,7 +149,10 @@ class UpdraftPlus_Admin {
|
|
140 |
$clientid = $storage_options['clientid'];
|
141 |
$token = (empty($storage_options['token'])) ? '' : $storage_options['token'];
|
142 |
|
143 |
-
if (!empty($clientid) && empty($token))
|
|
|
|
|
|
|
144 |
}
|
145 |
}
|
146 |
}
|
@@ -156,7 +168,8 @@ class UpdraftPlus_Admin {
|
|
156 |
} elseif (!empty($settings['settings'])) {
|
157 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
158 |
if (empty($storage_options['tk_access_token'])) {
|
159 |
-
|
|
|
160 |
}
|
161 |
}
|
162 |
}
|
@@ -172,14 +185,19 @@ class UpdraftPlus_Admin {
|
|
172 |
$updraftplus->log_wp_error($settings, true, true);
|
173 |
} elseif (!empty($settings['settings'])) {
|
174 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
175 |
-
if((defined('UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP') && UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP)){
|
176 |
-
if(!empty($storage_options['clientid']) && !empty($storage_options['secret']) && empty($storage_options['refresh_token'])) {
|
177 |
-
|
|
|
178 |
} elseif (empty($storage_options['refresh_token'])) {
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
-
} else{
|
182 |
-
if(empty($storage_options['refresh_token']))add_action('all_admin_notices', array($this,'show_admin_warning_onedrive'));
|
183 |
}
|
184 |
}
|
185 |
}
|
@@ -196,7 +214,7 @@ class UpdraftPlus_Admin {
|
|
196 |
} elseif (!empty($settings['settings'])) {
|
197 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
198 |
if (empty($storage_options['token']) && empty($storage_options['email'])) {
|
199 |
-
add_action('all_admin_notices', array($this,'show_admin_warning_updraftvault'));
|
200 |
}
|
201 |
}
|
202 |
}
|
@@ -205,7 +223,7 @@ class UpdraftPlus_Admin {
|
|
205 |
if ($this->disk_space_check(1048576*35) === false) add_action('all_admin_notices', array($this, 'show_admin_warning_diskspace'));
|
206 |
}
|
207 |
|
208 |
-
private function setup_all_admin_notices_udonly($service, $override = false){
|
209 |
global $wp_version;
|
210 |
|
211 |
if (UpdraftPlus_Options::user_can_manage() && defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && (!defined('UPDRAFTPLUS_DISABLE_WP_CRON_NOTICE') || !UPDRAFTPLUS_DISABLE_WP_CRON_NOTICE)) {
|
@@ -213,7 +231,7 @@ class UpdraftPlus_Admin {
|
|
213 |
}
|
214 |
|
215 |
if (UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
|
216 |
-
@ini_set('display_errors',1);
|
217 |
@error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
218 |
add_action('all_admin_notices', array($this, 'show_admin_debug_warning'));
|
219 |
}
|
@@ -223,9 +241,9 @@ class UpdraftPlus_Admin {
|
|
223 |
$this->no_settings_warning = true;
|
224 |
}
|
225 |
|
226 |
-
|
227 |
@set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);
|
228 |
-
$max_execution_time = (int)@ini_get('max_execution_time');
|
229 |
if ($max_execution_time>0 && $max_execution_time<20) {
|
230 |
add_action('all_admin_notices', array($this, 'show_admin_warning_execution_time'));
|
231 |
}
|
@@ -240,20 +258,10 @@ class UpdraftPlus_Admin {
|
|
240 |
if (version_compare($wp_version, '3.2', '<')) add_action('all_admin_notices', array($this, 'show_admin_warning_wordpressversion'));
|
241 |
}
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
foreach ($actions_to_remove as $action) {
|
249 |
-
remove_action('all_admin_notices', $action);
|
250 |
-
}
|
251 |
-
|
252 |
-
}
|
253 |
-
*/
|
254 |
-
|
255 |
-
//Used to output the information for the next scheduled backup
|
256 |
-
//**// moved to function for the ajax saves
|
257 |
public function next_scheduled_backups_output() {
|
258 |
// UNIX timestamp
|
259 |
$next_scheduled_backup = wp_next_scheduled('updraft_backup');
|
@@ -262,14 +270,14 @@ class UpdraftPlus_Admin {
|
|
262 |
$next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
|
263 |
// Convert to blog time zone
|
264 |
$next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
|
265 |
-
//
|
266 |
} else {
|
267 |
$next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
|
268 |
$files_not_scheduled = true;
|
269 |
}
|
270 |
|
271 |
$next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
|
272 |
-
if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database',UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
|
273 |
if (isset($files_not_scheduled)) {
|
274 |
$next_scheduled_backup_database = $next_scheduled_backup;
|
275 |
$database_not_scheduled = true;
|
@@ -283,7 +291,7 @@ class UpdraftPlus_Admin {
|
|
283 |
$next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
|
284 |
// Convert to blog time zone
|
285 |
$next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
|
286 |
-
//
|
287 |
} else {
|
288 |
$next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
|
289 |
$database_not_scheduled = true;
|
@@ -305,13 +313,16 @@ class UpdraftPlus_Admin {
|
|
305 |
}
|
306 |
}
|
307 |
|
|
|
|
|
|
|
308 |
private function admin_init() {
|
309 |
|
310 |
add_action('core_upgrade_preamble', array($this, 'core_upgrade_preamble'));
|
311 |
add_action('admin_action_upgrade-plugin', array($this, 'admin_action_upgrade_pluginortheme'));
|
312 |
add_action('admin_action_upgrade-theme', array($this, 'admin_action_upgrade_pluginortheme'));
|
313 |
|
314 |
-
add_action('admin_head', array($this,'admin_head'));
|
315 |
add_filter((is_multisite() ? 'network_admin_' : '').'plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
316 |
add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
|
317 |
add_action('wp_ajax_updraft_ajax', array($this, 'updraft_ajax_handler'));
|
@@ -326,8 +337,8 @@ class UpdraftPlus_Admin {
|
|
326 |
// Add a new Ajax action for saving settings
|
327 |
add_action('wp_ajax_updraft_savesettings', array($this, 'updraft_ajax_savesettings'));
|
328 |
|
329 |
-
// Ajax for settings import and export
|
330 |
-
add_action('wp_ajax_updraft_importsettings', array($this, 'updraft_ajax_importsettings'));
|
331 |
|
332 |
// UpdraftPlus templates
|
333 |
$this->register_template_directories();
|
@@ -346,7 +357,7 @@ class UpdraftPlus_Admin {
|
|
346 |
|
347 |
// Main dashboard page advert
|
348 |
// Since our nonce is printed, make sure they have sufficient credentials
|
349 |
-
if (
|
350 |
|
351 |
$dismissed_until = UpdraftPlus_Options::get_updraft_option('updraftplus_dismisseddashnotice', 0);
|
352 |
|
@@ -355,17 +366,17 @@ class UpdraftPlus_Admin {
|
|
355 |
$installed = @filemtime($backup_dir.'/index.html');
|
356 |
$installed_for = time() - $installed;
|
357 |
|
358 |
-
if (($installed && time() > $dismissed_until && $installed_for > 28*86400
|
359 |
add_action('all_admin_notices', array($this, 'show_admin_notice_upgradead'));
|
360 |
}
|
361 |
}
|
362 |
|
363 |
-
//Moved out for use with Ajax saving
|
364 |
$this->setup_all_admin_notices_global($service);
|
365 |
}
|
366 |
|
367 |
// Next, the actions that only come on the UpdraftPlus page
|
368 |
-
if (
|
369 |
$this->setup_all_admin_notices_udonly($service);
|
370 |
|
371 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 99999);
|
@@ -374,9 +385,8 @@ class UpdraftPlus_Admin {
|
|
374 |
/**
|
375 |
* Sets up what is needed to allow an in-page backup to be run. Will enqueue scripts and output appropriate HTML (so, should be run when at a suitable place). Not intended for use on the UpdraftPlus settings page.
|
376 |
*
|
377 |
-
* @param string
|
378 |
* @param callable $callback Callable function to output the contents of the updraft_inpage_prebackup element - i.e. what shows in the modal before a backup beings.
|
379 |
-
*
|
380 |
*/
|
381 |
public function add_backup_scaffolding($title, $callback) {
|
382 |
$this->admin_enqueue_scripts();
|
@@ -424,7 +434,7 @@ class UpdraftPlus_Admin {
|
|
424 |
die();
|
425 |
}
|
426 |
|
427 |
-
$restore_nonce = (string)$_POST['restorenonce'];
|
428 |
|
429 |
if (empty($_POST['ajaxauth'])) {
|
430 |
echo json_encode(array('e' => 'Illegitimate data sent (2)'));
|
@@ -461,15 +471,15 @@ class UpdraftPlus_Admin {
|
|
461 |
$updraftplus->backup_time_nonce($restore_nonce);
|
462 |
$updraftplus->logfile_open($restore_nonce);
|
463 |
|
464 |
-
$timestamp = empty($_POST['timestamp']) ? false : (int)$_POST['timestamp'];
|
465 |
-
$multisite = empty($_POST['multisite']) ? false : (bool)$_POST['multisite'];
|
466 |
-
$created_by_version = empty($_POST['created_by_version']) ? false : (int)$_POST['created_by_version'];
|
467 |
|
468 |
// TODO: We need to know about first_one (not yet sent), as well as last_one
|
469 |
|
470 |
// TODO: Verify the values of these
|
471 |
-
$type = empty($_POST['type']) ? false : (int)$_POST['type'];
|
472 |
-
$backupfile = empty($_POST['backupfile']) ? false : (string)$_POST['backupfile'];
|
473 |
|
474 |
$updraftplus->log("Deferred restore resumption: $type: $backupfile (timestamp=$timestamp, last_one=$last_one)");
|
475 |
|
@@ -557,18 +567,15 @@ class UpdraftPlus_Admin {
|
|
557 |
'id' => 'updraft_admin_node_premium',
|
558 |
'title' => 'UpdraftPlus Premium',
|
559 |
'parent' => 'updraft_admin_node',
|
560 |
-
'href' => apply_filters('updraftplus_com_link','https://updraftplus.com/shop/updraftplus-premium/')
|
561 |
);
|
562 |
$wp_admin_bar->add_node($args);
|
563 |
}
|
564 |
}
|
565 |
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
// return "<link rel='stylesheet' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n";
|
570 |
-
// }
|
571 |
-
|
572 |
public function show_admin_notice_upgradead() {
|
573 |
$this->include_template('wp-admin/notices/thanks-for-using-main-dash.php');
|
574 |
}
|
@@ -593,7 +600,9 @@ class UpdraftPlus_Admin {
|
|
593 |
|
594 |
}
|
595 |
|
596 |
-
|
|
|
|
|
597 |
public function admin_enqueue_scripts() {
|
598 |
|
599 |
global $updraftplus, $wp_locale;
|
@@ -604,10 +613,10 @@ class UpdraftPlus_Admin {
|
|
604 |
// Defeat other plugins/themes which dump their jQuery UI CSS onto our settings page
|
605 |
wp_deregister_style('jquery-ui');
|
606 |
$jquery_ui_css_enqueue_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '1.11.4'.'.'.time() : '1.11.4';
|
607 |
-
wp_enqueue_style('jquery-ui', UPDRAFTPLUS_URL.'/includes/jquery-ui.custom'.$min_or_not.'.css', array(), $jquery_ui_css_enqueue_version);
|
608 |
|
609 |
wp_enqueue_style('updraft-admin-css', UPDRAFTPLUS_URL.'/css/admin'.$min_or_not.'.css', array(), $enqueue_version);
|
610 |
-
//
|
611 |
|
612 |
$this->ensure_sufficient_jquery_and_enqueue();
|
613 |
$jquery_blockui_enqueue_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '2.70.0'.'.'.time() : '2.70.0';
|
@@ -624,14 +633,14 @@ class UpdraftPlus_Admin {
|
|
624 |
|
625 |
$day_selector = '';
|
626 |
for ($day_index = 0; $day_index <= 6; $day_index++) {
|
627 |
-
//
|
628 |
$selected = '';
|
629 |
$day_selector .= "\n\t<option value='" . $day_index . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
|
630 |
}
|
631 |
|
632 |
$mday_selector = '';
|
633 |
for ($mday_index = 1; $mday_index <= 28; $mday_index++) {
|
634 |
-
//
|
635 |
$selected = '';
|
636 |
$mday_selector .= "\n\t<option value='" . $mday_index . "' $selected>" . $mday_index . '</option>';
|
637 |
}
|
@@ -646,7 +655,7 @@ class UpdraftPlus_Admin {
|
|
646 |
'excludedeverything' => __('If you exclude both the database and the files, then you have excluded everything!', 'updraftplus'),
|
647 |
'nofileschosen' => __('You have chosen to backup files, but no file entities have been selected', 'updraftplus'),
|
648 |
'notableschosen' => __('You have chosen to backup a database, but no tables have been selected', 'updraftplus'),
|
649 |
-
'
|
650 |
'unexpectedresponse' => __('Unexpected response:', 'updraftplus'),
|
651 |
'servererrorcode' => __('The web server returned an error code (try again, or check your web server logs)', 'updraftplus'),
|
652 |
'newuserpass' => __("The new user's RackSpace console password is (this will not be shown again):", 'updraftplus'),
|
@@ -705,13 +714,13 @@ class UpdraftPlus_Admin {
|
|
705 |
'updatequotacount' => __('Update quota count', 'updraftplus'),
|
706 |
'addingsite' => __('Adding...', 'updraftplus'),
|
707 |
'addsite' => __('Add site', 'updraftplus'),
|
708 |
-
//
|
709 |
'creating_please_allow' => __('Creating...', 'updraftplus').(function_exists('openssl_encrypt') ? '' : ' ('.__('your PHP install lacks the openssl module; as a result, this can take minutes; if nothing has happened by then, then you should either try a smaller key size, or ask your web hosting company how to enable this PHP module on your setup.', 'updraftplus').')'),
|
710 |
'sendtosite' => __('Send to site:', 'updraftplus'),
|
711 |
'checkrpcsetup' => sprintf(__('You should check that the remote site is online, not firewalled, does not have security modules that may be blocking access, has UpdraftPlus version %s or later active and that the keys have been entered correctly.', 'updraftplus'), '2.10.3'),
|
712 |
'pleasenamekey' => __('Please give this key a name (e.g. indicate the site it is for):', 'updraftplus'),
|
713 |
'key' => __('Key', 'updraftplus'),
|
714 |
-
'nokeynamegiven' => sprintf(__("Failure: No %s was given.",'updraftplus'), __('key name', 'updraftplus')),
|
715 |
'deleting' => __('Deleting...', 'updraftplus'),
|
716 |
'enter_mothership_url' => __('Please enter a valid URL', 'updraftplus'),
|
717 |
'delete_response_not_understood' => __("We requested to delete the file, but could not understand the server's response", 'updraftplus'),
|
@@ -739,8 +748,8 @@ class UpdraftPlus_Admin {
|
|
739 |
'settings_test_result' => __('%s settings test result:', 'updraftplus'),
|
740 |
'nothing_yet_logged' => __('Nothing yet logged', 'updraftplus'),
|
741 |
'import_select_file' => __('You have not yet selected a file to import.', 'updraftplus'),
|
742 |
-
'import_invalid_json_file' => __('Error: The chosen file is corrupt. Please choose a valid UpdraftPlus export file.', 'updraftplus'),
|
743 |
-
'updraft_settings_url' => UpdraftPlus_Options::admin_page_url().'?page=updraftplus',
|
744 |
'network_site_url' => network_site_url(),
|
745 |
'importing' => __('Importing...', 'updraftplus'),
|
746 |
'importing_data_from' => __('This will import data from:', 'updraftplus'),
|
@@ -758,11 +767,13 @@ class UpdraftPlus_Admin {
|
|
758 |
'loading_log_file' => __('Loading log file', 'updraftplus'),
|
759 |
'updraftplus_version' => $updraftplus->version,
|
760 |
'updraftcentral_wizard_empty_url' => __('Please enter the URL where your UpdraftCentral dashboard is hosted.'),
|
761 |
-
'updraftcentral_wizard_invalid_url' => __('Please enter a valid URL e.g http://example.com', 'updraftplus')
|
762 |
-
)
|
763 |
}
|
764 |
|
765 |
-
|
|
|
|
|
766 |
public function core_upgrade_preamble() {
|
767 |
// They need to be able to perform backups, and to perform updates
|
768 |
if (!UpdraftPlus_Options::user_can_manage() || (!current_user_can('update_core') && !current_user_can('update_plugins') && !current_user_can('update_themes'))) return;
|
@@ -772,18 +783,18 @@ class UpdraftPlus_Admin {
|
|
772 |
}
|
773 |
|
774 |
?>
|
775 |
-
<?php
|
776 |
if (!class_exists('UpdraftPlus_Addon_Autobackup')) {
|
777 |
-
if (!class_exists('UpdraftPlus_Notices'))
|
778 |
global $updraftplus_notices;
|
779 |
-
echo apply_filters('updraftplus_autobackup_blurb', $updraftplus_notices->do_notice('autobackup', 'autobackup', true));
|
780 |
} else {
|
781 |
echo '<div class="updraft-ad-container updated">';
|
782 |
echo '<h3 style="margin-top: 2px;">'. __('Be safe with an automatic backup', 'updraftplus').'</h3>';
|
783 |
-
echo apply_filters('updraftplus_autobackup_blurb', '');
|
784 |
echo '</div>';
|
785 |
}
|
786 |
-
|
787 |
<script>
|
788 |
jQuery(document).ready(function() {
|
789 |
jQuery('.updraft-ad-container').appendTo('.wrap p:first');
|
@@ -792,16 +803,19 @@ class UpdraftPlus_Admin {
|
|
792 |
<?php
|
793 |
}
|
794 |
|
|
|
|
|
|
|
795 |
public function admin_head() {
|
796 |
|
797 |
global $pagenow;
|
798 |
|
799 |
-
if (
|
800 |
|
801 |
-
|
802 |
|
803 |
-
|
804 |
-
|
805 |
|
806 |
$plupload_init = array(
|
807 |
'runtimes' => 'html5,flash,silverlight,html4',
|
@@ -822,16 +836,8 @@ class UpdraftPlus_Admin {
|
|
822 |
'action' => 'plupload_action'
|
823 |
)
|
824 |
);
|
825 |
-
// 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
826 |
-
// 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
827 |
-
|
828 |
-
// We want to receive -db files also...
|
829 |
-
// if (1) {
|
830 |
-
// $plupload_init['filters'] = array(array('title' => __('Allowed Files'), 'extensions' => 'zip,tar,gz,bz2,crypt,sql,txt'));
|
831 |
-
// } else {
|
832 |
-
// }
|
833 |
|
834 |
-
|
835 |
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.swf')) {
|
836 |
$plupload_init['flash_swf_url'] = includes_url('js/plupload/Moxie.swf');
|
837 |
} else {
|
@@ -845,11 +851,11 @@ class UpdraftPlus_Admin {
|
|
845 |
}
|
846 |
|
847 |
?><script>
|
848 |
-
var updraft_credentialtest_nonce='<?php echo wp_create_nonce('updraftplus-credentialtest-nonce');?>';
|
849 |
-
var updraftplus_settings_nonce='<?php echo wp_create_nonce('updraftplus-settings-nonce');?>';
|
850 |
var updraft_siteurl = '<?php echo esc_js(site_url('', 'relative'));?>';
|
851 |
-
var updraft_plupload_config
|
852 |
-
var updraft_download_nonce='<?php echo wp_create_nonce('updraftplus_download');?>';
|
853 |
var updraft_accept_archivename = <?php echo apply_filters('updraftplus_accept_archivename_js', "[]");?>;
|
854 |
<?php
|
855 |
$plupload_init['browse_button'] = 'plupload-browse-button2';
|
@@ -858,45 +864,49 @@ class UpdraftPlus_Admin {
|
|
858 |
$plupload_init['multipart_params']['action'] = 'plupload_action2';
|
859 |
$plupload_init['filters'] = array(array('title' => __('Allowed Files'), 'extensions' => 'crypt'));
|
860 |
?>
|
861 |
-
var updraft_plupload_config2
|
862 |
var updraft_downloader_nonce = '<?php wp_create_nonce("updraftplus_download"); ?>'
|
863 |
<?php
|
864 |
$overdue = $this->howmany_overdue_crons();
|
865 |
-
if ($overdue >= 4) {
|
866 |
-
|
867 |
-
|
|
|
868 |
});
|
869 |
<?php } ?>
|
870 |
</script>
|
871 |
<?php
|
872 |
}
|
873 |
|
874 |
-
|
875 |
private function disk_space_check($space) {
|
876 |
global $updraftplus;
|
877 |
$updraft_dir = $updraftplus->backups_dir_location();
|
878 |
$disk_free_space = @disk_free_space($updraft_dir);
|
879 |
-
if (
|
880 |
return ($disk_free_space > $space) ? true : false;
|
881 |
}
|
882 |
|
883 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
public function plugin_action_links($links, $file) {
|
885 |
-
if (is_array($links) &&
|
886 |
$settings_link = '<a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__("Settings", "updraftplus").'</a>';
|
887 |
array_unshift($links, $settings_link);
|
888 |
-
|
889 |
-
// array_unshift($links, $settings_link);
|
890 |
-
$settings_link = '<a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/").'">'.__("Add-Ons / Pro Support","updraftplus").'</a>';
|
891 |
array_unshift($links, $settings_link);
|
892 |
}
|
893 |
return $links;
|
894 |
}
|
895 |
|
896 |
public function admin_action_upgrade_pluginortheme() {
|
897 |
-
if (isset($_GET['action']) && ($_GET['action']
|
898 |
|
899 |
-
if ($_GET['action']
|
900 |
if (!current_user_can('update_plugins')) return;
|
901 |
} else {
|
902 |
if (!current_user_can('update_themes')) return;
|
@@ -915,34 +925,33 @@ class UpdraftPlus_Admin {
|
|
915 |
$submenu_file = 'themes.php';
|
916 |
}
|
917 |
|
918 |
-
|
919 |
|
920 |
-
if (!class_exists('UpdraftPlus_Notices'))
|
921 |
global $updraftplus_notices;
|
922 |
$updraftplus_notices->do_notice('autobackup', 'autobackup');
|
923 |
}
|
924 |
}
|
925 |
|
926 |
-
public function show_admin_warning($message, $class =
|
927 |
echo '<div class="updraftmessage '.$class.'">'."<p>$message</p></div>";
|
928 |
}
|
929 |
|
930 |
-
//
|
931 |
public function show_admin_warning_multiple_storage_options() {
|
932 |
$this->show_admin_warning('<strong>UpdraftPlus:</strong> '.__('An error occurred when fetching storage module options: ', 'updraftplus').htmlspecialchars($this->storage_module_option_errors), 'error');
|
933 |
}
|
934 |
|
935 |
-
public function show_admin_warning_unwritable(){
|
936 |
$unwritable_mess = htmlspecialchars(__("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus'));
|
937 |
$this->show_admin_warning($unwritable_mess, "error");
|
938 |
-
}
|
939 |
|
940 |
public function show_admin_nosettings_warning() {
|
941 |
$this->show_admin_warning('<strong>'.__('Welcome to UpdraftPlus!', 'updraftplus').'</strong> '.__('To make a backup, just press the Backup Now button.', 'updraftplus').' <a href="#" id="updraft-navtab-settings2">'.__('To change any of the default settings of what is backed up, to configure scheduled backups, to send your backups to remote storage (recommended), and more, go to the settings tab.', 'updraftplus').'</a>', 'updated notice is-dismissible');
|
942 |
}
|
943 |
|
944 |
public function show_admin_warning_execution_time() {
|
945 |
-
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('The amount of time allowed for WordPress plugins to run is very low (%s seconds) - you should increase it to avoid backup failures due to time-outs (consult your web hosting company for more help - it is the max_execution_time PHP setting; the recommended value is %s seconds or more)', 'updraftplus'), (int)@ini_get('max_execution_time'), 90));
|
946 |
}
|
947 |
|
948 |
public function show_admin_warning_disabledcron() {
|
@@ -950,7 +959,7 @@ class UpdraftPlus_Admin {
|
|
950 |
}
|
951 |
|
952 |
public function show_admin_warning_diskspace() {
|
953 |
-
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('You have less than %s of free disk space on the disk which UpdraftPlus is configured to use to create backups. UpdraftPlus could well run out of space. Contact your the operator of your server (e.g. your web hosting company) to resolve this issue.', 'updraftplus'),'35 MB'));
|
954 |
}
|
955 |
|
956 |
public function show_admin_warning_wordpressversion() {
|
@@ -958,7 +967,7 @@ class UpdraftPlus_Admin {
|
|
958 |
}
|
959 |
|
960 |
public function show_admin_warning_litespeed() {
|
961 |
-
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('Your website is hosted using the %s web server.', 'updraftplus'),'LiteSpeed').' <a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/i-am-having-trouble-backing-up-and-my-web-hosting-company-uses-the-litespeed-webserver/").'">'.__('Please consult this FAQ if you have problems backing up.', 'updraftplus').'</a>');
|
962 |
}
|
963 |
|
964 |
public function show_admin_debug_warning() {
|
@@ -972,38 +981,58 @@ class UpdraftPlus_Admin {
|
|
972 |
return $ret;
|
973 |
}
|
974 |
|
975 |
-
|
|
|
|
|
976 |
public function show_admin_warning_dropbox() {
|
977 |
-
$this->
|
|
|
|
|
978 |
}
|
979 |
|
|
|
|
|
|
|
980 |
public function show_admin_warning_onedrive() {
|
981 |
-
|
|
|
|
|
982 |
}
|
983 |
|
984 |
public function show_admin_warning_updraftvault() {
|
985 |
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> '.sprintf(__('%s has been chosen for remote storage, but you are not currently connected.', 'updraftplus'), 'UpdraftPlus Vault').' '.__('Go to the remote storage settings in order to connect.', 'updraftplus'), 'updated');
|
986 |
}
|
987 |
|
|
|
|
|
|
|
988 |
public function show_admin_warning_googledrive() {
|
989 |
-
$this->
|
|
|
|
|
990 |
}
|
991 |
|
|
|
|
|
|
|
992 |
public function show_admin_warning_googlecloud() {
|
993 |
-
$this->
|
|
|
|
|
994 |
}
|
995 |
|
996 |
-
|
|
|
|
|
|
|
|
|
|
|
997 |
public function prune_updraft_dir_prefix($updraft_dir) {
|
998 |
if ('/' == substr($updraft_dir, 0, 1) || "\\" == substr($updraft_dir, 0, 1) || preg_match('/^[a-zA-Z]:/', $updraft_dir)) {
|
999 |
$wcd = trailingslashit(WP_CONTENT_DIR);
|
1000 |
if (strpos($updraft_dir, $wcd) === 0) {
|
1001 |
$updraft_dir = substr($updraft_dir, strlen($wcd));
|
1002 |
}
|
1003 |
-
# Legacy
|
1004 |
-
// if (strpos($updraft_dir, ABSPATH) === 0) {
|
1005 |
-
// $updraft_dir = substr($updraft_dir, strlen(ABSPATH));
|
1006 |
-
// }
|
1007 |
}
|
1008 |
return $updraft_dir;
|
1009 |
}
|
@@ -1017,7 +1046,7 @@ class UpdraftPlus_Admin {
|
|
1017 |
|
1018 |
if (empty($_REQUEST['timestamp']) || !is_numeric($_REQUEST['timestamp']) || empty($_REQUEST['type'])) exit;
|
1019 |
|
1020 |
-
$findex = empty($_REQUEST['findex']) ? 0 : (int)$_REQUEST['findex'];
|
1021 |
$stage = empty($_REQUEST['stage']) ? '' : $_REQUEST['stage'];
|
1022 |
$file_path = empty($_REQUEST['filepath']) ? '' : $_REQUEST['filepath'];
|
1023 |
|
@@ -1132,14 +1161,14 @@ class UpdraftPlus_Admin {
|
|
1132 |
$needs_downloading = false;
|
1133 |
|
1134 |
if (!file_exists($fullpath)) {
|
1135 |
-
//
|
1136 |
$needs_downloading = true;
|
1137 |
$updraftplus->log('File does not yet exist locally - needs downloading');
|
1138 |
} elseif ($known_size > 0 && filesize($fullpath) < $known_size) {
|
1139 |
$updraftplus->log("The file was found locally (".filesize($fullpath).") but did not match the size in the backup history ($known_size) - will resume downloading");
|
1140 |
$needs_downloading = true;
|
1141 |
} elseif ($known_size > 0) {
|
1142 |
-
$updraftplus->log('The file was found locally and matched the recorded size from the backup history ('.round($known_size/1024,1).' KB)');
|
1143 |
} else {
|
1144 |
$updraftplus->log('No file size was found recorded in the backup history. We will assume the local one is complete.');
|
1145 |
$known_size = filesize($fullpath);
|
@@ -1222,14 +1251,14 @@ class UpdraftPlus_Admin {
|
|
1222 |
|
1223 |
if ($restore) {
|
1224 |
$service_description = empty($updraftplus->backup_methods[$service]) ? $service : $updraftplus->backup_methods[$service];
|
1225 |
-
$updraftplus->log(__("File is not locally present - needs retrieving from remote storage",'updraftplus')." ($service_description)", 'notice-restore');
|
1226 |
}
|
1227 |
|
1228 |
$object = $storage_objects_and_ids[$service]['object'];
|
1229 |
|
1230 |
-
if (!$object->supports_feature('multi_options')) {
|
1231 |
-
error_log("UpdraftPlus_Admin::get_remote_file(): Multi-options not supported by: ".$service);
|
1232 |
-
continue;
|
1233 |
}
|
1234 |
|
1235 |
$instance_ids = $storage_objects_and_ids[$service]['instance_settings'];
|
@@ -1273,12 +1302,11 @@ class UpdraftPlus_Admin {
|
|
1273 |
/**
|
1274 |
* Downloads a specified file into UD's directory
|
1275 |
*
|
1276 |
-
* @param String $file
|
1277 |
-
* @param
|
1278 |
-
*
|
1279 |
* @return Boolean - Whether the operation succeeded. Inherited from the storage module's download() method. N.B. At the time of writing it looks like not all modules necessarily return true upon success; but false can be relied upon for detecting failure.
|
1280 |
*/
|
1281 |
-
private function download_file($file,
|
1282 |
|
1283 |
global $updraftplus;
|
1284 |
|
@@ -1318,7 +1346,11 @@ class UpdraftPlus_Admin {
|
|
1318 |
|
1319 |
}
|
1320 |
|
1321 |
-
|
|
|
|
|
|
|
|
|
1322 |
public function _updraftplus_background_operation_started($msg) {
|
1323 |
global $updraftplus;
|
1324 |
// The extra spaces are because of a bug seen on one server in handling of non-ASCII characters; see HS#11739
|
@@ -1348,7 +1380,7 @@ class UpdraftPlus_Admin {
|
|
1348 |
$data_in_get = array('get_log', 'get_fragment');
|
1349 |
|
1350 |
// UpdraftPlus_WPAdmin_Commands extends UpdraftPlus_Commands - i.e. all commands are in there
|
1351 |
-
if (!class_exists('UpdraftPlus_WPAdmin_Commands'))
|
1352 |
$commands = new UpdraftPlus_WPAdmin_Commands($this);
|
1353 |
|
1354 |
if (method_exists($commands, $subaction)) {
|
@@ -1407,9 +1439,8 @@ class UpdraftPlus_Admin {
|
|
1407 |
/**
|
1408 |
* Run a credentials test for the indicated remote storage module
|
1409 |
*
|
1410 |
-
* @param Array
|
1411 |
-
* @param Boolean $return_instead_of_echo
|
1412 |
-
*
|
1413 |
* @return Array|Void - the results, if they are being returned (rather than echoed). Keys: 'output' (the output), 'data' (other data)
|
1414 |
*/
|
1415 |
public function do_credentials_test($test_settings, $return_instead_of_echo = false) {
|
@@ -1419,7 +1450,7 @@ class UpdraftPlus_Admin {
|
|
1419 |
$objname = "UpdraftPlus_BackupModule_$method";
|
1420 |
|
1421 |
$this->logged = array();
|
1422 |
-
|
1423 |
set_error_handler(array($this, 'get_php_errors'), E_ALL & ~E_STRICT);
|
1424 |
|
1425 |
if (!class_exists($objname)) include_once(UPDRAFTPLUS_DIR."/methods/$method.php");
|
@@ -1427,7 +1458,7 @@ class UpdraftPlus_Admin {
|
|
1427 |
$ret = '';
|
1428 |
$data = null;
|
1429 |
|
1430 |
-
|
1431 |
if (method_exists($objname, "credentials_test")) {
|
1432 |
$obj = new $objname;
|
1433 |
if ($return_instead_of_echo) ob_start();
|
@@ -1452,9 +1483,7 @@ class UpdraftPlus_Admin {
|
|
1452 |
* Delete a backup set, whilst respecting limits on how much to delete in one go
|
1453 |
*
|
1454 |
* @uses remove_backup_set_cleanup()
|
1455 |
-
*
|
1456 |
* @param Array $opts - deletion options; with keys backup_timestamp, delete_remote, [remote_delete_limit]
|
1457 |
-
*
|
1458 |
* @return Array - as from remove_backup_set_cleanup()
|
1459 |
*/
|
1460 |
public function delete_set($opts) {
|
@@ -1462,9 +1491,9 @@ class UpdraftPlus_Admin {
|
|
1462 |
global $updraftplus;
|
1463 |
|
1464 |
$backups = UpdraftPlus_Backup_History::get_history();
|
1465 |
-
$timestamps = (string)$opts['backup_timestamp'];
|
1466 |
|
1467 |
-
$remote_delete_limit = (isset($opts['remote_delete_limit']) && $opts['remote_delete_limit'] > 0) ? (int)$opts['remote_delete_limit'] : PHP_INT_MAX;
|
1468 |
|
1469 |
$timestamps = explode(',', $timestamps);
|
1470 |
$delete_remote = empty($opts['delete_remote']) ? false : true;
|
@@ -1504,7 +1533,7 @@ class UpdraftPlus_Admin {
|
|
1504 |
$services = is_string($backups[$timestamp]['service']) ? array($backups[$timestamp]['service']) : $backups[$timestamp]['service'];
|
1505 |
if (is_array($services)) {
|
1506 |
foreach ($services as $service) {
|
1507 |
-
if ($service &&
|
1508 |
}
|
1509 |
}
|
1510 |
}
|
@@ -1517,7 +1546,7 @@ class UpdraftPlus_Admin {
|
|
1517 |
}
|
1518 |
}
|
1519 |
// Delete DB
|
1520 |
-
foreach ($backups[$timestamp] as $key => $value){
|
1521 |
if ('db' == strtolower(substr($key, 0, 2)) && '-size' != substr($key, -5, 5)) {
|
1522 |
$files_to_delete[$key] = $backups[$timestamp][$key];
|
1523 |
}
|
@@ -1572,12 +1601,12 @@ class UpdraftPlus_Admin {
|
|
1572 |
$deleted = $remote_obj->delete($file);
|
1573 |
|
1574 |
if (-1 === $deleted) {
|
1575 |
-
//echo __('Did not know how to delete from this cloud service.', 'updraftplus');
|
1576 |
} elseif (false !== $deleted) {
|
1577 |
$remote_deleted++;
|
1578 |
}
|
1579 |
|
1580 |
-
$itext = $index ? (string)$index : '';
|
1581 |
if ($was_string) {
|
1582 |
unset($backups[$timestamp][$key]);
|
1583 |
if ('db' == strtolower(substr($key, 0, 2))) unset($backups[$timestamp][$key][$index.'-size']);
|
@@ -1612,9 +1641,9 @@ class UpdraftPlus_Admin {
|
|
1612 |
/**
|
1613 |
* This function sorts the array of instance ids currently saved so that any instance id that is in both the saved settings and the backup history move to the top of the array, as these are likely to work. Then values that don't appear in the backup history move to the bottom.
|
1614 |
*
|
1615 |
-
* @param String $a
|
1616 |
-
* @param String $b
|
1617 |
-
* @return Integer
|
1618 |
*/
|
1619 |
public function instance_ids_sort($a, $b) {
|
1620 |
if (in_array($a, $this->backups_instance_ids)) {
|
@@ -1702,6 +1731,13 @@ class UpdraftPlus_Admin {
|
|
1702 |
));
|
1703 |
}
|
1704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1705 |
public function get_disk_space_used($entity) {
|
1706 |
global $updraftplus;
|
1707 |
if ('updraft' == $entity) {
|
@@ -1711,7 +1747,7 @@ class UpdraftPlus_Admin {
|
|
1711 |
if ('all' == $entity) {
|
1712 |
$total_size = 0;
|
1713 |
foreach ($backupable_entities as $entity => $data) {
|
1714 |
-
|
1715 |
$basedir = $backupable_entities[$entity];
|
1716 |
$dirs = apply_filters('updraftplus_dirlist_'.$entity, $basedir);
|
1717 |
$size = $this->recursive_directory_size($dirs, $updraftplus->get_exclude($entity), $basedir, 'numeric');
|
@@ -1719,7 +1755,7 @@ class UpdraftPlus_Admin {
|
|
1719 |
}
|
1720 |
return $updraftplus->convert_numeric_size_to_text($total_size);
|
1721 |
} elseif (!empty($backupable_entities[$entity])) {
|
1722 |
-
|
1723 |
$basedir = $backupable_entities[$entity];
|
1724 |
$dirs = apply_filters('updraftplus_dirlist_'.$entity, $basedir);
|
1725 |
return $this->recursive_directory_size($dirs, $updraftplus->get_exclude($entity), $basedir);
|
@@ -1728,6 +1764,13 @@ class UpdraftPlus_Admin {
|
|
1728 |
return __('Error', 'updraftplus');
|
1729 |
}
|
1730 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1731 |
public function activejobs_delete($job_id) {
|
1732 |
|
1733 |
if (preg_match("/^[0-9a-f]{12}$/", $job_id)) {
|
@@ -1757,14 +1800,19 @@ class UpdraftPlus_Admin {
|
|
1757 |
|
1758 |
}
|
1759 |
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
|
|
|
|
|
|
|
|
|
|
1763 |
public function get_download_statuses($downloaders) {
|
1764 |
global $updraftplus;
|
1765 |
$download_status = array();
|
1766 |
foreach ($downloaders as $downloader) {
|
1767 |
-
|
1768 |
if (preg_match('/^([^,]+),(\d+),([-a-z]+|db[0-9]+),(\d+)$/', $downloader, $matches)) {
|
1769 |
$findex = (empty($matches[4])) ? '0' : $matches[4];
|
1770 |
$updraftplus->nonce = dechex($matches[2]).$findex.substr(md5($matches[3]), 0, 3);
|
@@ -1786,7 +1834,7 @@ class UpdraftPlus_Admin {
|
|
1786 |
|
1787 |
global $updraftplus;
|
1788 |
|
1789 |
-
$download_status = empty($request['downloaders']) ? array(): $this->get_download_statuses(explode(':', $request['downloaders']));
|
1790 |
|
1791 |
if (!empty($request['oneshot'])) {
|
1792 |
$job_id = get_site_option('updraft_oneshotnonce', false);
|
@@ -1880,7 +1928,7 @@ class UpdraftPlus_Admin {
|
|
1880 |
|
1881 |
$potential_log_file = $updraft_dir."/log.".$nonce.".txt";
|
1882 |
|
1883 |
-
if (is_readable($potential_log_file)){
|
1884 |
|
1885 |
$templog_array = array();
|
1886 |
$log_file = fopen($potential_log_file, "r");
|
@@ -1916,6 +1964,11 @@ class UpdraftPlus_Admin {
|
|
1916 |
return $ret_array;
|
1917 |
}
|
1918 |
|
|
|
|
|
|
|
|
|
|
|
1919 |
public function howmany_overdue_crons() {
|
1920 |
$how_many_overdue = 0;
|
1921 |
if (function_exists('_get_cron_array') || (is_file(ABSPATH.WPINC.'/cron.php') && include_once(ABSPATH.WPINC.'/cron.php') && function_exists('_get_cron_array'))) {
|
@@ -1923,9 +1976,7 @@ class UpdraftPlus_Admin {
|
|
1923 |
if (is_array($crons)) {
|
1924 |
$timenow = time();
|
1925 |
foreach ($crons as $jt => $job) {
|
1926 |
-
if ($jt < $timenow)
|
1927 |
-
$how_many_overdue++;
|
1928 |
-
}
|
1929 |
}
|
1930 |
}
|
1931 |
}
|
@@ -1937,7 +1988,7 @@ class UpdraftPlus_Admin {
|
|
1937 |
if (0 == error_reporting()) return true;
|
1938 |
$logline = $updraftplus->php_error_to_logline($errno, $errstr, $errfile, $errline);
|
1939 |
if (false !== $logline) $this->logged[] = $logline;
|
1940 |
-
|
1941 |
return true;
|
1942 |
}
|
1943 |
|
@@ -1963,14 +2014,14 @@ class UpdraftPlus_Admin {
|
|
1963 |
} elseif (preg_match('/^downloaded:(\d+):(.*)$/', $file, $matches) && file_exists($matches[2])) {
|
1964 |
$response['p'] = 100;
|
1965 |
$response['f'] = $matches[2];
|
1966 |
-
$response['s'] = (int)$matches[1];
|
1967 |
-
$response['t'] = (int)$matches[1];
|
1968 |
$response['m'] = __('File ready.', 'updraftplus');
|
1969 |
if ('db' != substr($type, 0, 2)) $response['can_show_contents'] = true;
|
1970 |
} elseif (preg_match('/^downloading:(\d+):(.*)$/', $file, $matches) && file_exists($matches[2])) {
|
1971 |
// Convert to bytes
|
1972 |
$response['f'] = $matches[2];
|
1973 |
-
$total_size = (int)max($matches[1], 1);
|
1974 |
$cur_size = filesize($matches[2]);
|
1975 |
$response['s'] = $cur_size;
|
1976 |
$file_age = time() - filemtime($matches[2]);
|
@@ -1995,7 +2046,14 @@ class UpdraftPlus_Admin {
|
|
1995 |
return $uploads;
|
1996 |
}
|
1997 |
|
1998 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999 |
public function unique_filename_callback($dir, $name, $ext) {
|
2000 |
return $name.$ext;
|
2001 |
}
|
@@ -2047,7 +2105,7 @@ class UpdraftPlus_Admin {
|
|
2047 |
}
|
2048 |
|
2049 |
// If this was the chunk, then we should instead be concatenating onto the final file
|
2050 |
-
if (isset($_POST['chunks']) && isset($_POST['chunk']) && preg_match('/^[0-9]+$/'
|
2051 |
$final_file = basename($_POST['name']);
|
2052 |
if (!rename($status['file'], $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp')) {
|
2053 |
@unlink($status['file']);
|
@@ -2059,10 +2117,12 @@ class UpdraftPlus_Admin {
|
|
2059 |
// Final chunk? If so, then stich it all back together
|
2060 |
if ($_POST['chunk'] == $_POST['chunks']-1) {
|
2061 |
if ($wh = fopen($updraft_dir.'/'.$final_file, 'wb')) {
|
2062 |
-
for ($i=0
|
2063 |
$rf = $updraft_dir.'/'.$final_file.'.'.$i.'.zip.tmp';
|
2064 |
if ($rh = fopen($rf, 'rb')) {
|
2065 |
-
while ($line = fread($rh, 32768))
|
|
|
|
|
2066 |
fclose($rh);
|
2067 |
@unlink($rf);
|
2068 |
}
|
@@ -2098,7 +2158,7 @@ class UpdraftPlus_Admin {
|
|
2098 |
$response['dm'] = sprintf(__('This backup was created by %s, and can be imported.', 'updraftplus'), $accepted);
|
2099 |
} else {
|
2100 |
@unlink($status['file']);
|
2101 |
-
echo json_encode(array('e' => sprintf(__('Error: %s', 'updraftplus'),__('Bad filename format - this does not look like a file created by UpdraftPlus', 'updraftplus'))));
|
2102 |
exit;
|
2103 |
}
|
2104 |
} else {
|
@@ -2106,7 +2166,7 @@ class UpdraftPlus_Admin {
|
|
2106 |
$type = isset($matches[3]) ? $matches[3] : '';
|
2107 |
if (!preg_match('/^log\.[a-f0-9]{12}\.txt/', $file) && 'db' != $type && !isset($backupable_entities[$type])) {
|
2108 |
@unlink($status['file']);
|
2109 |
-
echo json_encode(array('e' => sprintf(__('Error: %s', 'updraftplus'),sprintf(__('This looks like a file created by UpdraftPlus, but this install does not know about this type of object: %s. Perhaps you need to install an add-on?', 'updraftplus'), htmlspecialchars($type)))));
|
2110 |
exit;
|
2111 |
}
|
2112 |
}
|
@@ -2118,7 +2178,9 @@ class UpdraftPlus_Admin {
|
|
2118 |
exit;
|
2119 |
}
|
2120 |
|
2121 |
-
|
|
|
|
|
2122 |
public function plupload_action2() {
|
2123 |
|
2124 |
@set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);
|
@@ -2141,8 +2203,8 @@ class UpdraftPlus_Admin {
|
|
2141 |
$farray['type'] = 'application/octet-stream';
|
2142 |
|
2143 |
if (isset($_POST['chunks'])) {
|
2144 |
-
//
|
2145 |
-
//
|
2146 |
} else {
|
2147 |
$farray['unique_filename_callback'] = array($this, 'unique_filename_callback');
|
2148 |
}
|
@@ -2160,7 +2222,7 @@ class UpdraftPlus_Admin {
|
|
2160 |
}
|
2161 |
|
2162 |
// If this was the chunk, then we should instead be concatenating onto the final file
|
2163 |
-
if (isset($_POST['chunks']) && isset($_POST['chunk']) && preg_match('/^[0-9]+$/'
|
2164 |
$final_file = basename($_POST['name']);
|
2165 |
rename($status['file'], $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp');
|
2166 |
$status['file'] = $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp';
|
@@ -2168,10 +2230,12 @@ class UpdraftPlus_Admin {
|
|
2168 |
// Final chunk? If so, then stich it all back together
|
2169 |
if ($_POST['chunk'] == $_POST['chunks']-1) {
|
2170 |
if ($wh = fopen($updraft_dir.'/'.$final_file, 'wb')) {
|
2171 |
-
for ($i=0
|
2172 |
$rf = $updraft_dir.'/'.$final_file.'.'.$i.'.zip.tmp';
|
2173 |
if ($rh = fopen($rf, 'rb')) {
|
2174 |
-
while ($line = fread($rh, 32768))
|
|
|
|
|
2175 |
fclose($rh);
|
2176 |
@unlink($rf);
|
2177 |
}
|
@@ -2195,11 +2259,13 @@ class UpdraftPlus_Admin {
|
|
2195 |
}
|
2196 |
|
2197 |
// send the uploaded file url in response
|
2198 |
-
// echo 'OK:'.$status['url'];
|
2199 |
echo 'OK:'.$file;
|
2200 |
exit;
|
2201 |
}
|
2202 |
|
|
|
|
|
|
|
2203 |
public function settings_header() {
|
2204 |
$this->include_template('wp-admin/settings/header.php');
|
2205 |
}
|
@@ -2215,13 +2281,10 @@ class UpdraftPlus_Admin {
|
|
2215 |
|
2216 |
global $updraftplus;
|
2217 |
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
*/
|
2223 |
-
|
2224 |
-
if (isset($_REQUEST['action']) && (($_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp'])) || ('updraft_restore_continue' == $_REQUEST['action'] && !empty($_REQUEST['restoreid'])))) {
|
2225 |
|
2226 |
$is_continuation = ('updraft_restore_continue' == $_REQUEST['action']) ? true : false;
|
2227 |
|
@@ -2253,8 +2316,8 @@ class UpdraftPlus_Admin {
|
|
2253 |
$backup_success = false;
|
2254 |
}
|
2255 |
|
2256 |
-
if (empty($updraftplus->errors) &&
|
2257 |
-
// TODO: Deal with the case of some of the work having been deferred
|
2258 |
// If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
|
2259 |
UpdraftPlus_Backup_History::rebuild();
|
2260 |
echo '<p><strong>';
|
@@ -2281,7 +2344,7 @@ class UpdraftPlus_Admin {
|
|
2281 |
echo '<strong>'.__('Actions', 'updraftplus').':</strong> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration', 'updraftplus').'</a>';
|
2282 |
return;
|
2283 |
} elseif (false === $backup_success) {
|
2284 |
-
|
2285 |
echo '<p>';
|
2286 |
$updraftplus->log_e('Restore failed...');
|
2287 |
echo '</p>';
|
@@ -2317,7 +2380,7 @@ class UpdraftPlus_Admin {
|
|
2317 |
|
2318 |
if (isset($_GET['message'])) $this->show_admin_warning(htmlspecialchars($_GET['message']));
|
2319 |
|
2320 |
-
if (isset($_GET['action']) && $_GET['action']
|
2321 |
$created = $this->create_backup_dir();
|
2322 |
if (is_wp_error($created)) {
|
2323 |
echo '<p>'.__('Backup directory could not be created', 'updraftplus').'...<br>';
|
@@ -2326,7 +2389,7 @@ class UpdraftPlus_Admin {
|
|
2326 |
echo '<li>'.htmlspecialchars($msg).'</li>';
|
2327 |
}
|
2328 |
echo '</ul></p>';
|
2329 |
-
} elseif (
|
2330 |
echo '<p>'.__('Backup directory successfully created.', 'updraftplus').'</p><br>';
|
2331 |
}
|
2332 |
echo '<b>'.__('Actions', 'updraftplus').':</b> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration', 'updraftplus').'</a>';
|
@@ -2362,40 +2425,39 @@ class UpdraftPlus_Admin {
|
|
2362 |
// Opens a div, which needs closing later
|
2363 |
if (isset($_GET['updraft_restore_success'])) {
|
2364 |
|
2365 |
-
if (get_template() === 'optimizePressTheme' || is_plugin_active('optimizePressPlugin') || is_plugin_active_for_network('optimizePressPlugin')){
|
2366 |
-
$this->show_admin_warning("<a href='https://optimizepress.zendesk.com/hc/en-us/articles/203699826-Update-URL-References-after-moving-domain' target='_blank'>" . __("OptimizePress 2.0 encodes its contents, so search/replace does not work.","updraftplus") . ' ' . __("To fix this problem go here.","updraftplus") . "</a>", "notice notice-warning");
|
2367 |
}
|
2368 |
-
$success_advert = (isset($_GET['pval']) && 0 == $_GET['pval'] && !$updraftplus->have_addons) ? '<p>'.__('For even more features and personal support, check out ', 'updraftplus').'<strong><a href="'.apply_filters("updraftplus_com_link",'https://updraftplus.com/shop/updraftplus-premium/').'" target="_blank">UpdraftPlus Premium</a>.</strong></p>' : "";
|
2369 |
|
2370 |
echo "<div class=\"updated backup-restored\"><span><strong>".__('Your backup has been restored.', 'updraftplus').'</strong></span><br>';
|
2371 |
// Unnecessary - will be advised of this below
|
2372 |
-
//
|
2373 |
echo $success_advert;
|
2374 |
$include_deleteform_div = false;
|
2375 |
|
2376 |
}
|
2377 |
|
2378 |
-
// $this->print_restore_in_progress_box_if_needed();
|
2379 |
-
|
2380 |
if ($this->scan_old_dirs(true)) $this->print_delete_old_dirs_form(true, $include_deleteform_div);
|
2381 |
|
2382 |
// Close the div opened by the earlier section
|
2383 |
if (isset($_GET['updraft_restore_success'])) echo '</div>';
|
2384 |
|
2385 |
-
if(empty($success_advert) && empty($this->no_settings_warning)) {
|
2386 |
|
2387 |
-
if (!class_exists('UpdraftPlus_Notices'))
|
2388 |
global $updraftplus_notices;
|
2389 |
$updraftplus_notices->do_notice();
|
2390 |
}
|
2391 |
|
2392 |
if (!$updraftplus->memory_check(64)) {
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
|
|
2399 |
|
2400 |
|
2401 |
if (!empty($updraftplus->errors)) {
|
@@ -2413,18 +2475,29 @@ class UpdraftPlus_Admin {
|
|
2413 |
|
2414 |
?>
|
2415 |
|
2416 |
-
<?php
|
2417 |
|
2418 |
$tabflag = 1;
|
2419 |
|
2420 |
-
if (isset($_REQUEST['tab'])){
|
2421 |
-
switch($_REQUEST['tab']) {
|
2422 |
-
case 'status':
|
2423 |
-
|
2424 |
-
|
2425 |
-
case '
|
2426 |
-
|
2427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2428 |
}
|
2429 |
}
|
2430 |
|
@@ -2500,7 +2573,7 @@ class UpdraftPlus_Admin {
|
|
2500 |
}
|
2501 |
|
2502 |
$restore_jobdata = $this->restore_in_progress_jobdata;
|
2503 |
-
$seconds_ago = time() - (int)$restore_jobdata['job_time_ms'];
|
2504 |
$minutes_ago = floor($seconds_ago/60);
|
2505 |
$seconds_ago = $seconds_ago - $minutes_ago*60;
|
2506 |
$time_ago = sprintf(__("%s minutes, %s seconds", 'updraftplus'), $minutes_ago, $seconds_ago);
|
@@ -2518,13 +2591,13 @@ class UpdraftPlus_Admin {
|
|
2518 |
|
2519 |
}
|
2520 |
|
|
|
|
|
|
|
|
|
|
|
2521 |
public function backupnow_modal_contents() {
|
2522 |
-
|
2523 |
-
$ret = $this->backup_now_widgetry();
|
2524 |
-
|
2525 |
-
// $ret .= '<p>'.__('Does nothing happen when you attempt backups?', 'updraftplus').' <a href="https://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/">'.__('Go here for help.', 'updraftplus').'</a></p>';
|
2526 |
-
|
2527 |
-
return $ret;
|
2528 |
}
|
2529 |
|
2530 |
private function backup_now_widgetry() {
|
@@ -2537,7 +2610,7 @@ class UpdraftPlus_Admin {
|
|
2537 |
|
2538 |
$ret .= '<div id="backupnow_database_moreoptions" class="updraft-hidden" style="display:none;">';
|
2539 |
|
2540 |
-
$premium_link = apply_filters('updraftplus_com_link','https://updraftplus.com/landing/updraftplus-premium');
|
2541 |
|
2542 |
$free_ret = '<em>'.__('All WordPress tables will be backed up.', 'updraftplus').' <a href="'.$premium_link.'">'. __('With UpdraftPlus Premium, you can choose to backup non-WordPress tables, backup only specified tables, and backup other databases too.', 'updraftplus').'</a></em>';
|
2543 |
|
@@ -2556,15 +2629,25 @@ class UpdraftPlus_Admin {
|
|
2556 |
return $ret;
|
2557 |
}
|
2558 |
|
2559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2560 |
public function render_active_jobs_and_log_table($wide_format = false, $print_active_jobs = true) {
|
2561 |
?>
|
2562 |
<table class="form-table" id="updraft_activejobs_table">
|
2563 |
|
2564 |
<?php $active_jobs = ($print_active_jobs) ? $this->print_active_jobs() : '';?>
|
2565 |
<tr id="updraft_activejobsrow" class="<?php
|
2566 |
-
if (!$active_jobs && !$wide_format) {
|
2567 |
-
|
|
|
|
|
|
|
|
|
2568 |
?>">
|
2569 |
<?php if ($wide_format) { ?>
|
2570 |
<td id="updraft_activejobs" colspan="2">
|
@@ -2594,7 +2677,7 @@ class UpdraftPlus_Admin {
|
|
2594 |
</tr>
|
2595 |
|
2596 |
<?php
|
2597 |
-
|
2598 |
if (1==0 && !defined('UPDRAFTPLUS_NOADS_B')) {
|
2599 |
$feed = $updraftplus->get_updraftplus_rssfeed();
|
2600 |
if (is_a($feed, 'SimplePie')) {
|
@@ -2604,7 +2687,7 @@ class UpdraftPlus_Admin {
|
|
2604 |
echo '<li>';
|
2605 |
echo '<a href="'.esc_attr($item->get_permalink()).'">';
|
2606 |
echo htmlspecialchars($item->get_title());
|
2607 |
-
|
2608 |
echo "</a> (".htmlspecialchars($item->get_date('j F Y')).")";
|
2609 |
echo '</li>';
|
2610 |
}
|
@@ -2616,13 +2699,16 @@ class UpdraftPlus_Admin {
|
|
2616 |
<?php
|
2617 |
}
|
2618 |
|
|
|
|
|
|
|
2619 |
private function most_recently_modified_log_link() {
|
2620 |
|
2621 |
global $updraftplus;
|
2622 |
list($mod_time, $log_file, $nonce) = $updraftplus->last_modified_log();
|
2623 |
|
2624 |
?>
|
2625 |
-
<a href="?page=updraftplus&action=downloadlatestmodlog&wpnonce=<?php echo wp_create_nonce('updraftplus_download') ?>" <?php if (!$mod_time) echo 'style="display:none;"'; ?> class="updraft-log-link" onclick="event.preventDefault(); updraft_popuplog('');"><?php _e('Download most recently modified log file', 'updraftplus');?></a>
|
2626 |
<?php
|
2627 |
}
|
2628 |
|
@@ -2639,7 +2725,7 @@ class UpdraftPlus_Admin {
|
|
2639 |
}
|
2640 |
|
2641 |
private function print_delete_old_dirs_form($include_blurb = true, $include_div = true) {
|
2642 |
-
if ($include_blurb) {
|
2643 |
if ($include_div) {
|
2644 |
echo '<div id="updraft_delete_old_dirs_pagediv" class="updated delete-old-directories">';
|
2645 |
}
|
@@ -2655,36 +2741,45 @@ class UpdraftPlus_Admin {
|
|
2655 |
if ($include_blurb && $include_div) echo '</div>';
|
2656 |
}
|
2657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2658 |
public function get_cron($job_id = false) {
|
2659 |
-
|
2660 |
$cron = get_option('cron');
|
2661 |
if (!is_array($cron)) $cron = array();
|
2662 |
if (false === $job_id) return $cron;
|
2663 |
|
2664 |
foreach ($cron as $time => $job) {
|
2665 |
-
if (isset($job['updraft_backup_resume']))
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
}
|
2672 |
}
|
2673 |
}
|
2674 |
}
|
2675 |
}
|
2676 |
|
2677 |
-
|
|
|
|
|
|
|
|
|
|
|
2678 |
private function print_active_jobs($this_job_only = false) {
|
2679 |
$cron = $this->get_cron();
|
2680 |
-
// $found_jobs = 0;
|
2681 |
$ret = '';
|
2682 |
|
2683 |
foreach ($cron as $time => $job) {
|
2684 |
if (isset($job['updraft_backup_resume'])) {
|
2685 |
foreach ($job['updraft_backup_resume'] as $hook => $info) {
|
2686 |
if (isset($info['args'][1])) {
|
2687 |
-
// $found_jobs++;
|
2688 |
$job_id = $info['args'][1];
|
2689 |
if (false === $this_job_only || $job_id == $this_job_only) {
|
2690 |
$ret .= $this->print_active_job($job_id, false, $time, $info['args'][0]);
|
@@ -2703,7 +2798,6 @@ class UpdraftPlus_Admin {
|
|
2703 |
}
|
2704 |
}
|
2705 |
|
2706 |
-
// if (0 == $found_jobs) $ret .= '<p><em>'.__('(None)', 'updraftplus').'</em></p>';
|
2707 |
return $ret;
|
2708 |
}
|
2709 |
|
@@ -2716,21 +2810,20 @@ class UpdraftPlus_Admin {
|
|
2716 |
|
2717 |
if (false == apply_filters('updraftplus_print_active_job_continue', true, $is_oneshot, $next_resumption, $jobdata)) return '';
|
2718 |
|
2719 |
-
#if (!is_array($jobdata)) $jobdata = array();
|
2720 |
if (!isset($jobdata['backup_time'])) return '';
|
2721 |
|
2722 |
$backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
|
2723 |
|
2724 |
-
$began_at = (isset($jobdata['backup_time'])) ? get_date_from_gmt(gmdate('Y-m-d H:i:s', (int)$jobdata['backup_time']), 'D, F j, Y H:i') : '?';
|
2725 |
|
2726 |
$jobstatus = empty($jobdata['jobstatus']) ? 'unknown' : $jobdata['jobstatus'];
|
2727 |
$stage = 0;
|
2728 |
switch ($jobstatus) {
|
2729 |
-
|
2730 |
case 'begun':
|
2731 |
$curstage = __('Backup begun', 'updraftplus');
|
2732 |
-
|
2733 |
-
|
2734 |
case 'filescreating':
|
2735 |
$stage = 1;
|
2736 |
$curstage = __('Creating file backup zips', 'updraftplus');
|
@@ -2740,44 +2833,42 @@ class UpdraftPlus_Admin {
|
|
2740 |
if (strlen($sdescrip) > 20 && isset($jobdata['filecreating_substatus']['e']) && is_array($jobdata['filecreating_substatus']['e']) && isset($backupable_entities[$jobdata['filecreating_substatus']['e']]['shortdescription'])) $sdescrip = $backupable_entities[$jobdata['filecreating_substatus']['e']]['shortdescription'];
|
2741 |
$curstage .= ' ('.$sdescrip.')';
|
2742 |
if (isset($jobdata['filecreating_substatus']['i']) && isset($jobdata['filecreating_substatus']['t'])) {
|
2743 |
-
$stage = min(2, 1 + ($jobdata['filecreating_substatus']['i']/max($jobdata['filecreating_substatus']['t'],1)));
|
2744 |
}
|
2745 |
}
|
2746 |
-
|
2747 |
case 'filescreated':
|
2748 |
$stage = 2;
|
2749 |
$curstage = __('Created file backup zips', 'updraftplus');
|
2750 |
-
|
2751 |
-
|
2752 |
-
# Stage 4
|
2753 |
case 'clouduploading':
|
2754 |
$stage = 4;
|
2755 |
$curstage = __('Uploading files to remote storage', 'updraftplus');
|
2756 |
if (isset($jobdata['uploading_substatus']['t']) && isset($jobdata['uploading_substatus']['i'])) {
|
2757 |
-
$t = max((int)$jobdata['uploading_substatus']['t'], 1);
|
2758 |
$i = min($jobdata['uploading_substatus']['i']/$t, 1);
|
2759 |
$p = min($jobdata['uploading_substatus']['p'], 1);
|
2760 |
$pd = $i + $p/$t;
|
2761 |
$stage = 4 + $pd;
|
2762 |
$curstage .= ' '.sprintf(__('(%s%%, file %s of %s)', 'updraftplus'), floor(100*$pd), $jobdata['uploading_substatus']['i']+1, $t);
|
2763 |
}
|
2764 |
-
|
2765 |
case 'pruning':
|
2766 |
$stage = 5;
|
2767 |
$curstage = __('Pruning old backup sets', 'updraftplus');
|
2768 |
-
|
2769 |
case 'resumingforerrors':
|
2770 |
$stage = -1;
|
2771 |
$curstage = __('Waiting until scheduled time to retry because of errors', 'updraftplus');
|
2772 |
-
|
2773 |
-
|
2774 |
case 'finished':
|
2775 |
$stage = 6;
|
2776 |
$curstage = __('Backup finished', 'updraftplus');
|
2777 |
-
|
2778 |
default:
|
2779 |
-
|
2780 |
-
# Database creation and encryption occupies the space from 2 to 4. Databases are created then encrypted, then the next databae is created/encrypted, etc.
|
2781 |
if ('dbcreated' == substr($jobstatus, 0, 9)) {
|
2782 |
$jobstatus = 'dbcreated';
|
2783 |
$whichdb = substr($jobstatus, 9);
|
@@ -2802,7 +2893,7 @@ class UpdraftPlus_Admin {
|
|
2802 |
if (!empty($jobdata['dbcreating_substatus']['t'])) {
|
2803 |
$curstage .= ' ('.sprintf(__('table: %s', 'updraftplus'), $jobdata['dbcreating_substatus']['t']).')';
|
2804 |
if (!empty($jobdata['dbcreating_substatus']['i']) && !empty($jobdata['dbcreating_substatus']['a'])) {
|
2805 |
-
$substage = max(0.001, ($jobdata['dbcreating_substatus']['i'] / max($jobdata['dbcreating_substatus']['a'],1)));
|
2806 |
$stage += $substage * $perdbspace * 0.5;
|
2807 |
}
|
2808 |
}
|
@@ -2834,12 +2925,12 @@ class UpdraftPlus_Admin {
|
|
2834 |
foreach ($time_passed as $run => $passed) {
|
2835 |
if (isset($runs_started[$run])) {
|
2836 |
$time_ago = microtime(true) - ($runs_started[$run] + $time_passed[$run]);
|
2837 |
-
if ($time_ago < $last_checkin_ago ||
|
2838 |
}
|
2839 |
}
|
2840 |
}
|
2841 |
|
2842 |
-
$next_res_after = (int)$time-time();
|
2843 |
$next_res_txt = ($is_oneshot) ? '' : ' - '.sprintf(__("next resumption: %d (after %ss)", 'updraftplus'), $next_resumption, $next_res_after). ' ';
|
2844 |
$last_activity_txt = ($last_checkin_ago >= 0) ? ' - '.sprintf(__('last activity: %ss ago', 'updraftplus'), floor($last_checkin_ago)).' ' : '';
|
2845 |
|
@@ -2856,7 +2947,7 @@ class UpdraftPlus_Admin {
|
|
2856 |
|
2857 |
if (!empty($jobdata['is_autobackup'])) $ret .= ' isautobackup';
|
2858 |
|
2859 |
-
$ret .= '" data-jobid="'.$job_id.'" data-lastactivity="'.(int)$last_checkin_ago.'" data-nextresumption="'.$next_resumption.'" data-nextresumptionafter="'.$next_res_after.'" title="'.esc_attr(sprintf(__('Job ID: %s', 'updraftplus'), $job_id)).$title_info.'">'.$began_at.'</span> ';
|
2860 |
|
2861 |
$ret .= $show_inline_info;
|
2862 |
$ret .= '- <a data-jobid="'.$job_id.'" href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&action=downloadlog&updraftplus_backup_nonce='.$job_id.'" class="updraft-log-link">'.__('show log', 'updraftplus').'</a>';
|
@@ -2875,7 +2966,7 @@ class UpdraftPlus_Admin {
|
|
2875 |
|
2876 |
$ret .= '<div class="curstage">';
|
2877 |
$ret .= htmlspecialchars($curstage);
|
2878 |
-
|
2879 |
$ret .= '<div class="updraft_percentage" data-info="'.esc_attr($curstage).'" data-progress="'.(($stage>0) ? (ceil((100/6)*$stage)) : '0').'" style="height: 100%; width:'.(($stage>0) ? (ceil((100/6)*$stage)) : '0').'%"></div>';
|
2880 |
$ret .= '</div></div>';
|
2881 |
|
@@ -2886,7 +2977,7 @@ class UpdraftPlus_Admin {
|
|
2886 |
}
|
2887 |
|
2888 |
private function delete_old_dirs_go($show_return = true) {
|
2889 |
-
echo
|
2890 |
|
2891 |
if ($this->delete_old_dirs()) {
|
2892 |
echo '<p>'.__('Old directories successfully removed.', 'updraftplus').'</p><br>';
|
@@ -2896,36 +2987,38 @@ class UpdraftPlus_Admin {
|
|
2896 |
if ($show_return) echo '<b>'.__('Actions', 'updraftplus').':</b> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration', 'updraftplus').'</a>';
|
2897 |
}
|
2898 |
|
2899 |
-
|
|
|
|
|
|
|
|
|
2900 |
private function delete_old_dirs() {
|
2901 |
global $wp_filesystem, $updraftplus;
|
2902 |
-
$credentials = request_filesystem_credentials(wp_nonce_url(UpdraftPlus_Options::admin_page_url()."?page=updraftplus&action=updraft_delete_old_dirs", 'updraftplus-credentialtest-nonce'));
|
2903 |
WP_Filesystem($credentials);
|
2904 |
-
if ($wp_filesystem->errors->get_error_code()) {
|
2905 |
-
foreach ($wp_filesystem->errors->get_error_messages() as $message)
|
2906 |
-
|
2907 |
-
exit;
|
2908 |
}
|
2909 |
// From WP_CONTENT_DIR - which contains 'themes'
|
2910 |
$ret = $this->delete_old_dirs_dir($wp_filesystem->wp_content_dir());
|
2911 |
|
2912 |
$updraft_dir = $updraftplus->backups_dir_location();
|
2913 |
if ($updraft_dir) {
|
2914 |
-
$ret4 =
|
2915 |
} else {
|
2916 |
$ret4 = true;
|
2917 |
}
|
2918 |
|
2919 |
-
// $ret2 = $this->delete_old_dirs_dir($wp_filesystem->abspath());
|
2920 |
$plugs = untrailingslashit($wp_filesystem->wp_plugins_dir());
|
2921 |
if ($wp_filesystem->is_dir($plugs.'-old')) {
|
2922 |
-
|
2923 |
if (!$wp_filesystem->delete($plugs.'-old', true)) {
|
2924 |
$ret3 = false;
|
2925 |
-
|
2926 |
} else {
|
2927 |
$ret3 = true;
|
2928 |
-
|
2929 |
}
|
2930 |
} else {
|
2931 |
$ret3 = true;
|
@@ -2951,7 +3044,7 @@ class UpdraftPlus_Admin {
|
|
2951 |
foreach ($list as $item) {
|
2952 |
$name = (is_array($item)) ? $item['name'] : $item;
|
2953 |
if ("-old" == substr($name, -4, 4)) {
|
2954 |
-
//recursively delete
|
2955 |
print "<strong>".__('Delete', 'updraftplus').": </strong>".htmlspecialchars($name).": ";
|
2956 |
|
2957 |
if ($wpfs) {
|
@@ -2974,7 +3067,11 @@ class UpdraftPlus_Admin {
|
|
2974 |
return $ret;
|
2975 |
}
|
2976 |
|
2977 |
-
|
|
|
|
|
|
|
|
|
2978 |
private function create_backup_dir() {
|
2979 |
|
2980 |
global $wp_filesystem, $updraftplus;
|
@@ -2997,11 +3094,11 @@ class UpdraftPlus_Admin {
|
|
2997 |
|
2998 |
if (!$wp_filesystem->is_dir($default_backup_dir) && !$wp_filesystem->mkdir($default_backup_dir, 0775)) {
|
2999 |
$wperr = new WP_Error;
|
3000 |
-
if ($wp_filesystem->errors->get_error_code()) {
|
3001 |
foreach ($wp_filesystem->errors->get_error_messages() as $message) {
|
3002 |
$wperr->add('mkdir_error', $message);
|
3003 |
}
|
3004 |
-
return $wperr;
|
3005 |
} else {
|
3006 |
return new WP_Error('mkdir_error', __('The request to the filesystem to create the directory failed.', 'updraftplus'));
|
3007 |
}
|
@@ -3029,7 +3126,12 @@ class UpdraftPlus_Admin {
|
|
3029 |
return true;
|
3030 |
}
|
3031 |
|
3032 |
-
|
|
|
|
|
|
|
|
|
|
|
3033 |
private function scan_old_dirs($print_as_comment = false) {
|
3034 |
global $updraftplus;
|
3035 |
$dirs = scandir(untrailingslashit(WP_CONTENT_DIR));
|
@@ -3042,7 +3144,7 @@ class UpdraftPlus_Admin {
|
|
3042 |
return true;
|
3043 |
}
|
3044 |
}
|
3045 |
-
|
3046 |
if (is_dir(untrailingslashit(WP_PLUGIN_DIR).'-old')) {
|
3047 |
if ($print_as_comment) echo '<!--'.htmlspecialchars(untrailingslashit(WP_PLUGIN_DIR).'-old').'-->';
|
3048 |
return true;
|
@@ -3052,9 +3154,10 @@ class UpdraftPlus_Admin {
|
|
3052 |
|
3053 |
/**
|
3054 |
* Outputs html for a storage method using the parameters passed in, this version should be removed when all remote storages use the multi version
|
3055 |
-
*
|
3056 |
-
* @param
|
3057 |
-
* @param
|
|
|
3058 |
*/
|
3059 |
public function storagemethod_row($method, $header, $contents) {
|
3060 |
?>
|
@@ -3066,10 +3169,11 @@ class UpdraftPlus_Admin {
|
|
3066 |
}
|
3067 |
|
3068 |
/**
|
3069 |
-
* Outputs html for a storage method using the parameters passed in
|
3070 |
-
*
|
3071 |
-
* @param
|
3072 |
-
* @param
|
|
|
3073 |
*/
|
3074 |
public function storagemethod_row_multi($classes, $header, $contents) {
|
3075 |
?>
|
@@ -3079,7 +3183,27 @@ class UpdraftPlus_Admin {
|
|
3079 |
</tr>
|
3080 |
<?php
|
3081 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3082 |
|
|
|
|
|
|
|
|
|
|
|
3083 |
public function last_backup_html() {
|
3084 |
|
3085 |
global $updraftplus;
|
@@ -3089,16 +3213,14 @@ class UpdraftPlus_Admin {
|
|
3089 |
if ($updraft_last_backup) {
|
3090 |
|
3091 |
// Convert to GMT, then to blog time
|
3092 |
-
$backup_time = (int)$updraft_last_backup['backup_time'];
|
3093 |
|
3094 |
$print_time = get_date_from_gmt(gmdate('Y-m-d H:i:s', $backup_time), 'D, F j, Y H:i');
|
3095 |
-
// $print_time = date_i18n('D, F j, Y H:i', $backup_time);
|
3096 |
|
3097 |
if (empty($updraft_last_backup['backup_time_incremental'])) {
|
3098 |
$last_backup_text = "<span style=\"color:".(($updraft_last_backup['success']) ? 'green' : 'black').";\">".$print_time.'</span>';
|
3099 |
} else {
|
3100 |
$inc_time = get_date_from_gmt(gmdate('Y-m-d H:i:s', $updraft_last_backup['backup_time_incremental']), 'D, F j, Y H:i');
|
3101 |
-
// $inc_time = date_i18n('D, F j, Y H:i', $updraft_last_backup['backup_time_incremental']);
|
3102 |
$last_backup_text = "<span style=\"color:".(($updraft_last_backup['success']) ? 'green' : 'black').";\">$inc_time</span> (".sprintf(__('incremental backup; base backup: %s', 'updraftplus'), $print_time).')';
|
3103 |
}
|
3104 |
|
@@ -3129,13 +3251,18 @@ class UpdraftPlus_Admin {
|
|
3129 |
}
|
3130 |
|
3131 |
} else {
|
3132 |
-
$last_backup_text =
|
3133 |
}
|
3134 |
|
3135 |
return $last_backup_text;
|
3136 |
|
3137 |
}
|
3138 |
|
|
|
|
|
|
|
|
|
|
|
3139 |
public function get_intervals() {
|
3140 |
return apply_filters('updraftplus_backup_intervals', array(
|
3141 |
'manual' => _x("Manual", 'i.e. Non-automatic', 'updraftplus'),
|
@@ -3149,7 +3276,7 @@ class UpdraftPlus_Admin {
|
|
3149 |
));
|
3150 |
}
|
3151 |
|
3152 |
-
public function really_writable_message($really_is_writable, $updraft_dir){
|
3153 |
if ($really_is_writable) {
|
3154 |
$dir_info = '<span style="color:green;">'.__('Backup directory specified is writable, which is good.', 'updraftplus').'</span>';
|
3155 |
} else {
|
@@ -3164,6 +3291,11 @@ class UpdraftPlus_Admin {
|
|
3164 |
return $dir_info;
|
3165 |
}
|
3166 |
|
|
|
|
|
|
|
|
|
|
|
3167 |
public function settings_formcontents($options = array()) {
|
3168 |
$this->include_template('wp-admin/settings/form-contents.php', false, array('options' => $options));
|
3169 |
}
|
@@ -3205,14 +3337,21 @@ class UpdraftPlus_Admin {
|
|
3205 |
return $ret;
|
3206 |
}
|
3207 |
|
3208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3209 |
public function files_selector_widgetry($prefix = '', $show_exclusion_options = true, $include_more = true) {
|
3210 |
|
3211 |
$ret = '';
|
3212 |
|
3213 |
global $updraftplus;
|
3214 |
$backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
|
3215 |
-
|
3216 |
$include_more_paths = UpdraftPlus_Options::get_updraft_option('updraft_include_more_path');
|
3217 |
foreach ($backupable_entities as $key => $info) {
|
3218 |
$included = (UpdraftPlus_Options::get_updraft_option("updraft_include_$key", apply_filters("updraftplus_defaultoption_include_".$key, true))) ? 'checked="checked"' : "";
|
@@ -3238,7 +3377,7 @@ class UpdraftPlus_Admin {
|
|
3238 |
|
3239 |
} else {
|
3240 |
|
3241 |
-
if (
|
3242 |
|
3243 |
$data_toggle_exclude_field = $show_exclusion_options ? 'data-toggle_exclude_field="'.$key.'"' : '';
|
3244 |
|
@@ -3253,6 +3392,15 @@ class UpdraftPlus_Admin {
|
|
3253 |
return $ret;
|
3254 |
}
|
3255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3256 |
public function show_double_warning($text, $extraclass = '', $echo = true) {
|
3257 |
|
3258 |
$ret = "<div class=\"error updraftplusmethod $extraclass\"><p>$text</p></div>";
|
@@ -3264,20 +3412,17 @@ class UpdraftPlus_Admin {
|
|
3264 |
}
|
3265 |
|
3266 |
public function optionfilter_split_every($value) {
|
3267 |
-
|
3268 |
-
if ($value < UPDRAFTPLUS_SPLIT_MIN) $value = UPDRAFTPLUS_SPLIT_MIN;
|
3269 |
-
return $value;
|
3270 |
}
|
3271 |
|
3272 |
/**
|
3273 |
* Check if curl exists; if not, print or return appropriate error messages
|
3274 |
*
|
3275 |
-
* @param String $service
|
3276 |
-
* @param Boolean $has_fallback
|
3277 |
-
* @param String
|
3278 |
-
* @param Boolean $echo_instead_of_return
|
3279 |
-
*
|
3280 |
-
* @returns String|Void - any resulting message, if $echo_instead_of_return was set
|
3281 |
*/
|
3282 |
public function curl_check($service, $has_fallback = false, $extraclass = '', $echo_instead_of_return = true) {
|
3283 |
|
@@ -3293,12 +3438,12 @@ class UpdraftPlus_Admin {
|
|
3293 |
$curl_ssl_supported= ($curl_version['features'] & CURL_VERSION_SSL);
|
3294 |
if (!$curl_ssl_supported) {
|
3295 |
if ($has_fallback) {
|
3296 |
-
$ret .= '<p><strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__("Your web server's PHP/Curl installation does not support https access. Communications with %s will be unencrypted. Ask your web host to install Curl/SSL in order to gain the ability for encryption (via an add-on).",'updraftplus'), $service).'</p>';
|
3297 |
} else {
|
3298 |
-
$ret .= $this->show_double_warning('<p><strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__("Your web server's PHP/Curl installation does not support https access. We cannot access %s without this support. Please contact your web hosting provider's support. %s <strong>requires</strong> Curl+https. Please do not file any support requests; there is no alternative.",'updraftplus'), $service, $service).'</p>', $extraclass, false);
|
3299 |
}
|
3300 |
} else {
|
3301 |
-
$ret .= '<p><em>'.sprintf(__("Good news: Your site's communications with %s can be encrypted. If you see any errors to do with encryption, then look in the 'Expert Settings' for more help.", 'updraftplus')
|
3302 |
}
|
3303 |
}
|
3304 |
if ($echo_instead_of_return) {
|
@@ -3308,22 +3453,29 @@ class UpdraftPlus_Admin {
|
|
3308 |
}
|
3309 |
}
|
3310 |
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3314 |
|
3315 |
-
|
3316 |
$size = 0;
|
3317 |
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
}
|
3322 |
|
3323 |
if (is_string($basedirs)) $basedirs = array($basedirs);
|
3324 |
|
3325 |
-
foreach ($directorieses as $ind => $directories) {
|
3326 |
-
if (!is_array($directories)) $directories=array($directories);
|
3327 |
|
3328 |
$basedir = empty($basedirs[$ind]) ? $basedirs[0] : $basedirs[$ind];
|
3329 |
|
@@ -3349,14 +3501,14 @@ class UpdraftPlus_Admin {
|
|
3349 |
|
3350 |
$directory = $prefix_directory.('' == $suffix_directory ? '' : '/'.$suffix_directory);
|
3351 |
$size = 0;
|
3352 |
-
if (substr($directory, -1) == '/') $directory = substr($directory,0
|
3353 |
|
3354 |
if (!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) return -1;
|
3355 |
if (file_exists($directory.'/.donotbackup')) return 0;
|
3356 |
|
3357 |
if ($handle = opendir($directory)) {
|
3358 |
while (($file = readdir($handle)) !== false) {
|
3359 |
-
if (
|
3360 |
$spath = ('' == $suffix_directory) ? $file : $suffix_directory.'/'.$file;
|
3361 |
if (false !== ($fkey = array_search($spath, $exclude))) {
|
3362 |
unset($exclude[$fkey]);
|
@@ -3367,7 +3519,9 @@ class UpdraftPlus_Admin {
|
|
3367 |
$size += filesize($path);
|
3368 |
} elseif (is_dir($path)) {
|
3369 |
$handlesize = $this->recursive_directory_size_raw($prefix_directory, $exclude, $suffix_directory.('' == $suffix_directory ? '' : '/').$file);
|
3370 |
-
if ($handlesize >= 0) {
|
|
|
|
|
3371 |
}
|
3372 |
}
|
3373 |
}
|
@@ -3384,7 +3538,7 @@ class UpdraftPlus_Admin {
|
|
3384 |
|
3385 |
$backup = $backup_history[$key];
|
3386 |
|
3387 |
-
$pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int)$key), 'M d, Y G:i');
|
3388 |
|
3389 |
$rawbackup = "<h2 title=\"$key\">$pretty_date</h2>";
|
3390 |
|
@@ -3406,12 +3560,6 @@ class UpdraftPlus_Admin {
|
|
3406 |
if (!isset($backup[$type])) continue;
|
3407 |
|
3408 |
$rawbackup .= $updraftplus->printfile($info['description'], $backup, $type, $checksums, $jd, true);
|
3409 |
-
|
3410 |
-
// $rawbackup .= '<h3>'.$info['description'].'</h3>';
|
3411 |
-
// $files = is_string($backup[$type]) ? array($backup[$type]) : $backup[$type];
|
3412 |
-
// foreach ($files as $index => $file) {
|
3413 |
-
// $rawbackup .= $file.'<br>';
|
3414 |
-
// }
|
3415 |
}
|
3416 |
|
3417 |
$total_size = 0;
|
@@ -3446,7 +3594,7 @@ class UpdraftPlus_Admin {
|
|
3446 |
|
3447 |
$rawbackup .= $show_services;
|
3448 |
|
3449 |
-
if (
|
3450 |
$rawbackup .= '</p><strong>'.__('Total backup size:', 'updraftplus').'</strong> '.$updraftplus->convert_numeric_size_to_text($total_size).'<p>';
|
3451 |
}
|
3452 |
|
@@ -3507,7 +3655,16 @@ class UpdraftPlus_Admin {
|
|
3507 |
return $ret;
|
3508 |
}
|
3509 |
|
3510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3511 |
public function download_buttons($backup, $key, $accept, &$entities, $esc_pretty_date) {
|
3512 |
global $updraftplus;
|
3513 |
$ret = '';
|
@@ -3538,7 +3695,7 @@ class UpdraftPlus_Admin {
|
|
3538 |
if ('wpcore' == $type) $wpcore_restore_descrip = $sdescrip;
|
3539 |
}
|
3540 |
if (isset($backup[$type])) {
|
3541 |
-
if (!is_array($backup[$type])) $backup[$type]=array($backup[$type]);
|
3542 |
$howmanyinset = count($backup[$type]);
|
3543 |
$expected_index = 0;
|
3544 |
$index_missing = false;
|
@@ -3547,7 +3704,7 @@ class UpdraftPlus_Admin {
|
|
3547 |
$whatfiles = $backup[$type];
|
3548 |
ksort($whatfiles);
|
3549 |
foreach ($whatfiles as $findex => $bfile) {
|
3550 |
-
$set_contents .= (
|
3551 |
if ($findex != $expected_index) $index_missing = true;
|
3552 |
$expected_index++;
|
3553 |
}
|
@@ -3572,10 +3729,9 @@ class UpdraftPlus_Admin {
|
|
3572 |
}
|
3573 |
|
3574 |
if (!$first_entity) {
|
3575 |
-
// $ret .= ', ';
|
3576 |
} else {
|
3577 |
$first_entity = false;
|
3578 |
-
}
|
3579 |
|
3580 |
$ret .= $this->download_button($type, $key, $findex, $info, $ide, $pdescrip, $esc_pretty_date, $set_contents);
|
3581 |
|
@@ -3591,11 +3747,10 @@ class UpdraftPlus_Admin {
|
|
3591 |
}
|
3592 |
|
3593 |
public function date_label($pretty_date, $key, $backup, $jobdata, $nonce, $simple_format = false) {
|
3594 |
-
// $ret = apply_filters('updraftplus_showbackup_date', '<strong>'.$pretty_date.'</strong>', $backup, $jobdata, (int)$key);
|
3595 |
|
3596 |
$pretty_date = $simple_format ? $pretty_date : '<div class="clear-right">'.$pretty_date.'</div>';
|
3597 |
|
3598 |
-
$ret = apply_filters('updraftplus_showbackup_date', $pretty_date, $backup, $jobdata, (int)$key, $simple_format);
|
3599 |
if (is_array($jobdata) && !empty($jobdata['resume_interval']) && (empty($jobdata['jobstatus']) || 'finished' != $jobdata['jobstatus'])) {
|
3600 |
if ($simple_format) {
|
3601 |
$ret .= ' '.__('(Not finished)', 'updraftplus');
|
@@ -3634,20 +3789,28 @@ class UpdraftPlus_Admin {
|
|
3634 |
return $ret;
|
3635 |
}
|
3636 |
|
3637 |
-
|
3638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3639 |
return '<div class="updraftplus-remove" style="float: left; clear: none;" data-hasremote="'.$sval.'">
|
3640 |
-
|
3641 |
-
|
3642 |
}
|
3643 |
|
3644 |
public function log_button($backup) {
|
3645 |
global $updraftplus;
|
3646 |
$updraft_dir = $updraftplus->backups_dir_location();
|
3647 |
$ret = '';
|
3648 |
-
if (isset($backup['nonce']) && preg_match("/^[0-9a-f]{12}$/"
|
3649 |
$nval = $backup['nonce'];
|
3650 |
-
// $lt = esc_attr(__('View Log', 'updraftplus'));
|
3651 |
$lt = __('View Log', 'updraftplus');
|
3652 |
$url = esc_attr(UpdraftPlus_Options::admin_page()."?page=updraftplus&action=downloadlog&updraftplus_backup_nonce=$nval");
|
3653 |
$ret .= <<<ENDHERE
|
@@ -3672,10 +3835,9 @@ ENDHERE;
|
|
3672 |
/**
|
3673 |
* Carry out the restore process
|
3674 |
*
|
3675 |
-
* @param
|
3676 |
-
* @param
|
3677 |
-
*
|
3678 |
-
* @return Boolean|WP_Error - WP_Error indicates a terminal failure; false indicates not-yet complete (not necessarily terminal); true indicates complete.
|
3679 |
*/
|
3680 |
private function restore_backup($timestamp, $continuation_data = null) {
|
3681 |
|
@@ -3715,24 +3877,23 @@ ENDHERE;
|
|
3715 |
|
3716 |
$credentials = request_filesystem_credentials(UpdraftPlus_Options::admin_page()."?page=updraftplus&action=updraft_restore&backup_timestamp=$timestamp", '', false, false, $extra_fields);
|
3717 |
WP_Filesystem($credentials);
|
3718 |
-
if ($wp_filesystem->errors->get_error_code()) {
|
3719 |
echo '<p><em><a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/asked-ftp-details-upon-restorationmigration-updates/").'">'.__('Why am I seeing this?', 'updraftplus').'</a></em></p>';
|
3720 |
-
foreach ($wp_filesystem->errors->get_error_messages() as $message) show_message($message);
|
3721 |
exit;
|
3722 |
}
|
3723 |
|
3724 |
// If we make it this far then WP_Filesystem has been instantiated and is functional
|
3725 |
|
3726 |
-
|
3727 |
$updraftplus->backup_time_nonce();
|
3728 |
$updraftplus->jobdata_set('job_type', 'restore');
|
3729 |
$updraftplus->jobdata_set('job_time_ms', $updraftplus->job_time_ms);
|
3730 |
$updraftplus->logfile_open($updraftplus->nonce);
|
3731 |
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
# TODO: Provide option to auto-email the log file
|
3736 |
|
3737 |
echo '<h1>'.__('UpdraftPlus Restoration: Progress', 'updraftplus').'</h1><div id="updraft-restore-progress">';
|
3738 |
|
@@ -3800,7 +3961,7 @@ ENDHERE;
|
|
3800 |
parse_str(stripslashes($_POST['updraft_restorer_restore_options']), $restore_options);
|
3801 |
}
|
3802 |
$restore_options['updraft_restorer_replacesiteurl'] = empty($_POST['updraft_restorer_replacesiteurl']) ? false : true;
|
3803 |
-
$restore_options['updraft_encryptionphrase'] = empty($_POST['updraft_encryptionphrase']) ? '' : (string)stripslashes($_POST['updraft_encryptionphrase']);
|
3804 |
$restore_options['updraft_restorer_wpcore_includewpconfig'] = empty($_POST['updraft_restorer_wpcore_includewpconfig']) ? false : true;
|
3805 |
$updraftplus->jobdata_set('restore_options', $restore_options);
|
3806 |
}
|
@@ -3821,7 +3982,7 @@ ENDHERE;
|
|
3821 |
$backupable_entities = apply_filters('updraft_backupable_file_entities_on_restore', $backupable_entities, $restore_options, $backup_set);
|
3822 |
|
3823 |
// We use a single object for each entity, because we want to store information about the backup set
|
3824 |
-
|
3825 |
|
3826 |
global $updraftplus_restorer;
|
3827 |
|
@@ -3851,14 +4012,14 @@ ENDHERE;
|
|
3851 |
foreach ($backup_set as $type => $files) {
|
3852 |
// All restorable entities must be given explicitly, as we can store other arbitrary data in the history array
|
3853 |
if (!isset($backupable_entities[$type]) && 'db' != $type) continue;
|
3854 |
-
if (isset($backupable_entities[$type]['restorable']) && $backupable_entities[$type]['restorable']
|
3855 |
|
3856 |
if (!isset($entities_to_download[$type])) continue;
|
3857 |
if ('wpcore' == $type && is_multisite() && 0 === $updraftplus_restorer->ud_backup_is_multisite) {
|
3858 |
echo "<p>$type: <strong>";
|
3859 |
$updraftplus->log(__('Skipping restoration of WordPress core when importing a single site into a multisite installation. If you had anything necessary in your WordPress directory then you will need to re-add it manually from the zip file.', 'updraftplus'), 'notice-restore');
|
3860 |
-
|
3861 |
-
|
3862 |
echo "</strong></p>";
|
3863 |
continue;
|
3864 |
}
|
@@ -3879,11 +4040,11 @@ ENDHERE;
|
|
3879 |
|
3880 |
$this->get_remote_file($service, $file, $timestamp, true);
|
3881 |
|
3882 |
-
$index = (
|
3883 |
// If a file size is stored in the backup data, then verify correctness of the local file
|
3884 |
if (isset($backup_set[$type.$index.'-size'])) {
|
3885 |
$fs = $backup_set[$type.$index.'-size'];
|
3886 |
-
$print_message = __("Archive is expected to be size:",'updraftplus')." ".round($fs/1024, 1)." KB: ";
|
3887 |
$as = @filesize($fullpath);
|
3888 |
if ($as == $fs) {
|
3889 |
$updraftplus->log($print_message.__('OK', 'updraftplus'), 'notice-restore');
|
@@ -3891,7 +4052,7 @@ ENDHERE;
|
|
3891 |
$updraftplus->log($print_message.__('Error:', 'updraftplus')." ".__('file is size:', 'updraftplus')." ".round($as/1024)." ($fs, $as)", 'warning-restore');
|
3892 |
}
|
3893 |
} else {
|
3894 |
-
$updraftplus->log(__("The backup records do not contain information about the proper size of this file.",'updraftplus'), 'notice-restore');
|
3895 |
}
|
3896 |
if (!is_readable($fullpath)) {
|
3897 |
$updraftplus->log(__('Could not find one of the files for restoration', 'updraftplus')." ($file)", 'warning-restore');
|
@@ -3923,11 +4084,11 @@ ENDHERE;
|
|
3923 |
foreach ($val->get_error_codes() as $code) {
|
3924 |
if ('already_exists' == $code) $this->print_delete_old_dirs_form(false);
|
3925 |
}
|
3926 |
-
echo '</div>'; //close the updraft_restore_progress div even if we error
|
3927 |
restore_error_handler();
|
3928 |
return $val;
|
3929 |
} elseif (false === $val) {
|
3930 |
-
echo '</div>'; //close the updraft_restore_progress div even if we error
|
3931 |
restore_error_handler();
|
3932 |
return false;
|
3933 |
}
|
@@ -4023,12 +4184,12 @@ ENDHERE;
|
|
4023 |
}
|
4024 |
}
|
4025 |
}
|
4026 |
-
echo '</div>'; //close the updraft_restore_progress div even if we error
|
4027 |
restore_error_handler();
|
4028 |
return $val;
|
4029 |
}
|
4030 |
} elseif (false === $val) {
|
4031 |
-
echo '</div>'; //close the updraft_restore_progress div even if we error
|
4032 |
restore_error_handler();
|
4033 |
return false;
|
4034 |
}
|
@@ -4056,11 +4217,11 @@ ENDHERE;
|
|
4056 |
// Clear any cached pages after the restore
|
4057 |
$updraftplus_restorer->clear_cache();
|
4058 |
|
4059 |
-
if (!function_exists('validate_current_theme'))
|
4060 |
|
4061 |
// Have seen a case where the current theme in the DB began with a capital, but not on disk - and this breaks migrating from Windows to a case-sensitive system
|
4062 |
$template = get_option('template');
|
4063 |
-
if (!empty($template) &&
|
4064 |
|
4065 |
$theme_root = get_theme_root($template);
|
4066 |
$theme_root2 = get_theme_root(strtolower($template));
|
@@ -4085,13 +4246,25 @@ ENDHERE;
|
|
4085 |
return true;
|
4086 |
}
|
4087 |
|
4088 |
-
public function option_filter_template($val) {
|
|
|
|
|
|
|
4089 |
|
4090 |
-
public function option_filter_stylesheet($val) {
|
|
|
|
|
|
|
4091 |
|
4092 |
-
public function option_filter_template_root($val) {
|
|
|
|
|
|
|
4093 |
|
4094 |
-
public function option_filter_stylesheet_root($val) {
|
|
|
|
|
|
|
4095 |
|
4096 |
public function sort_restoration_entities($a, $b) {
|
4097 |
if ($a == $b) return 0;
|
@@ -4129,15 +4302,15 @@ ENDHERE;
|
|
4129 |
die;
|
4130 |
}
|
4131 |
|
4132 |
-
public function updraft_ajax_importsettings() {
|
4133 |
-
global $updraftplus;
|
4134 |
-
|
4135 |
-
if (empty($_POST) || empty($_POST['subaction']) || 'importsettings' != $_POST['subaction'] || !isset($_POST['nonce']) || !is_user_logged_in() || !UpdraftPlus_Options::user_can_manage() || !wp_verify_nonce($_POST['nonce'], 'updraftplus-settings-nonce')) die('Security check');
|
4136 |
-
|
4137 |
-
if (empty($_POST['settings']) || !is_string($_POST['settings'])) die('Invalid data');
|
4138 |
|
4139 |
$this->import_settings($_POST);
|
4140 |
-
}
|
4141 |
|
4142 |
/**
|
4143 |
* This method handles the imported json settings it will convert them into a readable format for the existing save settings function, it will also update some of the options to match the new remote storage options format (Apr 2017)
|
@@ -4177,9 +4350,9 @@ ENDHERE;
|
|
4177 |
if (empty($posted_settings['updraft_azure']['settings'])) $posted_settings['updraft_azure'] = $updraftplus->wrap_remote_storage_options($posted_settings['updraft_azure']);
|
4178 |
if (empty($posted_settings['updraft_dropbox']['settings'])) $posted_settings['updraft_dropbox'] = $updraftplus->wrap_remote_storage_options($posted_settings['updraft_dropbox']);
|
4179 |
|
4180 |
-
echo json_encode($this->save_settings($posted_settings));
|
4181 |
|
4182 |
-
die;
|
4183 |
}
|
4184 |
|
4185 |
private function backup_now_remote_message() {
|
@@ -4197,12 +4370,13 @@ ENDHERE;
|
|
4197 |
return '<input type="checkbox" id="backupnow_includecloud" checked="checked"> <label for="backupnow_includecloud">'.__("Send this backup to remote storage", 'updraftplus').'</label>';
|
4198 |
}
|
4199 |
}
|
4200 |
-
|
4201 |
-
|
4202 |
-
|
4203 |
-
|
4204 |
-
|
4205 |
-
|
|
|
4206 |
public function save_settings($settings) {
|
4207 |
|
4208 |
global $updraftplus;
|
@@ -4218,11 +4392,11 @@ ENDHERE;
|
|
4218 |
|
4219 |
$add_to_post_keys = array('updraft_interval', 'updraft_interval_database', 'updraft_starttime_files', 'updraft_starttime_db', 'updraft_startday_files', 'updraft_startday_db');
|
4220 |
|
4221 |
-
//If database and files are on same schedule, override the db day/time settings
|
4222 |
if (isset($settings['updraft_interval_database']) && isset($settings['updraft_interval_database']) && $settings['updraft_interval_database'] == $settings['updraft_interval'] && isset($settings['updraft_starttime_files'])) {
|
4223 |
$settings['updraft_starttime_db'] = $settings['updraft_starttime_files'];
|
4224 |
$settings['updraft_startday_db'] = $settings['updraft_startday_files'];
|
4225 |
-
}
|
4226 |
foreach ($add_to_post_keys as $key) {
|
4227 |
// For add-ons that look at $_POST to find saved settings, add the relevant keys to $_POST so that they find them there
|
4228 |
if (isset($settings[$key])) {
|
@@ -4257,14 +4431,14 @@ ENDHERE;
|
|
4257 |
foreach ($settings as $key => $value) {
|
4258 |
|
4259 |
if (in_array($key, $relevant_keys)) {
|
4260 |
-
if (
|
4261 |
-
foreach ($value as $subkey => $subvalue){
|
4262 |
-
if (
|
4263 |
}
|
4264 |
}
|
4265 |
|
4266 |
// This flag indicates that either the stored database option was changed, or that the supplied option was changed before being stored. It isn't comprehensive - it's only used to update some UI elements with invalid input.
|
4267 |
-
$updated = empty($mass_updated) ? (is_string($value) &&
|
4268 |
|
4269 |
$db_updated = empty($mass_updated) ? UpdraftPlus_Options::update_updraft_option($key, $value) : true;
|
4270 |
|
@@ -4274,10 +4448,12 @@ ENDHERE;
|
|
4274 |
$value = UpdraftPlus_Options::get_updraft_option($key);
|
4275 |
if (is_string($value)) $return_array['changed'][$key] = $value;
|
4276 |
}
|
4277 |
-
|
4278 |
} else {
|
|
|
|
|
4279 |
// When last active, it was catching: option_page, action, _wpnonce, _wp_http_referer, updraft_s3_endpoint, updraft_dreamobjects_endpoint. The latter two are empty; probably don't need to be in the page at all.
|
4280 |
-
//error_log("Non-UD key when saving from POSTed data: ".$key);
|
4281 |
}
|
4282 |
}
|
4283 |
} else {
|
@@ -4296,13 +4472,13 @@ ENDHERE;
|
|
4296 |
|
4297 |
// Check if $more_files_path_updated is true, is so then there's a change and we should update the backup modal
|
4298 |
if ($more_files_path_updated) {
|
4299 |
-
$return_array['updraft_include_more_path'] = $this->files_selector_widgetry('backupnow_files_', false, 'sometimes');
|
4300 |
}
|
4301 |
|
4302 |
-
//Because of the single AJAX call, we need to remove the existing UD messages from the 'all_admin_notices' action
|
4303 |
remove_all_actions('all_admin_notices');
|
4304 |
|
4305 |
-
//Moving from 2 to 1 ajax call
|
4306 |
ob_start();
|
4307 |
|
4308 |
$service = UpdraftPlus_Options::get_updraft_option('updraft_service');
|
@@ -4312,7 +4488,7 @@ ENDHERE;
|
|
4312 |
|
4313 |
do_action('all_admin_notices');
|
4314 |
|
4315 |
-
if (!$really_is_writable) { //Check if writable
|
4316 |
$this->show_admin_warning_unwritable();
|
4317 |
}
|
4318 |
|
@@ -4338,16 +4514,16 @@ ENDHERE;
|
|
4338 |
$return_array['messages'] = $messages_output;
|
4339 |
$return_array['scheduled'] = $scheduled_output;
|
4340 |
|
4341 |
-
|
4342 |
-
|
4343 |
-
|
4344 |
return $return_array;
|
4345 |
|
4346 |
}
|
4347 |
|
4348 |
/**
|
4349 |
* A method to remove UpdraftPlus settings from the options table.
|
|
|
4350 |
* @param boolean $wipe_all_settings Set to true as default as we want to remove all options, set to false if calling from UpdraftCentral, as we do not want to remove the UpdraftCentral key or we will lose connection to the site.
|
|
|
4351 |
*/
|
4352 |
public function updraft_wipe_settings($wipe_all_settings = true) {
|
4353 |
|
@@ -4374,15 +4550,37 @@ ENDHERE;
|
|
4374 |
|
4375 |
return true;
|
4376 |
}
|
4377 |
-
|
4378 |
-
|
4379 |
-
|
4380 |
-
|
4381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4382 |
return $vault;
|
4383 |
}
|
4384 |
|
4385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4386 |
public function http_get($uri = null, $curl = false) {
|
4387 |
|
4388 |
if (!preg_match('/^https?/', $uri)) return json_encode(array('e' => 'Non-http URL specified'));
|
@@ -4398,7 +4596,7 @@ ENDHERE;
|
|
4398 |
curl_setopt($ch, CURLOPT_FAILONERROR, true);
|
4399 |
curl_setopt($ch, CURLOPT_HEADER, false);
|
4400 |
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
4401 |
-
curl_setopt($ch, CURLOPT_STDERR, $output=fopen('php://temp', "w+"));
|
4402 |
$response = curl_exec($ch);
|
4403 |
$error = curl_error($ch);
|
4404 |
$getinfo = curl_getinfo($ch);
|
@@ -4415,13 +4613,12 @@ ENDHERE;
|
|
4415 |
|
4416 |
if (!empty($verb)) $resp['r'] = htmlspecialchars($verb)."\n\n".$resp['r'];
|
4417 |
|
4418 |
-
//
|
4419 |
$resp['verb'] = $verb;
|
4420 |
$resp['response'] = $response;
|
4421 |
$resp['status'] = $getinfo;
|
4422 |
|
4423 |
return json_encode($resp);
|
4424 |
-
// echo json_encode(array('r' => htmlspecialchars(substr($response, 0, 2048))));
|
4425 |
} else {
|
4426 |
$response = wp_remote_get($uri, array('timeout' => 10));
|
4427 |
if (is_wp_error($response)) {
|
@@ -4454,7 +4651,7 @@ ENDHERE;
|
|
4454 |
ob_start();
|
4455 |
$history = UpdraftPlus_Backup_History::get_history();
|
4456 |
var_dump($history);
|
4457 |
-
$response["html"] .= ob_get_clean();
|
4458 |
$response['html'] .= '</pre>';
|
4459 |
|
4460 |
$response['html'] .= '<h3 id="ud-debuginfo-files">'.__('Files', 'updraftplus').'</h3><pre>';
|
@@ -4478,7 +4675,11 @@ ENDHERE;
|
|
4478 |
}
|
4479 |
@$d->close();
|
4480 |
krsort($raw_output, SORT_NUMERIC);
|
4481 |
-
|
|
|
|
|
|
|
|
|
4482 |
$response['html'] .= '</pre>';
|
4483 |
|
4484 |
$response['html'] .= '<h3 id="ud-debuginfo-options">'.__('Options (raw)', 'updraftplus').'</h3>';
|
@@ -4496,14 +4697,20 @@ ENDHERE;
|
|
4496 |
$response['html'] .= ob_get_clean();
|
4497 |
|
4498 |
if (true == $no_pre_tags) {
|
4499 |
-
$response['html'] = str_replace('<pre>',''
|
4500 |
-
$response['html'] = str_replace('</pre>',''
|
4501 |
}
|
4502 |
|
4503 |
return $response;
|
4504 |
}
|
4505 |
|
4506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4507 |
public function call_wp_action($data = null, $close_connection_callable = false) {
|
4508 |
global $updraftplus;
|
4509 |
|
@@ -4527,7 +4734,7 @@ ENDHERE;
|
|
4527 |
|
4528 |
$ret = ob_get_clean();
|
4529 |
|
4530 |
-
//
|
4531 |
if ($close_connection_callable) {
|
4532 |
if (is_callable($close_connection_callable)) {
|
4533 |
call_user_func($close_connection_callable, array('r' => $res));
|
@@ -4553,22 +4760,25 @@ ENDHERE;
|
|
4553 |
$response['response'] = $res;
|
4554 |
$response['log'] = $output;
|
4555 |
|
4556 |
-
//Check if response is empty
|
4557 |
if (!empty($returned)) $response['status'] = $returned;
|
4558 |
|
4559 |
return $response;
|
4560 |
}
|
4561 |
|
|
|
|
|
|
|
4562 |
public function enqueue_jstree() {
|
4563 |
|
4564 |
static $already_enqueued = false;
|
4565 |
if ($already_enqueued) return;
|
4566 |
|
4567 |
-
$already_enqueued = true;
|
4568 |
$jstree_enqueue_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '3.3'.'.'.time() : '3.3';
|
4569 |
$min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
|
4570 |
-
|
4571 |
wp_enqueue_script('jstree', UPDRAFTPLUS_URL.'/includes/jstree/jstree'.$min_or_not.'.js', array('jquery'), $jstree_enqueue_version);
|
4572 |
-
wp_enqueue_style('jstree', UPDRAFTPLUS_URL.'/includes/jstree/themes/default/style'.$min_or_not.'.css', array(), $jstree_enqueue_version);
|
4573 |
}
|
4574 |
}
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed');
|
4 |
|
5 |
// Admin-area code lives here. This gets called in admin_menu, earlier than admin_init
|
6 |
|
15 |
|
16 |
private $backups_instance_ids;
|
17 |
|
18 |
+
private $auth_instance_ids = array('dropbox' => array(), 'onedrive' => array(), 'googledrive' => array(), 'googlecloud' => array());
|
19 |
+
|
20 |
public function __construct() {
|
21 |
$this->admin_init();
|
22 |
}
|
33 |
return $path;
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Get the path to the UI templates directory
|
38 |
+
*
|
39 |
+
* @return String - a filesystem directory path
|
40 |
+
*/
|
41 |
public function get_templates_dir() {
|
42 |
return apply_filters('updraftplus_templates_dir', $this->wp_normalize_path(UPDRAFTPLUS_DIR.'/templates'));
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
45 |
private function register_template_directories() {
|
46 |
|
47 |
$template_directories = array();
|
121 |
$clientid = $storage_options['clientid'];
|
122 |
$token = empty($storage_options['token']) ? '' : $storage_options['token'];
|
123 |
}
|
124 |
+
if (!empty($clientid) && '' == $token) {
|
125 |
+
if (!in_array($instance_id, $this->auth_instance_ids['googledrive'])) $this->auth_instance_ids['googledrive'][] = $instance_id;
|
126 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'));
|
127 |
+
}
|
128 |
unset($clientid);
|
129 |
unset($token);
|
130 |
} else {
|
131 |
+
if (empty($storage_options['user_id'])) {
|
132 |
+
if (!in_array($instance_id, $this->auth_instance_ids['googledrive'])) $this->auth_instance_ids['googledrive'][] = $instance_id;
|
133 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'));
|
134 |
+
}
|
135 |
}
|
136 |
}
|
137 |
}
|
149 |
$clientid = $storage_options['clientid'];
|
150 |
$token = (empty($storage_options['token'])) ? '' : $storage_options['token'];
|
151 |
|
152 |
+
if (!empty($clientid) && empty($token)) {
|
153 |
+
if (!in_array($instance_id, $this->auth_instance_ids['googlecloud'])) $this->auth_instance_ids['googlecloud'][] = $instance_id;
|
154 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'));
|
155 |
+
}
|
156 |
}
|
157 |
}
|
158 |
}
|
168 |
} elseif (!empty($settings['settings'])) {
|
169 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
170 |
if (empty($storage_options['tk_access_token'])) {
|
171 |
+
if (!in_array($instance_id, $this->auth_instance_ids['dropbox'])) $this->auth_instance_ids['dropbox'][] = $instance_id;
|
172 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_dropbox'))) add_action('all_admin_notices', array($this, 'show_admin_warning_dropbox'));
|
173 |
}
|
174 |
}
|
175 |
}
|
185 |
$updraftplus->log_wp_error($settings, true, true);
|
186 |
} elseif (!empty($settings['settings'])) {
|
187 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
188 |
+
if ((defined('UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP') && UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP)) {
|
189 |
+
if (!empty($storage_options['clientid']) && !empty($storage_options['secret']) && empty($storage_options['refresh_token'])) {
|
190 |
+
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
|
191 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
|
192 |
} elseif (empty($storage_options['refresh_token'])) {
|
193 |
+
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
|
194 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
|
195 |
+
}
|
196 |
+
} else {
|
197 |
+
if (empty($storage_options['refresh_token'])) {
|
198 |
+
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
|
199 |
+
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
|
200 |
}
|
|
|
|
|
201 |
}
|
202 |
}
|
203 |
}
|
214 |
} elseif (!empty($settings['settings'])) {
|
215 |
foreach ($settings['settings'] as $instance_id => $storage_options) {
|
216 |
if (empty($storage_options['token']) && empty($storage_options['email'])) {
|
217 |
+
add_action('all_admin_notices', array($this, 'show_admin_warning_updraftvault'));
|
218 |
}
|
219 |
}
|
220 |
}
|
223 |
if ($this->disk_space_check(1048576*35) === false) add_action('all_admin_notices', array($this, 'show_admin_warning_diskspace'));
|
224 |
}
|
225 |
|
226 |
+
private function setup_all_admin_notices_udonly($service, $override = false) {
|
227 |
global $wp_version;
|
228 |
|
229 |
if (UpdraftPlus_Options::user_can_manage() && defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && (!defined('UPDRAFTPLUS_DISABLE_WP_CRON_NOTICE') || !UPDRAFTPLUS_DISABLE_WP_CRON_NOTICE)) {
|
231 |
}
|
232 |
|
233 |
if (UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
|
234 |
+
@ini_set('display_errors', 1);
|
235 |
@error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
236 |
add_action('all_admin_notices', array($this, 'show_admin_debug_warning'));
|
237 |
}
|
241 |
$this->no_settings_warning = true;
|
242 |
}
|
243 |
|
244 |
+
// Avoid false positives, by attempting to raise the limit (as happens when we actually do a backup)
|
245 |
@set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);
|
246 |
+
$max_execution_time = (int) @ini_get('max_execution_time');
|
247 |
if ($max_execution_time>0 && $max_execution_time<20) {
|
248 |
add_action('all_admin_notices', array($this, 'show_admin_warning_execution_time'));
|
249 |
}
|
258 |
if (version_compare($wp_version, '3.2', '<')) add_action('all_admin_notices', array($this, 'show_admin_warning_wordpressversion'));
|
259 |
}
|
260 |
|
261 |
+
/**
|
262 |
+
* Used to output the information for the next scheduled backup.
|
263 |
+
* moved to function for the ajax saves
|
264 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
public function next_scheduled_backups_output() {
|
266 |
// UNIX timestamp
|
267 |
$next_scheduled_backup = wp_next_scheduled('updraft_backup');
|
270 |
$next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
|
271 |
// Convert to blog time zone
|
272 |
$next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
|
273 |
+
// $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup);
|
274 |
} else {
|
275 |
$next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
|
276 |
$files_not_scheduled = true;
|
277 |
}
|
278 |
|
279 |
$next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
|
280 |
+
if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
|
281 |
if (isset($files_not_scheduled)) {
|
282 |
$next_scheduled_backup_database = $next_scheduled_backup;
|
283 |
$database_not_scheduled = true;
|
291 |
$next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
|
292 |
// Convert to blog time zone
|
293 |
$next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
|
294 |
+
// $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database);
|
295 |
} else {
|
296 |
$next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
|
297 |
$database_not_scheduled = true;
|
313 |
}
|
314 |
}
|
315 |
|
316 |
+
/**
|
317 |
+
* Run upon the WP admin_init action
|
318 |
+
*/
|
319 |
private function admin_init() {
|
320 |
|
321 |
add_action('core_upgrade_preamble', array($this, 'core_upgrade_preamble'));
|
322 |
add_action('admin_action_upgrade-plugin', array($this, 'admin_action_upgrade_pluginortheme'));
|
323 |
add_action('admin_action_upgrade-theme', array($this, 'admin_action_upgrade_pluginortheme'));
|
324 |
|
325 |
+
add_action('admin_head', array($this, 'admin_head'));
|
326 |
add_filter((is_multisite() ? 'network_admin_' : '').'plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
327 |
add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
|
328 |
add_action('wp_ajax_updraft_ajax', array($this, 'updraft_ajax_handler'));
|
337 |
// Add a new Ajax action for saving settings
|
338 |
add_action('wp_ajax_updraft_savesettings', array($this, 'updraft_ajax_savesettings'));
|
339 |
|
340 |
+
// Ajax for settings import and export
|
341 |
+
add_action('wp_ajax_updraft_importsettings', array($this, 'updraft_ajax_importsettings'));
|
342 |
|
343 |
// UpdraftPlus templates
|
344 |
$this->register_template_directories();
|
357 |
|
358 |
// Main dashboard page advert
|
359 |
// Since our nonce is printed, make sure they have sufficient credentials
|
360 |
+
if ('index.php' == $pagenow && current_user_can('update_plugins') && (!file_exists(UPDRAFTPLUS_DIR.'/udaddons') || (defined('UPDRAFTPLUS_FORCE_DASHNOTICE') && UPDRAFTPLUS_FORCE_DASHNOTICE))) {
|
361 |
|
362 |
$dismissed_until = UpdraftPlus_Options::get_updraft_option('updraftplus_dismisseddashnotice', 0);
|
363 |
|
366 |
$installed = @filemtime($backup_dir.'/index.html');
|
367 |
$installed_for = time() - $installed;
|
368 |
|
369 |
+
if (($installed && time() > $dismissed_until && $installed_for > 28*86400 && !defined('UPDRAFTPLUS_NOADS_B')) || (defined('UPDRAFTPLUS_FORCE_DASHNOTICE') && UPDRAFTPLUS_FORCE_DASHNOTICE)) {
|
370 |
add_action('all_admin_notices', array($this, 'show_admin_notice_upgradead'));
|
371 |
}
|
372 |
}
|
373 |
|
374 |
+
// Moved out for use with Ajax saving
|
375 |
$this->setup_all_admin_notices_global($service);
|
376 |
}
|
377 |
|
378 |
// Next, the actions that only come on the UpdraftPlus page
|
379 |
+
if (UpdraftPlus_Options::admin_page() != $pagenow || empty($_REQUEST['page']) || 'updraftplus' != $_REQUEST['page']) return;
|
380 |
$this->setup_all_admin_notices_udonly($service);
|
381 |
|
382 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 99999);
|
385 |
/**
|
386 |
* Sets up what is needed to allow an in-page backup to be run. Will enqueue scripts and output appropriate HTML (so, should be run when at a suitable place). Not intended for use on the UpdraftPlus settings page.
|
387 |
*
|
388 |
+
* @param string $title Text to use for the title of the modal
|
389 |
* @param callable $callback Callable function to output the contents of the updraft_inpage_prebackup element - i.e. what shows in the modal before a backup beings.
|
|
|
390 |
*/
|
391 |
public function add_backup_scaffolding($title, $callback) {
|
392 |
$this->admin_enqueue_scripts();
|
434 |
die();
|
435 |
}
|
436 |
|
437 |
+
$restore_nonce = (string) $_POST['restorenonce'];
|
438 |
|
439 |
if (empty($_POST['ajaxauth'])) {
|
440 |
echo json_encode(array('e' => 'Illegitimate data sent (2)'));
|
471 |
$updraftplus->backup_time_nonce($restore_nonce);
|
472 |
$updraftplus->logfile_open($restore_nonce);
|
473 |
|
474 |
+
$timestamp = empty($_POST['timestamp']) ? false : (int) $_POST['timestamp'];
|
475 |
+
$multisite = empty($_POST['multisite']) ? false : (bool) $_POST['multisite'];
|
476 |
+
$created_by_version = empty($_POST['created_by_version']) ? false : (int) $_POST['created_by_version'];
|
477 |
|
478 |
// TODO: We need to know about first_one (not yet sent), as well as last_one
|
479 |
|
480 |
// TODO: Verify the values of these
|
481 |
+
$type = empty($_POST['type']) ? false : (int) $_POST['type'];
|
482 |
+
$backupfile = empty($_POST['backupfile']) ? false : (string) $_POST['backupfile'];
|
483 |
|
484 |
$updraftplus->log("Deferred restore resumption: $type: $backupfile (timestamp=$timestamp, last_one=$last_one)");
|
485 |
|
567 |
'id' => 'updraft_admin_node_premium',
|
568 |
'title' => 'UpdraftPlus Premium',
|
569 |
'parent' => 'updraft_admin_node',
|
570 |
+
'href' => apply_filters('updraftplus_com_link', 'https://updraftplus.com/shop/updraftplus-premium/')
|
571 |
);
|
572 |
$wp_admin_bar->add_node($args);
|
573 |
}
|
574 |
}
|
575 |
|
576 |
+
/**
|
577 |
+
* Output HTML for a dashboard notice highlighting the benefits of upgrading to Premium
|
578 |
+
*/
|
|
|
|
|
|
|
579 |
public function show_admin_notice_upgradead() {
|
580 |
$this->include_template('wp-admin/notices/thanks-for-using-main-dash.php');
|
581 |
}
|
600 |
|
601 |
}
|
602 |
|
603 |
+
/**
|
604 |
+
* This is also called directly from the auto-backup add-on
|
605 |
+
*/
|
606 |
public function admin_enqueue_scripts() {
|
607 |
|
608 |
global $updraftplus, $wp_locale;
|
613 |
// Defeat other plugins/themes which dump their jQuery UI CSS onto our settings page
|
614 |
wp_deregister_style('jquery-ui');
|
615 |
$jquery_ui_css_enqueue_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '1.11.4'.'.'.time() : '1.11.4';
|
616 |
+
wp_enqueue_style('jquery-ui', UPDRAFTPLUS_URL.'/includes/jquery-ui.custom'.$min_or_not.'.css', array(), $jquery_ui_css_enqueue_version);
|
617 |
|
618 |
wp_enqueue_style('updraft-admin-css', UPDRAFTPLUS_URL.'/css/admin'.$min_or_not.'.css', array(), $enqueue_version);
|
619 |
+
// add_filter('style_loader_tag', array($this, 'style_loader_tag'), 10, 2);
|
620 |
|
621 |
$this->ensure_sufficient_jquery_and_enqueue();
|
622 |
$jquery_blockui_enqueue_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '2.70.0'.'.'.time() : '2.70.0';
|
633 |
|
634 |
$day_selector = '';
|
635 |
for ($day_index = 0; $day_index <= 6; $day_index++) {
|
636 |
+
// $selected = ($opt == $day_index) ? 'selected="selected"' : '';
|
637 |
$selected = '';
|
638 |
$day_selector .= "\n\t<option value='" . $day_index . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
|
639 |
}
|
640 |
|
641 |
$mday_selector = '';
|
642 |
for ($mday_index = 1; $mday_index <= 28; $mday_index++) {
|
643 |
+
// $selected = ($opt == $mday_index) ? 'selected="selected"' : '';
|
644 |
$selected = '';
|
645 |
$mday_selector .= "\n\t<option value='" . $mday_index . "' $selected>" . $mday_index . '</option>';
|
646 |
}
|
655 |
'excludedeverything' => __('If you exclude both the database and the files, then you have excluded everything!', 'updraftplus'),
|
656 |
'nofileschosen' => __('You have chosen to backup files, but no file entities have been selected', 'updraftplus'),
|
657 |
'notableschosen' => __('You have chosen to backup a database, but no tables have been selected', 'updraftplus'),
|
658 |
+
'restore_proceeding' => __('The restore operation has begun. Do not press stop or close your browser until it reports itself as having finished.', 'updraftplus'),
|
659 |
'unexpectedresponse' => __('Unexpected response:', 'updraftplus'),
|
660 |
'servererrorcode' => __('The web server returned an error code (try again, or check your web server logs)', 'updraftplus'),
|
661 |
'newuserpass' => __("The new user's RackSpace console password is (this will not be shown again):", 'updraftplus'),
|
714 |
'updatequotacount' => __('Update quota count', 'updraftplus'),
|
715 |
'addingsite' => __('Adding...', 'updraftplus'),
|
716 |
'addsite' => __('Add site', 'updraftplus'),
|
717 |
+
// 'resetting' => __('Resetting...', 'updraftplus'),
|
718 |
'creating_please_allow' => __('Creating...', 'updraftplus').(function_exists('openssl_encrypt') ? '' : ' ('.__('your PHP install lacks the openssl module; as a result, this can take minutes; if nothing has happened by then, then you should either try a smaller key size, or ask your web hosting company how to enable this PHP module on your setup.', 'updraftplus').')'),
|
719 |
'sendtosite' => __('Send to site:', 'updraftplus'),
|
720 |
'checkrpcsetup' => sprintf(__('You should check that the remote site is online, not firewalled, does not have security modules that may be blocking access, has UpdraftPlus version %s or later active and that the keys have been entered correctly.', 'updraftplus'), '2.10.3'),
|
721 |
'pleasenamekey' => __('Please give this key a name (e.g. indicate the site it is for):', 'updraftplus'),
|
722 |
'key' => __('Key', 'updraftplus'),
|
723 |
+
'nokeynamegiven' => sprintf(__("Failure: No %s was given.", 'updraftplus'), __('key name', 'updraftplus')),
|
724 |
'deleting' => __('Deleting...', 'updraftplus'),
|
725 |
'enter_mothership_url' => __('Please enter a valid URL', 'updraftplus'),
|
726 |
'delete_response_not_understood' => __("We requested to delete the file, but could not understand the server's response", 'updraftplus'),
|
748 |
'settings_test_result' => __('%s settings test result:', 'updraftplus'),
|
749 |
'nothing_yet_logged' => __('Nothing yet logged', 'updraftplus'),
|
750 |
'import_select_file' => __('You have not yet selected a file to import.', 'updraftplus'),
|
751 |
+
'import_invalid_json_file' => __('Error: The chosen file is corrupt. Please choose a valid UpdraftPlus export file.', 'updraftplus'),
|
752 |
+
'updraft_settings_url' => UpdraftPlus_Options::admin_page_url().'?page=updraftplus',
|
753 |
'network_site_url' => network_site_url(),
|
754 |
'importing' => __('Importing...', 'updraftplus'),
|
755 |
'importing_data_from' => __('This will import data from:', 'updraftplus'),
|
767 |
'loading_log_file' => __('Loading log file', 'updraftplus'),
|
768 |
'updraftplus_version' => $updraftplus->version,
|
769 |
'updraftcentral_wizard_empty_url' => __('Please enter the URL where your UpdraftCentral dashboard is hosted.'),
|
770 |
+
'updraftcentral_wizard_invalid_url' => __('Please enter a valid URL e.g http://example.com', 'updraftplus')
|
771 |
+
));
|
772 |
}
|
773 |
|
774 |
+
/**
|
775 |
+
* Despite the name, this fires irrespective of what capabilities the user has (even none - so be careful)
|
776 |
+
*/
|
777 |
public function core_upgrade_preamble() {
|
778 |
// They need to be able to perform backups, and to perform updates
|
779 |
if (!UpdraftPlus_Options::user_can_manage() || (!current_user_can('update_core') && !current_user_can('update_plugins') && !current_user_can('update_themes'))) return;
|
783 |
}
|
784 |
|
785 |
?>
|
786 |
+
<?php
|
787 |
if (!class_exists('UpdraftPlus_Addon_Autobackup')) {
|
788 |
+
if (!class_exists('UpdraftPlus_Notices')) include_once(UPDRAFTPLUS_DIR.'/includes/updraftplus-notices.php');
|
789 |
global $updraftplus_notices;
|
790 |
+
echo apply_filters('updraftplus_autobackup_blurb', $updraftplus_notices->do_notice('autobackup', 'autobackup', true));
|
791 |
} else {
|
792 |
echo '<div class="updraft-ad-container updated">';
|
793 |
echo '<h3 style="margin-top: 2px;">'. __('Be safe with an automatic backup', 'updraftplus').'</h3>';
|
794 |
+
echo apply_filters('updraftplus_autobackup_blurb', '');
|
795 |
echo '</div>';
|
796 |
}
|
797 |
+
?>
|
798 |
<script>
|
799 |
jQuery(document).ready(function() {
|
800 |
jQuery('.updraft-ad-container').appendTo('.wrap p:first');
|
803 |
<?php
|
804 |
}
|
805 |
|
806 |
+
/**
|
807 |
+
* Run upon the WP admin_head action
|
808 |
+
*/
|
809 |
public function admin_head() {
|
810 |
|
811 |
global $pagenow;
|
812 |
|
813 |
+
if (UpdraftPlus_Options::admin_page() != $pagenow || !isset($_REQUEST['page']) || 'updraftplus' != $_REQUEST['page'] || !UpdraftPlus_Options::user_can_manage()) return;
|
814 |
|
815 |
+
$chunk_size = min(wp_max_upload_size()-1024, 1048576*2);
|
816 |
|
817 |
+
// The multiple_queues argument is ignored in plupload 2.x (WP3.9+) - http://make.wordpress.org/core/2014/04/11/plupload-2-x-in-wordpress-3-9/
|
818 |
+
// max_file_size is also in filters as of plupload 2.x, but in its default position is still supported for backwards-compatibility. Likewise, our use of filters.extensions below is supported by a backwards-compatibility option (the current way is filters.mime-types.extensions
|
819 |
|
820 |
$plupload_init = array(
|
821 |
'runtimes' => 'html5,flash,silverlight,html4',
|
836 |
'action' => 'plupload_action'
|
837 |
)
|
838 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
|
840 |
+
// WP 3.9 updated to plupload 2.0 - https://core.trac.wordpress.org/ticket/25663
|
841 |
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.swf')) {
|
842 |
$plupload_init['flash_swf_url'] = includes_url('js/plupload/Moxie.swf');
|
843 |
} else {
|
851 |
}
|
852 |
|
853 |
?><script>
|
854 |
+
var updraft_credentialtest_nonce = '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce');?>';
|
855 |
+
var updraftplus_settings_nonce = '<?php echo wp_create_nonce('updraftplus-settings-nonce');?>';
|
856 |
var updraft_siteurl = '<?php echo esc_js(site_url('', 'relative'));?>';
|
857 |
+
var updraft_plupload_config = <?php echo json_encode($plupload_init); ?>;
|
858 |
+
var updraft_download_nonce = '<?php echo wp_create_nonce('updraftplus_download');?>';
|
859 |
var updraft_accept_archivename = <?php echo apply_filters('updraftplus_accept_archivename_js', "[]");?>;
|
860 |
<?php
|
861 |
$plupload_init['browse_button'] = 'plupload-browse-button2';
|
864 |
$plupload_init['multipart_params']['action'] = 'plupload_action2';
|
865 |
$plupload_init['filters'] = array(array('title' => __('Allowed Files'), 'extensions' => 'crypt'));
|
866 |
?>
|
867 |
+
var updraft_plupload_config2 = <?php echo json_encode($plupload_init); ?>;
|
868 |
var updraft_downloader_nonce = '<?php wp_create_nonce("updraftplus_download"); ?>'
|
869 |
<?php
|
870 |
$overdue = $this->howmany_overdue_crons();
|
871 |
+
if ($overdue >= 4) {
|
872 |
+
?>
|
873 |
+
jQuery(document).ready(function() {
|
874 |
+
setTimeout(function(){ updraft_check_overduecrons(); }, 11000);
|
875 |
});
|
876 |
<?php } ?>
|
877 |
</script>
|
878 |
<?php
|
879 |
}
|
880 |
|
|
|
881 |
private function disk_space_check($space) {
|
882 |
global $updraftplus;
|
883 |
$updraft_dir = $updraftplus->backups_dir_location();
|
884 |
$disk_free_space = @disk_free_space($updraft_dir);
|
885 |
+
if (false == $disk_free_space) return -1;
|
886 |
return ($disk_free_space > $space) ? true : false;
|
887 |
}
|
888 |
|
889 |
+
/**
|
890 |
+
* Adds the settings link under the plugin on the plugin screen.
|
891 |
+
*
|
892 |
+
* @param Array $links Set of links for the plugin, before being filtered
|
893 |
+
* @param String $file File name (relative to the plugin directory)
|
894 |
+
* @return Array filtered results
|
895 |
+
*/
|
896 |
public function plugin_action_links($links, $file) {
|
897 |
+
if (is_array($links) && 'updraftplus/updraftplus.php' == $file) {
|
898 |
$settings_link = '<a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__("Settings", "updraftplus").'</a>';
|
899 |
array_unshift($links, $settings_link);
|
900 |
+
$settings_link = '<a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/").'">'.__("Add-Ons / Pro Support", "updraftplus").'</a>';
|
|
|
|
|
901 |
array_unshift($links, $settings_link);
|
902 |
}
|
903 |
return $links;
|
904 |
}
|
905 |
|
906 |
public function admin_action_upgrade_pluginortheme() {
|
907 |
+
if (isset($_GET['action']) && ('upgrade-plugin' == $_GET['action'] || 'upgrade-theme' == $_GET['action']) && !class_exists('UpdraftPlus_Addon_Autobackup') && !defined('UPDRAFTPLUS_NOADS_B')) {
|
908 |
|
909 |
+
if ('upgrade-plugin' == $_GET['action']) {
|
910 |
if (!current_user_can('update_plugins')) return;
|
911 |
} else {
|
912 |
if (!current_user_can('update_themes')) return;
|
925 |
$submenu_file = 'themes.php';
|
926 |
}
|
927 |
|
928 |
+
include_once(ABSPATH.'wp-admin/admin-header.php');
|
929 |
|
930 |
+
if (!class_exists('UpdraftPlus_Notices')) include_once(UPDRAFTPLUS_DIR.'/includes/updraftplus-notices.php');
|
931 |
global $updraftplus_notices;
|
932 |
$updraftplus_notices->do_notice('autobackup', 'autobackup');
|
933 |
}
|
934 |
}
|
935 |
|
936 |
+
public function show_admin_warning($message, $class = 'updated') {
|
937 |
echo '<div class="updraftmessage '.$class.'">'."<p>$message</p></div>";
|
938 |
}
|
939 |
|
|
|
940 |
public function show_admin_warning_multiple_storage_options() {
|
941 |
$this->show_admin_warning('<strong>UpdraftPlus:</strong> '.__('An error occurred when fetching storage module options: ', 'updraftplus').htmlspecialchars($this->storage_module_option_errors), 'error');
|
942 |
}
|
943 |
|
944 |
+
public function show_admin_warning_unwritable() {
|
945 |
$unwritable_mess = htmlspecialchars(__("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus'));
|
946 |
$this->show_admin_warning($unwritable_mess, "error");
|
947 |
+
}
|
948 |
|
949 |
public function show_admin_nosettings_warning() {
|
950 |
$this->show_admin_warning('<strong>'.__('Welcome to UpdraftPlus!', 'updraftplus').'</strong> '.__('To make a backup, just press the Backup Now button.', 'updraftplus').' <a href="#" id="updraft-navtab-settings2">'.__('To change any of the default settings of what is backed up, to configure scheduled backups, to send your backups to remote storage (recommended), and more, go to the settings tab.', 'updraftplus').'</a>', 'updated notice is-dismissible');
|
951 |
}
|
952 |
|
953 |
public function show_admin_warning_execution_time() {
|
954 |
+
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('The amount of time allowed for WordPress plugins to run is very low (%s seconds) - you should increase it to avoid backup failures due to time-outs (consult your web hosting company for more help - it is the max_execution_time PHP setting; the recommended value is %s seconds or more)', 'updraftplus'), (int) @ini_get('max_execution_time'), 90));
|
955 |
}
|
956 |
|
957 |
public function show_admin_warning_disabledcron() {
|
959 |
}
|
960 |
|
961 |
public function show_admin_warning_diskspace() {
|
962 |
+
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('You have less than %s of free disk space on the disk which UpdraftPlus is configured to use to create backups. UpdraftPlus could well run out of space. Contact your the operator of your server (e.g. your web hosting company) to resolve this issue.', 'updraftplus'), '35 MB'));
|
963 |
}
|
964 |
|
965 |
public function show_admin_warning_wordpressversion() {
|
967 |
}
|
968 |
|
969 |
public function show_admin_warning_litespeed() {
|
970 |
+
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('Your website is hosted using the %s web server.', 'updraftplus'), 'LiteSpeed').' <a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/i-am-having-trouble-backing-up-and-my-web-hosting-company-uses-the-litespeed-webserver/").'">'.__('Please consult this FAQ if you have problems backing up.', 'updraftplus').'</a>');
|
971 |
}
|
972 |
|
973 |
public function show_admin_debug_warning() {
|
981 |
return $ret;
|
982 |
}
|
983 |
|
984 |
+
/**
|
985 |
+
* Output authorisation links for any un-authorised Dropbox settings instances
|
986 |
+
*/
|
987 |
public function show_admin_warning_dropbox() {
|
988 |
+
foreach ($this->auth_instance_ids['dropbox'] as $instance_id) {
|
989 |
+
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> <a class="updraft_authlink" href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&action=updraftmethod-dropbox-auth&updraftplus_dropboxauth=doit&updraftplus_instance='.$instance_id.'">'.sprintf(__('Follow this link to authorize access to your %s account (you will not be able to back up to %s without it).', 'updraftplus'), 'Dropbox', 'Dropbox').'</a>', 'updated updraft_authenticate_dropbox');
|
990 |
+
}
|
991 |
}
|
992 |
|
993 |
+
/**
|
994 |
+
* Output authorisation links for any un-authorised OneDrive settings instances
|
995 |
+
*/
|
996 |
public function show_admin_warning_onedrive() {
|
997 |
+
foreach ($this->auth_instance_ids['onedrive'] as $instance_id) {
|
998 |
+
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> <a class="updraft_authlink" href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&action=updraftmethod-onedrive-auth&updraftplus_onedriveauth=doit&updraftplus_instance='.$instance_id.'">'.sprintf(__('Follow this link to authorize access to your %s account (you will not be able to back up to %s without it).', 'updraftplus'), 'OneDrive', 'OneDrive').'</a>', 'updated updraft_authenticate_onedrive');
|
999 |
+
}
|
1000 |
}
|
1001 |
|
1002 |
public function show_admin_warning_updraftvault() {
|
1003 |
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> '.sprintf(__('%s has been chosen for remote storage, but you are not currently connected.', 'updraftplus'), 'UpdraftPlus Vault').' '.__('Go to the remote storage settings in order to connect.', 'updraftplus'), 'updated');
|
1004 |
}
|
1005 |
|
1006 |