'+updraftlion.rescanningremote+'
'); } else { updraft_history_lastchecksum = false; jQuery('#updraft-navtab-backups-content .updraft_existing_backups').html(''+updraftlion.rescanning+'
'); } } var what_op = remotescan ? 'remotescan' : (rescanner ? 'rescan' : false); var data = { operation: what_op, debug: debug, backup_count: backup_count, } updraft_send_command('rescan', data, function(resp) { if (resp.hasOwnProperty('logs_exist') && resp.logs_exist) { // Afficher le lien « journal le plus récemment modifié », au cas où il aurait été précédemment masqué (s'il n'y avait pas de journaux jusqu'à présent) jQuery('#updraft_lastlogmessagerow .updraft-log-link').show(); } if (resp.hasOwnProperty('migrate_tab') && resp.migrate_tab) { if (!jQuery('#updraft-navtab-migrate').hasClass('nav-tab-active')) { jQuery('#updraft_migrate_tab_alt').html(''); jQuery('#updraft_migrate').replaceWith(jQuery(resp.migrate_tab).find('#updraft_migrate')); setup_migrate_tabs(); } } if (resp.hasOwnProperty('espace_disque_du_serveur_web')) { if ('' == resp.espace_disque_du_serveur_web) { console.log("UpdraftPlus : l'espace_disque_du_serveur_web est vide"); if (jQuery('#updraft-navtab-backups-content .updraft-server-disk-space').length) { jQuery('#updraft-navtab-backups-content .updraft-server-disk-space').slideUp('slow', function() { jQuery(this).remove(); }); } } else { if (jQuery('#updraft-navtab-backups-content .updraft-server-disk-space').length) { jQuery('#updraft-navtab-backups-content .updraft-server-disk-space').replaceWith(resp.web_server_disk_space); } else { jQuery('#updraft-navtab-backups-content .updraft-disk-space-actions').prepend(resp.web_server_disk_space); } } } update_backupnow_modal(resp); if (resp.hasOwnProperty('backupnow_file_entities')) { impossible_increment_entities = resp.backupnow_file_entities; } if (resp.n != null) { jQuery('#updraft-existing-backups-heading').html(resp.n); } if (resp.t != null) { if (resp.cksum != null) { if (resp.cksum == updraft_history_lastchecksum) { // Évitez d'actualiser inutilement le HTML si les données sont les mêmes. Cela permet d'éviter de réinitialiser le DOM (gênant lors du débogage) et de conserver les sélections de lignes de l'utilisateur. return; } updraft_history_lastchecksum = resp.cksum; } jQuery('#updraft-navtab-backups-content .updraft_existing_backups').html(resp.t); updraft_backups_selection.checkSelectionStatus(); if (resp.data) { console.log(resp.data); } } }); } /** * Cette fonction vérifiera si la réponse transmise contient du contenu pour la modale de sauvegarde maintenant qui doit être mise à jour sur la page * * @param {array} response - un tableau qui peut contenir du contenu backupnow_modal qui doit être mis à jour */ function update_backupnow_modal(response) { if (response.hasOwnProperty('modal_afterfileoptions')) { jQuery('.backupnow_modal_afterfileoptions').html(response.modal_afterfileoptions); } } /** * Exclure la mise à jour du champ de saisie masqué des entités * * @param {string} include_entity_name - nom de l'entité de sauvegarde */ function updraft_exclude_entity_update(include_entity_name) { var exclude_entities = []; jQuery('#updraft_include_'+include_entity_name+'_exclude_container .updraft_exclude_entity_wrapper .updraft_exclude_entity_field').each(function() { var data_val = jQuery(this).data('val').toString().trim(); if ('' != data_val) { exclude_entities.push(data_val); } }); jQuery('#updraft_include_'+include_entity_name+'_exclude').val(exclude_entities.join(',')); } /** * Vérifier l'unicité de la règle d'exclusion dans include_backup_file * * @param {string} exclude_rule - règle d'exclusion * @param {string} include_backup_file - le type de fichier de sauvegarde sur lequel exclude_rule sera appliqué * * @return {booléen} vrai si exclude_rule est unique sinon faux */ function updraft_is_unique_exclude_rule(exclude_rule, include_backup_file) { existing_exclude_rules_str = jQuery('#updraft_include_'+include_backup_file+'_exclude').val(); existing_exclude_rules = existing_exclude_rules_str.split(','); if (jQuery.inArray(exclude_rule, existing_exclude_rules) > -1) { alert(updraftlion.duplicate_exclude_rule_error_msg) return false; } else { return true; } } var updraft_interval_week_val = false; var updraft_interval_month_val = false; function updraft_intervals_monthly_or_not(selector_id, now_showing) { var selector = '#updraft-navtab-settings-content #'+selector_id; var current_length = jQuery(selector+' option').length; var is_monthly = ('mensuel' == now_showing) ? true : false; var existing_is_monthly = false; if (current_length > 10) { existing_is_monthly = true; } if (!is_monthly && !existing_is_monthly) { return; } if (is_monthly && existing_is_monthly) { if ('monthly' == now_showing) { // existing_is_monthly ne signifie pas la même chose que now_showing=='monthly'. existing_is_monthly fait référence à la liste déroulante, et non à son affichage. Nous devrons peut-être rajouter ces mots. '+updraftlion.jour+' ').après(' '+updraftlion.danslemois+' '); } return; } jQuery('.updraft_monthly_extra_words_'+selector_id).remove(); if (is_monthly) { // Enregistrer l'ancienne valeur updraft_interval_week_val = jQuery(selector+' option:selected').val(); jQuery(selector).html(updraftlion.mdayselector).before(''+updraftlion.jour+' ').après(' '+updraftlion.danslemois+' '); var select_mday = (updraft_interval_month_val === false) ? 1 : updraft_interval_month_val; // Convertir du jour du mois (ordinal) en index d'option (commence à 0) select_mday = select_mday - 1; jQuery(selector+" option").eq(select_mday).prop('selected', true); } else { // Enregistrer l'ancienne valeur updraft_interval_month_val = jQuery(selector+' option:selected').val(); jQuery(selector).html(updraftlion.dayselector); var select_day = (updraft_interval_week_val === false) ? 1 : updraft_interval_week_val; jQuery(selector+" option").eq(select_day).prop('selected', true); } } function updraft_check_same_times() { var dbmanual = 0; var file_interval = jQuery('#updraft-navtab-settings-content .updraft_interval').val(); if (file_interval == 'manual') { // jQuery('#updraft_files_timings').css('opacity', '0.25'); jQuery('#updraft-navtab-settings-content .updraft_files_timings').hide(); } else { // jQuery('#updraft_files_timings').css('opacity', 1); jQuery('#updraft-navtab-settings-content .updraft_files_timings').show(); } if ('weekly' == file_interval || 'fortnightly' == file_interval || 'monthly' == file_interval) { updraft_intervals_monthly_or_not('updraft_startday_files', file_interval); jQuery('#updraft-navtab-settings-content #updraft_startday_files').show(); } else { jQuery('.updraft_monthly_extra_words_updraft_startday_files').remove(); jQuery('#updraft-navtab-settings-content #updraft_startday_files').hide(); } var db_interval = jQuery('#updraft-navtab-settings-content .updraft_interval_database').val(); if (db_interval == 'manual') { dbmanual = 1; // jQuery('#updraft_db_timings').css('opacity', '0.25'); jQuery('#updraft-navtab-settings-content .updraft_db_timings').hide(); } if ('weekly' == db_interval || 'fortnightly' == db_interval || 'monthly' == db_interval) { updraft_intervals_monthly_or_not('updraft_startday_db', db_interval); jQuery('#updraft-navtab-settings-content #updraft_startday_db').show(); } else { jQuery('.updraft_monthly_extra_words_updraft_startday_db').remove(); jQuery('#updraft-navtab-settings-content #updraft_startday_db').hide(); } if (db_interval == file_interval) { // jQuery('#updraft_db_timings').css('opacity','0.25'); jQuery('#updraft-navtab-settings-content .updraft_db_timings').hide(); // jQuery('#updraft_same_schedules_message').show(); if (0 == dbmanual) { jQuery('#updraft-navtab-settings-content .updraft_same_schedules_message').show(); } else { jQuery('#updraft-navtab-settings-content .updraft_same_schedules_message').hide(); } } else { jQuery('#updraft-navtab-settings-content .updraft_same_schedules_message').hide(); if (0 == dbmanual) { // jQuery('#updraft_db_timings').css('opacity', '1'); jQuery('#updraft-navtab-settings-content .updraft_db_timings').show(); } } } // Visit the site in the background every 3.5 minutes - ensures that backups can progress if you've got the UD settings page open if ('undefined' !== typeof updraft_siteurl) { setInterval(function() { jQuery.get(updraft_siteurl+'/wp-cron.php');}, 210000); } function updraft_activejobs_delete(jobid) { updraft_aborted_jobs[jobid] = 1; jQuery('#updraft-jobid-'+jobid).closest('.updraft_row').addClass('deleting'); updraft_send_command('activejobs_delete', jobid, function(resp) { var job_row = jQuery('#updraft-jobid-'+jobid).closest('.updraft_row'); job_row.addClass('deleting'); if (resp.ok == 'Y') { jQuery('#updraft-jobid-'+jobid).html(resp.m); job_row.remove(); // inpage backup - Close modal if canceling backup if (jQuery('#updraft-backupnow-inpage-modal').dialog('isOpen')) jQuery('#updraft-backupnow-inpage-modal').dialog('close'); updraft_show_success_modal({ message: updraft_active_job_is_clone(jobid) ? '+updraftlion.calcul+''); updraft_send_command('get_fragment', { fragment: 'disk_usage', data: key }, function(response) { jQuery('#updraft_diskspaceused_'+key).html(response.output); }, { type: 'GET' }); } /** * Vérifie si le travail spécifié est un clone * * @param {string} job_id L'ID du travail * * @return {int} */ function updraft_active_job_is_clone(job_id) { return updraft_clone_jobs.filter(function(val) { return val == job_id; }).length; } /** * Ouvrir une fenêtre modale avec le contenu récupéré à partir d'une iframe * * @param {String} getwhat - le paramètre de sous-action à transmettre au gestionnaire AJAX d'UD * @param {String} title - le titre de la fenêtre modale */ function updraft_iframe_modal(getwhat, title) { var width = 780; var height = 500; jQuery('#updraft-iframe-modal-innards').html(''); jQuery('#updraft-iframe-modal').dialog({ titre: titre, resizeOnWindowResize: true, scrollWithViewport: true, resizeAccordingToViewport: true, useContentSize: false, ouvert: fonction(événement, interface utilisateur) { jQuery(this).dialog('option', 'largeur', largeur), jQuery(this).dialog('option', 'minHeight', 260); si (jQuery(fenêtre).height() > hauteur) { jQuery(this).dialog('option', 'hauteur', hauteur); } else { jQuery(this).dialog('option', 'hauteur', jQuery(fenêtre).height()-30); } } }).dialog('ouvrir'); } fonction updraft_html_modal(showwhat, titre, largeur, hauteur) { jQuery('#updraft-iframe-modal-innards').html(showwhat); var updraft_html_modal_buttons = {}; si (largeur < 450) { updraft_html_modal_buttons[updraftlion.close] = function() { jQuery(this).dialog("close"); }; } jQuery('#updraft-iframe-modal').dialog({ titre : titre, boutons : updraft_html_modal_buttons, resizeOnWindowResize : true, scrollWithViewport : true, resizeAccordingToViewport : true, useContentSize : false, open : function(événement, interface utilisateur) { jQuery(this).dialog('option', 'largeur', largeur), jQuery(this).dialog('option', 'minHeight', 260); if (jQuery(window).height() > height) { jQuery(this).dialog('option', 'height', height); } else { jQuery(this).dialog('option', 'height', jQuery(window).height()-30); } } }).dialog('open'); } fonction updraftplus_diskspace() { jQuery('#updraft-navtab-backups-content .updraft_diskspaceused').html(''+updraftlion.calcul+'updraft_send_command('get_fragment', { fragment: 'disk_usage', data: 'updraft' }, function(response) { jQuery('#updraft-navtab-backups-content .updraft_diskspaceused').html(response.output); }, { type: 'GET' }); } var lastlog_lastmessage = ""; function updraftplus_deletefromserver(timestamp, type, findex) { if (!findex) findex=0; var pdata = { stage: 'delete', timestamp: timestamp, type: type, findex: findex }; updraftplus_show_contents(timestamp, type, findex) { var modal_content = '' + updraftlion.zip_fichier_contenu_info + ' -
'+updraftlion.browse_download_link+''+resp.message_d'erreur_fatale+'
'); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: erreur: "+status+" ("+error_code+")"; jQuery('#updraft_zip_files_jstree').html(''+message_d'erreur+'
'); console.log(error_message); alert(error_message); console.log(response); } } }); }, "error": function(error) { alert(error); console.log(error); }, }, "search": { "show_only_matches": true }, "plugins": ["search", "sort"], }); // Update modal title once tree loads jQuery('#updraft_zip_files_jstree').on('ready.jstree', function(e, data) { jQuery('#updraft-iframe-modal').dialog('option', 'title', updraftlion.zip_file_contents + ': ' + data.instance.get_node('#').children[0]) }); // Search function for jstree, this will hide nodes that don't match the search var timeout = false; jQuery('#zip_files_jstree_search').on('keyup', function () { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(function () { var value = jQuery('#zip_files_jstree_search').val(); jQuery('#updraft_zip_files_jstree').jstree(true).search(value); }, 250); }); // Detect change on the tree and update the input that has been marked as editing jQuery('#updraft_zip_files_jstree').on("changed.jstree", function (e, data) { jQuery('#updraft_zip_path_text').text(data.node.li_attr.path); if (data.node.li_attr.size) { jQuery('#updraft_zip_size_text').text(data.node.li_attr.size); jQuery('#updraft_zip_download_item').show(); } else { jQuery('#updraft_zip_size_text').text(''); jQuery('#updraft_zip_download_item').hide(); } }); jQuery('#updraft_zip_download_item').on('click', function(event) { event.preventDefault(); var path = jQuery('#updraft_zip_path_text').text(); updraft_send_command('get_zipfile_download', {path:path, timestamp:timestamp, type:type, findex:findex}, function(response) { if (response.hasOwnProperty('error')) { alert(response.error); } else if (response.hasOwnProperty('path')) { location.href =ajaxurl+'?_wpnonce='+updraft_download_nonce+'×tamp='+timestamp+'&type='+type+'&stage=2&findex='+findex+'&filepath='+response.path+'&action=updraft_download_backup'; } else { alert(updraftlion.download_timeout); } }, { error_callback: function(response, status, error_code, resp) { if (typeof resp !== 'undefined' && resp.hasOwnProperty('fatal_error')) { console.error(resp.fatal_error_message); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: error: "+status+" ("+error_code+")"; console.log(error_message); alert(error_message); console.log(response); } } }); }); } /** * This function will clean up the updraft downloader UI * * @param {object} item - the object pressed in the UI * @param {string} what - the file entity */ function remove_updraft_downloader(item, what) { jQuery(item).closest('.updraftplus_downloader').fadeOut().remove(); if (0 == jQuery('.updraftplus_downloader_container_'+what+' .updraftplus_downloader').length) jQuery('.updraftplus_downloader_container_'+what).remove(); } /** * This function will prepare the downloader UI and kick of the request to download the file entities. * * @param {string} base - la chaîne de base pour l'ID * @param {integer} backup_timestamp - l'horodatage de sauvegarde * @param {string} what - l'entité du fichier * @param {string} whicharea - la zone à laquelle nous voulons ajouter le téléchargeur * @param {string} set_contents - le contenu que nous voulons télécharger * @param {string} prettydate - la jolie date de sauvegarde * @param {boolean} async - booléen pour indiquer s'il s'agit d'une requête asynchrone ou non */ function updraft_downloader(base, backup_timestamp, what, whicharea, set_contents, prettydate, async) { if (typeof set_contents !== "string") set_contents = set_contents.toString(); jQuery('.ud_downloadstatus').show(); var set_contents = set_contents.split(','); var prdate = (prettydate) ? '); jQuery('.updraftplus_downloader_container_' + quoi).append('' + updraftlion.download + ' ' + quoi + ' (' + prdate + '):'); } for (var i = 0; i < set_contents.length; i++) { // Créer un endroit pour que le statut soit trouvé var stid = base+backup_timestamp+'_'+what+'_'+set_contents[i]; var stid_selector = '.'+stid; var show_index = parseInt(set_contents[i]); show_index++; var itext = (0 == set_contents[i]) ? '' : ' ('+show_index+')'; if (!jQuery(stid_selector).length) { jQuery('.updraftplus_downloader_container_'+what).append('' + avertissements de courant ascendant +'
' + resp.w + '' + updraftlion.erreurs + '
' + resp.e + ''+resp.message_d'erreur_fatale+'
'); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: erreur: "+status+" ("+error_code+")"; jQuery('#updraft-restore-modal-stage2a').html(''+message_d'erreur+'
'); console.log(error_message); alert(error_message); console.log(response); } } }); } function updraft_downloader_status(base, nonce, what, findex) { // Court-circuit. Voir les versions précédentes pour l'ancien code. return; } function updraft_downloader_status_update(download_status, response_raw) { var cancel_repeat = 0; jQuery(download_status).each(function (x, dstatus) { si (dstatus.base == '') return; var stid = dstatus.base + dstatus.timestamp + '_' + dstatus.what + '_' + dstatus.findex; var stid_selector = '.' + stid; si (dstatus.e != null) { jQuery(stid_selector + ' .raw').html('' + erreur de courant ascendant + ' ' + dstatus.e); console.log(dstatus); } else if (dstatus.p != null) { jQuery(stid_selector + '_st .dlfileprogress').width(dstatus.p + '%'); // jQuery(stid_selector+'_st .dlsofar').html(Math.round(dstatus.s/1024)); // jQuery(stid_selector+'_st .dlsize').html(Math.round(dstatus.t/1024)); // Un redémarrage est-il approprié ? // dstatus.a, s'il est défini, indique que a) le téléchargement est incomplet et b) la valeur est le nombre de secondes depuis la dernière modification du fichier... if (dstatus.a != null && dstatus.a > 0) { var timenow = (new Date).getTime(); // Rappelez-vous que c'est en millisecondes var sincelastrestart = timenow - lasttimebegan; if (dstatus.a > 90 && sincelastrestart > 60000) { console.log(dstatus.timestamp + " " + dstatus.what + " " + dstatus.findex + ": redémarrage du téléchargement: file_age=" + dstatus.a + ", sincelastrestart_ms=" + sincelastrestart); jQuery(stid_selector).data('lasttimebegan', (new Date).getTime()); var $original_button = jQuery('#updraft-navtab-backups-content .uddownloadform_' + dstatus.what + '_' + dstatus.timestamp + '_' + dstatus.findex); var données = { type : dstatus.quoi, horodatage : dstatus.horodatage, findex : dstatus.findex }; var options = { action : 'updraft_download_backup', nonce_key : '_wpnonce', nonce : $original_button.data('wp_nonce').toString(), délai d'attente : 10000 }; updraft_send_command('updraft_download_backup', données, null, options); jQuery(stid_selector).data('lasttimebegan', (new Date).getTime()); } } si (dstatus.m != null) { si (dstatus.p >= 100 && 'udrestoredlstatus_' == dstatus.base) { jQuery(stid_selector + ' .raw').html(dstatus.m); jQuery(stid_selector).fadeOut('slow', function () { remove_updraft_downloader(this, dstatus.what); updraft_restorer_checkstage2(0); }); } else if (dstatus.p >= 100 && dstatus.base == 'udclonedlstatus_') { jQuery(stid_selector + ' .raw').html(dstatus.m); jQuery(stid_selector).fadeOut('slow', function () { remove_updraft_downloader(this, dstatus.what); }); } else if (dstatus.p < 100 || dstatus.base != 'uddlstatus_') { jQuery(stid_selector + ' .raw').html(dstatus.m); } else { var file_ready_actions = updraftlion.fileready + ' ' + '(taille: ' + convert_numeric_size_to_text(dstatus.s) + '). ' + updraftlion.actions + ':\ \ '; si (dstatus.hasOwnProperty('can_show_contents') && dstatus.can_show_contents) { file_ready_actions += ' '; } jQuery(stid_selector + ' .raw').html(file_ready_actions); jQuery(stid_selector + '_st').remove(); } } // dlstatus_lastlog = response_raw; } else if (dstatus.m != null) { jQuery(stid_selector + ' .raw').html(dstatus.m); } else { jQuery(stid_selector + ' .raw').html(updraftlion.jsonnotunderstood + ' (' + response_raw + ')'); cancel_repeat = 1; } }); return cancel_repeat; } /** * Convertit un nombre d'octets en une valeur d'unité textuelle appropriée * * @param {long} octets * @returns chaîne */ function convert_numeric_size_to_text(octets) { if (1024 > octets) { return octets + " b"; } else if (1024 * 1024 > octets) { return (octets / 1024).toFixed(2) + " Ko"; } else if (1024 * 1024 * 1024 > octets ) { return (octets / (1024 * 1024)).toFixed(2) + " Mo"; } else { return (octets / (1024 * 1024 * 1024)).toFixed(2) + " Go"; } } /** * Fonction qui configure un appel ajax pour démarrer une sauvegarde * * @param {Integer} backupnow_nodb Indique si la base de données doit être sauvegardée : les valeurs valides sont 0, 1 * @param {Integer} backupnow_nofiles Indique si des fichiers doivent être sauvegardés : les valeurs valides sont 0, 1 * @param {Integer} backupnow_nocloud Indique si la sauvegarde doit être téléchargée vers le stockage cloud : les valeurs valides sont 0, 1 * @param {String} onlythesefileentities Une liste csv d'entités de fichier à sauvegarder * @param {String} onlythesetableentities Une liste csv d'entités de table à sauvegarder * @param {Array} extradata toutes les données supplémentaires à ajouter * @param {String} label Une étiquette facultative à ajouter à une sauvegarde * @param {String} only_these_cloud_services Un tableau d'emplacements de stockage distants à sauvegarder */ function updraft_backupnow_go(backupnow_nodb, backupnow_nofiles, backupnow_nocloud, onlythesefileentities, extradata, label, onlythesetableentities, only_these_cloud_services) { var params = { backupnow_nodb: backupnow_nodb, backupnow_nofiles: backupnow_nofiles, backupnow_nocloud: backupnow_nocloud, backupnow_label: label, extradata: extradata }; if ('' != onlythesefileentities) { params.onlythisfileentity = onlythesefileentities; } if ('' != onlythesetableentities) { params.onlythesetableentities = onlythesetableentities; } if ('' != only_these_cloud_services) { params.only_these_cloud_services = only_these_cloud_services; } params.always_keep = (typeof extradata.always_keep !== 'undefined') ? extradata.always_keep : 0 ; supprimer extradata.always_keep ; params.incremental = (typeof extradata.incremental !== 'undefined') ? extradata.incremental : 0 ; supprimer extradata.incremental ; params.db_anon_all = (typeof extradata.db_anon !== 'undefined' && typeof extradata.db_anon.all !== 'undefined') ? extradata.db_anon.all : 0; params.db_anon_non_staff = (typeof extradata.db_anon !== 'undefined' && typeof extradata.db_anon.non_staff !== 'undefined') ? extradata.db_anon.non_staff : 0; params.db_anon_wc_orders = (typeof extradata.db_anon !== 'undefined' && typeof extradata.db_anon.wc_orders !== 'undefined') ?' + ou message_d'erreur_fatal + '
'); } else { var error_message = "updraft_send_command: erreur: " + statut + " (" + code_erreur + ")"; $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status').html('' + message_erreur + '
'); console.log(error_message); console.log(response); } } }); } setTimeout(function () { if (0 != which_to_download.length) { temporary_clone_process_create(options, backup_timestamp, backup_nonce, backup_options); return; } var clone_id = options['form_data']['clone_id']; var secret_token = options['form_data']['secret_token']; updraft_send_command('process_updraftplus_clone_create', options, function (response) { try { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_migrate_createclone').prop('disabled', false); $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_spinner.spinner').removeClass('visible'); if (response.hasOwnProperty('status') && 'error' == response.status) { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status').html(updraftlion.error + ' ' + response.message).show(); return; } if ('success' === response.status) { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2').hide(); $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage3').show(); $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage3').html(response.html); // remove the clone timeout as the clone has now been created if (temporary_clone_timeout) clearTimeout(temporary_clone_timeout); // check if the response includes a secret token, if it does we have claimed a clone from the queue and need to update our current secret token to the one that belongs to the claimed clone if (response.hasOwnProperty('secret_token')) { secret_token = response.secret_token; } if ('wp_only' === backup_nonce) { jQuery('#updraft_clone_progress .updraftplus_spinner.spinner').addClass('visible'); temporary_clone_poll(clone_id, secret_token); } else { jQuery('#updraft_clone_progress .updraftplus_spinner.spinner').addClass('visible'); temporary_clone_boot_backup(clone_id, secret_token, response.url, response.key, backup_nonce, backup_timestamp, backup_options); } } } catch (err) { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_migrate_createclone').prop('disabled', false); console.log("Error when processing the response of process_updraftplus_clone_create (as follows)"); console.log(err); } }); }, 5000); } /** * This function will send an AJAX request to the backend to start a clone backup job * * @param {string} clone_id - the clone id * @param {string} secret_token - the clone secret * @param {string} clone_url - the clone url * @param {string} key - the migration key * @param {string} backup_nonce - the nonce for the backup we want to use or 'current' for a fresh backup * @param {string} backup_timestamp - the timestamp for the backup we want to use or 'current' for a fresh backup * @param {array} backup_options - an array of options for the backup */ function temporary_clone_boot_backup(clone_id, secret_token, clone_url, key, backup_nonce, backup_timestamp, backup_options) { var params = { updraftplus_clone_backup: 1, backupnow_nodb: 0, backupnow_nofiles: 0, backupnow_nocloud: 0, backupnow_label: 'UpdraftClone', extradata: '', onlythisfileentity: 'plugins,themes,uploads,others', clone_id: clone_id, secret_token: secret_token, clone_url: clone_url, key: key, backup_nonce: backup_nonce, backup_timestamp: backup_timestamp, db_anon_all: backup_options['db_anon_all'], db_anon_non_staff: backup_options['db_anon_non_staff'], db_anon_wc_orders: backup_options['db_anon_wc_orders'], clone_region: backup_options['clone_region'] }; updraft_activejobslist_backupnownonce_only = 1; updraft_send_command('backupnow', params, function (response) { jQuery('#updraft_clone_progress .updraftplus_spinner.spinner').removeClass('visible'); jQuery('#updraft_backup_started').html(response.m); if (response.hasOwnProperty('nonce')) { // Can't return it from this context updraft_backupnow_nonce = response.nonce; updraft_clone_jobs.push(updraft_backupnow_nonce); updraft_inpage_success_callback = function () { jQuery('#updraft_clone_activejobsrow').hide(); // If user aborts the job if (updraft_aborted_jobs[updraft_backupnow_nonce]) { jQuery('#updraft_clone_progress').html(updraftlion.clone_backup_aborted); } else { jQuery('#updraft_clone_progress').html(updraftlion.clone_backup_complete); } }; console.log("UpdraftPlus: ID of started job: " + updraft_backupnow_nonce); } updraft_activejobs_update(true); }); } /** * This function will send an AJAX request to the backend to poll for the clones install information * * @param {string} clone_id - the clone id * @param {string} secret_token - the clone secret */ function temporary_clone_poll(clone_id, secret_token) { var options = { clone_id: clone_id, secret_token: secret_token, }; setTimeout(function () { updraft_send_command('process_updraftplus_clone_poll', options, function (response) { if (response.hasOwnProperty('status')) { if ('error' == response.status) { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status').html(updraftlion.error + ' ' + response.message).show(); return; } if ('success' === response.status) { if (response.hasOwnProperty('data') && response.data.hasOwnProperty('wordpress_credentials')) { $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_spinner.spinner').removeClass('visible'); $('#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_clone_progress').append(''+message_d'erreur+'
'); console.log(error_message); console.log(response); } } }); } catch (err) { console.log("UpdraftPlus: error (follows) when looking for items needing downloading"); console.log(err); alert(updraftlion.jsonnotunderstood); } }); }); // Make sure all are downloaded } else if (2 == updraft_restore_stage) { updraft_restorer_checkstage2(1); } else if (3 == updraft_restore_stage) { var continue_restore = 1; jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', true); $('#updraft_restoreoptions_ui input.required').each(function(index) { if (continue_restore == 0) return; var sitename = $(this).val(); if (sitename == '') { alert(updraftlion.pleasefillinrequired); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); continue_restore = 0; } else if ($(this).attr('pattern') != '') { var pattern = $(this).attr('pattern'); var re = new RegExp(pattern, "g"); if (!re.test(sitename)) { alert($(this).data('invalidpattern')); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); continue_restore = 0; } } }); if (1 == dbselected) { anyselected = 0; jQuery('input[name="updraft_restore_tables_options[]"').each(function (x, y) { if (jQuery(y).is(':checked') && !jQuery(y).is(':disabled')) anyselected = 1; }); if (0 == anyselected && !skipped_db_scan) { alert(updraftlion.youdidnotselectany); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); return; } } if (1 == pluginselected) { anyselected = 0; if (!jQuery(".updraftplus_restore_plugins_options_container").length) anyselected = 1; jQuery('input[name="updraft_restore_plugins_options[]"').each(function (x, y) { if (jQuery(y).is(':checked') && !jQuery(y).is(':disabled')) anyselected = 1; }); if (0 == anyselected) { alert(updraftlion.youdidnotselectany); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); return; } } if (1 == themeselected) { anyselected = 0; if (!jQuery(".updraftplus_restore_themes_options_container").length) anyselected = 1; jQuery('input[name="updraft_restore_themes_options[]"').each(function (x, y) { if (jQuery(y).is(':checked') && !jQuery(y).is(':disabled')) anyselected = 1; }); if (0 == anyselected) { alert(updraftlion.youdidnotselectany); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); return; } } if (1 == moreselected) { anyselected = 0; jQuery('input[name="updraft_include_more_index[]"').each(function (x, y) { if (jQuery(y).is(':checked') && !jQuery(y).is(':disabled')) { anyselected = 1; if ('' == jQuery('#updraft_include_more_path_restore' + x).val()) { alert(updraftlion.emptyrestorepath); } } }); if (0 == anyselected) { alert(updraftlion.youdidnotselectany); jQuery('.updraft-restore--next-step, .updraft-restore--cancel').prop('disabled', false); return; } } if (!continue_restore) return; var restore_options = $('#updraft_restoreoptions_ui select, #updraft_restoreoptions_ui input').serialize(); // jQuery serialize does not pick up unchecked checkboxes, but we want to include these so that we have a list of table/plugins/themes the user does not want to restore we prepend these with udp-skip-{entity}- and check this on the backend var entities = ['table', 'plugins', 'themes']; jQuery.each(entities, function(i, entity) { jQuery.each(jQuery('input[name="updraft_restore_' + entity + '_options[]').filter(function(idx) { return jQuery(this).prop('checked') === false }), function(idx, el) { restore_options += '&' + jQuery(el).attr('name') + '=' + 'udp-skip-' + entity + '-' + jQuery(el).val(); }); }) console.log("Restore options: "+restore_options); if (typeof php_max_input_vars !== 'undefined') { var restore_options_length = restore_options.split("&").length; var warning_template_start = '' + avertissements de courant ascendant +'
'+resp.message_d'erreur_fatale+'
'); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: erreur: "+status+" ("+error_code+")"; jQuery('#updraft_zip_files_jstree').html(''+message_d'erreur+'
'); console.log(message_d'erreur); alert(message_d'erreur); console.log(réponse); } } }); }, "erreur": function(erreur) { alert(erreur); console.log(erreur); }, }, "recherche": { "afficher_uniquement_les_correspondances": vrai }, "plugins": ["trier"], }); } else if ('contain-clause' == panel) { jQuery('#updraft_exclude_files_folders_wildcards_jstree').jstree({ "core": { "multiple": false, "data": function (nodeid, callback) { updraft_send_command('get_jstree_directory_nodes', {entity: 'filebrowser', directories_only: 1, node:nodeid, path: jQuery('#updraft_exclude_modal_path').val(), findex: 0, skip_root_node: 0}, function(response) { if (response.hasOwnProperty('error')) { alert(response.error); } else { callback.call(this, response.nodes); } }, { error_callback: function(response, status, error_code, resp) { si (typeof resp !== 'undefined' && resp.hasOwnProperty('fatal_error')) { console.error(resp.fatal_error_message); jQuery('#updraft_zip_files_jstree').html(''+resp.message_d'erreur_fatale+'
'); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: erreur: "+status+" ("+error_code+")"; jQuery('#updraft_zip_files_jstree').html(''+message_d'erreur+'
'); console.log(error_message); alert(error_message); console.log(response); } } }); }, "error": function(error) { alert(error); console.log(error); }, }, "search": { "show_only_matches": true }, "plugins": ["sort"], }); } jQuery('#updraft_exclude_modal_main').slideUp(); jQuery('.updraft-exclude-panel').hide(); jQuery('.updraft-exclude-panel[data-panel='+panel+']').slideDown(); }); jQuery('.updraft-exclude-modal-reset').on('click', function(event) { event.preventDefault(); jQuery('#updraft_exclude_files_folders_jstree').jstree("destroy"); jQuery('#updraft_exclude_files_folders_wildcards_jstree').jstree("destroy"); jQuery('#updraft_exclude_extension_field').val(''); jQuery('#updraft_exclude_prefix_field').val(''); jQuery('.updraft-exclude-panel').slideUp(); jQuery('#updraft_exclude_modal_main').slideDown(); }); jQuery('.updraft-exclude-submit').on('click', function() { var panel = jQuery(this).data('panel'); var exclude_item_val = ''; switch (panel) { case 'file-dir': var exclude_jstree_selected = jQuery("#updraft_exclude_files_folders_jstree").jstree("get_selected"); if (0 == exclude_jstree_selected.length) { alert(updraftlion.exclude_select_file_or_folder_msg); return; } var selected_file_or_folder = exclude_jstree_selected[0]; var prefix_path = jQuery('#updraft_exclude_modal_path').val(); if (selected_file_or_folder.substr(0, prefix_path.length) == prefix_path) { selected_file_or_folder = selected_file_or_folder.substr(prefix_path.length, selected_file_or_folder.length); } if ('/' == selected_file_or_folder.charAt(0)) selected_file_or_folder = selected_file_or_folder.substr(1); if ('/' == selected_file_or_folder.charAt(selected_file_or_folder.length - 1)) selected_file_or_folder = selected_file_or_folder.substr(0, selected_file_or_folder.length - 1); exclude_item_val = selected_file_or_folder; break; case 'extension': var exclude_extension = jQuery('#updraft_exclude_extension_field').val(); if ('' == exclude_extension) { alert(updraftlion.exclude_type_ext_msg); return; } if (!exclude_extension.match(/^[0-9a-zA-Z]+$/)) { alert(updraftlion.exclude_ext_error_msg); return; } exclude_item_val = 'ext:'+exclude_extension; break; case 'begin-with': var prefix = jQuery('#updraft_exclude_prefix_field').val(); if ('' == prefix) { alert(updraftlion.exclude_type_prefix_msg); return; } if (!prefix.match(/^\s*[a-z-_\d,\s]+\s*$/i)) { alert(updraftlion.exclude_prefix_error_msg); return; } exclude_item_val = 'prefix:'+prefix; break; case 'contain-clause': var exclude_jstree_selected = jQuery("#updraft_exclude_files_folders_wildcards_jstree").jstree("get_selected"); if (0 == exclude_jstree_selected.length) { alert(updraftlion.exclude_select_folder_wildcards_msg); return; } var clause_val = jQuery(this).parents('div.updraft-exclude-panel').find('div.clause-input-container input').val(); jQuery(this).parents('div.updraft-exclude-panel').find('div.clause-input-container input').val(''); var clause_type = jQuery(this).parents('div.updraft-exclude-panel').find('div.clause-input-container select').val(); if ('' == clause_val) { alert(updraftlion.exclude_contain_error_msg); return; } jQuery(this).parents('div.updraft-exclude-panel').find('div.clause-input-container select option').eq(0).prop('selected', true); var selected_file_or_folder = exclude_jstree_selected[0]; var prefix_path = jQuery('#updraft_exclude_modal_path').val(); if (selected_file_or_folder.substr(0, prefix_path.length) == prefix_path) { selected_file_or_folder = selected_file_or_folder.substr(prefix_path.length, selected_file_or_folder.length); } if ('/' == selected_file_or_folder.charAt(0)) selected_file_or_folder = selected_file_or_folder.substr(1); if ('/' == selected_file_or_folder.charAt(selected_file_or_folder.length - 1)) selected_file_or_folder = selected_file_or_folder.substr(0, selected_file_or_folder.length - 1); exclude_item_val = selected_file_or_folder; if ('' !== exclude_item_val) exclude_item_val += '/'; clause_val = clause_val.replace(/\*/g, '\\*'); if ('beginning' === clause_type) { exclude_item_val += clause_val + '*'; } else if ('middle' === clause_type) { exclude_item_val += '*' + clause_val + '*'; } else if ('end' === clause_type) { exclude_item_val += '*' + clause_val; } break; default: return; } var include_backup_file = jQuery('#updraft_exclude_modal_for').val(); if (!updraft_is_unique_exclude_rule(exclude_item_val, include_backup_file)) return; var exclude_entity_html = ''; jQuery('.updraft_exclude_entity_container[data-include-backup-file="' + include_backup_file + '"]').append(exclude_entity_html); updraft_exclude_entity_update(include_backup_file); jQuery('#updraft_exclude_modal').dialog('close'); }); // TODO : ceci est suspecté d'être obsolète. Confirmer + supprimer. jQuery('#updraft-navtab-settings-content .updraft-service').on('change', function() { var active_class = jQuery(this).val(); jQuery('#updraft-navtab-settings-content .updraftplusmethod').hide(); jQuery('#updraft-navtab-settings-content .'+active_class).show(); }); jQuery('#updraft-navtab-settings-content a.updraft_show_decryption_widget').on('click', function(e) { e.preventDefault(); jQuery('#updraftplus_db_decrypt').val(jQuery('#updraft_encryptionphrase').val()); jQuery('#updraft-manualdecrypt-modal').slideToggle(); }); jQuery('#updraftplus-phpinfo').on('click', function(e) { e.preventDefault(); updraft_iframe_modal('phpinfo', updraftlion.phpinfo); }); jQuery('#updraftplus-rawbackuphistory').on('click', function(e) { e.preventDefault(); updraft_iframe_modal('rawbackuphistory', updraftlion.raw); }); // + Added addons navtab jQuery('#updraft-navtab-status').on('click', function(e) { e.preventDefault(); updraft_open_main_tab('status'); updraft_page_is_visible = 1; updraft_console_focussed_tab = 'status'; // Refresh the console, as its next update might be far away updraft_activejobs_update(true); }); jQuery('#updraft-navtab-expert').on('click', function(e) { e.preventDefault(); updraft_open_main_tab('expert'); updraft_page_is_visible = 1; }); jQuery('#updraft-navtab-settings, #updraft-navtab-settings2, #updraft_backupnow_gotosettings').on('click', function(e) { e.preventDefault(); // These next two should only do anything if the relevant selector was clicked jQuery(this).parents('.updraftmessage').remove(); jQuery('#updraft-backupnow-modal').dialog('close'); updraft_open_main_tab('settings'); updraft_page_is_visible = 1; }); jQuery('#updraft-navtab-addons').on('click', function(e) { e.preventDefault(); jQuery(this).addClass('b#nav-tab-active'); updraft_open_main_tab('addons'); updraft_page_is_visible = 1; }); jQuery('#updraft-navtab-backups').on('click', function(e) { e.preventDefault(); updraft_console_focussed_tab = 'backups'; updraft_historytimertoggle(1); updraft_open_main_tab('backups'); }); jQuery('#updraft-navtab-migrate').on('click', function(e) { e.preventDefault(); jQuery('#updraft_migrate_tab_alt').html('').hide(); updraft_open_main_tab('migrate'); updraft_page_is_visible = 1; if (!jQuery('#updraft_migrate .updraft_migrate_widget_module_content').is(':visible')) { jQuery('.updraft_migrate_intro').show(); } }); if ('migrate' == updraftlion.tab) jQuery('#updraft-navtab-migrate').trigger('click'); updraft_send_command('ping', null, function(data, response) { if ('success' == response && data != 'pong' && data.indexOf('pong')>=0) { jQuery('#updraft-navtab-backups-content .ud-whitespace-warning').show(); console.log("UpdraftPlus: Extra output warning: response (which should be just (string)'pong') follows."); console.log(data); } }, { json_parse: false, type: 'GET' }); // Section: Plupload try { if (typeof updraft_plupload_config !== 'undefined') { plupload_init(); } } catch (err) { console.log(err); } function plupload_init() { // create the uploader and pass the config from above var uploader = new plupload.Uploader(updraft_plupload_config); // checks if browser supports drag and drop upload, makes some css adjustments if necessary uploader.bind('Init', function(up) { var uploaddiv = jQuery('#plupload-upload-ui'); if (up.features.dragdrop) { uploaddiv.addClass('drag-drop'); jQuery('#drag-drop-area') .on('dragover.wp-uploader', function() { uploaddiv.addClass('drag-over'); }) .on('dragleave.wp-uploader, drop.wp-uploader', function() { uploaddiv.removeClass('drag-over'); }); } else { uploaddiv.removeClass('drag-drop'); jQuery('#drag-drop-area').off('.wp-uploader'); } }); uploader.init(); // a file was added in the queue uploader.bind('FilesAdded', function(up, files) { if ($('#updraft-plupload-modal').is(':hidden')) { $('#updraft-plupload-modal').slideToggle(); } // var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10); plupload.each(files, function(file) { // @codingStandardsIgnoreLine if (! /^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-[\-a-z]+([0-9]+?)?(\.(zip|gz|gz\.crypt))?$/i.test(file.name) && !'+resp.r+''); } else { console.log(resp); } }, { type: 'GET' }); } jQuery('#updraft_activejobs_table, #updraft-navtab-migrate-content').on('click', '.updraft_jobinfo_delete', function(e) { e.preventDefault(); var job_id = jQuery(this).data('jobid'); if (job_id) { $(this).addClass('disabled'); updraft_activejobs_delete(job_id); } else { console.log("UpdraftPlus : un lien d'arrêt de tâche a été cliqué, mais l'ID de tâche est introuvable"); } }); jQuery('#updraft_activejobs_table, #updraft-navtab-backups-content .updraft_existing_backups, #updraft-backupnow-inpage-modal, #updraft-navtab-migrate-content').on('click', '.updraft-log-link', function(e) { e.preventDefault(); var file_id = jQuery(this).data('fileid'); var job_id = jQuery(this).data('jobid'); if (file_id) { updraft_popuplog(file_id); } else if (job_id) { updraft_popuplog(job_id); } else { console.log("UpdraftPlus : un lien de journal a été cliqué, mais l'ID de tâche est introuvable "); } }); fonction updraft_restore_setup(entités, clé, afficher_données) { updraft_restore_setoptions(entités); jQuery('#updraft_restore_timestamp').val(clé); jQuery('.updraft_restore_date').html(afficher_données); updraft_restore_stage = 1; // jQuery('#updraft-restore-modal').dialog('ouvrir'); updraft_restore_modal.open(); updraft_activejobs_update(true); } jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', 'button.choose-components-button', function(e) { var entity = jQuery(this).data('entities'); var backup_timestamp = jQuery(this).data('backup_timestamp'); var show_data = jQuery(this).data('showdata'); updraft_restore_setup(entities, backup_timestamp, show_data); }); /** * Obtenir la valeur d'un paramètre d'URL nommé - https://stackoverflow.com/questions/4548487/jquery-read-query-string * * @param {string} name - URL parameter to return the value of * * @returns {string} */ function get_parameter_by_name(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex_s = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp(regex_s); var results = regex.exec(window.location.href); if (results == null) { return ''; } else { return decodeURIComponent(results[1].replace(/\+/g, ' ')); } } if (get_parameter_by_name('udaction') == 'initiate_restore') { var entities = get_parameter_by_name('entities'); var backup_timestamp = get_parameter_by_name('backup_timestamp'); var show_data = get_parameter_by_name('showdata'); updraft_restore_setup(entities, backup_timestamp, show_data); } var updraft_upload_modal_buttons = {}; updraft_upload_modal_buttons[updraftlion.uploadbutton] = function () { var key = jQuery('#updraft_upload_timestamp').val(); var nonce = jQuery('#updraft_upload_nonce').val(); var services = ''; var send_list = false; jQuery('.updraft_remote_storage_destination').each(function (index) { if (jQuery(this).is(':checked')) { send_list = true; } }); if (!send_list) { jQuery('#updraft-upload-modal-error').html(updraftlion.local_upload_error); return; } else { services = jQuery("input[name^='updraft_remote_storage_destination_']").serializeArray(); } jQuery(this).dialog("close"); alert(updraftlion.local_upload_started); updraft_send_command('upload_local_backup', { use_nonce: nonce, use_timestamp: key, services: services }); }; updraft_upload_modal_buttons[updraftlion.cancel] = function () { jQuery(this).dialog("close"); }; jQuery("#updraft-upload-modal").dialog({ autoOpen: false, modal: true, resizeOnWindowResize: true, scrollWithViewport: true, resizeAccordingToViewport: true, useContentSize: false, open: function(event, ui) { $(this).parent().trigger('focus'); $(this).dialog('option', 'width', 308); if (jQuery(window).height() > 460) { $(this).dialog('option', 'height', 318); } else if (jQuery(window).height() > 250 && jQuery(window).height() < 461) { $(this).dialog('option', 'height', 460); } else { $(this).dialog('option', 'height', jQuery(window).height() - 20); } }, buttons: updraft_upload_modal_buttons }); jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', 'button.updraft-upload-link', function (e) { e.preventDefault(); var nonce = jQuery(this).data('nonce').toString(); var key = jQuery(this).data('key').toString(); var services = jQuery(this).data('services').toString(); if (nonce) { updraft_upload(key, nonce, services); } else { console.log("UpdraftPlus: A upload link was clicked, but the Job ID could not be found"); } }); jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', '.updraft-load-more-backups', function (e) { e.preventDefault(); var backup_count = parseInt(jQuery('#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row').length) + parseInt(updraftlion.existing_backups_limit); updraft_updatehistory(0, 0, 0, backup_count); }); jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', '.updraft-load-all-backups', function (e) { e.preventDefault(); updraft_updatehistory(0, 0, 0, 9999999); }); /** * Opens the dialog box for confirmation of where to upload the backup * * @param {string} key - The UNIX timestamp of the backup * @param {string} nonce - The backup job ID * @param {string} services - A list of services that have not been uploaded to yet */ function updraft_upload(key, nonce, services) { jQuery('#updraft_upload_timestamp').val(key); jQuery('#updraft_upload_nonce').val(nonce); var services_array = services.split(","); jQuery('.updraft_remote_storage_destination').each(function (index) { var name = jQuery(this).val(); if (jQuery.inArray(name, services_array) == -1) { jQuery(this).prop('checked', false); jQuery(this).prop('disabled', true); var label = $(this).prop("labels"); jQuery(label).find('span').show(); } }); jQuery('#updraft-upload-modal').dialog('open'); } jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', '.updraft-delete-link', function(e) { e.preventDefault(); var hasremote = jQuery(this).data('hasremote'); var nonce = jQuery(this).data('nonce').toString(); var key = jQuery(this).data('key').toString(); if (nonce) { updraft_delete(key, nonce, hasremote); } else { console.log("UpdraftPlus: A delete link was clicked, but the Job ID could not be found"); } }); jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('click', 'button.updraft_download_button', function(e) { e.preventDefault(); var base = 'uddlstatus_'; var backup_timestamp = jQuery(this).data('backup_timestamp'); var what = jQuery(this).data('what'); var whicharea = '.ud_downloadstatus'; var set_contents = jQuery(this).data('set_contents'); var prettydate = jQuery(this).data('prettydate'); var async = true; updraft_downloader(base, backup_timestamp, what, whicharea, set_contents, prettydate, async); }); jQuery('#updraft-navtab-backups-content .updraft_existing_backups').on('dblclick', '.updraft_existingbackup_date', function (e) { e.preventDefault(); var nonce = jQuery(this).data('nonce').toString(); var timestamp = jQuery(this).data('timestamp').toString(); updraft_send_command('rawbackup_history', { timestamp: timestamp, nonce: nonce }, function (response) { if (response.hasOwnProperty('rawbackup')) { var textArea = document.createElement('textarea'); textArea.innerHTML = response.rawbackup; updraft_html_modal(textArea.value, updraftlion.raw, 780, 500); } else { updraft_html_modal(updraftlion.jsonnotunderstood, updraftlion.raw, 780, 500); } }, { type: 'POST' }); updraft_html_modal('
'+resp.e+'
', updraftlion.disconnect, 400, 250); si (resp.hasOwnProperty('code') && resp.code == 'no_quota') { $(settings_css_prefix+'#updraftvault_settings_connect').slideUp(); $(settings_css_prefix+'#updraftvault_settings_default').slideDown(); } } sinon si (resp.hasOwnProperty('connected') && resp.connected && resp.hasOwnProperty('html')) { $(settings_css_prefix+'#updraftvault_settings_connect').slideUp(); $(settings_css_prefix+'#updraftvault_settings_connected').html(resp.html).slideDown(); } else { console.log(resp); alert(updraftlion.unexpectedresponse+' '+response); } }, { error_callback: function(response, status, error_code, resp) { $(settings_css_prefix+'#updraftvault_connect_go').html(updraftlion.connect); if (typeof resp !== 'undefined' && resp.hasOwnProperty('fatal_error')) { console.error(resp.fatal_error_message); alert(resp.fatal_error_message); } else { var error_message = "updraft_send_command: error: "+status+" ("+error_code+")"; console.log(error_message); alert(error_message); console.log(response); } } }); return false; }); // Marquer une sauvegarde comme toujours conserver (ne pas supprimer) $('#updraft-iframe-modal').on('change', '#always_keep_this_backup', function() { var backup_key = $(this).data('backup_key'); var params = { backup_key: backup_key, always_keep: $(this).is(':checked') ? 1 : 0, }; updraft_send_command('toujours_conserver_cette_sauvegarde', params, function(resp) { if (resp.hasOwnProperty('rawbackup')) { jQuery('#updraft-iframe-modal').dialog('close'); jQuery('.updraft_existing_backups_row_'+backup_key+' .updraft_existingbackup_date').data('rawbackup', resp.rawbackup); updraft_html_modal(jQuery('.updraft_existing_backups_row_'+backup_key+' .updraft_existingbackup_date').data('rawbackup'), updraftlion.raw, 780, 500); } }); }); }); // Fin de la sauvegarde Vault // Suivant : la base de données chiffrée pluploader jQuery(function($) { try { if (typeof updraft_plupload_config2 !== 'undefined') { plupload_init(); } } catch (err) { console.log(err); } function plupload_init() { // crée l'uploader et passe la configuration ci-dessus var uploader = new plupload.Uploader(updraft_plupload_config2); // vérifie si le navigateur prend en charge le téléchargement par glisser-déposer, effectue quelques ajustements CSS si nécessaire uploader.bind('Init', function(up) { var uploaddiv = jQuery('#plupload-upload-ui2'); if (up.features.dragdrop) { uploaddiv.addClass('drag-drop'); jQuery('#drag-drop-area2') .on('dragover.wp-uploader', function() { uploaddiv.addClass('drag-over'); }) .on('dragleave.wp-uploader, drop.wp-uploader', function() { uploaddiv.removeClass('drag-over'); }); } else { uploaddiv.removeClass('drag-drop'); jQuery('#drag-drop-area2').off('.wp-uploader'); } }); uploader.init(); // un fichier a été ajouté dans la file d'attente uploader.bind('FilesAdded', function(up, files) { // var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10); plupload.each(files, function(file) { // @codingStandardsIgnoreLine if (!/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-db([0-9]+)?\.(gz\.crypt)$/i.test(file.name)) { alert(file.name+': '+updraftlion.notdba); uploader.removeFile(file); return; } // un fichier a été ajouté, vous souhaiterez peut-être mettre à jour votre DOM ici...\ \
\ \ '; }); // Ajouter des méthodes distantes html en utilisant handlebarjs if ($('#remote-storage-holder').length) { var html = ''; var not_instance_ids = ['default', 'template_properties']; for (var method in updraftlion.remote_storage_templates) { if ('undefined' != typeof updraftlion.remote_storage_options[method] && not_instance_ids.length < Object.keys(updraftlion.remote_storage_options[method]).length) { var template = Guidon.compile(updraftlion.remote_storage_templates[méthode]); for (var partial_template_name in updraftlion.remote_storage_partial_templates[méthode]) { Guidon.registerPartial(partial_template_name, Guidon.compile(updraftlion.remote_storage_partial_templates[method][partial_template_name])); } var first_instance = true; var instance_count = 1; for (var instance_id in updraftlion.remote_storage_options[method]) { if (not_instance_ids.indexOf(instance_id) > -1) continue; var context = {}; // Initier une référence en affectant un objet vide à une variable (dans ce cas, la variable de contexte) afin qu'il puisse être utilisé comme cible de fusion d'un ou plusieurs autres objets. Contrairement aux valeurs de base (booléen, chaîne, entier, etc.), en Javascript, les objets et les tableaux sont passés par référence // copiez ce qui se trouve dans les propriétés du modèle dans le contexte en écrasant les mêmes propriétés d'objet, puis copiez ce qui se trouve dans les paramètres d'instance dans le contexte en écrasant toutes les mêmes propriétés de l'opération de fusion précédente (le cas échéant).