Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp...
File: admin.php
'registration_successful' => __('Registration successful.', 'updraftplus').' '.__('Please follow this link to open %s in a new window.', 'updraftplus'),
[1000] Fix | Delete
'username_password_required' => __('Both email and password fields are required.', 'updraftplus'),
[1001] Fix | Delete
'valid_email_required' => __('An email is required and needs to be in a valid format.', 'updraftplus'),
[1002] Fix | Delete
'trouble_connecting' => __('Trouble connecting? Try using an alternative method in the advanced security options.', 'updraftplus'),
[1003] Fix | Delete
'checking_tfa_code' => __('Verifying one-time password...', 'updraftplus'),
[1004] Fix | Delete
'perhaps_login' => __('Perhaps you would want to login instead.', 'updraftplus'),
[1005] Fix | Delete
'generating_key' => __('Please wait while the system generates and registers an encryption key for your website with UpdraftCentral Cloud.', 'updraftplus'),
[1006] Fix | Delete
'updraftcentral_cloud_redirect' => __('Please wait while you are redirected to UpdraftCentral Cloud.', 'updraftplus'),
[1007] Fix | Delete
'data_consent_required' => __('You need to read and accept the UpdraftCentral Cloud data and privacy policies before you can proceed.', 'updraftplus'),
[1008] Fix | Delete
'close_wizard' => __('You can also close this wizard.', 'updraftplus'),
[1009] Fix | Delete
'control_udc_connections' => __('For future control of all your UpdraftCentral connections, go to the "Advanced Tools" tab.', 'updraftplus'),
[1010] Fix | Delete
'main_tabs_keys' => array_keys($main_tabs),
[1011] Fix | Delete
'clone_version_warning' => __('Warning: you have selected a lower version than your currently installed version. This may fail if you have components that are incompatible with earlier versions.', 'updraftplus'),
[1012] Fix | Delete
'clone_backup_complete' => __('The clone has been provisioned, and its data has been sent to it. Once the clone has finished deploying it, you will receive an email.', 'updraftplus'),
[1013] Fix | Delete
'clone_backup_aborted' => __('The preparation of the clone data has been aborted.', 'updraftplus'),
[1014] Fix | Delete
'current_clean_url' => UpdraftPlus::get_current_clean_url(),
[1015] Fix | Delete
'exclude_rule_remove_conformation_msg' => __('Are you sure you want to remove this exclusion rule?', 'updraftplus'),
[1016] Fix | Delete
'exclude_select_file_or_folder_msg' => __('Please select a file/folder which you would like to exclude', 'updraftplus'),
[1017] Fix | Delete
'exclude_select_folder_wildcards_msg' => __('Please select a folder in which the files/directories you would like to exclude are located'),
[1018] Fix | Delete
'exclude_type_ext_msg' => __('Please enter a file extension, like zip', 'updraftplus'),
[1019] Fix | Delete
'exclude_ext_error_msg' => __('Please enter a valid file extension', 'updraftplus'),
[1020] Fix | Delete
'exclude_type_prefix_msg' => __('Please enter characters that begin the filename which you would like to exclude', 'updraftplus'),
[1021] Fix | Delete
'exclude_prefix_error_msg' => __('Please enter a valid file name prefix', 'updraftplus'),
[1022] Fix | Delete
'exclude_contain_error_msg' => __('Please enter part of the file name', 'updraftplus'),
[1023] Fix | Delete
'duplicate_exclude_rule_error_msg' => __('The exclusion rule which you are trying to add already exists', 'updraftplus'),
[1024] Fix | Delete
'clone_key_required' => __('UpdraftClone key is required.', 'updraftplus'),
[1025] Fix | Delete
'files_new_backup' => __('Include your files in the backup', 'updraftplus'),
[1026] Fix | Delete
'files_incremental_backup' => __('File backup options', 'updraftplus'),
[1027] Fix | Delete
'ajax_restore_invalid_response' => __('HTML was detected in the response. You may have a security module on your webserver blocking the restoration operation.', 'updraftplus'),
[1028] Fix | Delete
'emptyrestorepath' => __('You have not selected a restore path for your chosen backups', 'updraftplus'),
[1029] Fix | Delete
'updraftvault_info' => '<h3>'.__('Try UpdraftVault!', 'updraftplus').'</h3>'
[1030] Fix | Delete
.'<p>'.__('UpdraftVault is our remote storage which works seamlessly with UpdraftPlus.', 'updraftplus')
[1031] Fix | Delete
.' <a href="'.apply_filters('updraftplus_com_link', 'https://updraftplus.com/updraftvault/').'" target="_blank">'.__('Find out more here.', 'updraftplus').'</a>'
[1032] Fix | Delete
.'</p>'
[1033] Fix | Delete
.'<p><a href="'.apply_filters('updraftplus_com_link', $updraftplus->get_url('shop_vault_5')).'" target="_blank" '.$checkout_embed_5gb_trial_attribute.' class="button button-primary">'.__('Try it - 1 month for $1!', 'updraftplus').'</a></p>',
[1034] Fix | Delete
'login_udc_no_licences_short' => __('No UpdraftCentral licences were available. Continuing to connect to account.'),
[1035] Fix | Delete
'credentials' => __('credentials', 'updraftplus'),
[1036] Fix | Delete
'username' => __('Username', 'updraftplus'),
[1037] Fix | Delete
'password' => __('Password', 'updraftplus'),
[1038] Fix | Delete
'last_activity' => __('last activity: %d seconds ago', 'updraftplus'),
[1039] Fix | Delete
'no_recent_activity' => __('no recent activity; will offer resumption after: %d seconds', 'updraftplus'),
[1040] Fix | Delete
'restore_files_progress' => __('Restoring %s1 files out of %s2', 'updraftplus'),
[1041] Fix | Delete
'restore_db_table_progress' => __('Restoring table: %s', 'updraftplus'),
[1042] Fix | Delete
'restore_db_stored_routine_progress' => __('Restoring stored routine: %s', 'updraftplus'),
[1043] Fix | Delete
'finished' => __('Finished', 'updraftplus'),
[1044] Fix | Delete
'begun' => __('Begun', 'updraftplus'),
[1045] Fix | Delete
'maybe_downloading_entities' => __('Downloading backup files if needed', 'updraftplus'),
[1046] Fix | Delete
'preparing_backup_files' => __('Preparing backup files', 'updraftplus'),
[1047] Fix | Delete
'ajax_restore_contact_failed' => __('Attempts by the browser to contact the website failed.', 'updraftplus'),
[1048] Fix | Delete
'ajax_restore_error' => __('Restore error:', 'updraftplus'),
[1049] Fix | Delete
'ajax_restore_404_detected' => '<div class="notice notice-warning" style="margin: 0px; padding: 5px;"><p><span class="dashicons dashicons-warning"></span> <strong>'. __('Warning:', 'updraftplus') . '</strong></p><p>' . __('Attempts by the browser to access some pages have returned a "not found (404)" error. This could mean that your .htaccess file has incorrect contents, is missing, or that your webserver is missing an equivalent mechanism.', 'updraftplus'). '</p><p>'.__('Missing pages:', 'updraftplus').'</p><ul class="updraft_missing_pages"></ul><a target="_blank" href="https://updraftplus.com/faqs/migrating-site-front-page-works-pages-give-404-error/">'.__('Follow this link for more information', 'updraftplus').'.</a></div>',
[1050] Fix | Delete
'delete_error_log_prompt' => __('Please check the error log for more details', 'updraftplus'),
[1051] Fix | Delete
'existing_backups_limit' => defined('UPDRAFTPLUS_EXISTING_BACKUPS_LIMIT') ? UPDRAFTPLUS_EXISTING_BACKUPS_LIMIT : 100,
[1052] Fix | Delete
'remote_scan_warning' => __('Warning: if you continue, you will add all backups stored in the configured remote storage directory (whichever site they were created by).'),
[1053] Fix | Delete
'hosting_restriction_one_backup_permonth' => __("You have reached the monthly limit for the number of backups you can create at this time.", 'updraftplus').' '.__('Your hosting provider only allows you to take one backup per month.', 'updraftplus').' '.sprintf(__("Please contact your hosting company (%s) if you require further support.", 'updraftplus'), $hosting_company['name']),
[1054] Fix | Delete
'hosting_restriction_one_incremental_perday' => __("You have reached the daily limit for the number of incremental backups you can create at this time.", 'updraftplus').' '.__("Your hosting provider only allows you to take one incremental backup per day.", 'updraftplus').' '.sprintf(__("Please contact your hosting company (%s) if you require further support.", 'updraftplus'), $hosting_company['name']),
[1055] Fix | Delete
'hosting_restriction' => $updraftplus->is_hosting_backup_limit_reached(),
[1056] Fix | Delete
'conditional_logic' => array(
[1057] Fix | Delete
'day_of_the_week_options' => $updraftplus->list_days_of_the_week(),
[1058] Fix | Delete
'logic_options' => array(
[1059] Fix | Delete
array(
[1060] Fix | Delete
'label' => __('on every backup', 'updraftplus'),
[1061] Fix | Delete
'value' => '',
[1062] Fix | Delete
),
[1063] Fix | Delete
array(
[1064] Fix | Delete
'label' => __('if any of the following conditions are matched:', 'updraftplus'),
[1065] Fix | Delete
'value' => 'any',
[1066] Fix | Delete
),
[1067] Fix | Delete
array(
[1068] Fix | Delete
'label' => __('if all of the following conditions are matched:', 'updraftplus'),
[1069] Fix | Delete
'value' => 'all',
[1070] Fix | Delete
),
[1071] Fix | Delete
),
[1072] Fix | Delete
'operand_options' => array(
[1073] Fix | Delete
array(
[1074] Fix | Delete
'label' => __('Day of the week', 'updraftplus'),
[1075] Fix | Delete
'value' => 'day_of_the_week',
[1076] Fix | Delete
),
[1077] Fix | Delete
array(
[1078] Fix | Delete
'label' => __('Day of the month', 'updraftplus'),
[1079] Fix | Delete
'value' => 'day_of_the_month',
[1080] Fix | Delete
),
[1081] Fix | Delete
),
[1082] Fix | Delete
'operator_options' => array(
[1083] Fix | Delete
array(
[1084] Fix | Delete
'label' => __('is', 'updraftplus'),
[1085] Fix | Delete
'value' => 'is',
[1086] Fix | Delete
),
[1087] Fix | Delete
array(
[1088] Fix | Delete
'label' => __('is not', 'updraftplus'),
[1089] Fix | Delete
'value' => 'is_not',
[1090] Fix | Delete
),
[1091] Fix | Delete
)
[1092] Fix | Delete
),
[1093] Fix | Delete
'php_max_input_vars_detected_warning' => __('The number of restore options that will be sent exceeds the configured maximum in your PHP configuration (max_input_vars).', 'updraftplus').' '.__('If you proceed with the restoration then some of the restore options will be lost and you may get unexpected results. See the browser console log for more information.', 'updraftplus')
[1094] Fix | Delete
));
[1095] Fix | Delete
}
[1096] Fix | Delete
[1097] Fix | Delete
/**
[1098] Fix | Delete
* Despite the name, this fires irrespective of what capabilities the user has (even none - so be careful)
[1099] Fix | Delete
*/
[1100] Fix | Delete
public function core_upgrade_preamble() {
[1101] Fix | Delete
// They need to be able to perform backups, and to perform updates
[1102] Fix | Delete
if (!UpdraftPlus_Options::user_can_manage() || (!current_user_can('update_core') && !current_user_can('update_plugins') && !current_user_can('update_themes'))) return;
[1103] Fix | Delete
[1104] Fix | Delete
if (!class_exists('UpdraftPlus_Addon_Autobackup')) {
[1105] Fix | Delete
if (defined('UPDRAFTPLUS_NOADS_B')) return;
[1106] Fix | Delete
}
[1107] Fix | Delete
[1108] Fix | Delete
?>
[1109] Fix | Delete
<?php
[1110] Fix | Delete
if (!class_exists('UpdraftPlus_Addon_Autobackup')) {
[1111] Fix | Delete
if (!class_exists('UpdraftPlus_Notices')) include_once(UPDRAFTPLUS_DIR.'/includes/updraftplus-notices.php');
[1112] Fix | Delete
global $updraftplus_notices;
[1113] Fix | Delete
echo apply_filters('updraftplus_autobackup_blurb', $updraftplus_notices->do_notice('autobackup', 'autobackup', true));
[1114] Fix | Delete
} else {
[1115] Fix | Delete
echo apply_filters('updraftplus_autobackup_blurb', '');
[1116] Fix | Delete
}
[1117] Fix | Delete
?>
[1118] Fix | Delete
<script>
[1119] Fix | Delete
jQuery(function() {
[1120] Fix | Delete
jQuery('.updraft-ad-container').appendTo(jQuery('.wrap p').first());
[1121] Fix | Delete
});
[1122] Fix | Delete
</script>
[1123] Fix | Delete
<?php
[1124] Fix | Delete
}
[1125] Fix | Delete
[1126] Fix | Delete
/**
[1127] Fix | Delete
* Run upon the WP admin_head action
[1128] Fix | Delete
*/
[1129] Fix | Delete
public function admin_head() {
[1130] Fix | Delete
[1131] Fix | Delete
global $pagenow;
[1132] Fix | Delete
[1133] Fix | Delete
if (UpdraftPlus_Options::admin_page() != $pagenow || !isset($_REQUEST['page']) || 'updraftplus' != $_REQUEST['page'] || !UpdraftPlus_Options::user_can_manage()) return;
[1134] Fix | Delete
[1135] Fix | Delete
$chunk_size = min(wp_max_upload_size()-1024, 1048576*2);
[1136] Fix | Delete
[1137] Fix | Delete
// 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/
[1138] Fix | Delete
// 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
[1139] Fix | Delete
[1140] Fix | Delete
$plupload_init = array(
[1141] Fix | Delete
'runtimes' => 'html5,flash,silverlight,html4',
[1142] Fix | Delete
'browse_button' => 'plupload-browse-button',
[1143] Fix | Delete
'container' => 'plupload-upload-ui',
[1144] Fix | Delete
'drop_element' => 'drag-drop-area',
[1145] Fix | Delete
'file_data_name' => 'async-upload',
[1146] Fix | Delete
'multiple_queues' => true,
[1147] Fix | Delete
'max_file_size' => '100Gb',
[1148] Fix | Delete
'chunk_size' => $chunk_size.'b',
[1149] Fix | Delete
'url' => admin_url('admin-ajax.php', 'relative'),
[1150] Fix | Delete
'multipart' => true,
[1151] Fix | Delete
'multi_selection' => true,
[1152] Fix | Delete
'urlstream_upload' => true,
[1153] Fix | Delete
// additional post data to send to our ajax hook
[1154] Fix | Delete
'multipart_params' => array(
[1155] Fix | Delete
'_ajax_nonce' => wp_create_nonce('updraft-uploader'),
[1156] Fix | Delete
'action' => 'plupload_action'
[1157] Fix | Delete
)
[1158] Fix | Delete
);
[1159] Fix | Delete
[1160] Fix | Delete
// WP 3.9 updated to plupload 2.0 - https://core.trac.wordpress.org/ticket/25663
[1161] Fix | Delete
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.swf')) {
[1162] Fix | Delete
$plupload_init['flash_swf_url'] = includes_url('js/plupload/Moxie.swf');
[1163] Fix | Delete
} else {
[1164] Fix | Delete
$plupload_init['flash_swf_url'] = includes_url('js/plupload/plupload.flash.swf');
[1165] Fix | Delete
}
[1166] Fix | Delete
[1167] Fix | Delete
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.xap')) {
[1168] Fix | Delete
$plupload_init['silverlight_xap_url'] = includes_url('js/plupload/Moxie.xap');
[1169] Fix | Delete
} else {
[1170] Fix | Delete
$plupload_init['silverlight_xap_url'] = includes_url('js/plupload/plupload.silverlight.swf');
[1171] Fix | Delete
}
[1172] Fix | Delete
[1173] Fix | Delete
?><script>
[1174] Fix | Delete
var updraft_credentialtest_nonce = '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce');?>';
[1175] Fix | Delete
var updraftplus_settings_nonce = '<?php echo wp_create_nonce('updraftplus-settings-nonce');?>';
[1176] Fix | Delete
var updraft_siteurl = '<?php echo esc_js(site_url('', 'relative'));?>';
[1177] Fix | Delete
var updraft_plupload_config = <?php echo json_encode($plupload_init); ?>;
[1178] Fix | Delete
var updraft_download_nonce = '<?php echo wp_create_nonce('updraftplus_download');?>';
[1179] Fix | Delete
var updraft_accept_archivename = <?php echo apply_filters('updraftplus_accept_archivename_js', "[]");?>;
[1180] Fix | Delete
<?php
[1181] Fix | Delete
$plupload_init['browse_button'] = 'plupload-browse-button2';
[1182] Fix | Delete
$plupload_init['container'] = 'plupload-upload-ui2';
[1183] Fix | Delete
$plupload_init['drop_element'] = 'drag-drop-area2';
[1184] Fix | Delete
$plupload_init['multipart_params']['action'] = 'plupload_action2';
[1185] Fix | Delete
$plupload_init['filters'] = array(array('title' => __('Allowed Files'), 'extensions' => 'crypt'));
[1186] Fix | Delete
?>
[1187] Fix | Delete
var updraft_plupload_config2 = <?php echo json_encode($plupload_init); ?>;
[1188] Fix | Delete
var updraft_downloader_nonce = '<?php wp_create_nonce("updraftplus_download"); ?>'
[1189] Fix | Delete
<?php
[1190] Fix | Delete
$overdue = $this->howmany_overdue_crons();
[1191] Fix | Delete
if ($overdue >= 4) {
[1192] Fix | Delete
?>
[1193] Fix | Delete
jQuery(function() {
[1194] Fix | Delete
setTimeout(function(){ updraft_check_overduecrons(); }, 11000);
[1195] Fix | Delete
});
[1196] Fix | Delete
<?php } ?>
[1197] Fix | Delete
</script>
[1198] Fix | Delete
<?php
[1199] Fix | Delete
}
[1200] Fix | Delete
[1201] Fix | Delete
/**
[1202] Fix | Delete
* Check if available disk space is at least the specified number of bytes
[1203] Fix | Delete
*
[1204] Fix | Delete
* @param Integer $space - number of bytes
[1205] Fix | Delete
*
[1206] Fix | Delete
* @return Integer|Boolean - true or false to indicate if available; of -1 if the result is unknown
[1207] Fix | Delete
*/
[1208] Fix | Delete
private function disk_space_check($space) {
[1209] Fix | Delete
// Allow checking by some other means (user request)
[1210] Fix | Delete
if (null !== ($filtered_result = apply_filters('updraftplus_disk_space_check', null, $space))) return $filtered_result;
[1211] Fix | Delete
global $updraftplus;
[1212] Fix | Delete
$updraft_dir = $updraftplus->backups_dir_location();
[1213] Fix | Delete
$disk_free_space = function_exists('disk_free_space') ? @disk_free_space($updraft_dir) : false;// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[1214] Fix | Delete
if (false == $disk_free_space) return -1;
[1215] Fix | Delete
return ($disk_free_space > $space) ? true : false;
[1216] Fix | Delete
}
[1217] Fix | Delete
[1218] Fix | Delete
/**
[1219] Fix | Delete
* Adds the settings link under the plugin on the plugin screen.
[1220] Fix | Delete
*
[1221] Fix | Delete
* @param Array $links Set of links for the plugin, before being filtered
[1222] Fix | Delete
* @param String $file File name (relative to the plugin directory)
[1223] Fix | Delete
* @return Array filtered results
[1224] Fix | Delete
*/
[1225] Fix | Delete
public function plugin_action_links($links, $file) {
[1226] Fix | Delete
if (is_array($links) && 'updraftplus/updraftplus.php' == $file) {
[1227] Fix | Delete
$settings_link = '<a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus" class="js-updraftplus-settings">'.__("Settings", "updraftplus").'</a>';
[1228] Fix | Delete
array_unshift($links, $settings_link);
[1229] Fix | Delete
$settings_link = '<a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/").'" target="_blank">'.__("Premium / Pro Support", "updraftplus").'</a>';
[1230] Fix | Delete
array_unshift($links, $settings_link);
[1231] Fix | Delete
}
[1232] Fix | Delete
return $links;
[1233] Fix | Delete
}
[1234] Fix | Delete
[1235] Fix | Delete
public function admin_action_upgrade_pluginortheme() {
[1236] Fix | Delete
if (isset($_GET['action']) && ('upgrade-plugin' == $_GET['action'] || 'upgrade-theme' == $_GET['action']) && !class_exists('UpdraftPlus_Addon_Autobackup') && !defined('UPDRAFTPLUS_NOADS_B')) {
[1237] Fix | Delete
[1238] Fix | Delete
if ('upgrade-plugin' == $_GET['action']) {
[1239] Fix | Delete
if (!current_user_can('update_plugins')) return;
[1240] Fix | Delete
} else {
[1241] Fix | Delete
if (!current_user_can('update_themes')) return;
[1242] Fix | Delete
}
[1243] Fix | Delete
[1244] Fix | Delete
$dismissed_until = UpdraftPlus_Options::get_updraft_option('updraftplus_dismissedautobackup', 0);
[1245] Fix | Delete
if ($dismissed_until > time()) return;
[1246] Fix | Delete
[1247] Fix | Delete
if ('upgrade-plugin' == $_GET['action']) {
[1248] Fix | Delete
$title = __('Update Plugin');// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1249] Fix | Delete
$parent_file = 'plugins.php';// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1250] Fix | Delete
$submenu_file = 'plugins.php';// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1251] Fix | Delete
} else {
[1252] Fix | Delete
$title = __('Update Theme');// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1253] Fix | Delete
$parent_file = 'themes.php';// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1254] Fix | Delete
$submenu_file = 'themes.php';// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Passed though to wp-admin/admin-header.php
[1255] Fix | Delete
}
[1256] Fix | Delete
[1257] Fix | Delete
include_once(ABSPATH.'wp-admin/admin-header.php');
[1258] Fix | Delete
[1259] Fix | Delete
if (!class_exists('UpdraftPlus_Notices')) include_once(UPDRAFTPLUS_DIR.'/includes/updraftplus-notices.php');
[1260] Fix | Delete
global $updraftplus_notices;
[1261] Fix | Delete
$updraftplus_notices->do_notice('autobackup', 'autobackup');
[1262] Fix | Delete
}
[1263] Fix | Delete
}
[1264] Fix | Delete
[1265] Fix | Delete
/**
[1266] Fix | Delete
* Show an administrative warning message, which can appear only on the UpdraftPlus plugin page
[1267] Fix | Delete
*
[1268] Fix | Delete
* @param String $message the HTML for the message (already escaped)
[1269] Fix | Delete
* @param String $class CSS class to use for the div
[1270] Fix | Delete
*/
[1271] Fix | Delete
public function show_plugin_page_admin_warning($message, $class = 'updated') {
[1272] Fix | Delete
[1273] Fix | Delete
global $pagenow, $plugin_page;
[1274] Fix | Delete
[1275] Fix | Delete
if (UpdraftPlus_Options::admin_page() !== $pagenow || 'updraftplus' !== $plugin_page) return;
[1276] Fix | Delete
[1277] Fix | Delete
$this->show_admin_warning($message, $class);
[1278] Fix | Delete
}
[1279] Fix | Delete
[1280] Fix | Delete
/**
[1281] Fix | Delete
* Paint a div for a dashboard warning
[1282] Fix | Delete
*
[1283] Fix | Delete
* @param String $message - the HTML for the message (already escaped)
[1284] Fix | Delete
* @param String $class - CSS class to use for the div
[1285] Fix | Delete
*/
[1286] Fix | Delete
public function show_admin_warning($message, $class = 'updated') {
[1287] Fix | Delete
echo '<div class="updraftmessage '.$class.'">'."<p>$message</p></div>";
[1288] Fix | Delete
}
[1289] Fix | Delete
[1290] Fix | Delete
public function show_admin_warning_multiple_storage_options() {
[1291] Fix | Delete
$this->show_admin_warning('<strong>UpdraftPlus:</strong> '.__('An error occurred when fetching storage module options: ', 'updraftplus').htmlspecialchars($this->storage_module_option_errors), 'error');
[1292] Fix | Delete
}
[1293] Fix | Delete
[1294] Fix | Delete
public function show_admin_warning_unwritable() {
[1295] Fix | Delete
// One of the translators has erroneously changed "Backup" into "Back up" (which means, "reverse" !)
[1296] Fix | Delete
$unwritable_mess = htmlspecialchars(str_ireplace('Back Up', 'Backup', __("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus')));
[1297] Fix | Delete
$this->show_admin_warning($unwritable_mess, "error");
[1298] Fix | Delete
}
[1299] Fix | Delete
[1300] Fix | Delete
public function show_admin_nosettings_warning() {
[1301] Fix | Delete
$this->show_admin_warning('<strong>'.__('Welcome to UpdraftPlus!', 'updraftplus').'</strong> '.str_ireplace('Back Up', 'Backup', __('To make a backup, just press the Backup Now button.', 'updraftplus')).' <a href="'.UpdraftPlus::get_current_clean_url().'" 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');
[1302] Fix | Delete
}
[1303] Fix | Delete
[1304] Fix | Delete
public function show_admin_warning_execution_time() {
[1305] Fix | Delete
$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));// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[1306] Fix | Delete
}
[1307] Fix | Delete
[1308] Fix | Delete
public function show_admin_warning_disabledcron() {
[1309] Fix | Delete
$ret = '<div class="updraftmessage updated"><p>';
[1310] Fix | Delete
$ret .= '<strong>'.__('Warning', 'updraftplus').':</strong> '.__('The scheduler is disabled in your WordPress install, via the DISABLE_WP_CRON setting. No backups can run (even &quot;Backup Now&quot;) unless either you have set up a facility to call the scheduler manually, or until it is enabled.', 'updraftplus').' <a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/#disablewpcron/").'" target="_blank">'.__('Go here for more information.', 'updraftplus').'</a>';
[1311] Fix | Delete
$ret .= '</p></div>';
[1312] Fix | Delete
return $ret;
[1313] Fix | Delete
}
[1314] Fix | Delete
[1315] Fix | Delete
public function show_admin_warning_diskspace() {
[1316] Fix | Delete
$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'));
[1317] Fix | Delete
}
[1318] Fix | Delete
[1319] Fix | Delete
public function show_admin_warning_wordpressversion() {
[1320] Fix | Delete
$this->show_admin_warning('<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('UpdraftPlus does not officially support versions of WordPress before %s. It may work for you, but if it does not, then please be aware that no support is available until you upgrade WordPress.', 'updraftplus'), '3.2'));
[1321] Fix | Delete
}
[1322] Fix | Delete
[1323] Fix | Delete
public function show_admin_warning_litespeed() {
[1324] Fix | Delete
$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/").'" target="_blank">'.__('Please consult this FAQ if you have problems backing up.', 'updraftplus').'</a>');
[1325] Fix | Delete
}
[1326] Fix | Delete
[1327] Fix | Delete
public function show_admin_debug_warning() {
[1328] Fix | Delete
$this->show_admin_warning('<strong>'.__('Notice', 'updraftplus').':</strong> '.__('UpdraftPlus\'s debug mode is on. You may see debugging notices on this page not just from UpdraftPlus, but from any other plugin installed. Please try to make sure that the notice you are seeing is from UpdraftPlus before you raise a support request.', 'updraftplus').'</a>');
[1329] Fix | Delete
}
[1330] Fix | Delete
[1331] Fix | Delete
public function show_admin_warning_overdue_crons($howmany) {
[1332] Fix | Delete
$ret = '<div class="updraftmessage updated"><p>';
[1333] Fix | Delete
$ret .= '<strong>'.__('Warning', 'updraftplus').':</strong> '.sprintf(__('WordPress has a number (%d) of scheduled tasks which are overdue. Unless this is a development site, this probably means that the scheduler in your WordPress install is not working.', 'updraftplus'), $howmany).' <a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/scheduler-wordpress-installation-working/").'" target="_blank">'.__('Read this page for a guide to possible causes and how to fix it.', 'updraftplus').'</a>';
[1334] Fix | Delete
$ret .= '</p></div>';
[1335] Fix | Delete
return $ret;
[1336] Fix | Delete
}
[1337] Fix | Delete
[1338] Fix | Delete
/**
[1339] Fix | Delete
* Output authorisation links for any un-authorised Dropbox settings instances
[1340] Fix | Delete
*/
[1341] Fix | Delete
public function show_admin_warning_dropbox() {
[1342] Fix | Delete
$this->get_method_auth_link('dropbox');
[1343] Fix | Delete
}
[1344] Fix | Delete
[1345] Fix | Delete
/**
[1346] Fix | Delete
* Output authorisation links for any un-authorised OneDrive settings instances
[1347] Fix | Delete
*/
[1348] Fix | Delete
public function show_admin_warning_onedrive() {
[1349] Fix | Delete
$this->get_method_auth_link('onedrive');
[1350] Fix | Delete
}
[1351] Fix | Delete
[1352] Fix | Delete
public function show_admin_warning_updraftvault() {
[1353] Fix | Delete
$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');
[1354] Fix | Delete
}
[1355] Fix | Delete
[1356] Fix | Delete
/**
[1357] Fix | Delete
* Output authorisation links for any un-authorised Google Drive settings instances
[1358] Fix | Delete
*/
[1359] Fix | Delete
public function show_admin_warning_googledrive() {
[1360] Fix | Delete
$this->get_method_auth_link('googledrive');
[1361] Fix | Delete
}
[1362] Fix | Delete
[1363] Fix | Delete
/**
[1364] Fix | Delete
* Output authorisation links for any un-authorised Google Cloud settings instances
[1365] Fix | Delete
*/
[1366] Fix | Delete
public function show_admin_warning_googlecloud() {
[1367] Fix | Delete
$this->get_method_auth_link('googlecloud');
[1368] Fix | Delete
}
[1369] Fix | Delete
[1370] Fix | Delete
/**
[1371] Fix | Delete
* Show DreamObjects cluster migration warning
[1372] Fix | Delete
*/
[1373] Fix | Delete
public function show_admin_warning_dreamobjects() {
[1374] Fix | Delete
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> '.sprintf(__('The %s endpoint is scheduled to shut down on the 1st October 2018. You will need to switch to a different end-point and migrate your data before that date. %sPlease see this article for more information%s'), 'objects-us-west-1.dream.io', '<a href="https://help.dreamhost.com/hc/en-us/articles/360002135871-Cluster-migration-procedure" target="_blank">', '</a>'), 'updated');
[1375] Fix | Delete
}
[1376] Fix | Delete
[1377] Fix | Delete
/**
[1378] Fix | Delete
* Show notice if the account connection attempted to register with UDC Cloud but could not due to lack of licences
[1379] Fix | Delete
*/
[1380] Fix | Delete
public function show_admin_warning_udc_couldnt_connect() {
[1381] Fix | Delete
$this->show_admin_warning('<strong>'.__('Notice', 'updraftplus').':</strong> '.sprintf(__('Connection to your %1$s account was successful. However, we were not able to register this site with %2$s, as there are no available %2$s licences on the account.', 'updraftplus'), 'UpdraftPlus.com', 'UpdraftCentral Cloud'), 'updated');
[1382] Fix | Delete
}
[1383] Fix | Delete
[1384] Fix | Delete
/**
[1385] Fix | Delete
* Output warning of Microsoft Azure Germany shutdown
[1386] Fix | Delete
*/
[1387] Fix | Delete
public function show_admin_warning_azure_germany() {
[1388] Fix | Delete
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice', 'updraftplus').':</strong> '.sprintf(__('Due to the shutdown of the %1$s endpoint, support for %1$s will be ending soon. You will need to migrate to the Global endpoint in your UpdraftPlus settings. For more information, please see: %2$s', 'updraftplus'), 'Azure Germany', '<a href="https://www.microsoft.com/en-us/cloud-platform/germany-cloud-regions" target="_blank">https://www.microsoft.com/en-us/cloud-platform/germany-cloud-regions</a>'), 'updated');
[1389] Fix | Delete
}
[1390] Fix | Delete
[1391] Fix | Delete
/**
[1392] Fix | Delete
* Output warning of Microsoft OneDrive Germany shutdown
[1393] Fix | Delete
*/
[1394] Fix | Delete
public function show_admin_warning_onedrive_germany() {
[1395] Fix | Delete
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice', 'updraftplus').':</strong> '.sprintf(__('Due to the shutdown of the %1$s endpoint, support for %1$s will be ending soon. You will need to migrate to the Global endpoint in your UpdraftPlus settings. For more information, please see: %2$s', 'updraftplus'), 'OneDrive Germany', '<a href="https://www.microsoft.com/en-us/cloud-platform/germany-cloud-regions" target="_blank">https://www.microsoft.com/en-us/cloud-platform/germany-cloud-regions</a>'), 'updated');
[1396] Fix | Delete
}
[1397] Fix | Delete
[1398] Fix | Delete
/**
[1399] Fix | Delete
* This method will setup the storage object and get the authentication link ready to be output with the notice
[1400] Fix | Delete
*
[1401] Fix | Delete
* @param String $method - the remote storage method
[1402] Fix | Delete
*/
[1403] Fix | Delete
public function get_method_auth_link($method) {
[1404] Fix | Delete
$storage_objects_and_ids = UpdraftPlus_Storage_Methods_Interface::get_storage_objects_and_ids(array($method));
[1405] Fix | Delete
[1406] Fix | Delete
$object = $storage_objects_and_ids[$method]['object'];
[1407] Fix | Delete
[1408] Fix | Delete
foreach ($this->auth_instance_ids[$method] as $instance_id) {
[1409] Fix | Delete
[1410] Fix | Delete
$object->set_instance_id($instance_id);
[1411] Fix | Delete
[1412] Fix | Delete
$this->show_admin_warning('<strong>'.__('UpdraftPlus notice:', 'updraftplus').'</strong> '.$object->get_authentication_link(false, false), 'updated updraft_authenticate_'.$method);
[1413] Fix | Delete
}
[1414] Fix | Delete
}
[1415] Fix | Delete
[1416] Fix | Delete
/**
[1417] Fix | Delete
* Start a download of a backup. This method is called via the AJAX action updraft_download_backup. May die instead of returning depending upon the mode in which it is called.
[1418] Fix | Delete
*/
[1419] Fix | Delete
public function updraft_download_backup() {
[1420] Fix | Delete
try {
[1421] Fix | Delete
if (empty($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'updraftplus_download')) die;
[1422] Fix | Delete
[1423] Fix | Delete
if (empty($_REQUEST['timestamp']) || !is_numeric($_REQUEST['timestamp']) || empty($_REQUEST['type'])) exit;
[1424] Fix | Delete
[1425] Fix | Delete
$findexes = empty($_REQUEST['findex']) ? array(0) : $_REQUEST['findex'];
[1426] Fix | Delete
$stage = empty($_REQUEST['stage']) ? '' : $_REQUEST['stage'];
[1427] Fix | Delete
$file_path = empty($_REQUEST['filepath']) ? '' : $_REQUEST['filepath'];
[1428] Fix | Delete
[1429] Fix | Delete
// This call may not actually return, depending upon what mode it is called in
[1430] Fix | Delete
$result = $this->do_updraft_download_backup($findexes, $_REQUEST['type'], $_REQUEST['timestamp'], $stage, false, $file_path);
[1431] Fix | Delete
[1432] Fix | Delete
// In theory, if a response was already sent, then Connection: close has been issued, and a Content-Length. However, in https://updraftplus.com/forums/topic/pclzip_err_bad_format-10-invalid-archive-structure/ a browser ignores both of these, and then picks up the second output and complains.
[1433] Fix | Delete
if (empty($result['already_closed'])) echo json_encode($result);
[1434] Fix | Delete
} catch (Exception $e) {
[1435] Fix | Delete
$log_message = 'PHP Fatal Exception error ('.get_class($e).') has occurred during download backup. Error Message: '.$e->getMessage().' (Code: '.$e->getCode().', line '.$e->getLine().' in '.$e->getFile().')';
[1436] Fix | Delete
error_log($log_message);
[1437] Fix | Delete
echo json_encode(array(
[1438] Fix | Delete
'fatal_error' => true,
[1439] Fix | Delete
'fatal_error_message' => $log_message
[1440] Fix | Delete
));
[1441] Fix | Delete
// @codingStandardsIgnoreLine
[1442] Fix | Delete
} catch (Error $e) {
[1443] Fix | Delete
$log_message = 'PHP Fatal error ('.get_class($e).') has occurred during download backup. Error Message: '.$e->getMessage().' (Code: '.$e->getCode().', line '.$e->getLine().' in '.$e->getFile().')';
[1444] Fix | Delete
error_log($log_message);
[1445] Fix | Delete
echo json_encode(array(
[1446] Fix | Delete
'fatal_error' => true,
[1447] Fix | Delete
'fatal_error_message' => $log_message
[1448] Fix | Delete
));
[1449] Fix | Delete
}
[1450] Fix | Delete
die();
[1451] Fix | Delete
}
[1452] Fix | Delete
[1453] Fix | Delete
/**
[1454] Fix | Delete
* Ensure that a specified backup is present, downloading if necessary (or delete it, if the parameters so indicate). N.B. This function may die(), depending on the request being made in $stage
[1455] Fix | Delete
*
[1456] Fix | Delete
* @param Array $findexes - the index number of the backup archive requested
[1457] Fix | Delete
* @param String $type - the entity type (e.g. 'plugins') being requested
[1458] Fix | Delete
* @param Integer $timestamp - identifier for the backup being requested (UNIX epoch time)
[1459] Fix | Delete
* @param Mixed $stage - the stage; valid values include (have not audited for other possibilities) at least 'delete' and 2.
[1460] Fix | Delete
* @param Callable|Boolean $close_connection_callable - function used to close the connection to the caller; an array of data to return is passed. If false, then UpdraftPlus::close_browser_connection is called with a JSON version of the data.
[1461] Fix | Delete
* @param String $file_path - an over-ride for where to download the file to (basename only)
[1462] Fix | Delete
*
[1463] Fix | Delete
* @return Array - sumary of the results. May also just die.
[1464] Fix | Delete
*/
[1465] Fix | Delete
public function do_updraft_download_backup($findexes, $type, $timestamp, $stage, $close_connection_callable = false, $file_path = '') {
[1466] Fix | Delete
[1467] Fix | Delete
if (function_exists('set_time_limit')) @set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[1468] Fix | Delete
[1469] Fix | Delete
global $updraftplus;
[1470] Fix | Delete
[1471] Fix | Delete
if (!is_array($findexes)) $findexes = array($findexes);
[1472] Fix | Delete
[1473] Fix | Delete
$connection_closed = false;
[1474] Fix | Delete
[1475] Fix | Delete
// Check that it is a known entity type; if not, die
[1476] Fix | Delete
if ('db' != substr($type, 0, 2)) {
[1477] Fix | Delete
$backupable_entities = $updraftplus->get_backupable_file_entities(true);
[1478] Fix | Delete
foreach ($backupable_entities as $t => $info) {
[1479] Fix | Delete
if ($type == $t) $type_match = true;
[1480] Fix | Delete
}
[1481] Fix | Delete
if (empty($type_match)) return array('result' => 'error', 'code' => 'no_such_type');
[1482] Fix | Delete
}
[1483] Fix | Delete
[1484] Fix | Delete
$debug_mode = UpdraftPlus_Options::get_updraft_option('updraft_debug_mode');
[1485] Fix | Delete
[1486] Fix | Delete
// Retrieve the information from our backup history
[1487] Fix | Delete
$backup_history = UpdraftPlus_Backup_History::get_history();
[1488] Fix | Delete
[1489] Fix | Delete
foreach ($findexes as $findex) {
[1490] Fix | Delete
// This is a bit ugly; these variables get placed back into $_POST (where they may possibly have come from), so that UpdraftPlus::log() can detect exactly where to log the download status.
[1491] Fix | Delete
$_POST['findex'] = $findex;
[1492] Fix | Delete
$_POST['type'] = $type;
[1493] Fix | Delete
$_POST['timestamp'] = $timestamp;
[1494] Fix | Delete
[1495] Fix | Delete
// We already know that no possible entities have an MD5 clash (even after 2 characters)
[1496] Fix | Delete
// Also, there's nothing enforcing a requirement that nonces are hexadecimal
[1497] Fix | Delete
$job_nonce = dechex($timestamp).$findex.substr(md5($type), 0, 3);
[1498] Fix | Delete
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function