Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp...
File: admin.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed');
[2] Fix | Delete
[3] Fix | Delete
// Admin-area code lives here. This gets called in admin_menu, earlier than admin_init
[4] Fix | Delete
[5] Fix | Delete
global $updraftplus_admin;
[6] Fix | Delete
if (!is_a($updraftplus_admin, 'UpdraftPlus_Admin')) $updraftplus_admin = new UpdraftPlus_Admin();
[7] Fix | Delete
[8] Fix | Delete
class UpdraftPlus_Admin {
[9] Fix | Delete
[10] Fix | Delete
public $logged = array();
[11] Fix | Delete
[12] Fix | Delete
private $template_directories;
[13] Fix | Delete
[14] Fix | Delete
private $backups_instance_ids;
[15] Fix | Delete
[16] Fix | Delete
private $auth_instance_ids = array('dropbox' => array(), 'onedrive' => array(), 'googledrive' => array(), 'googlecloud' => array());
[17] Fix | Delete
[18] Fix | Delete
private $php_versions = array('5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0');
[19] Fix | Delete
[20] Fix | Delete
private $storage_service_without_settings;
[21] Fix | Delete
[22] Fix | Delete
private $storage_service_with_partial_settings;
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* Constructor
[26] Fix | Delete
*/
[27] Fix | Delete
public function __construct() {
[28] Fix | Delete
$this->admin_init();
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Get the path to the UI templates directory
[33] Fix | Delete
*
[34] Fix | Delete
* @return String - a filesystem directory path
[35] Fix | Delete
*/
[36] Fix | Delete
public function get_templates_dir() {
[37] Fix | Delete
return apply_filters('updraftplus_templates_dir', UpdraftPlus_Manipulation_Functions::wp_normalize_path(UPDRAFTPLUS_DIR.'/templates'));
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
private function register_template_directories() {
[41] Fix | Delete
[42] Fix | Delete
$template_directories = array();
[43] Fix | Delete
[44] Fix | Delete
$templates_dir = $this->get_templates_dir();
[45] Fix | Delete
[46] Fix | Delete
if ($dh = opendir($templates_dir)) {
[47] Fix | Delete
while (($file = readdir($dh)) !== false) {
[48] Fix | Delete
if ('.' == $file || '..' == $file) continue;
[49] Fix | Delete
if (is_dir($templates_dir.'/'.$file)) {
[50] Fix | Delete
$template_directories[$file] = $templates_dir.'/'.$file;
[51] Fix | Delete
}
[52] Fix | Delete
}
[53] Fix | Delete
closedir($dh);
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
// This is the optimal hook for most extensions to hook into
[57] Fix | Delete
$this->template_directories = apply_filters('updraftplus_template_directories', $template_directories);
[58] Fix | Delete
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Output, or return, the results of running a template (from the 'templates' directory, unless a filter over-rides it). Templates are run with $updraftplus, $updraftplus_admin and $wpdb set.
[63] Fix | Delete
*
[64] Fix | Delete
* @param String $path - path to the template
[65] Fix | Delete
* @param Boolean $return_instead_of_echo - by default, the template is echo-ed; set this to instead return it
[66] Fix | Delete
* @param Array $extract_these - variables to inject into the template's run context
[67] Fix | Delete
*
[68] Fix | Delete
* @return Void|String
[69] Fix | Delete
*/
[70] Fix | Delete
public function include_template($path, $return_instead_of_echo = false, $extract_these = array()) {
[71] Fix | Delete
if ($return_instead_of_echo) ob_start();
[72] Fix | Delete
[73] Fix | Delete
if (preg_match('#^([^/]+)/(.*)$#', $path, $matches)) {
[74] Fix | Delete
$prefix = $matches[1];
[75] Fix | Delete
$suffix = $matches[2];
[76] Fix | Delete
if (isset($this->template_directories[$prefix])) {
[77] Fix | Delete
$template_file = $this->template_directories[$prefix].'/'.$suffix;
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
if (!isset($template_file)) $template_file = UPDRAFTPLUS_DIR.'/templates/'.$path;
[82] Fix | Delete
[83] Fix | Delete
$template_file = apply_filters('updraftplus_template', $template_file, $path);
[84] Fix | Delete
[85] Fix | Delete
do_action('updraftplus_before_template', $path, $template_file, $return_instead_of_echo, $extract_these);
[86] Fix | Delete
[87] Fix | Delete
if (!file_exists($template_file)) {
[88] Fix | Delete
error_log("UpdraftPlus: template not found: $template_file");
[89] Fix | Delete
echo __('Error:', 'updraftplus').' '.__('template not found', 'updraftplus')." ($path)";
[90] Fix | Delete
} else {
[91] Fix | Delete
extract($extract_these);
[92] Fix | Delete
global $updraftplus, $wpdb;// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
[93] Fix | Delete
$updraftplus_admin = $this;// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
[94] Fix | Delete
include $template_file;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
do_action('updraftplus_after_template', $path, $template_file, $return_instead_of_echo, $extract_these);
[98] Fix | Delete
[99] Fix | Delete
if ($return_instead_of_echo) return ob_get_clean();
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Add actions for any needed dashboard notices for remote storage services
[104] Fix | Delete
*
[105] Fix | Delete
* @param String|Array $services - a list of services, or single service
[106] Fix | Delete
*/
[107] Fix | Delete
private function setup_all_admin_notices_global($services) {
[108] Fix | Delete
[109] Fix | Delete
global $updraftplus;
[110] Fix | Delete
[111] Fix | Delete
if ('googledrive' === $services || (is_array($services) && in_array('googledrive', $services))) {
[112] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('googledrive');
[113] Fix | Delete
[114] Fix | Delete
if (is_wp_error($settings)) {
[115] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[116] Fix | Delete
$this->storage_module_option_errors .= "Google Drive (".$settings->get_error_code()."): ".$settings->get_error_message();
[117] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[118] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[119] Fix | Delete
} elseif (!empty($settings['settings'])) {
[120] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[121] Fix | Delete
if ((defined('UPDRAFTPLUS_CUSTOM_GOOGLEDRIVE_APP') && UPDRAFTPLUS_CUSTOM_GOOGLEDRIVE_APP) || !empty($storage_options['clientid'])) {
[122] Fix | Delete
if (!empty($storage_options['clientid'])) {
[123] Fix | Delete
$clientid = $storage_options['clientid'];
[124] Fix | Delete
$token = empty($storage_options['token']) ? '' : $storage_options['token'];
[125] Fix | Delete
}
[126] Fix | Delete
if (!empty($clientid) && '' == $token) {
[127] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['googledrive'])) $this->auth_instance_ids['googledrive'][] = $instance_id;
[128] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'));
[129] Fix | Delete
}
[130] Fix | Delete
unset($clientid);
[131] Fix | Delete
unset($token);
[132] Fix | Delete
} else {
[133] Fix | Delete
if (empty($storage_options['user_id'])) {
[134] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['googledrive'])) $this->auth_instance_ids['googledrive'][] = $instance_id;
[135] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googledrive'));
[136] Fix | Delete
}
[137] Fix | Delete
}
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
if ('googlecloud' === $services || (is_array($services) && in_array('googlecloud', $services))) {
[142] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('googlecloud');
[143] Fix | Delete
[144] Fix | Delete
if (is_wp_error($settings)) {
[145] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[146] Fix | Delete
$this->storage_module_option_errors .= "Google Cloud (".$settings->get_error_code()."): ".$settings->get_error_message();
[147] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[148] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[149] Fix | Delete
} elseif (!empty($settings['settings'])) {
[150] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[151] Fix | Delete
if ((defined('UPDRAFTPLUS_CUSTOM_GOOGLECLOUD_APP') && UPDRAFTPLUS_CUSTOM_GOOGLECLOUD_APP) || !empty($storage_options['clientid'])) {
[152] Fix | Delete
$clientid = $storage_options['clientid'];
[153] Fix | Delete
$token = (empty($storage_options['token'])) ? '' : $storage_options['token'];
[154] Fix | Delete
[155] Fix | Delete
if (!empty($clientid) && empty($token)) {
[156] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['googlecloud'])) $this->auth_instance_ids['googlecloud'][] = $instance_id;
[157] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'));
[158] Fix | Delete
}
[159] Fix | Delete
} else {
[160] Fix | Delete
if (empty($storage_options['user_id'])) {
[161] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['googlecloud'])) $this->auth_instance_ids['googlecloud'][] = $instance_id;
[162] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'))) add_action('all_admin_notices', array($this, 'show_admin_warning_googlecloud'));
[163] Fix | Delete
}
[164] Fix | Delete
}
[165] Fix | Delete
}
[166] Fix | Delete
}
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
if ('dropbox' === $services || (is_array($services) && in_array('dropbox', $services))) {
[170] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('dropbox');
[171] Fix | Delete
[172] Fix | Delete
if (is_wp_error($settings)) {
[173] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[174] Fix | Delete
$this->storage_module_option_errors .= "Dropbox (".$settings->get_error_code()."): ".$settings->get_error_message();
[175] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[176] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[177] Fix | Delete
} elseif (!empty($settings['settings'])) {
[178] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[179] Fix | Delete
if (empty($storage_options['tk_access_token'])) {
[180] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['dropbox'])) $this->auth_instance_ids['dropbox'][] = $instance_id;
[181] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_dropbox'))) add_action('all_admin_notices', array($this, 'show_admin_warning_dropbox'));
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
}
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
if ('onedrive' === $services || (is_array($services) && in_array('onedrive', $services))) {
[188] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('onedrive');
[189] Fix | Delete
[190] Fix | Delete
if (is_wp_error($settings)) {
[191] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[192] Fix | Delete
$this->storage_module_option_errors .= "OneDrive (".$settings->get_error_code()."): ".$settings->get_error_message();
[193] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[194] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[195] Fix | Delete
} elseif (!empty($settings['settings'])) {
[196] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[197] Fix | Delete
if ((defined('UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP') && UPDRAFTPLUS_CUSTOM_ONEDRIVE_APP)) {
[198] Fix | Delete
if (!empty($storage_options['clientid']) && !empty($storage_options['secret']) && empty($storage_options['refresh_token'])) {
[199] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
[200] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
[201] Fix | Delete
} elseif (empty($storage_options['refresh_token'])) {
[202] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
[203] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
[204] Fix | Delete
}
[205] Fix | Delete
} else {
[206] Fix | Delete
if (empty($storage_options['refresh_token'])) {
[207] Fix | Delete
if (!in_array($instance_id, $this->auth_instance_ids['onedrive'])) $this->auth_instance_ids['onedrive'][] = $instance_id;
[208] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive'));
[209] Fix | Delete
}
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
if (isset($storage_options['endpoint_tld']) && 'de' === $storage_options['endpoint_tld']) {
[213] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_onedrive_germany'))) add_action('all_admin_notices', array($this, 'show_admin_warning_onedrive_germany'));
[214] Fix | Delete
}
[215] Fix | Delete
}
[216] Fix | Delete
}
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
if ('azure' === $services || (is_array($services) && in_array('azure', $services))) {
[220] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('azure');
[221] Fix | Delete
[222] Fix | Delete
if (is_wp_error($settings)) {
[223] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[224] Fix | Delete
$this->storage_module_option_errors .= "Azure (".$settings->get_error_code()."): ".$settings->get_error_message();
[225] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[226] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[227] Fix | Delete
} elseif (!empty($settings['settings'])) {
[228] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[229] Fix | Delete
if (isset($storage_options['endpoint']) && 'blob.core.cloudapi.de' === $storage_options['endpoint']) {
[230] Fix | Delete
if (false === has_action('all_admin_notices', array($this, 'show_admin_warning_azure_germany'))) add_action('all_admin_notices', array($this, 'show_admin_warning_azure_germany'));
[231] Fix | Delete
}
[232] Fix | Delete
}
[233] Fix | Delete
}
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
if ('updraftvault' === $services || (is_array($services) && in_array('updraftvault', $services))) {
[237] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('updraftvault');
[238] Fix | Delete
[239] Fix | Delete
if (is_wp_error($settings)) {
[240] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[241] Fix | Delete
$this->storage_module_option_errors .= "UpdraftVault (".$settings->get_error_code()."): ".$settings->get_error_message();
[242] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[243] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[244] Fix | Delete
} elseif (!empty($settings['settings'])) {
[245] Fix | Delete
foreach ($settings['settings'] as $instance_id => $storage_options) {
[246] Fix | Delete
if (empty($storage_options['token']) && empty($storage_options['email'])) {
[247] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_updraftvault'));
[248] Fix | Delete
}
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
if ($this->disk_space_check(1048576*35) === false) add_action('all_admin_notices', array($this, 'show_admin_warning_diskspace'));
[254] Fix | Delete
[255] Fix | Delete
$all_services = UpdraftPlus_Storage_Methods_Interface::get_enabled_storage_objects_and_ids($updraftplus->get_canonical_service_list());
[256] Fix | Delete
[257] Fix | Delete
$this->storage_service_without_settings = array();
[258] Fix | Delete
$this->storage_service_with_partial_settings = array();
[259] Fix | Delete
[260] Fix | Delete
foreach ($all_services as $method => $sinfo) {
[261] Fix | Delete
if (empty($sinfo['object']) || empty($sinfo['instance_settings']) || !is_callable(array($sinfo['object'], 'options_exist'))) continue;
[262] Fix | Delete
foreach ($sinfo['instance_settings'] as $opt) {
[263] Fix | Delete
if (!$sinfo['object']->options_exist($opt)) {
[264] Fix | Delete
if (isset($opt['auth_in_progress'])) {
[265] Fix | Delete
$this->storage_service_with_partial_settings[$method] = $updraftplus->backup_methods[$method];
[266] Fix | Delete
} else {
[267] Fix | Delete
$this->storage_service_without_settings[] = $updraftplus->backup_methods[$method];
[268] Fix | Delete
}
[269] Fix | Delete
}
[270] Fix | Delete
}
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
if (!empty($this->storage_service_with_partial_settings)) {
[274] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_if_remote_storage_with_partial_setttings'));
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
if (!empty($this->storage_service_without_settings)) {
[278] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_if_remote_storage_settting_are_empty'));
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
if ($updraftplus->is_restricted_hosting('only_one_backup_per_month')) {
[282] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_one_backup_per_month'));
[283] Fix | Delete
}
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
private function setup_all_admin_notices_udonly($service, $override = false) {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Filter use
[287] Fix | Delete
global $updraftplus;
[288] Fix | Delete
[289] Fix | Delete
if (UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
[290] Fix | Delete
@ini_set('display_errors', 1);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[291] Fix | Delete
if (defined('E_DEPRECATED')) {
[292] Fix | Delete
@error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged, PHPCompatibility.Constants.NewConstants.e_deprecatedFound -- Ok to ignore
[293] Fix | Delete
} else {
[294] Fix | Delete
@error_reporting(E_ALL & ~E_NOTICE);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[295] Fix | Delete
}
[296] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_debug_warning'));
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
if (null === UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
[300] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_nosettings_warning'));
[301] Fix | Delete
$this->no_settings_warning = true;
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
// Avoid false positives, by attempting to raise the limit (as happens when we actually do a backup)
[305] Fix | Delete
if (function_exists('set_time_limit')) @set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[306] Fix | Delete
$max_execution_time = (int) @ini_get('max_execution_time');// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[307] Fix | Delete
if ($max_execution_time>0 && $max_execution_time<20) {
[308] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_execution_time'));
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
// LiteSpeed has a generic problem with terminating cron jobs
[312] Fix | Delete
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false) {
[313] Fix | Delete
if (!is_file(ABSPATH.'.htaccess') || !preg_match('/noabort/i', file_get_contents(ABSPATH.'.htaccess'))) {
[314] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_litespeed'));
[315] Fix | Delete
}
[316] Fix | Delete
}
[317] Fix | Delete
[318] Fix | Delete
if (version_compare($updraftplus->get_wordpress_version(), '3.2', '<')) add_action('all_admin_notices', array($this, 'show_admin_warning_wordpressversion'));
[319] Fix | Delete
[320] Fix | Delete
// DreamObjects west cluster shutdown warning
[321] Fix | Delete
if ('dreamobjects' === $service || (is_array($service) && in_array('dreamobjects', $service))) {
[322] Fix | Delete
$settings = UpdraftPlus_Storage_Methods_Interface::update_remote_storage_options_format('dreamobjects');
[323] Fix | Delete
[324] Fix | Delete
if (is_wp_error($settings)) {
[325] Fix | Delete
if (!isset($this->storage_module_option_errors)) $this->storage_module_option_errors = '';
[326] Fix | Delete
$this->storage_module_option_errors .= "DreamObjects (".$settings->get_error_code()."): ".$settings->get_error_message();
[327] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_multiple_storage_options'));
[328] Fix | Delete
$updraftplus->log_wp_error($settings, true, true);
[329] Fix | Delete
} elseif (!empty($settings['settings'])) {
[330] Fix | Delete
foreach ($settings['settings'] as $storage_options) {
[331] Fix | Delete
if ('objects-us-west-1.dream.io' == $storage_options['endpoint']) {
[332] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_dreamobjects'));
[333] Fix | Delete
}
[334] Fix | Delete
}
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
// If the plugin was not able to connect to a UDC account due to lack of licences
[339] Fix | Delete
if (isset($_GET['udc_connect']) && 0 == $_GET['udc_connect']) {
[340] Fix | Delete
add_action('all_admin_notices', array($this, 'show_admin_warning_udc_couldnt_connect'));
[341] Fix | Delete
}
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
/**
[345] Fix | Delete
* Used to output the information for the next scheduled backup.
[346] Fix | Delete
* moved to function for the ajax saves
[347] Fix | Delete
*/
[348] Fix | Delete
public function next_scheduled_backups_output() {
[349] Fix | Delete
// UNIX timestamp
[350] Fix | Delete
$next_scheduled_backup = wp_next_scheduled('updraft_backup');
[351] Fix | Delete
if ($next_scheduled_backup) {
[352] Fix | Delete
// Convert to GMT
[353] Fix | Delete
$next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
[354] Fix | Delete
// Convert to blog time zone
[355] Fix | Delete
$next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
[356] Fix | Delete
// $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup);
[357] Fix | Delete
} else {
[358] Fix | Delete
$next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
[359] Fix | Delete
$files_not_scheduled = true;
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
$next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
[363] Fix | Delete
if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
[364] Fix | Delete
if (isset($files_not_scheduled)) {
[365] Fix | Delete
$next_scheduled_backup_database = $next_scheduled_backup;
[366] Fix | Delete
$database_not_scheduled = true;
[367] Fix | Delete
} else {
[368] Fix | Delete
$next_scheduled_backup_database = __("At the same time as the files backup", 'updraftplus');
[369] Fix | Delete
$next_scheduled_backup_database_same_time = true;
[370] Fix | Delete
}
[371] Fix | Delete
} else {
[372] Fix | Delete
if ($next_scheduled_backup_database) {
[373] Fix | Delete
// Convert to GMT
[374] Fix | Delete
$next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
[375] Fix | Delete
// Convert to blog time zone
[376] Fix | Delete
$next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
[377] Fix | Delete
// $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database);
[378] Fix | Delete
} else {
[379] Fix | Delete
$next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
[380] Fix | Delete
$database_not_scheduled = true;
[381] Fix | Delete
}
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
if (isset($files_not_scheduled) && isset($database_not_scheduled)) {
[385] Fix | Delete
?>
[386] Fix | Delete
<span class="not-scheduled"><?php _e('Nothing currently scheduled', 'updraftplus'); ?></span>
[387] Fix | Delete
<?php
[388] Fix | Delete
} else {
[389] Fix | Delete
echo empty($next_scheduled_backup_database_same_time) ? __('Files', 'updraftplus') : __('Files and database', 'updraftplus');
[390] Fix | Delete
?>
[391] Fix | Delete
:
[392] Fix | Delete
<span class="updraft_all-files">
[393] Fix | Delete
<?php
[394] Fix | Delete
echo $next_scheduled_backup;
[395] Fix | Delete
?>
[396] Fix | Delete
</span>
[397] Fix | Delete
<?php
[398] Fix | Delete
if (empty($next_scheduled_backup_database_same_time)) {
[399] Fix | Delete
_e('Database', 'updraftplus');
[400] Fix | Delete
?>
[401] Fix | Delete
:
[402] Fix | Delete
<span class="updraft_all-files">
[403] Fix | Delete
<?php
[404] Fix | Delete
echo $next_scheduled_backup_database;
[405] Fix | Delete
?>
[406] Fix | Delete
</span>
[407] Fix | Delete
<?php
[408] Fix | Delete
}
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
/**
[414] Fix | Delete
* Used to output the information for the next scheduled file backup.
[415] Fix | Delete
* moved to function for the ajax saves
[416] Fix | Delete
*
[417] Fix | Delete
* @param Boolean $return_instead_of_echo Whether to return or echo the results. N.B. More than just the results to echo will be returned
[418] Fix | Delete
* @return Void|String If $return_instead_of_echo parameter is true, It returns html string
[419] Fix | Delete
*/
[420] Fix | Delete
public function next_scheduled_files_backups_output($return_instead_of_echo = false) {
[421] Fix | Delete
if ($return_instead_of_echo) ob_start();
[422] Fix | Delete
// UNIX timestamp
[423] Fix | Delete
$next_scheduled_backup = wp_next_scheduled('updraft_backup');
[424] Fix | Delete
if ($next_scheduled_backup) {
[425] Fix | Delete
// Convert to blog time zone. wp_date() (WP 5.3+) also performs locale translation.
[426] Fix | Delete
$next_scheduled_backup = function_exists('wp_date') ? wp_date('D, F j, Y H:i', $next_scheduled_backup) : get_date_from_gmt(gmdate('Y-m-d H:i:s', $next_scheduled_backup), 'D, F j, Y H:i');
[427] Fix | Delete
$files_not_scheduled = false;
[428] Fix | Delete
} else {
[429] Fix | Delete
$next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
[430] Fix | Delete
$files_not_scheduled = true;
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
if ($files_not_scheduled) {
[434] Fix | Delete
echo '<span>'.$next_scheduled_backup.'</span>';
[435] Fix | Delete
} else {
[436] Fix | Delete
echo '<span class="updraft_next_scheduled_date_time">'.$next_scheduled_backup.'</span>';
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
if ($return_instead_of_echo) return ob_get_clean();
[440] Fix | Delete
}
[441] Fix | Delete
[442] Fix | Delete
/**
[443] Fix | Delete
* Used to output the information for the next scheduled database backup.
[444] Fix | Delete
* moved to function for the ajax saves
[445] Fix | Delete
*
[446] Fix | Delete
* @param Boolean $return_instead_of_echo Whether to return or echo the results. N.B. More than just the results to echo will be returned
[447] Fix | Delete
* @return Void|String If $return_instead_of_echo parameter is true, It returns html string
[448] Fix | Delete
*/
[449] Fix | Delete
public function next_scheduled_database_backups_output($return_instead_of_echo = false) {
[450] Fix | Delete
if ($return_instead_of_echo) ob_start();
[451] Fix | Delete
[452] Fix | Delete
$next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
[453] Fix | Delete
if ($next_scheduled_backup_database) {
[454] Fix | Delete
// Convert to GMT
[455] Fix | Delete
$next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
[456] Fix | Delete
// Convert to blog time zone. wp_date() (WP 5.3+) also performs locale translation.
[457] Fix | Delete
$next_scheduled_backup_database = function_exists('wp_date') ? wp_date('D, F j, Y H:i', $next_scheduled_backup_database) : get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
[458] Fix | Delete
$database_not_scheduled = false;
[459] Fix | Delete
} else {
[460] Fix | Delete
$next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
[461] Fix | Delete
$database_not_scheduled = true;
[462] Fix | Delete
}
[463] Fix | Delete
[464] Fix | Delete
if ($database_not_scheduled) {
[465] Fix | Delete
echo '<span>'.$next_scheduled_backup_database.'</span>';
[466] Fix | Delete
} else {
[467] Fix | Delete
echo '<span class="updraft_next_scheduled_date_time">'.$next_scheduled_backup_database.'</span>';
[468] Fix | Delete
}
[469] Fix | Delete
[470] Fix | Delete
if ($return_instead_of_echo) return ob_get_clean();
[471] Fix | Delete
}
[472] Fix | Delete
[473] Fix | Delete
/**
[474] Fix | Delete
* Run upon the WP admin_init action
[475] Fix | Delete
*/
[476] Fix | Delete
private function admin_init() {
[477] Fix | Delete
[478] Fix | Delete
add_action('admin_init', array($this, 'maybe_download_backup_from_email'));
[479] Fix | Delete
[480] Fix | Delete
add_action('core_upgrade_preamble', array($this, 'core_upgrade_preamble'));
[481] Fix | Delete
add_action('admin_action_upgrade-plugin', array($this, 'admin_action_upgrade_pluginortheme'));
[482] Fix | Delete
add_action('admin_action_upgrade-theme', array($this, 'admin_action_upgrade_pluginortheme'));
[483] Fix | Delete
[484] Fix | Delete
add_action('admin_head', array($this, 'admin_head'));
[485] Fix | Delete
add_filter((is_multisite() ? 'network_admin_' : '').'plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
[486] Fix | Delete
add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
[487] Fix | Delete
add_action('wp_ajax_updraft_ajax', array($this, 'updraft_ajax_handler'));
[488] Fix | Delete
add_action('wp_ajax_updraft_ajaxrestore', array($this, 'updraft_ajaxrestore'));
[489] Fix | Delete
add_action('wp_ajax_nopriv_updraft_ajaxrestore', array($this, 'updraft_ajaxrestore'));
[490] Fix | Delete
add_action('wp_ajax_updraft_ajaxrestore_continue', array($this, 'updraft_ajaxrestore'));
[491] Fix | Delete
add_action('wp_ajax_nopriv_updraft_ajaxrestore_continue', array($this, 'updraft_ajaxrestore'));
[492] Fix | Delete
[493] Fix | Delete
add_action('wp_ajax_plupload_action', array($this, 'plupload_action'));
[494] Fix | Delete
add_action('wp_ajax_plupload_action2', array($this, 'plupload_action2'));
[495] Fix | Delete
[496] Fix | Delete
add_action('wp_before_admin_bar_render', array($this, 'wp_before_admin_bar_render'));
[497] Fix | Delete
[498] Fix | Delete
// Add a new Ajax action for saving settings
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function