Changeset 3253259
- Timestamp:
- 03/10/2025 10:47:05 AM (11 months ago)
- Location:
- backwpup
- Files:
-
- 16 edited
- 1 copied
-
tags/5.0.6 (copied) (copied from backwpup/trunk)
-
tags/5.0.6/assets/js/backwpup-admin.js (modified) (1 diff)
-
tags/5.0.6/assets/js/backwpup-admin.min.js (modified) (1 diff)
-
tags/5.0.6/backwpup.php (modified) (1 diff)
-
tags/5.0.6/changelog.txt (modified) (1 diff)
-
tags/5.0.6/inc/class-create-archive.php (modified) (6 diffs)
-
tags/5.0.6/languages/backwpup.pot (modified) (2 diffs)
-
tags/5.0.6/readme.txt (modified) (2 diffs)
-
tags/5.0.6/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/assets/js/backwpup-admin.js (modified) (1 diff)
-
trunk/assets/js/backwpup-admin.min.js (modified) (1 diff)
-
trunk/backwpup.php (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/inc/class-create-archive.php (modified) (6 diffs)
-
trunk/languages/backwpup.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
backwpup/tags/5.0.6/assets/js/backwpup-admin.js
r3249764 r3253259 532 532 event.stopPropagation(); 533 533 const $menu = $(this).find(".js-backwpup-menu-content"); 534 535 $(".js-backwpup-menu-content").not($menu).addClass("hidden"); 534 536 535 537 if ($menu.hasClass("hidden")) { -
backwpup/tags/5.0.6/assets/js/backwpup-admin.min.js
r3249764 r3253259 1 jQuery(document).ready((function($){async function postToWP(e){return await fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams(e)}).then((e=>e.json()))}function requestWPApi(e,a,t,n="GET",i=null){$.ajax({url:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",backwpupApi.nonce)},method:n,data:a,success:function(e){t(e,a)},error:function(e,a){i?i(e,a):console.log(a)}})}function getUrlParameter(e,a=""){let t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):a}$(".js-backwpup-intonly").on("keydown",(function(e){return!!["Backspace","Delete","ArrowLeft","ArrowRight"].includes(e.code)||!isNaN(Number(e.key))&&"Space"!==e.code})),window.refresh_storage_destinations=function(e,a){$("#destination-"+e).prop("checked",a);const t=[""];$('input[name="storage_destinations[]"]').each((function(){$(this).is(":checked")&&t.push($(this).val())})),requestWPApi(backwpupApi.updatejob,{storage_destinations:t},(function(e){requestWPApi(backwpupApi.storagelistcompact,{},(function(e){$("#backwpup-storage-list-compact-container").html(e)}),"GET",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseText)}))}),"POST",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseJSON.error)}));0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length?$(".js-backwpup-onboarding-submit-form").prop("disabled",!1):$(".js-backwpup-onboarding-submit-form").prop("disabled",!0)},window.gdrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"gdrive"},(function(e){$("#gdrive_authenticate_label").html(e)}),"GET")},window.onedrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"onedrive"},(function(e){$("#onedrive_authenticate_label").html(e)}),"GET")},window.dropbox_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"dropbox"},(function(e){$("#drobox_authenticate_infos").html(e)}),"GET")},window.update_license=function(){const e=$("#license_action").val(),a={license_action:e,license_instance_key:$("#license_instance_key").val(),license_submit:!0};let t="activate";"activate"===e&&(t="deactivate",a.license_api_key=$("#license_api_key").val(),a.license_product_id=$("#license_product_id").val()),requestWPApi(backwpupApi.license_update,a,(function(e){console.log(e),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"info",font:"xs",content:e.message}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)})),backwpup_license_refresh(t),200===e.status&&console.log(e)}),"POST",(function(e,a){console.log(e.responseJSON.error),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"alert",font:"xs",content:e.responseJSON.error}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)}))}))},window.backwpup_license_refresh=function(e){let a="sidebar/license-parts/"+e;console.log(a),requestWPApi(backwpupApi.getblock,{block_name:a,block_type:"children"},(function(e){$("#backwpup_license").html(e),$(".js-backwpup-license_update").on("click",update_license)}),"POST")};const $modal=$("#backwpup-modal"),$sidebar=$("#backwpup-sidebar");function openSidebar(e){$sidebar.find("article").hide(),$sidebar.find("#sidebar-"+e).show(),$("body").addClass("overflow-hidden"),$sidebar.removeClass("translate-x-[450px]")}function closeSidebar(){$("body").removeClass("overflow-hidden"),$sidebar.addClass("translate-x-[450px]")}function openModal(e,a={}){$modal.find("article").hide();let t=$modal.find("#sidebar-"+e);t.show(),a.url&&t.find(".js-backwpup-open-url").attr("data-href",a.url),$("body").addClass("overflow-hidden"),$modal.removeClass("hidden").addClass("flex")}function closeModal(){$("body").removeClass("overflow-hidden"),$modal.addClass("hidden").removeClass("flex")}function initSugarSyncEvents(){$(".js-backwpup-authenticate-sugar-sync").on("click",(function(){let e={cloud_name:"sugarsync",sugaremail:$("#sugaremail").val(),sugarpass:$("#sugarpass").val()};requestWPApi(backwpupApi.authenticate_cloud,e,(function(e){$("#sugarsynclogin").html(e),$("#sugarsync_authenticate_infos").html(""),initSugarSyncEvents()}),"POST",(function(e,a){$("#sugarsync_authenticate_infos").html(e.responseText)}))})),$(".js-backwpup-delete-sugar-sync-auth").on("click",(function(){requestWPApi(backwpupApi.delete_auth_cloud,{cloud_name:"sugarsync"},(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),$("#sugarsynclogin").html(e),initSugarSyncEvents()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),requestWPApi(backwpupApi.getblock,{block_name:"sidebar/sugar-sync-parts/root-folder",block_type:"children"},(function(e){$("#sugarsyncroot").html(e)}),"POST",(function(e,a){$("#sugarsyncroot").html(e.responseText)}))}function initDropboxEvents(){$(".js-backwpup-test-dropbox-storage").on("click",(function(){const e={cloud_name:"dropbox",dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};let a=$("#dropbbox_code").val();a&&(e.dropbbox_code=a);let t=$("#sandbox_code").val();t&&!a&&(e.sandbox_code=t),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("DROPBOX",!1),alert(e.responseJSON.error)}))})),$(".js-backwpup-delete-dropbox-auth").on("click",(function(){const e={cloud_name:"dropbox",delete_auth:!0,dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){alert(e.responseJSON.error)}))}))}function initModalEvent(){$(".js-backwpup-open-modal").on("click",(function(){const e=$(this).data("content");let a={};$(this).data("url")&&(a.url=$(this).data("url")),openModal(e,a)}))}$(".js-backwpup-open-sidebar").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-close-sidebar").on("click",closeSidebar),$(".js-backwpup-open-url").on("click",(function(){$(this).data("href")&&(window.location=$(this).data("href"))})),$(".js-backwpup-close-modal").on("click",closeModal),$(".js-backwpup-filter-tables").on("keyup",(function(){const e=$(this).val().toLowerCase();$(".js-backwpup-tables-list label").each((function(){""===e||$(this).find("input").attr("value").toLowerCase().includes(e)?$(this).show():$(this).hide()}))})),$(".js-backwpup-filter-tables").next(".js-backwpup-clear-search").on("click",(function(){$(".js-backwpup-tables-list label").show()}));const $backupsTable=$("#backwpup-backup-history");let isCheckboxListenerInitialized=!1;function showFrequencyFilesFields(e){"weekly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").show(),$(".js-backwpup-frequency-file-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").hide())}function showFrequencyTablesFields(e){"weekly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").show(),$(".js-backwpup-frequency-table-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").hide())}function initMenuEvent(){$(".js-backwpup-menu").on("click",(function(e){e.stopPropagation();const a=$(this).find(".js-backwpup-menu-content"); a.hasClass("hidden")?a.removeClass("hidden"):a.addClass("hidden")})),$("#bulk-actions-apply").prop("disabled",!0),$(".js-backwpup-select-backup").on("click",(function(){const e=$(".js-backwpup-select-backup:checked").length>0;console.log(e),$("#bulk-actions-apply").prop("disabled",!e)}))}function initPaginationEvent(){$(".js-backwpup-table-pagination button").on("click",(function(){let e=$(this).data("page");loadBackupsListingAndPagination(e);let a=new URL(window.location.href);a.searchParams.set("page_num",e),history.pushState({},"",a)}))}function loadBackupsListingAndPagination(e){requestWPApi(backwpupApi.backupslistings,{page:e,length:backwpupApi.backupslistingslength},refreshBackupTable,"POST")}$(".js-backwpup-select-all").on("change",(function(){const e=$(this).prop("checked");$("#bulk-actions-apply").prop("disabled",!e),$backupsTable.find("input[type=checkbox]").prop("checked",e),isCheckboxListenerInitialized||($backupsTable.on("change","input[type=checkbox]",(function(){const e=$backupsTable.find("input[type=checkbox]").length===$backupsTable.find("input[type=checkbox]:checked").length;$(".js-backwpup-select-all").prop("checked",e)})),isCheckboxListenerInitialized=!0)})),showFrequencyFilesFields($(".js-backwpup-frequency-files").val()),showFrequencyTablesFields($(".js-backwpup-frequency-tables").val()),$(".js-backwpup-frequency-files").on("change",(function(){showFrequencyFilesFields($(this).val())})),$(".js-backwpup-frequency-tables").on("change",(function(){showFrequencyTablesFields($(this).val())})),$(document).on("click",(function(){$(".js-backwpup-menu-content").addClass("hidden")})),$(".js-backwpup-toggle-tables").on("click",(function(){postToWP({action:"backwpup_toggle_database",tables:$(this).is(":checked")}).then((e=>{}))})),$(".js-backwpup-clear-search").on("click",(function(){$(this).prev().val("")})),$(".js-backwpup-add-input-button").on("click",(function(){const e=$(this).prev().val().trim();if(""===e)return;$(this).prev().val("");let a=$(".js-backwpup-add-input-values").val().split(",");if(!a.includes(e)){a.push(e),a=[...new Set(a)],$(".js-backwpup-add-input-values").val(a.join(","));if(!$(".js-backwpup-add-input-tags button span").map((function(){return $(this).text()})).get().includes(e)){const a=$(this).parents(".js-backwpup-add-input").find(".js-backwpup-add-input-tag-template button").clone();a.find("span").text(e),a.appendTo(".js-backwpup-add-input-tags")}}})),$(".js-backwpup-add-input-tags").on("click",".js-backwpup-remove-tag",(function(){$(this).remove();let e=$(".js-backwpup-add-input-values").val().split(",");e=e.filter((e=>e!==$(this).data("tag"))),$(".js-backwpup-add-input-values").val(e.join(","))})),$(".js-backwpup-toggle-include button").on("click",(function(){const e=$(this).parents(".js-backwpup-toggle-include"),a=e.find("input[type=checkbox]");a.prop("checked",!a.prop("checked")),a.prop("checked")?(e.find(".js-backwpup-toggle-include-add").addClass("hidden"),e.find(".js-backwpup-toggle-include-remove").removeClass("hidden")):(e.find(".js-backwpup-toggle-include-add").removeClass("hidden"),e.find(".js-backwpup-toggle-include-remove").addClass("hidden"))})),$(".js-backwpup-start-backup").on("click",(function(){requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){window.location.reload()}),500)}),"POST")})),$(".js-backwpup-toggle-exclude").on("change",(function(){const e=$(this).prop("checked");$(this).closest("div").find("button").prop("disabled",!e)})),$(".js-backwpup-toggle-files").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-files-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"files"},(function(e){$("#backwpup-files-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-toggle-database").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-database-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"database"},(function(e){$("#backwpup-database-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-test-s3-storage").on("click",(function(){if(""!=$("#s3bucketerror").html())return refresh_storage_destinations("S3",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"s3",s3region:$("#s3region").val(),s3base_url:$("#s3base_url").val(),s3base_region:$("#s3base_region").val(),s3base_version:$("#s3base_version").val(),s3base_signature:$("#s3base_signature").val(),s3accesskey:$("#s3accesskey").val(),s3secretkey:$("#s3secretkey").val(),s3bucket:$("#s3bucket").val(),s3newbucket:$("#s3newbucket").val(),s3dir:$("#s3dir").val(),s3maxbackups:$("#s3maxbackups").val(),s3storageclass:"STANDARD"===$("#s3storageclass").val()?"":$("#s3storageclass").val()};$("#s3base_multipart").prop("checked")&&(e.s3base_multipart=$("#s3base_multipart").val()),$("#s3base_pathstylebucket").prop("checked")&&(e.s3base_pathstylebucket=$("#s3base_pathstylebucket").val()),$("#s3ssencrypt").prop("checked")&&(e.s3ssencrypt=$("#s3ssencrypt").val()),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("S3",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("S3",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-glacier-storage").on("click",(function(){if(""!=$("#glacierbucketerror").html())return refresh_storage_destinations("GLACIER",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"glacier",glacieraccesskey:$("#glacieraccesskey").val(),glaciersecretkey:$("#glaciersecretkey").val(),glacierregion:$("#glacierregion").val(),glaciervault:$("#glaciervault").val(),glaciermaxbackups:$("#glaciermaxbackups").val(),newvault:$("#newvault").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GLACIER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GLACIER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-folder-storage").on("click",(function(){const e={cloud_name:"folder",backupdir:$("#backupdir").val(),maxbackups:$("#maxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FOLDER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FOLDER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-ftp-storage").on("click",(function(){const e={cloud_name:"ftp",ftphost:$("#ftphost").val(),ftphostport:$("#ftphostport").val(),ftpuser:$("#ftpuser").val(),ftppass:$("#ftppass").val(),ftptimeout:$("#ftptimeout").val(),ftpdir:$("#ftpdir").val(),ftpmaxbackups:$("#ftpmaxbackups").val(),ftpssl:$("#ftpssl").prop("checked"),ftppasv:$("#ftppasv").prop("checked")};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FTP",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FTP",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-gdrive-storage").on("click",(function(){const e={cloud_name:"gdrive",gdriveusetrash:$("#gdriveusetrash").prop("checked"),gdrivemaxbackups:$("#gdrivemaxbackups").val(),gdrivedir:$("#gdrivedir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-delete-hidrive-auth").on("click",(function(){const e={cloud_name:"hidrive",hidrive_delete_authorization:!0,hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){closeSidebar()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),$(".js-backwpup-test-hidrive-storage").on("click",(function(){const e={cloud_name:"hidrive",hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};let a=$("#hidrive_authorization_code").val();a&&(e.hidrive_authorization_code=a),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("HIDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("HIDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-onedrive-storage").on("click",(function(){const e={cloud_name:"onedrive",onedrivedir:$("#onedrivedir").val(),onedrivemaxbackups:$("#onedrivemaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("ONEDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("ONEDRIVE",!0),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-sugar-sync-storage").on("click",(function(){const e={cloud_name:"sugarsync",sugardir:$("#sugardir").val(),sugarmaxbackups:$("#sugarmaxbackups").val(),sugarroot:$("#sugarroot").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("SUGARSYNC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-rackspace-cloud-storage").on("click",(function(){const e={cloud_name:"rsc",newrsccontainer:$("#newrsccontainer").val(),rscdir:$("#rscdir").val(),rscmaxbackups:$("#rscmaxbackups").val(),rsccontainer:$("#rsccontainer").val(),rscusername:$("#rscusername").val(),rscapikey:$("#rscapikey").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("RSC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("RSC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-msazure-storage").click((function(){const e={cloud_name:"msazure",msazureaccname:$("#msazureaccname").val(),msazurekey:$("#msazurekey").val(),msazurecontainer:$("#msazurecontainer").val(),newmsazurecontainer:$("#newmsazurecontainer").val(),msazuredir:$("#msazuredir").val(),msazuremaxbackups:$("#msazuremaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("MSAZURE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("MSAZURE",!1),alert("Error in cloud configuration")}))}));const $onboardingSteps=$("#backwpup-onboarding-steps"),$onboardingPanes=$("#backwpup-onboarding-panes"),lineStyles="before:bg-secondary-base",circleActiveStyles="bg-secondary-base after:absolute after:z-10 after:inset after:w-12 after:h-12 after:border-secondary-base after:border after:rounded-full after:animate-pulse",circleReachedStyles="bg-secondary-base";function init_network_authentication(){const e=$(".js-backwpup-network-authentication-method").val();$("#network-"+e+"-authentication").show()}function verifyOnboardingStep1(){const e=!$(".js-backwpup-onboarding-toggle-files").prop("checked"),a=!$(".js-backwpup-onboarding-toggle-database").prop("checked");e&&a?$(".js-backwpup-onboarding-step-2").prop("disabled",!0):$(".js-backwpup-onboarding-step-2").prop("disabled",!1)}function refreshBackupTable(e,a){if(e.success&&e.data){var t=e.data,n=jQuery.parseHTML(t);jQuery("#backwpup-backup-history tbody").html(n),window.BWU.downloader.init(),initMenuEvent(),initModalEvent();let i=Math.ceil(jQuery('input[name="nb_backups"]').val()/a.length);requestWPApi(backwpupApi.backupspagination,{page:a.page,max_pages:i},refreshPagination,"POST")}}function refreshPagination(e){if(e.success&&e.data){var a=e.data,t=jQuery.parseHTML(a);jQuery("#backwpup-pagination").html(t),initPaginationEvent()}}function isGenerateJsIncluded(){const e=document.querySelectorAll("script");for(let a of e)if(a.src.includes("backwpup-generate.js")||a.src.includes("backwpup-generate.min.js"))return!0;return!1}function startBackupProcess(){isGenerateJsIncluded()?$(".progress-bar").on("hide",(function(){console.log(".progress-bar is being hidden")})):requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){"#dbbackup"!==window.location.hash&&window.location.reload()}),500)}),"POST")}$(".js-backwpup-onboarding-step-1").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=1]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-2").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=2]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=1] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),$onboardingSteps.find("article[data-step=3]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-3").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=3]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=3]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=2] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),closeSidebar()})),$(".js-backwpup-onboarding-submit-form").on("click",(function(){0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length&&$("#backwpup-onboarding-form").submit()})),$(".js-backwpup-toggle-storage").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-gdrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","gdrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-onedrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","onedrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-refresh-authentification").on("click",(function(){let trigger=$(this).data("trigger");"function"==typeof window[trigger]?window[trigger]():eval(trigger),closeModal()})),$(".js-backwpup-modal-and-focus").on("click",(function(){openModal("dialog");const e=$(this).data("id-focus-after");$(".js-backwpup-refresh-authentification").data("trigger",'$("#'+e+'").focus()'),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-gdrive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_googleclientsecret:{value:$("#backwpup_cfg_googleclientsecret").val(),secure:!0},backwpup_cfg_googleclientid:{value:$("#backwpup_cfg_googleclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#gdrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#gdrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-one-drive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_onedriveclientsecret:{value:$("#backwpup_cfg_onedriveclientsecret").val(),secure:!0},backwpup_cfg_onedriveclientid:{value:$("#backwpup_cfg_onedriveclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#onedrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#onedrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-test-storage").on("click",(function(){const e={action:"backwpup_test_storage",storage:$(this).data("storage")};postToWP(e).then((a=>{$(`input[name=storage_${e.storage}]`).prop("checked",!0);$(this).closest("#backwpup-sidebar").length>0||closeSidebar()})),$(`input[name=storage_${e.storage}]`).prop("checked",!0);const a=$(this).closest("#backwpup-sidebar").length>0;"backwpuponboarding"===new URLSearchParams(window.location.search).get("page")?closeSidebar():a?openSidebar("storages"):closeSidebar()})),init_network_authentication(),$(".js-backwpup-network-authentication-method").on("change",(function(){$("#network-authentications").children("div").hide(),init_network_authentication()})),$(".js-backwpup-sidebar-submit-form").on("click",(function(){$(this).siblings("div").children().submit()})),$(".js-backwpup-onboarding-toggle-files").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-files-setings").prop("disabled",!e),$(".onboarding-files-frequency").prop("disabled",!e),$(".onboarding-files-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-toggle-database").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-database-setings").prop("disabled",!e),$(".onboarding-database-frequency").prop("disabled",!e),$(".onboarding-database-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-files-frequency").on("change",(function(){if($("#sidebar-frequency-files")){let e=$("#sidebar-frequency-files").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),$(".js-backwpup-onboarding-database-frequency").on("change",(function(){if($("#sidebar-frequency-tables")){let e=$("#sidebar-frequency-tables").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),jQuery("#backwpup-backup-history tbody").length>0&&loadBackupsListingAndPagination(getUrlParameter("page_num",1)),initModalEvent(),initSugarSyncEvents(),initDropboxEvents(),$(".save_database_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_database_settings,a,(function(e){if(200===e.status){if($("#backwpup-database-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='database_frequency']"),a=$("#sidebar-frequency-tables-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$(".save_files_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_files_settings,a,(function(e){if(200===e.status){if($("#backwpup-files-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='files_frequency']"),a=$("#sidebar-frequency-files-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$("#bulk-actions-apply").on("click",(function(){const e=$(this).data("action"),a=$backupsTable.find("input[type=checkbox]:checked").map((function(){return{dataset:$(this).data("delete")}})).get();requestWPApi(backwpupApi.backups_bulk_actions,{action:e,backups:a},(function(e){loadBackupsListingAndPagination(getUrlParameter("page_num",1))}),"POST"),$(".js-backwpup-select-all").prop("checked",!1)})),$("#bulk-actions-select").on("change",(function(){const e=$(this).val();$("#bulk-actions-apply").data("action",e)})),$("#save-excluded-tables").on("click",(function(){const e=$(".js-backwpup-tables-list input[type='checkbox']"),a=$(this).closest("article"),t=[];e.each((function(){$(this).is(":checked")&&t.push($(this).val())}));const n=a.find("input[type='hidden']"),i=[];n.each((function(){i.push({name:$(this).attr("name"),value:$(this).val()})})),t.forEach((function(e){i.push({name:"tabledb[]",value:e})}));const s=$.param(i);requestWPApi(backwpupApi.save_excluded_tables,s,(function(e){200===e.status&&closeSidebar()}),"POST")})),$(".js-backwpup-license_update").on("click",update_license),$(".file-exclusions-submit").on("click",(function(e){const a=$(this).closest("article").find("input"),t={};function n(e,a){e.endsWith("[]")?(t[e]||(t[e]=[]),a&&t[e].push(a)):t[e]=a}a.each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())})),$('[id^="sidebar-exclude-files-"]').each((function(){$(this).find("input").each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())}))}));const i=$.param(t);requestWPApi(backwpupApi.save_file_exclusions,i,(function(e){200===e.status&&closeSidebar()}),"POST")})),window.location.search.includes("backwpupfirstbackup")&&startBackupProcess();var buyProMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=buypro"]');buyProMenuItem.length&&(buyProMenuItem.attr("href","https://backwpup.com/#buy"),buyProMenuItem.attr("target","_blank"),buyProMenuItem.css({color:"#3ac495","font-weight":"bold"}));var DocsMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=docs"]');DocsMenuItem.length&&(DocsMenuItem.attr("href","https://backwpup.com/docs/"),DocsMenuItem.attr("target","_blank"))})),function(e){var a=e.fn.hide;e.fn.hide=function(){return this.trigger("hide"),a.apply(this,arguments)}}(jQuery);1 jQuery(document).ready((function($){async function postToWP(e){return await fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams(e)}).then((e=>e.json()))}function requestWPApi(e,a,t,n="GET",i=null){$.ajax({url:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",backwpupApi.nonce)},method:n,data:a,success:function(e){t(e,a)},error:function(e,a){i?i(e,a):console.log(a)}})}function getUrlParameter(e,a=""){let t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):a}$(".js-backwpup-intonly").on("keydown",(function(e){return!!["Backspace","Delete","ArrowLeft","ArrowRight"].includes(e.code)||!isNaN(Number(e.key))&&"Space"!==e.code})),window.refresh_storage_destinations=function(e,a){$("#destination-"+e).prop("checked",a);const t=[""];$('input[name="storage_destinations[]"]').each((function(){$(this).is(":checked")&&t.push($(this).val())})),requestWPApi(backwpupApi.updatejob,{storage_destinations:t},(function(e){requestWPApi(backwpupApi.storagelistcompact,{},(function(e){$("#backwpup-storage-list-compact-container").html(e)}),"GET",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseText)}))}),"POST",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseJSON.error)}));0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length?$(".js-backwpup-onboarding-submit-form").prop("disabled",!1):$(".js-backwpup-onboarding-submit-form").prop("disabled",!0)},window.gdrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"gdrive"},(function(e){$("#gdrive_authenticate_label").html(e)}),"GET")},window.onedrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"onedrive"},(function(e){$("#onedrive_authenticate_label").html(e)}),"GET")},window.dropbox_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"dropbox"},(function(e){$("#drobox_authenticate_infos").html(e)}),"GET")},window.update_license=function(){const e=$("#license_action").val(),a={license_action:e,license_instance_key:$("#license_instance_key").val(),license_submit:!0};let t="activate";"activate"===e&&(t="deactivate",a.license_api_key=$("#license_api_key").val(),a.license_product_id=$("#license_product_id").val()),requestWPApi(backwpupApi.license_update,a,(function(e){console.log(e),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"info",font:"xs",content:e.message}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)})),backwpup_license_refresh(t),200===e.status&&console.log(e)}),"POST",(function(e,a){console.log(e.responseJSON.error),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"alert",font:"xs",content:e.responseJSON.error}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)}))}))},window.backwpup_license_refresh=function(e){let a="sidebar/license-parts/"+e;console.log(a),requestWPApi(backwpupApi.getblock,{block_name:a,block_type:"children"},(function(e){$("#backwpup_license").html(e),$(".js-backwpup-license_update").on("click",update_license)}),"POST")};const $modal=$("#backwpup-modal"),$sidebar=$("#backwpup-sidebar");function openSidebar(e){$sidebar.find("article").hide(),$sidebar.find("#sidebar-"+e).show(),$("body").addClass("overflow-hidden"),$sidebar.removeClass("translate-x-[450px]")}function closeSidebar(){$("body").removeClass("overflow-hidden"),$sidebar.addClass("translate-x-[450px]")}function openModal(e,a={}){$modal.find("article").hide();let t=$modal.find("#sidebar-"+e);t.show(),a.url&&t.find(".js-backwpup-open-url").attr("data-href",a.url),$("body").addClass("overflow-hidden"),$modal.removeClass("hidden").addClass("flex")}function closeModal(){$("body").removeClass("overflow-hidden"),$modal.addClass("hidden").removeClass("flex")}function initSugarSyncEvents(){$(".js-backwpup-authenticate-sugar-sync").on("click",(function(){let e={cloud_name:"sugarsync",sugaremail:$("#sugaremail").val(),sugarpass:$("#sugarpass").val()};requestWPApi(backwpupApi.authenticate_cloud,e,(function(e){$("#sugarsynclogin").html(e),$("#sugarsync_authenticate_infos").html(""),initSugarSyncEvents()}),"POST",(function(e,a){$("#sugarsync_authenticate_infos").html(e.responseText)}))})),$(".js-backwpup-delete-sugar-sync-auth").on("click",(function(){requestWPApi(backwpupApi.delete_auth_cloud,{cloud_name:"sugarsync"},(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),$("#sugarsynclogin").html(e),initSugarSyncEvents()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),requestWPApi(backwpupApi.getblock,{block_name:"sidebar/sugar-sync-parts/root-folder",block_type:"children"},(function(e){$("#sugarsyncroot").html(e)}),"POST",(function(e,a){$("#sugarsyncroot").html(e.responseText)}))}function initDropboxEvents(){$(".js-backwpup-test-dropbox-storage").on("click",(function(){const e={cloud_name:"dropbox",dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};let a=$("#dropbbox_code").val();a&&(e.dropbbox_code=a);let t=$("#sandbox_code").val();t&&!a&&(e.sandbox_code=t),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("DROPBOX",!1),alert(e.responseJSON.error)}))})),$(".js-backwpup-delete-dropbox-auth").on("click",(function(){const e={cloud_name:"dropbox",delete_auth:!0,dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){alert(e.responseJSON.error)}))}))}function initModalEvent(){$(".js-backwpup-open-modal").on("click",(function(){const e=$(this).data("content");let a={};$(this).data("url")&&(a.url=$(this).data("url")),openModal(e,a)}))}$(".js-backwpup-open-sidebar").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-close-sidebar").on("click",closeSidebar),$(".js-backwpup-open-url").on("click",(function(){$(this).data("href")&&(window.location=$(this).data("href"))})),$(".js-backwpup-close-modal").on("click",closeModal),$(".js-backwpup-filter-tables").on("keyup",(function(){const e=$(this).val().toLowerCase();$(".js-backwpup-tables-list label").each((function(){""===e||$(this).find("input").attr("value").toLowerCase().includes(e)?$(this).show():$(this).hide()}))})),$(".js-backwpup-filter-tables").next(".js-backwpup-clear-search").on("click",(function(){$(".js-backwpup-tables-list label").show()}));const $backupsTable=$("#backwpup-backup-history");let isCheckboxListenerInitialized=!1;function showFrequencyFilesFields(e){"weekly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").show(),$(".js-backwpup-frequency-file-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").hide())}function showFrequencyTablesFields(e){"weekly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").show(),$(".js-backwpup-frequency-table-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").hide())}function initMenuEvent(){$(".js-backwpup-menu").on("click",(function(e){e.stopPropagation();const a=$(this).find(".js-backwpup-menu-content");$(".js-backwpup-menu-content").not(a).addClass("hidden"),a.hasClass("hidden")?a.removeClass("hidden"):a.addClass("hidden")})),$("#bulk-actions-apply").prop("disabled",!0),$(".js-backwpup-select-backup").on("click",(function(){const e=$(".js-backwpup-select-backup:checked").length>0;console.log(e),$("#bulk-actions-apply").prop("disabled",!e)}))}function initPaginationEvent(){$(".js-backwpup-table-pagination button").on("click",(function(){let e=$(this).data("page");loadBackupsListingAndPagination(e);let a=new URL(window.location.href);a.searchParams.set("page_num",e),history.pushState({},"",a)}))}function loadBackupsListingAndPagination(e){requestWPApi(backwpupApi.backupslistings,{page:e,length:backwpupApi.backupslistingslength},refreshBackupTable,"POST")}$(".js-backwpup-select-all").on("change",(function(){const e=$(this).prop("checked");$("#bulk-actions-apply").prop("disabled",!e),$backupsTable.find("input[type=checkbox]").prop("checked",e),isCheckboxListenerInitialized||($backupsTable.on("change","input[type=checkbox]",(function(){const e=$backupsTable.find("input[type=checkbox]").length===$backupsTable.find("input[type=checkbox]:checked").length;$(".js-backwpup-select-all").prop("checked",e)})),isCheckboxListenerInitialized=!0)})),showFrequencyFilesFields($(".js-backwpup-frequency-files").val()),showFrequencyTablesFields($(".js-backwpup-frequency-tables").val()),$(".js-backwpup-frequency-files").on("change",(function(){showFrequencyFilesFields($(this).val())})),$(".js-backwpup-frequency-tables").on("change",(function(){showFrequencyTablesFields($(this).val())})),$(document).on("click",(function(){$(".js-backwpup-menu-content").addClass("hidden")})),$(".js-backwpup-toggle-tables").on("click",(function(){postToWP({action:"backwpup_toggle_database",tables:$(this).is(":checked")}).then((e=>{}))})),$(".js-backwpup-clear-search").on("click",(function(){$(this).prev().val("")})),$(".js-backwpup-add-input-button").on("click",(function(){const e=$(this).prev().val().trim();if(""===e)return;$(this).prev().val("");let a=$(".js-backwpup-add-input-values").val().split(",");if(!a.includes(e)){a.push(e),a=[...new Set(a)],$(".js-backwpup-add-input-values").val(a.join(","));if(!$(".js-backwpup-add-input-tags button span").map((function(){return $(this).text()})).get().includes(e)){const a=$(this).parents(".js-backwpup-add-input").find(".js-backwpup-add-input-tag-template button").clone();a.find("span").text(e),a.appendTo(".js-backwpup-add-input-tags")}}})),$(".js-backwpup-add-input-tags").on("click",".js-backwpup-remove-tag",(function(){$(this).remove();let e=$(".js-backwpup-add-input-values").val().split(",");e=e.filter((e=>e!==$(this).data("tag"))),$(".js-backwpup-add-input-values").val(e.join(","))})),$(".js-backwpup-toggle-include button").on("click",(function(){const e=$(this).parents(".js-backwpup-toggle-include"),a=e.find("input[type=checkbox]");a.prop("checked",!a.prop("checked")),a.prop("checked")?(e.find(".js-backwpup-toggle-include-add").addClass("hidden"),e.find(".js-backwpup-toggle-include-remove").removeClass("hidden")):(e.find(".js-backwpup-toggle-include-add").removeClass("hidden"),e.find(".js-backwpup-toggle-include-remove").addClass("hidden"))})),$(".js-backwpup-start-backup").on("click",(function(){requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){window.location.reload()}),500)}),"POST")})),$(".js-backwpup-toggle-exclude").on("change",(function(){const e=$(this).prop("checked");$(this).closest("div").find("button").prop("disabled",!e)})),$(".js-backwpup-toggle-files").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-files-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"files"},(function(e){$("#backwpup-files-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-toggle-database").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-database-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"database"},(function(e){$("#backwpup-database-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-test-s3-storage").on("click",(function(){if(""!=$("#s3bucketerror").html())return refresh_storage_destinations("S3",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"s3",s3region:$("#s3region").val(),s3base_url:$("#s3base_url").val(),s3base_region:$("#s3base_region").val(),s3base_version:$("#s3base_version").val(),s3base_signature:$("#s3base_signature").val(),s3accesskey:$("#s3accesskey").val(),s3secretkey:$("#s3secretkey").val(),s3bucket:$("#s3bucket").val(),s3newbucket:$("#s3newbucket").val(),s3dir:$("#s3dir").val(),s3maxbackups:$("#s3maxbackups").val(),s3storageclass:"STANDARD"===$("#s3storageclass").val()?"":$("#s3storageclass").val()};$("#s3base_multipart").prop("checked")&&(e.s3base_multipart=$("#s3base_multipart").val()),$("#s3base_pathstylebucket").prop("checked")&&(e.s3base_pathstylebucket=$("#s3base_pathstylebucket").val()),$("#s3ssencrypt").prop("checked")&&(e.s3ssencrypt=$("#s3ssencrypt").val()),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("S3",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("S3",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-glacier-storage").on("click",(function(){if(""!=$("#glacierbucketerror").html())return refresh_storage_destinations("GLACIER",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"glacier",glacieraccesskey:$("#glacieraccesskey").val(),glaciersecretkey:$("#glaciersecretkey").val(),glacierregion:$("#glacierregion").val(),glaciervault:$("#glaciervault").val(),glaciermaxbackups:$("#glaciermaxbackups").val(),newvault:$("#newvault").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GLACIER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GLACIER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-folder-storage").on("click",(function(){const e={cloud_name:"folder",backupdir:$("#backupdir").val(),maxbackups:$("#maxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FOLDER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FOLDER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-ftp-storage").on("click",(function(){const e={cloud_name:"ftp",ftphost:$("#ftphost").val(),ftphostport:$("#ftphostport").val(),ftpuser:$("#ftpuser").val(),ftppass:$("#ftppass").val(),ftptimeout:$("#ftptimeout").val(),ftpdir:$("#ftpdir").val(),ftpmaxbackups:$("#ftpmaxbackups").val(),ftpssl:$("#ftpssl").prop("checked"),ftppasv:$("#ftppasv").prop("checked")};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FTP",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FTP",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-gdrive-storage").on("click",(function(){const e={cloud_name:"gdrive",gdriveusetrash:$("#gdriveusetrash").prop("checked"),gdrivemaxbackups:$("#gdrivemaxbackups").val(),gdrivedir:$("#gdrivedir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-delete-hidrive-auth").on("click",(function(){const e={cloud_name:"hidrive",hidrive_delete_authorization:!0,hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){closeSidebar()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),$(".js-backwpup-test-hidrive-storage").on("click",(function(){const e={cloud_name:"hidrive",hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};let a=$("#hidrive_authorization_code").val();a&&(e.hidrive_authorization_code=a),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("HIDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("HIDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-onedrive-storage").on("click",(function(){const e={cloud_name:"onedrive",onedrivedir:$("#onedrivedir").val(),onedrivemaxbackups:$("#onedrivemaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("ONEDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("ONEDRIVE",!0),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-sugar-sync-storage").on("click",(function(){const e={cloud_name:"sugarsync",sugardir:$("#sugardir").val(),sugarmaxbackups:$("#sugarmaxbackups").val(),sugarroot:$("#sugarroot").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("SUGARSYNC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-rackspace-cloud-storage").on("click",(function(){const e={cloud_name:"rsc",newrsccontainer:$("#newrsccontainer").val(),rscdir:$("#rscdir").val(),rscmaxbackups:$("#rscmaxbackups").val(),rsccontainer:$("#rsccontainer").val(),rscusername:$("#rscusername").val(),rscapikey:$("#rscapikey").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("RSC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("RSC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-msazure-storage").click((function(){const e={cloud_name:"msazure",msazureaccname:$("#msazureaccname").val(),msazurekey:$("#msazurekey").val(),msazurecontainer:$("#msazurecontainer").val(),newmsazurecontainer:$("#newmsazurecontainer").val(),msazuredir:$("#msazuredir").val(),msazuremaxbackups:$("#msazuremaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("MSAZURE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("MSAZURE",!1),alert("Error in cloud configuration")}))}));const $onboardingSteps=$("#backwpup-onboarding-steps"),$onboardingPanes=$("#backwpup-onboarding-panes"),lineStyles="before:bg-secondary-base",circleActiveStyles="bg-secondary-base after:absolute after:z-10 after:inset after:w-12 after:h-12 after:border-secondary-base after:border after:rounded-full after:animate-pulse",circleReachedStyles="bg-secondary-base";function init_network_authentication(){const e=$(".js-backwpup-network-authentication-method").val();$("#network-"+e+"-authentication").show()}function verifyOnboardingStep1(){const e=!$(".js-backwpup-onboarding-toggle-files").prop("checked"),a=!$(".js-backwpup-onboarding-toggle-database").prop("checked");e&&a?$(".js-backwpup-onboarding-step-2").prop("disabled",!0):$(".js-backwpup-onboarding-step-2").prop("disabled",!1)}function refreshBackupTable(e,a){if(e.success&&e.data){var t=e.data,n=jQuery.parseHTML(t);jQuery("#backwpup-backup-history tbody").html(n),window.BWU.downloader.init(),initMenuEvent(),initModalEvent();let i=Math.ceil(jQuery('input[name="nb_backups"]').val()/a.length);requestWPApi(backwpupApi.backupspagination,{page:a.page,max_pages:i},refreshPagination,"POST")}}function refreshPagination(e){if(e.success&&e.data){var a=e.data,t=jQuery.parseHTML(a);jQuery("#backwpup-pagination").html(t),initPaginationEvent()}}function isGenerateJsIncluded(){const e=document.querySelectorAll("script");for(let a of e)if(a.src.includes("backwpup-generate.js")||a.src.includes("backwpup-generate.min.js"))return!0;return!1}function startBackupProcess(){isGenerateJsIncluded()?$(".progress-bar").on("hide",(function(){console.log(".progress-bar is being hidden")})):requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){"#dbbackup"!==window.location.hash&&window.location.reload()}),500)}),"POST")}$(".js-backwpup-onboarding-step-1").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=1]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-2").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=2]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=1] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),$onboardingSteps.find("article[data-step=3]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-3").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=3]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=3]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=2] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),closeSidebar()})),$(".js-backwpup-onboarding-submit-form").on("click",(function(){0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length&&$("#backwpup-onboarding-form").submit()})),$(".js-backwpup-toggle-storage").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-gdrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","gdrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-onedrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","onedrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-refresh-authentification").on("click",(function(){let trigger=$(this).data("trigger");"function"==typeof window[trigger]?window[trigger]():eval(trigger),closeModal()})),$(".js-backwpup-modal-and-focus").on("click",(function(){openModal("dialog");const e=$(this).data("id-focus-after");$(".js-backwpup-refresh-authentification").data("trigger",'$("#'+e+'").focus()'),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-gdrive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_googleclientsecret:{value:$("#backwpup_cfg_googleclientsecret").val(),secure:!0},backwpup_cfg_googleclientid:{value:$("#backwpup_cfg_googleclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#gdrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#gdrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-one-drive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_onedriveclientsecret:{value:$("#backwpup_cfg_onedriveclientsecret").val(),secure:!0},backwpup_cfg_onedriveclientid:{value:$("#backwpup_cfg_onedriveclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#onedrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#onedrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-test-storage").on("click",(function(){const e={action:"backwpup_test_storage",storage:$(this).data("storage")};postToWP(e).then((a=>{$(`input[name=storage_${e.storage}]`).prop("checked",!0);$(this).closest("#backwpup-sidebar").length>0||closeSidebar()})),$(`input[name=storage_${e.storage}]`).prop("checked",!0);const a=$(this).closest("#backwpup-sidebar").length>0;"backwpuponboarding"===new URLSearchParams(window.location.search).get("page")?closeSidebar():a?openSidebar("storages"):closeSidebar()})),init_network_authentication(),$(".js-backwpup-network-authentication-method").on("change",(function(){$("#network-authentications").children("div").hide(),init_network_authentication()})),$(".js-backwpup-sidebar-submit-form").on("click",(function(){$(this).siblings("div").children().submit()})),$(".js-backwpup-onboarding-toggle-files").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-files-setings").prop("disabled",!e),$(".onboarding-files-frequency").prop("disabled",!e),$(".onboarding-files-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-toggle-database").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-database-setings").prop("disabled",!e),$(".onboarding-database-frequency").prop("disabled",!e),$(".onboarding-database-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-files-frequency").on("change",(function(){if($("#sidebar-frequency-files")){let e=$("#sidebar-frequency-files").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),$(".js-backwpup-onboarding-database-frequency").on("change",(function(){if($("#sidebar-frequency-tables")){let e=$("#sidebar-frequency-tables").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),jQuery("#backwpup-backup-history tbody").length>0&&loadBackupsListingAndPagination(getUrlParameter("page_num",1)),initModalEvent(),initSugarSyncEvents(),initDropboxEvents(),$(".save_database_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_database_settings,a,(function(e){if(200===e.status){if($("#backwpup-database-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='database_frequency']"),a=$("#sidebar-frequency-tables-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$(".save_files_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_files_settings,a,(function(e){if(200===e.status){if($("#backwpup-files-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='files_frequency']"),a=$("#sidebar-frequency-files-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$("#bulk-actions-apply").on("click",(function(){const e=$(this).data("action"),a=$backupsTable.find("input[type=checkbox]:checked").map((function(){return{dataset:$(this).data("delete")}})).get();requestWPApi(backwpupApi.backups_bulk_actions,{action:e,backups:a},(function(e){loadBackupsListingAndPagination(getUrlParameter("page_num",1))}),"POST"),$(".js-backwpup-select-all").prop("checked",!1)})),$("#bulk-actions-select").on("change",(function(){const e=$(this).val();$("#bulk-actions-apply").data("action",e)})),$("#save-excluded-tables").on("click",(function(){const e=$(".js-backwpup-tables-list input[type='checkbox']"),a=$(this).closest("article"),t=[];e.each((function(){$(this).is(":checked")&&t.push($(this).val())}));const n=a.find("input[type='hidden']"),i=[];n.each((function(){i.push({name:$(this).attr("name"),value:$(this).val()})})),t.forEach((function(e){i.push({name:"tabledb[]",value:e})}));const s=$.param(i);requestWPApi(backwpupApi.save_excluded_tables,s,(function(e){200===e.status&&closeSidebar()}),"POST")})),$(".js-backwpup-license_update").on("click",update_license),$(".file-exclusions-submit").on("click",(function(e){const a=$(this).closest("article").find("input"),t={};function n(e,a){e.endsWith("[]")?(t[e]||(t[e]=[]),a&&t[e].push(a)):t[e]=a}a.each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())})),$('[id^="sidebar-exclude-files-"]').each((function(){$(this).find("input").each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())}))}));const i=$.param(t);requestWPApi(backwpupApi.save_file_exclusions,i,(function(e){200===e.status&&closeSidebar()}),"POST")})),window.location.search.includes("backwpupfirstbackup")&&startBackupProcess();var buyProMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=buypro"]');buyProMenuItem.length&&(buyProMenuItem.attr("href","https://backwpup.com/#buy"),buyProMenuItem.attr("target","_blank"),buyProMenuItem.css({color:"#3ac495","font-weight":"bold"}));var DocsMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=docs"]');DocsMenuItem.length&&(DocsMenuItem.attr("href","https://backwpup.com/docs/"),DocsMenuItem.attr("target","_blank"))})),function(e){var a=e.fn.hide;e.fn.hide=function(){return this.trigger("hide"),a.apply(this,arguments)}}(jQuery); -
backwpup/tags/5.0.6/backwpup.php
r3249764 r3253259 6 6 * Author: BackWPup – WordPress Backup & Restore Plugin 7 7 * Author URI: https://backwpup.com 8 * Version: 5.0. 58 * Version: 5.0.6 9 9 * Requires at least: 4.9 10 10 * Requires PHP: 7.4 -
backwpup/tags/5.0.6/changelog.txt
r3249764 r3253259 1 1 == Changelog == 2 = 5.0.6 = 3 Release date: March 10, 2025 4 5 * Fixed: Archive file format Tar generation code to handle long file names 6 * Fixed: Clicking on actions should close other opened sections in Backup History 7 2 8 = 5.0.5 = 3 9 Release date: March 03, 2025 -
backwpup/tags/5.0.6/inc/class-create-archive.php
r3249764 r3253259 602 602 $chunk_size = 1024 * 1024 * 4; 603 603 $filename = $name_in_archive; 604 $filename_prefix = '';605 606 // Split filename larger than 100 chars607 if (100 < strlen($name_in_archive)) {608 $filename_offset = strlen($name_in_archive) - 100;609 $split_pos = strpos($name_in_archive, '/', $filename_offset);610 611 if ($split_pos === false) {612 $split_pos = strrpos($name_in_archive, '/');613 }614 615 $filename = substr($name_in_archive, $split_pos + 1);616 $filename_prefix = substr($name_in_archive, 0, $split_pos);617 618 if (strlen($filename) > 100) {619 $filename = substr($filename, -100);620 trigger_error(621 sprintf(622 // translators: $1 is the file name.623 esc_html__('File name "%1$s" is too long to be saved correctly in %2$s archive!', 'backwpup'),624 $name_in_archive,625 $this->method626 ),627 E_USER_WARNING628 );629 }630 631 if (155 < strlen($filename_prefix)) {632 trigger_error(633 sprintf(634 // translators: $1 is the file name to use in the archive.635 esc_html__('File path "%1$s" is too long to be saved correctly in %2$s archive!', 'backwpup'),636 $name_in_archive,637 $this->method638 ),639 E_USER_WARNING640 );641 }642 }643 604 644 605 // Get file stat. … … 663 624 $file_stat['mtime'], 664 625 0, 665 $owner, 666 $group, 667 $filename_prefix 668 ); 626 $owner, 627 $group 628 ); 669 629 670 630 $fd = false; … … 717 677 $name_in_archive = trailingslashit($name_in_archive); 718 678 719 $tar_filename = $name_in_archive; 720 $tar_filename_prefix = ''; 721 722 // Split filename larger than 100 chars. 723 if (100 < strlen($name_in_archive)) { 724 $filename_offset = strlen($name_in_archive) - 100; 725 $split_pos = strpos($name_in_archive, '/', $filename_offset); 726 727 if ($split_pos === false) { 728 $split_pos = strrpos(untrailingslashit($name_in_archive), '/'); 729 } 730 731 $tar_filename = substr($name_in_archive, $split_pos + 1); 732 $tar_filename_prefix = substr($name_in_archive, 0, $split_pos); 733 734 if (strlen($tar_filename) > 100) { 735 $tar_filename = substr($tar_filename, -100); 736 trigger_error( 737 sprintf( 738 // translators: $1 is the name of the folder. $2 is the archive name. 739 esc_html__( 740 'Folder name "%1$s" is too long to be saved correctly in %2$s archive!', 741 'backwpup' 742 ), 743 $name_in_archive, 744 $this->method 745 ), 746 E_USER_WARNING 747 ); 748 } 749 750 if (strlen($tar_filename_prefix) > 155) { 751 trigger_error( 752 sprintf( 753 // translators: $1 is the name of the folder. $2 is the archive name. 754 esc_html__( 755 'Folder path "%1$s" is too long to be saved correctly in %2$s archive!', 756 'backwpup' 757 ), 758 $name_in_archive, 759 $this->method 760 ), 761 E_USER_WARNING 762 ); 763 } 764 } 679 $tar_filename = $name_in_archive; 765 680 766 681 $file_stat = @stat($folder_name); … … 777 692 $file_stat['mtime'], 778 693 5, 779 $owner, 780 $group, 781 $tar_filename_prefix 782 ); 694 $owner, 695 $group 696 ); 783 697 784 698 $this->fwrite($header); … … 837 751 /** 838 752 * Make Tar Headers. 839 * 840 * @param string $name The name of the file or directory. Known as Item. 841 * @param string $mode the permissions for the item 842 * @param int $uid the owner ID 843 * @param int $gid the group ID 844 * @param int $size the size of the item 845 * @param int $mtime the time of the last modification 846 * @param int $typeflag The type of the item. 0 for File and 5 for Directory. 847 * @param string $owner the owner Name 848 * @param string $group the group Name 849 * @param string $prefix the item prefix 850 * 753 * 754 * @param string $name The name of the file or directory. Known as Item. 755 * @param string $mode the permissions for the item. 756 * @param int $uid the owner ID. 757 * @param int $gid the group ID. 758 * @param int $size the size of the item. 759 * @param int $mtime the time of the last modification. 760 * @param int $typeflag The type of the item. 0 for File and 5 for Directory. 761 * @param string $owner the owner Name. 762 * @param string $group the group Name. 763 * 851 764 * @return mixed|string 852 */ 853 private function make_tar_headers($name, $mode, $uid, $gid, $size, $mtime, $typeflag, $owner, $group, $prefix) 854 { 855 // Generate the TAR header for this file 856 $chunk = pack( 857 'a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12', 858 $name, //name of file 100 859 sprintf('%07o', $mode), //file mode 8 860 sprintf('%07o', $uid), //owner user ID 8 861 sprintf('%07o', $gid), //owner group ID 8 862 sprintf('%011o', $size), //length of file in bytes 12 863 sprintf('%011o', $mtime), //modify time of file 12 864 ' ', //checksum for header 8 865 $typeflag, //type of file 0 or null = File, 5=Dir 866 '', //name of linked file 100 867 'ustar', //USTAR indicator 6 868 '00', //USTAR version 2 869 $owner, //owner user name 32 870 $group, //owner group name 32 871 '', //device major number 8 872 '', //device minor number 8 873 $prefix, //prefix for file name 155 874 '' 875 ); //fill block 12 876 877 // Computes the unsigned Checksum of a file's header 878 $checksum = 0; 765 */ 766 private function make_tar_headers( $name, $mode, $uid, $gid, $size, $mtime, $typeflag, $owner, $group ) { 767 $headers = ''; 768 $orig_name = $name; 769 $prefix = ''; 770 771 // Attempt to split filename larger than 100 chars. 772 if ( 100 < strlen( $name ) ) { 773 $filename_offset = strlen( $name ) - 100; 774 $split_pos = strpos( $name, '/', $filename_offset ); 775 776 if ( false === $split_pos ) { 777 $split_pos = strrpos( $name, '/' ); 778 } 779 780 $prefix = substr( $name, 0, $split_pos ); 781 $name = substr( $name, $split_pos + 1 ); 782 } 783 784 // Handle long filenames. (gnu tar format) 785 // If the name is longer than 100 or the prefix is longer than 155 we 786 // need to encode the name as a preceeding chunk with a @LongLink 787 // header and truncate the filename in the actual header that we write. 788 if ( strlen( $name ) > 100 || strlen( $prefix ) > 155 ) { 789 $longlink_content = $orig_name . "\0"; 790 791 $longlink_header = $this->make_tar_headers( 792 '@LongLink', 793 '0000777', 794 0, 795 0, 796 strlen( $longlink_content ), 797 time(), 798 'L', 799 'root', 800 'root' 801 ); 802 803 // Add ending null byte, and pack into binary to a multiple of 512. 804 $chunk_count = ceil( strlen( $longlink_content ) / 512 ); 805 $packed_size = $chunk_count * 512; 806 $packed_content = pack( 'a' . $packed_size, $longlink_content ); 807 808 $headers .= $longlink_header . $packed_content; 809 // Truncate name for actual header. 810 $name = substr( $orig_name, 0, 100 ); 811 $prefix = ''; 812 } 813 814 // Generate the TAR header for this file. 815 $chunk = pack( 816 'a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12', 817 $name, // name of file 100. 818 sprintf( '%07o', $mode ), // file mode 8. 819 sprintf( '%07o', $uid ), // owner user ID 8. 820 sprintf( '%07o', $gid ), // owner group ID 8. 821 sprintf( '%011o', $size ), // length of file in bytes 12. 822 sprintf( '%011o', $mtime ), // modify time of file 12. 823 ' ', // checksum for header 8. 824 $typeflag, // type of file 0 or null = File, 5=Dir. 825 '', // name of linked file 100. 826 'ustar', // USTAR indicator 6. 827 ' ', // USTAR Version (00 for ustar, double-space for gnutar) 2. 828 $owner, // owner user name 32. 829 $group, // owner group name 32. 830 '', // device major number 8. 831 '', // device minor number 8. 832 $prefix, // prefix for file name 155. 833 '' 834 ); // fill block 12. 835 836 // Computes the unsigned Checksum of a file's header. 837 $checksum = 0; 879 838 880 839 for ($i = 0; $i < 512; ++$i) { … … 882 841 } 883 842 884 $checksum = pack('a8', sprintf('%07o', $checksum)); 885 886 return substr_replace($chunk, $checksum, 148, 8); 887 } 843 $checksum = pack( 'a8', sprintf( '%07o', $checksum ) ); 844 $chunk = substr_replace( $chunk, $checksum, 148, 8 ); 845 846 return $headers . $chunk; 847 } 888 848 889 849 /** -
backwpup/tags/5.0.6/languages/backwpup.pot
r3249764 r3253259 7 7 "Content-Type: text/plain; charset=UTF-8\n" 8 8 "Content-Transfer-Encoding: 8bit\n" 9 "POT-Creation-Date: 2025-03- 03 14:01+0000\n"9 "POT-Creation-Date: 2025-03-10 10:19+0000\n" 10 10 "X-Poedit-Basepath: ..\n" 11 11 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" … … 390 390 msgstr "" 391 391 392 #. translators: $1 is the file name. 393 #: inc/class-create-archive.php:623 394 msgid "File name \"%1$s\" is too long to be saved correctly in %2$s archive!" 395 msgstr "" 396 397 #. translators: $1 is the file name to use in the archive. 398 #: inc/class-create-archive.php:635 399 msgid "File path \"%1$s\" is too long to be saved correctly in %2$s archive!" 400 msgstr "" 401 402 #: inc/class-create-archive.php:677 392 #: inc/class-create-archive.php:637 403 393 msgid "Cannot open source file %s for archiving. Writing an empty file." 404 394 msgstr "" 405 395 406 #. translators: $1 is the name of the folder. $2 is the archive name. 407 #: inc/class-create-archive.php:739 408 msgid "Folder name \"%1$s\" is too long to be saved correctly in %2$s archive!" 409 msgstr "" 410 411 #. translators: $1 is the name of the folder. $2 is the archive name. 412 #: inc/class-create-archive.php:754 413 msgid "Folder path \"%1$s\" is too long to be saved correctly in %2$s archive!" 414 msgstr "" 415 416 #: inc/class-create-archive.php:822 396 #: inc/class-create-archive.php:736 417 397 msgid "If %s will be added to your backup archive, the archive will be too large for operations with this PHP Version. You might want to consider splitting the backup job in multiple jobs with less files each." 418 398 msgstr "" 419 399 420 #: inc/class-create-archive.php: 900, inc/class-create-archive.php:901400 #: inc/class-create-archive.php:860, inc/class-create-archive.php:861 421 401 msgid "Unknown" 422 402 msgstr "" 423 403 424 404 #. translators: $1 is the filename to add into the archive. 425 #: inc/class-create-archive.php: 936405 #: inc/class-create-archive.php:896 426 406 msgid "Cannot open source file %s." 427 407 msgstr "" -
backwpup/tags/5.0.6/readme.txt
r3249764 r3253259 6 6 Tested up to: 6.7.1 7 7 Requires PHP: 7.4 8 Stable tag: 5.0. 58 Stable tag: 5.0.6 9 9 License: GPLv2+ 10 10 … … 203 203 204 204 205 == Changelog == 205 == Changelog == 206 = 5.0.6 = 207 Release date: March 10, 2025 208 209 * Fixed: Archive file format Tar generation code to handle long file names 210 * Fixed: Clicking on actions should close other opened sections in Backup History 211 206 212 = 5.0.5 = 207 213 Release date: March 03, 2025 -
backwpup/tags/5.0.6/vendor/composer/installed.php
r3249764 r3253259 2 2 'root' => array( 3 3 'name' => 'inpsyde/backwpup-pro', 4 'pretty_version' => '5.0. 5',5 'version' => '5.0. 5.0',6 'reference' => ' f94c705cd995f3383ebd213778032c4682e35771',4 'pretty_version' => '5.0.6', 5 'version' => '5.0.6.0', 6 'reference' => '70377c7302f1d67d016f74f5e9e3840f9c245626', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 225 225 ), 226 226 'inpsyde/backwpup-pro' => array( 227 'pretty_version' => '5.0. 5',228 'version' => '5.0. 5.0',229 'reference' => ' f94c705cd995f3383ebd213778032c4682e35771',227 'pretty_version' => '5.0.6', 228 'version' => '5.0.6.0', 229 'reference' => '70377c7302f1d67d016f74f5e9e3840f9c245626', 230 230 'type' => 'wordpress-plugin', 231 231 'install_path' => __DIR__ . '/../../', -
backwpup/trunk/assets/js/backwpup-admin.js
r3249764 r3253259 532 532 event.stopPropagation(); 533 533 const $menu = $(this).find(".js-backwpup-menu-content"); 534 535 $(".js-backwpup-menu-content").not($menu).addClass("hidden"); 534 536 535 537 if ($menu.hasClass("hidden")) { -
backwpup/trunk/assets/js/backwpup-admin.min.js
r3249764 r3253259 1 jQuery(document).ready((function($){async function postToWP(e){return await fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams(e)}).then((e=>e.json()))}function requestWPApi(e,a,t,n="GET",i=null){$.ajax({url:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",backwpupApi.nonce)},method:n,data:a,success:function(e){t(e,a)},error:function(e,a){i?i(e,a):console.log(a)}})}function getUrlParameter(e,a=""){let t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):a}$(".js-backwpup-intonly").on("keydown",(function(e){return!!["Backspace","Delete","ArrowLeft","ArrowRight"].includes(e.code)||!isNaN(Number(e.key))&&"Space"!==e.code})),window.refresh_storage_destinations=function(e,a){$("#destination-"+e).prop("checked",a);const t=[""];$('input[name="storage_destinations[]"]').each((function(){$(this).is(":checked")&&t.push($(this).val())})),requestWPApi(backwpupApi.updatejob,{storage_destinations:t},(function(e){requestWPApi(backwpupApi.storagelistcompact,{},(function(e){$("#backwpup-storage-list-compact-container").html(e)}),"GET",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseText)}))}),"POST",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseJSON.error)}));0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length?$(".js-backwpup-onboarding-submit-form").prop("disabled",!1):$(".js-backwpup-onboarding-submit-form").prop("disabled",!0)},window.gdrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"gdrive"},(function(e){$("#gdrive_authenticate_label").html(e)}),"GET")},window.onedrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"onedrive"},(function(e){$("#onedrive_authenticate_label").html(e)}),"GET")},window.dropbox_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"dropbox"},(function(e){$("#drobox_authenticate_infos").html(e)}),"GET")},window.update_license=function(){const e=$("#license_action").val(),a={license_action:e,license_instance_key:$("#license_instance_key").val(),license_submit:!0};let t="activate";"activate"===e&&(t="deactivate",a.license_api_key=$("#license_api_key").val(),a.license_product_id=$("#license_product_id").val()),requestWPApi(backwpupApi.license_update,a,(function(e){console.log(e),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"info",font:"xs",content:e.message}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)})),backwpup_license_refresh(t),200===e.status&&console.log(e)}),"POST",(function(e,a){console.log(e.responseJSON.error),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"alert",font:"xs",content:e.responseJSON.error}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)}))}))},window.backwpup_license_refresh=function(e){let a="sidebar/license-parts/"+e;console.log(a),requestWPApi(backwpupApi.getblock,{block_name:a,block_type:"children"},(function(e){$("#backwpup_license").html(e),$(".js-backwpup-license_update").on("click",update_license)}),"POST")};const $modal=$("#backwpup-modal"),$sidebar=$("#backwpup-sidebar");function openSidebar(e){$sidebar.find("article").hide(),$sidebar.find("#sidebar-"+e).show(),$("body").addClass("overflow-hidden"),$sidebar.removeClass("translate-x-[450px]")}function closeSidebar(){$("body").removeClass("overflow-hidden"),$sidebar.addClass("translate-x-[450px]")}function openModal(e,a={}){$modal.find("article").hide();let t=$modal.find("#sidebar-"+e);t.show(),a.url&&t.find(".js-backwpup-open-url").attr("data-href",a.url),$("body").addClass("overflow-hidden"),$modal.removeClass("hidden").addClass("flex")}function closeModal(){$("body").removeClass("overflow-hidden"),$modal.addClass("hidden").removeClass("flex")}function initSugarSyncEvents(){$(".js-backwpup-authenticate-sugar-sync").on("click",(function(){let e={cloud_name:"sugarsync",sugaremail:$("#sugaremail").val(),sugarpass:$("#sugarpass").val()};requestWPApi(backwpupApi.authenticate_cloud,e,(function(e){$("#sugarsynclogin").html(e),$("#sugarsync_authenticate_infos").html(""),initSugarSyncEvents()}),"POST",(function(e,a){$("#sugarsync_authenticate_infos").html(e.responseText)}))})),$(".js-backwpup-delete-sugar-sync-auth").on("click",(function(){requestWPApi(backwpupApi.delete_auth_cloud,{cloud_name:"sugarsync"},(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),$("#sugarsynclogin").html(e),initSugarSyncEvents()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),requestWPApi(backwpupApi.getblock,{block_name:"sidebar/sugar-sync-parts/root-folder",block_type:"children"},(function(e){$("#sugarsyncroot").html(e)}),"POST",(function(e,a){$("#sugarsyncroot").html(e.responseText)}))}function initDropboxEvents(){$(".js-backwpup-test-dropbox-storage").on("click",(function(){const e={cloud_name:"dropbox",dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};let a=$("#dropbbox_code").val();a&&(e.dropbbox_code=a);let t=$("#sandbox_code").val();t&&!a&&(e.sandbox_code=t),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("DROPBOX",!1),alert(e.responseJSON.error)}))})),$(".js-backwpup-delete-dropbox-auth").on("click",(function(){const e={cloud_name:"dropbox",delete_auth:!0,dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){alert(e.responseJSON.error)}))}))}function initModalEvent(){$(".js-backwpup-open-modal").on("click",(function(){const e=$(this).data("content");let a={};$(this).data("url")&&(a.url=$(this).data("url")),openModal(e,a)}))}$(".js-backwpup-open-sidebar").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-close-sidebar").on("click",closeSidebar),$(".js-backwpup-open-url").on("click",(function(){$(this).data("href")&&(window.location=$(this).data("href"))})),$(".js-backwpup-close-modal").on("click",closeModal),$(".js-backwpup-filter-tables").on("keyup",(function(){const e=$(this).val().toLowerCase();$(".js-backwpup-tables-list label").each((function(){""===e||$(this).find("input").attr("value").toLowerCase().includes(e)?$(this).show():$(this).hide()}))})),$(".js-backwpup-filter-tables").next(".js-backwpup-clear-search").on("click",(function(){$(".js-backwpup-tables-list label").show()}));const $backupsTable=$("#backwpup-backup-history");let isCheckboxListenerInitialized=!1;function showFrequencyFilesFields(e){"weekly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").show(),$(".js-backwpup-frequency-file-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").hide())}function showFrequencyTablesFields(e){"weekly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").show(),$(".js-backwpup-frequency-table-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").hide())}function initMenuEvent(){$(".js-backwpup-menu").on("click",(function(e){e.stopPropagation();const a=$(this).find(".js-backwpup-menu-content"); a.hasClass("hidden")?a.removeClass("hidden"):a.addClass("hidden")})),$("#bulk-actions-apply").prop("disabled",!0),$(".js-backwpup-select-backup").on("click",(function(){const e=$(".js-backwpup-select-backup:checked").length>0;console.log(e),$("#bulk-actions-apply").prop("disabled",!e)}))}function initPaginationEvent(){$(".js-backwpup-table-pagination button").on("click",(function(){let e=$(this).data("page");loadBackupsListingAndPagination(e);let a=new URL(window.location.href);a.searchParams.set("page_num",e),history.pushState({},"",a)}))}function loadBackupsListingAndPagination(e){requestWPApi(backwpupApi.backupslistings,{page:e,length:backwpupApi.backupslistingslength},refreshBackupTable,"POST")}$(".js-backwpup-select-all").on("change",(function(){const e=$(this).prop("checked");$("#bulk-actions-apply").prop("disabled",!e),$backupsTable.find("input[type=checkbox]").prop("checked",e),isCheckboxListenerInitialized||($backupsTable.on("change","input[type=checkbox]",(function(){const e=$backupsTable.find("input[type=checkbox]").length===$backupsTable.find("input[type=checkbox]:checked").length;$(".js-backwpup-select-all").prop("checked",e)})),isCheckboxListenerInitialized=!0)})),showFrequencyFilesFields($(".js-backwpup-frequency-files").val()),showFrequencyTablesFields($(".js-backwpup-frequency-tables").val()),$(".js-backwpup-frequency-files").on("change",(function(){showFrequencyFilesFields($(this).val())})),$(".js-backwpup-frequency-tables").on("change",(function(){showFrequencyTablesFields($(this).val())})),$(document).on("click",(function(){$(".js-backwpup-menu-content").addClass("hidden")})),$(".js-backwpup-toggle-tables").on("click",(function(){postToWP({action:"backwpup_toggle_database",tables:$(this).is(":checked")}).then((e=>{}))})),$(".js-backwpup-clear-search").on("click",(function(){$(this).prev().val("")})),$(".js-backwpup-add-input-button").on("click",(function(){const e=$(this).prev().val().trim();if(""===e)return;$(this).prev().val("");let a=$(".js-backwpup-add-input-values").val().split(",");if(!a.includes(e)){a.push(e),a=[...new Set(a)],$(".js-backwpup-add-input-values").val(a.join(","));if(!$(".js-backwpup-add-input-tags button span").map((function(){return $(this).text()})).get().includes(e)){const a=$(this).parents(".js-backwpup-add-input").find(".js-backwpup-add-input-tag-template button").clone();a.find("span").text(e),a.appendTo(".js-backwpup-add-input-tags")}}})),$(".js-backwpup-add-input-tags").on("click",".js-backwpup-remove-tag",(function(){$(this).remove();let e=$(".js-backwpup-add-input-values").val().split(",");e=e.filter((e=>e!==$(this).data("tag"))),$(".js-backwpup-add-input-values").val(e.join(","))})),$(".js-backwpup-toggle-include button").on("click",(function(){const e=$(this).parents(".js-backwpup-toggle-include"),a=e.find("input[type=checkbox]");a.prop("checked",!a.prop("checked")),a.prop("checked")?(e.find(".js-backwpup-toggle-include-add").addClass("hidden"),e.find(".js-backwpup-toggle-include-remove").removeClass("hidden")):(e.find(".js-backwpup-toggle-include-add").removeClass("hidden"),e.find(".js-backwpup-toggle-include-remove").addClass("hidden"))})),$(".js-backwpup-start-backup").on("click",(function(){requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){window.location.reload()}),500)}),"POST")})),$(".js-backwpup-toggle-exclude").on("change",(function(){const e=$(this).prop("checked");$(this).closest("div").find("button").prop("disabled",!e)})),$(".js-backwpup-toggle-files").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-files-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"files"},(function(e){$("#backwpup-files-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-toggle-database").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-database-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"database"},(function(e){$("#backwpup-database-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-test-s3-storage").on("click",(function(){if(""!=$("#s3bucketerror").html())return refresh_storage_destinations("S3",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"s3",s3region:$("#s3region").val(),s3base_url:$("#s3base_url").val(),s3base_region:$("#s3base_region").val(),s3base_version:$("#s3base_version").val(),s3base_signature:$("#s3base_signature").val(),s3accesskey:$("#s3accesskey").val(),s3secretkey:$("#s3secretkey").val(),s3bucket:$("#s3bucket").val(),s3newbucket:$("#s3newbucket").val(),s3dir:$("#s3dir").val(),s3maxbackups:$("#s3maxbackups").val(),s3storageclass:"STANDARD"===$("#s3storageclass").val()?"":$("#s3storageclass").val()};$("#s3base_multipart").prop("checked")&&(e.s3base_multipart=$("#s3base_multipart").val()),$("#s3base_pathstylebucket").prop("checked")&&(e.s3base_pathstylebucket=$("#s3base_pathstylebucket").val()),$("#s3ssencrypt").prop("checked")&&(e.s3ssencrypt=$("#s3ssencrypt").val()),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("S3",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("S3",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-glacier-storage").on("click",(function(){if(""!=$("#glacierbucketerror").html())return refresh_storage_destinations("GLACIER",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"glacier",glacieraccesskey:$("#glacieraccesskey").val(),glaciersecretkey:$("#glaciersecretkey").val(),glacierregion:$("#glacierregion").val(),glaciervault:$("#glaciervault").val(),glaciermaxbackups:$("#glaciermaxbackups").val(),newvault:$("#newvault").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GLACIER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GLACIER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-folder-storage").on("click",(function(){const e={cloud_name:"folder",backupdir:$("#backupdir").val(),maxbackups:$("#maxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FOLDER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FOLDER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-ftp-storage").on("click",(function(){const e={cloud_name:"ftp",ftphost:$("#ftphost").val(),ftphostport:$("#ftphostport").val(),ftpuser:$("#ftpuser").val(),ftppass:$("#ftppass").val(),ftptimeout:$("#ftptimeout").val(),ftpdir:$("#ftpdir").val(),ftpmaxbackups:$("#ftpmaxbackups").val(),ftpssl:$("#ftpssl").prop("checked"),ftppasv:$("#ftppasv").prop("checked")};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FTP",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FTP",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-gdrive-storage").on("click",(function(){const e={cloud_name:"gdrive",gdriveusetrash:$("#gdriveusetrash").prop("checked"),gdrivemaxbackups:$("#gdrivemaxbackups").val(),gdrivedir:$("#gdrivedir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-delete-hidrive-auth").on("click",(function(){const e={cloud_name:"hidrive",hidrive_delete_authorization:!0,hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){closeSidebar()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),$(".js-backwpup-test-hidrive-storage").on("click",(function(){const e={cloud_name:"hidrive",hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};let a=$("#hidrive_authorization_code").val();a&&(e.hidrive_authorization_code=a),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("HIDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("HIDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-onedrive-storage").on("click",(function(){const e={cloud_name:"onedrive",onedrivedir:$("#onedrivedir").val(),onedrivemaxbackups:$("#onedrivemaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("ONEDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("ONEDRIVE",!0),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-sugar-sync-storage").on("click",(function(){const e={cloud_name:"sugarsync",sugardir:$("#sugardir").val(),sugarmaxbackups:$("#sugarmaxbackups").val(),sugarroot:$("#sugarroot").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("SUGARSYNC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-rackspace-cloud-storage").on("click",(function(){const e={cloud_name:"rsc",newrsccontainer:$("#newrsccontainer").val(),rscdir:$("#rscdir").val(),rscmaxbackups:$("#rscmaxbackups").val(),rsccontainer:$("#rsccontainer").val(),rscusername:$("#rscusername").val(),rscapikey:$("#rscapikey").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("RSC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("RSC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-msazure-storage").click((function(){const e={cloud_name:"msazure",msazureaccname:$("#msazureaccname").val(),msazurekey:$("#msazurekey").val(),msazurecontainer:$("#msazurecontainer").val(),newmsazurecontainer:$("#newmsazurecontainer").val(),msazuredir:$("#msazuredir").val(),msazuremaxbackups:$("#msazuremaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("MSAZURE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("MSAZURE",!1),alert("Error in cloud configuration")}))}));const $onboardingSteps=$("#backwpup-onboarding-steps"),$onboardingPanes=$("#backwpup-onboarding-panes"),lineStyles="before:bg-secondary-base",circleActiveStyles="bg-secondary-base after:absolute after:z-10 after:inset after:w-12 after:h-12 after:border-secondary-base after:border after:rounded-full after:animate-pulse",circleReachedStyles="bg-secondary-base";function init_network_authentication(){const e=$(".js-backwpup-network-authentication-method").val();$("#network-"+e+"-authentication").show()}function verifyOnboardingStep1(){const e=!$(".js-backwpup-onboarding-toggle-files").prop("checked"),a=!$(".js-backwpup-onboarding-toggle-database").prop("checked");e&&a?$(".js-backwpup-onboarding-step-2").prop("disabled",!0):$(".js-backwpup-onboarding-step-2").prop("disabled",!1)}function refreshBackupTable(e,a){if(e.success&&e.data){var t=e.data,n=jQuery.parseHTML(t);jQuery("#backwpup-backup-history tbody").html(n),window.BWU.downloader.init(),initMenuEvent(),initModalEvent();let i=Math.ceil(jQuery('input[name="nb_backups"]').val()/a.length);requestWPApi(backwpupApi.backupspagination,{page:a.page,max_pages:i},refreshPagination,"POST")}}function refreshPagination(e){if(e.success&&e.data){var a=e.data,t=jQuery.parseHTML(a);jQuery("#backwpup-pagination").html(t),initPaginationEvent()}}function isGenerateJsIncluded(){const e=document.querySelectorAll("script");for(let a of e)if(a.src.includes("backwpup-generate.js")||a.src.includes("backwpup-generate.min.js"))return!0;return!1}function startBackupProcess(){isGenerateJsIncluded()?$(".progress-bar").on("hide",(function(){console.log(".progress-bar is being hidden")})):requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){"#dbbackup"!==window.location.hash&&window.location.reload()}),500)}),"POST")}$(".js-backwpup-onboarding-step-1").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=1]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-2").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=2]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=1] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),$onboardingSteps.find("article[data-step=3]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-3").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=3]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=3]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=2] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),closeSidebar()})),$(".js-backwpup-onboarding-submit-form").on("click",(function(){0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length&&$("#backwpup-onboarding-form").submit()})),$(".js-backwpup-toggle-storage").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-gdrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","gdrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-onedrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","onedrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-refresh-authentification").on("click",(function(){let trigger=$(this).data("trigger");"function"==typeof window[trigger]?window[trigger]():eval(trigger),closeModal()})),$(".js-backwpup-modal-and-focus").on("click",(function(){openModal("dialog");const e=$(this).data("id-focus-after");$(".js-backwpup-refresh-authentification").data("trigger",'$("#'+e+'").focus()'),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-gdrive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_googleclientsecret:{value:$("#backwpup_cfg_googleclientsecret").val(),secure:!0},backwpup_cfg_googleclientid:{value:$("#backwpup_cfg_googleclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#gdrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#gdrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-one-drive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_onedriveclientsecret:{value:$("#backwpup_cfg_onedriveclientsecret").val(),secure:!0},backwpup_cfg_onedriveclientid:{value:$("#backwpup_cfg_onedriveclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#onedrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#onedrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-test-storage").on("click",(function(){const e={action:"backwpup_test_storage",storage:$(this).data("storage")};postToWP(e).then((a=>{$(`input[name=storage_${e.storage}]`).prop("checked",!0);$(this).closest("#backwpup-sidebar").length>0||closeSidebar()})),$(`input[name=storage_${e.storage}]`).prop("checked",!0);const a=$(this).closest("#backwpup-sidebar").length>0;"backwpuponboarding"===new URLSearchParams(window.location.search).get("page")?closeSidebar():a?openSidebar("storages"):closeSidebar()})),init_network_authentication(),$(".js-backwpup-network-authentication-method").on("change",(function(){$("#network-authentications").children("div").hide(),init_network_authentication()})),$(".js-backwpup-sidebar-submit-form").on("click",(function(){$(this).siblings("div").children().submit()})),$(".js-backwpup-onboarding-toggle-files").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-files-setings").prop("disabled",!e),$(".onboarding-files-frequency").prop("disabled",!e),$(".onboarding-files-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-toggle-database").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-database-setings").prop("disabled",!e),$(".onboarding-database-frequency").prop("disabled",!e),$(".onboarding-database-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-files-frequency").on("change",(function(){if($("#sidebar-frequency-files")){let e=$("#sidebar-frequency-files").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),$(".js-backwpup-onboarding-database-frequency").on("change",(function(){if($("#sidebar-frequency-tables")){let e=$("#sidebar-frequency-tables").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),jQuery("#backwpup-backup-history tbody").length>0&&loadBackupsListingAndPagination(getUrlParameter("page_num",1)),initModalEvent(),initSugarSyncEvents(),initDropboxEvents(),$(".save_database_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_database_settings,a,(function(e){if(200===e.status){if($("#backwpup-database-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='database_frequency']"),a=$("#sidebar-frequency-tables-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$(".save_files_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_files_settings,a,(function(e){if(200===e.status){if($("#backwpup-files-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='files_frequency']"),a=$("#sidebar-frequency-files-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$("#bulk-actions-apply").on("click",(function(){const e=$(this).data("action"),a=$backupsTable.find("input[type=checkbox]:checked").map((function(){return{dataset:$(this).data("delete")}})).get();requestWPApi(backwpupApi.backups_bulk_actions,{action:e,backups:a},(function(e){loadBackupsListingAndPagination(getUrlParameter("page_num",1))}),"POST"),$(".js-backwpup-select-all").prop("checked",!1)})),$("#bulk-actions-select").on("change",(function(){const e=$(this).val();$("#bulk-actions-apply").data("action",e)})),$("#save-excluded-tables").on("click",(function(){const e=$(".js-backwpup-tables-list input[type='checkbox']"),a=$(this).closest("article"),t=[];e.each((function(){$(this).is(":checked")&&t.push($(this).val())}));const n=a.find("input[type='hidden']"),i=[];n.each((function(){i.push({name:$(this).attr("name"),value:$(this).val()})})),t.forEach((function(e){i.push({name:"tabledb[]",value:e})}));const s=$.param(i);requestWPApi(backwpupApi.save_excluded_tables,s,(function(e){200===e.status&&closeSidebar()}),"POST")})),$(".js-backwpup-license_update").on("click",update_license),$(".file-exclusions-submit").on("click",(function(e){const a=$(this).closest("article").find("input"),t={};function n(e,a){e.endsWith("[]")?(t[e]||(t[e]=[]),a&&t[e].push(a)):t[e]=a}a.each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())})),$('[id^="sidebar-exclude-files-"]').each((function(){$(this).find("input").each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())}))}));const i=$.param(t);requestWPApi(backwpupApi.save_file_exclusions,i,(function(e){200===e.status&&closeSidebar()}),"POST")})),window.location.search.includes("backwpupfirstbackup")&&startBackupProcess();var buyProMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=buypro"]');buyProMenuItem.length&&(buyProMenuItem.attr("href","https://backwpup.com/#buy"),buyProMenuItem.attr("target","_blank"),buyProMenuItem.css({color:"#3ac495","font-weight":"bold"}));var DocsMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=docs"]');DocsMenuItem.length&&(DocsMenuItem.attr("href","https://backwpup.com/docs/"),DocsMenuItem.attr("target","_blank"))})),function(e){var a=e.fn.hide;e.fn.hide=function(){return this.trigger("hide"),a.apply(this,arguments)}}(jQuery);1 jQuery(document).ready((function($){async function postToWP(e){return await fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams(e)}).then((e=>e.json()))}function requestWPApi(e,a,t,n="GET",i=null){$.ajax({url:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",backwpupApi.nonce)},method:n,data:a,success:function(e){t(e,a)},error:function(e,a){i?i(e,a):console.log(a)}})}function getUrlParameter(e,a=""){let t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):a}$(".js-backwpup-intonly").on("keydown",(function(e){return!!["Backspace","Delete","ArrowLeft","ArrowRight"].includes(e.code)||!isNaN(Number(e.key))&&"Space"!==e.code})),window.refresh_storage_destinations=function(e,a){$("#destination-"+e).prop("checked",a);const t=[""];$('input[name="storage_destinations[]"]').each((function(){$(this).is(":checked")&&t.push($(this).val())})),requestWPApi(backwpupApi.updatejob,{storage_destinations:t},(function(e){requestWPApi(backwpupApi.storagelistcompact,{},(function(e){$("#backwpup-storage-list-compact-container").html(e)}),"GET",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseText)}))}),"POST",(function(e,a){$("#backwpup-storage-list-compact-container").html(e.responseJSON.error)}));0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length?$(".js-backwpup-onboarding-submit-form").prop("disabled",!1):$(".js-backwpup-onboarding-submit-form").prop("disabled",!0)},window.gdrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"gdrive"},(function(e){$("#gdrive_authenticate_label").html(e)}),"GET")},window.onedrive_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"onedrive"},(function(e){$("#onedrive_authenticate_label").html(e)}),"GET")},window.dropbox_refresh_authentification=function(){requestWPApi(backwpupApi.cloud_is_authenticated,{cloud_name:"dropbox"},(function(e){$("#drobox_authenticate_infos").html(e)}),"GET")},window.update_license=function(){const e=$("#license_action").val(),a={license_action:e,license_instance_key:$("#license_instance_key").val(),license_submit:!0};let t="activate";"activate"===e&&(t="deactivate",a.license_api_key=$("#license_api_key").val(),a.license_product_id=$("#license_product_id").val()),requestWPApi(backwpupApi.license_update,a,(function(e){console.log(e),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"info",font:"xs",content:e.message}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)})),backwpup_license_refresh(t),200===e.status&&console.log(e)}),"POST",(function(e,a){console.log(e.responseJSON.error),requestWPApi(backwpupApi.getblock,{block_name:"alerts/info",block_type:"component",block_data:{type:"alert",font:"xs",content:e.responseJSON.error}},(function(e){$("#backwpup_message").html(e)}),"POST",(function(e,a){console.log(e.responseJSON.error)}))}))},window.backwpup_license_refresh=function(e){let a="sidebar/license-parts/"+e;console.log(a),requestWPApi(backwpupApi.getblock,{block_name:a,block_type:"children"},(function(e){$("#backwpup_license").html(e),$(".js-backwpup-license_update").on("click",update_license)}),"POST")};const $modal=$("#backwpup-modal"),$sidebar=$("#backwpup-sidebar");function openSidebar(e){$sidebar.find("article").hide(),$sidebar.find("#sidebar-"+e).show(),$("body").addClass("overflow-hidden"),$sidebar.removeClass("translate-x-[450px]")}function closeSidebar(){$("body").removeClass("overflow-hidden"),$sidebar.addClass("translate-x-[450px]")}function openModal(e,a={}){$modal.find("article").hide();let t=$modal.find("#sidebar-"+e);t.show(),a.url&&t.find(".js-backwpup-open-url").attr("data-href",a.url),$("body").addClass("overflow-hidden"),$modal.removeClass("hidden").addClass("flex")}function closeModal(){$("body").removeClass("overflow-hidden"),$modal.addClass("hidden").removeClass("flex")}function initSugarSyncEvents(){$(".js-backwpup-authenticate-sugar-sync").on("click",(function(){let e={cloud_name:"sugarsync",sugaremail:$("#sugaremail").val(),sugarpass:$("#sugarpass").val()};requestWPApi(backwpupApi.authenticate_cloud,e,(function(e){$("#sugarsynclogin").html(e),$("#sugarsync_authenticate_infos").html(""),initSugarSyncEvents()}),"POST",(function(e,a){$("#sugarsync_authenticate_infos").html(e.responseText)}))})),$(".js-backwpup-delete-sugar-sync-auth").on("click",(function(){requestWPApi(backwpupApi.delete_auth_cloud,{cloud_name:"sugarsync"},(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),$("#sugarsynclogin").html(e),initSugarSyncEvents()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),requestWPApi(backwpupApi.getblock,{block_name:"sidebar/sugar-sync-parts/root-folder",block_type:"children"},(function(e){$("#sugarsyncroot").html(e)}),"POST",(function(e,a){$("#sugarsyncroot").html(e.responseText)}))}function initDropboxEvents(){$(".js-backwpup-test-dropbox-storage").on("click",(function(){const e={cloud_name:"dropbox",dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};let a=$("#dropbbox_code").val();a&&(e.dropbbox_code=a);let t=$("#sandbox_code").val();t&&!a&&(e.sandbox_code=t),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("DROPBOX",!1),alert(e.responseJSON.error)}))})),$(".js-backwpup-delete-dropbox-auth").on("click",(function(){const e={cloud_name:"dropbox",delete_auth:!0,dropboxmaxbackups:$("#dropboxmaxbackups").val(),dropboxdir:$("#dropboxdir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("DROPBOX",e.connected),dropbox_refresh_authentification(),closeSidebar()}),"POST",(function(e,a){alert(e.responseJSON.error)}))}))}function initModalEvent(){$(".js-backwpup-open-modal").on("click",(function(){const e=$(this).data("content");let a={};$(this).data("url")&&(a.url=$(this).data("url")),openModal(e,a)}))}$(".js-backwpup-open-sidebar").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-close-sidebar").on("click",closeSidebar),$(".js-backwpup-open-url").on("click",(function(){$(this).data("href")&&(window.location=$(this).data("href"))})),$(".js-backwpup-close-modal").on("click",closeModal),$(".js-backwpup-filter-tables").on("keyup",(function(){const e=$(this).val().toLowerCase();$(".js-backwpup-tables-list label").each((function(){""===e||$(this).find("input").attr("value").toLowerCase().includes(e)?$(this).show():$(this).hide()}))})),$(".js-backwpup-filter-tables").next(".js-backwpup-clear-search").on("click",(function(){$(".js-backwpup-tables-list label").show()}));const $backupsTable=$("#backwpup-backup-history");let isCheckboxListenerInitialized=!1;function showFrequencyFilesFields(e){"weekly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").show(),$(".js-backwpup-frequency-file-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-file-show-if-weekly").hide(),$(".js-backwpup-frequency-file-show-if-monthly").hide())}function showFrequencyTablesFields(e){"weekly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").show(),$(".js-backwpup-frequency-table-show-if-monthly").hide()),"monthly"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").show()),"daily"===e&&($(".js-backwpup-frequency-table-show-if-weekly").hide(),$(".js-backwpup-frequency-table-show-if-monthly").hide())}function initMenuEvent(){$(".js-backwpup-menu").on("click",(function(e){e.stopPropagation();const a=$(this).find(".js-backwpup-menu-content");$(".js-backwpup-menu-content").not(a).addClass("hidden"),a.hasClass("hidden")?a.removeClass("hidden"):a.addClass("hidden")})),$("#bulk-actions-apply").prop("disabled",!0),$(".js-backwpup-select-backup").on("click",(function(){const e=$(".js-backwpup-select-backup:checked").length>0;console.log(e),$("#bulk-actions-apply").prop("disabled",!e)}))}function initPaginationEvent(){$(".js-backwpup-table-pagination button").on("click",(function(){let e=$(this).data("page");loadBackupsListingAndPagination(e);let a=new URL(window.location.href);a.searchParams.set("page_num",e),history.pushState({},"",a)}))}function loadBackupsListingAndPagination(e){requestWPApi(backwpupApi.backupslistings,{page:e,length:backwpupApi.backupslistingslength},refreshBackupTable,"POST")}$(".js-backwpup-select-all").on("change",(function(){const e=$(this).prop("checked");$("#bulk-actions-apply").prop("disabled",!e),$backupsTable.find("input[type=checkbox]").prop("checked",e),isCheckboxListenerInitialized||($backupsTable.on("change","input[type=checkbox]",(function(){const e=$backupsTable.find("input[type=checkbox]").length===$backupsTable.find("input[type=checkbox]:checked").length;$(".js-backwpup-select-all").prop("checked",e)})),isCheckboxListenerInitialized=!0)})),showFrequencyFilesFields($(".js-backwpup-frequency-files").val()),showFrequencyTablesFields($(".js-backwpup-frequency-tables").val()),$(".js-backwpup-frequency-files").on("change",(function(){showFrequencyFilesFields($(this).val())})),$(".js-backwpup-frequency-tables").on("change",(function(){showFrequencyTablesFields($(this).val())})),$(document).on("click",(function(){$(".js-backwpup-menu-content").addClass("hidden")})),$(".js-backwpup-toggle-tables").on("click",(function(){postToWP({action:"backwpup_toggle_database",tables:$(this).is(":checked")}).then((e=>{}))})),$(".js-backwpup-clear-search").on("click",(function(){$(this).prev().val("")})),$(".js-backwpup-add-input-button").on("click",(function(){const e=$(this).prev().val().trim();if(""===e)return;$(this).prev().val("");let a=$(".js-backwpup-add-input-values").val().split(",");if(!a.includes(e)){a.push(e),a=[...new Set(a)],$(".js-backwpup-add-input-values").val(a.join(","));if(!$(".js-backwpup-add-input-tags button span").map((function(){return $(this).text()})).get().includes(e)){const a=$(this).parents(".js-backwpup-add-input").find(".js-backwpup-add-input-tag-template button").clone();a.find("span").text(e),a.appendTo(".js-backwpup-add-input-tags")}}})),$(".js-backwpup-add-input-tags").on("click",".js-backwpup-remove-tag",(function(){$(this).remove();let e=$(".js-backwpup-add-input-values").val().split(",");e=e.filter((e=>e!==$(this).data("tag"))),$(".js-backwpup-add-input-values").val(e.join(","))})),$(".js-backwpup-toggle-include button").on("click",(function(){const e=$(this).parents(".js-backwpup-toggle-include"),a=e.find("input[type=checkbox]");a.prop("checked",!a.prop("checked")),a.prop("checked")?(e.find(".js-backwpup-toggle-include-add").addClass("hidden"),e.find(".js-backwpup-toggle-include-remove").removeClass("hidden")):(e.find(".js-backwpup-toggle-include-add").removeClass("hidden"),e.find(".js-backwpup-toggle-include-remove").addClass("hidden"))})),$(".js-backwpup-start-backup").on("click",(function(){requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){window.location.reload()}),500)}),"POST")})),$(".js-backwpup-toggle-exclude").on("change",(function(){const e=$(this).prop("checked");$(this).closest("div").find("button").prop("disabled",!e)})),$(".js-backwpup-toggle-files").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-files-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"files"},(function(e){$("#backwpup-files-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-toggle-database").on("change",(function(){const e=$(this).prop("checked");let a=$(this).data("job-id");$("#backwpup-database-options").find("button").prop("disabled",!e),requestWPApi(backwpupApi.updatejob,{job_id:a,activ:e,type:"database"},(function(e){$("#backwpup-database-options div p.label-scheduled").html(e.message)}),"POST")})),$(".js-backwpup-test-s3-storage").on("click",(function(){if(""!=$("#s3bucketerror").html())return refresh_storage_destinations("S3",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"s3",s3region:$("#s3region").val(),s3base_url:$("#s3base_url").val(),s3base_region:$("#s3base_region").val(),s3base_version:$("#s3base_version").val(),s3base_signature:$("#s3base_signature").val(),s3accesskey:$("#s3accesskey").val(),s3secretkey:$("#s3secretkey").val(),s3bucket:$("#s3bucket").val(),s3newbucket:$("#s3newbucket").val(),s3dir:$("#s3dir").val(),s3maxbackups:$("#s3maxbackups").val(),s3storageclass:"STANDARD"===$("#s3storageclass").val()?"":$("#s3storageclass").val()};$("#s3base_multipart").prop("checked")&&(e.s3base_multipart=$("#s3base_multipart").val()),$("#s3base_pathstylebucket").prop("checked")&&(e.s3base_pathstylebucket=$("#s3base_pathstylebucket").val()),$("#s3ssencrypt").prop("checked")&&(e.s3ssencrypt=$("#s3ssencrypt").val()),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("S3",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("S3",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-glacier-storage").on("click",(function(){if(""!=$("#glacierbucketerror").html())return refresh_storage_destinations("GLACIER",!1),void alert("Error in Bucket Configurations");const e={cloud_name:"glacier",glacieraccesskey:$("#glacieraccesskey").val(),glaciersecretkey:$("#glaciersecretkey").val(),glacierregion:$("#glacierregion").val(),glaciervault:$("#glaciervault").val(),glaciermaxbackups:$("#glaciermaxbackups").val(),newvault:$("#newvault").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GLACIER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GLACIER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-folder-storage").on("click",(function(){const e={cloud_name:"folder",backupdir:$("#backupdir").val(),maxbackups:$("#maxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FOLDER",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FOLDER",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-ftp-storage").on("click",(function(){const e={cloud_name:"ftp",ftphost:$("#ftphost").val(),ftphostport:$("#ftphostport").val(),ftpuser:$("#ftpuser").val(),ftppass:$("#ftppass").val(),ftptimeout:$("#ftptimeout").val(),ftpdir:$("#ftpdir").val(),ftpmaxbackups:$("#ftpmaxbackups").val(),ftpssl:$("#ftpssl").prop("checked"),ftppasv:$("#ftppasv").prop("checked")};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("FTP",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("FTP",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-gdrive-storage").on("click",(function(){const e={cloud_name:"gdrive",gdriveusetrash:$("#gdriveusetrash").prop("checked"),gdrivemaxbackups:$("#gdrivemaxbackups").val(),gdrivedir:$("#gdrivedir").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("GDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("GDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-delete-hidrive-auth").on("click",(function(){const e={cloud_name:"hidrive",hidrive_delete_authorization:!0,hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){closeSidebar()}),"POST",(function(e,a){alert("Error in cloud configuration")}))})),$(".js-backwpup-test-hidrive-storage").on("click",(function(){const e={cloud_name:"hidrive",hidrive_max_backups:$("#hidrive_max_backups").val(),hidrive_destination_folder:$("#hidrive_destination_folder").val()};let a=$("#hidrive_authorization_code").val();a&&(e.hidrive_authorization_code=a),requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("HIDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("HIDRIVE",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-onedrive-storage").on("click",(function(){const e={cloud_name:"onedrive",onedrivedir:$("#onedrivedir").val(),onedrivemaxbackups:$("#onedrivemaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("ONEDRIVE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("ONEDRIVE",!0),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-sugar-sync-storage").on("click",(function(){const e={cloud_name:"sugarsync",sugardir:$("#sugardir").val(),sugarmaxbackups:$("#sugarmaxbackups").val(),sugarroot:$("#sugarroot").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("SUGARSYNC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("SUGARSYNC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-rackspace-cloud-storage").on("click",(function(){const e={cloud_name:"rsc",newrsccontainer:$("#newrsccontainer").val(),rscdir:$("#rscdir").val(),rscmaxbackups:$("#rscmaxbackups").val(),rsccontainer:$("#rsccontainer").val(),rscusername:$("#rscusername").val(),rscapikey:$("#rscapikey").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("RSC",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("RSC",!1),alert("Error in cloud configuration")}))})),$(".js-backwpup-test-msazure-storage").click((function(){const e={cloud_name:"msazure",msazureaccname:$("#msazureaccname").val(),msazurekey:$("#msazurekey").val(),msazurecontainer:$("#msazurecontainer").val(),newmsazurecontainer:$("#newmsazurecontainer").val(),msazuredir:$("#msazuredir").val(),msazuremaxbackups:$("#msazuremaxbackups").val()};requestWPApi(backwpupApi.cloudsaveandtest,e,(function(e){refresh_storage_destinations("MSAZURE",e.connected),closeSidebar()}),"POST",(function(e,a){refresh_storage_destinations("MSAZURE",!1),alert("Error in cloud configuration")}))}));const $onboardingSteps=$("#backwpup-onboarding-steps"),$onboardingPanes=$("#backwpup-onboarding-panes"),lineStyles="before:bg-secondary-base",circleActiveStyles="bg-secondary-base after:absolute after:z-10 after:inset after:w-12 after:h-12 after:border-secondary-base after:border after:rounded-full after:animate-pulse",circleReachedStyles="bg-secondary-base";function init_network_authentication(){const e=$(".js-backwpup-network-authentication-method").val();$("#network-"+e+"-authentication").show()}function verifyOnboardingStep1(){const e=!$(".js-backwpup-onboarding-toggle-files").prop("checked"),a=!$(".js-backwpup-onboarding-toggle-database").prop("checked");e&&a?$(".js-backwpup-onboarding-step-2").prop("disabled",!0):$(".js-backwpup-onboarding-step-2").prop("disabled",!1)}function refreshBackupTable(e,a){if(e.success&&e.data){var t=e.data,n=jQuery.parseHTML(t);jQuery("#backwpup-backup-history tbody").html(n),window.BWU.downloader.init(),initMenuEvent(),initModalEvent();let i=Math.ceil(jQuery('input[name="nb_backups"]').val()/a.length);requestWPApi(backwpupApi.backupspagination,{page:a.page,max_pages:i},refreshPagination,"POST")}}function refreshPagination(e){if(e.success&&e.data){var a=e.data,t=jQuery.parseHTML(a);jQuery("#backwpup-pagination").html(t),initPaginationEvent()}}function isGenerateJsIncluded(){const e=document.querySelectorAll("script");for(let a of e)if(a.src.includes("backwpup-generate.js")||a.src.includes("backwpup-generate.min.js"))return!0;return!1}function startBackupProcess(){isGenerateJsIncluded()?$(".progress-bar").on("hide",(function(){console.log(".progress-bar is being hidden")})):requestWPApi(backwpupApi.startbackup,{},(function(e){200===e.status&&setTimeout((function(){"#dbbackup"!==window.location.hash&&window.location.reload()}),500)}),"POST")}$(".js-backwpup-onboarding-step-1").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=1]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-2").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=2]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=2]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=1] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),$onboardingSteps.find("article[data-step=3]").removeClass(lineStyles).find("div:first-child").removeClass(circleActiveStyles),closeSidebar()})),$(".js-backwpup-onboarding-step-3").on("click",(function(){$onboardingPanes.find("article").removeClass("flex").addClass("hidden"),$onboardingPanes.find("article[data-step=3]").removeClass("hidden").addClass("flex"),$onboardingSteps.find("article[data-step=3]").addClass(lineStyles).find("div:first-child").addClass(circleActiveStyles),$onboardingSteps.find("article[data-step=2] div:first-child").removeClass(circleActiveStyles).addClass(circleReachedStyles),closeSidebar()})),$(".js-backwpup-onboarding-submit-form").on("click",(function(){0!==$('input[type="checkbox"][name^="onboarding_storage"]:checked').length&&$("#backwpup-onboarding-form").submit()})),$(".js-backwpup-toggle-storage").on("click",(function(){openSidebar($(this).data("content"))})),$(".js-backwpup-gdrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","gdrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-onedrive-reauthenticate").on("click",(function(){openModal("dialog"),$(".js-backwpup-refresh-authentification").data("trigger","onedrive_refresh_authentification"),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-refresh-authentification").on("click",(function(){let trigger=$(this).data("trigger");"function"==typeof window[trigger]?window[trigger]():eval(trigger),closeModal()})),$(".js-backwpup-modal-and-focus").on("click",(function(){openModal("dialog");const e=$(this).data("id-focus-after");$(".js-backwpup-refresh-authentification").data("trigger",'$("#'+e+'").focus()'),window.open($(this).data("url"),"_blank")})),$(".js-backwpup-gdrive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_googleclientsecret:{value:$("#backwpup_cfg_googleclientsecret").val(),secure:!0},backwpup_cfg_googleclientid:{value:$("#backwpup_cfg_googleclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#gdrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#gdrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-one-drive-connect-api").on("click",(function(){const e=$(this).closest("details");let a={backwpup_cfg_onedriveclientsecret:{value:$("#backwpup_cfg_onedriveclientsecret").val(),secure:!0},backwpup_cfg_onedriveclientid:{value:$("#backwpup_cfg_onedriveclientid").val(),secure:!1}};requestWPApi(backwpupApi.save_site_option,a,(function(a){$("#onedrive_authenticate_infos").html(a.message),e.removeAttr("open")}),"POST",(function(e,a){$("#onedrive_authenticate_infos").html("Error")}))})),$(".js-backwpup-test-storage").on("click",(function(){const e={action:"backwpup_test_storage",storage:$(this).data("storage")};postToWP(e).then((a=>{$(`input[name=storage_${e.storage}]`).prop("checked",!0);$(this).closest("#backwpup-sidebar").length>0||closeSidebar()})),$(`input[name=storage_${e.storage}]`).prop("checked",!0);const a=$(this).closest("#backwpup-sidebar").length>0;"backwpuponboarding"===new URLSearchParams(window.location.search).get("page")?closeSidebar():a?openSidebar("storages"):closeSidebar()})),init_network_authentication(),$(".js-backwpup-network-authentication-method").on("change",(function(){$("#network-authentications").children("div").hide(),init_network_authentication()})),$(".js-backwpup-sidebar-submit-form").on("click",(function(){$(this).siblings("div").children().submit()})),$(".js-backwpup-onboarding-toggle-files").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-files-setings").prop("disabled",!e),$(".onboarding-files-frequency").prop("disabled",!e),$(".onboarding-files-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-toggle-database").on("change",(function(){const e=$(this).prop("checked");$(".onboarding-advanced-database-setings").prop("disabled",!e),$(".onboarding-database-frequency").prop("disabled",!e),$(".onboarding-database-frequency-settings").prop("disabled",!e),verifyOnboardingStep1()})),$(".js-backwpup-onboarding-files-frequency").on("change",(function(){if($("#sidebar-frequency-files")){let e=$("#sidebar-frequency-files").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),$(".js-backwpup-onboarding-database-frequency").on("change",(function(){if($("#sidebar-frequency-tables")){let e=$("#sidebar-frequency-tables").find("select[name='frequency']");e.val(this.value),e.trigger("change")}})),jQuery("#backwpup-backup-history tbody").length>0&&loadBackupsListingAndPagination(getUrlParameter("page_num",1)),initModalEvent(),initSugarSyncEvents(),initDropboxEvents(),$(".save_database_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_database_settings,a,(function(e){if(200===e.status){if($("#backwpup-database-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='database_frequency']"),a=$("#sidebar-frequency-tables-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$(".save_files_settings").on("click",(function(){const e=$(this).closest("article"),a={frequency:e.find("select[name='frequency']").val(),start_time:e.find("input[name='start_time']").val(),day_of_week:e.find("select[name='day_of_week']").val(),day_of_month:e.find("select[name='day_of_month']").val()};requestWPApi(backwpupApi.save_files_settings,a,(function(e){if(200===e.status){if($("#backwpup-files-options div p.label-scheduled").html(e.next_backup),$("#backwpup-onboarding-panes")){let e=$("#backwpup-onboarding-panes").find("select[name='files_frequency']"),a=$("#sidebar-frequency-files-pro").find("select[name='frequency']");e.val(a.val())}closeSidebar()}}),"POST")})),$("#bulk-actions-apply").on("click",(function(){const e=$(this).data("action"),a=$backupsTable.find("input[type=checkbox]:checked").map((function(){return{dataset:$(this).data("delete")}})).get();requestWPApi(backwpupApi.backups_bulk_actions,{action:e,backups:a},(function(e){loadBackupsListingAndPagination(getUrlParameter("page_num",1))}),"POST"),$(".js-backwpup-select-all").prop("checked",!1)})),$("#bulk-actions-select").on("change",(function(){const e=$(this).val();$("#bulk-actions-apply").data("action",e)})),$("#save-excluded-tables").on("click",(function(){const e=$(".js-backwpup-tables-list input[type='checkbox']"),a=$(this).closest("article"),t=[];e.each((function(){$(this).is(":checked")&&t.push($(this).val())}));const n=a.find("input[type='hidden']"),i=[];n.each((function(){i.push({name:$(this).attr("name"),value:$(this).val()})})),t.forEach((function(e){i.push({name:"tabledb[]",value:e})}));const s=$.param(i);requestWPApi(backwpupApi.save_excluded_tables,s,(function(e){200===e.status&&closeSidebar()}),"POST")})),$(".js-backwpup-license_update").on("click",update_license),$(".file-exclusions-submit").on("click",(function(e){const a=$(this).closest("article").find("input"),t={};function n(e,a){e.endsWith("[]")?(t[e]||(t[e]=[]),a&&t[e].push(a)):t[e]=a}a.each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())})),$('[id^="sidebar-exclude-files-"]').each((function(){$(this).find("input").each((function(){$(this).is(":checkbox")?$(this).is(":checked")&&n($(this).attr("name"),$(this).val()):n($(this).attr("name"),$(this).val())}))}));const i=$.param(t);requestWPApi(backwpupApi.save_file_exclusions,i,(function(e){200===e.status&&closeSidebar()}),"POST")})),window.location.search.includes("backwpupfirstbackup")&&startBackupProcess();var buyProMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=buypro"]');buyProMenuItem.length&&(buyProMenuItem.attr("href","https://backwpup.com/#buy"),buyProMenuItem.attr("target","_blank"),buyProMenuItem.css({color:"#3ac495","font-weight":"bold"}));var DocsMenuItem=$('#toplevel_page_backwpup ul li a[href="admin.php?page=docs"]');DocsMenuItem.length&&(DocsMenuItem.attr("href","https://backwpup.com/docs/"),DocsMenuItem.attr("target","_blank"))})),function(e){var a=e.fn.hide;e.fn.hide=function(){return this.trigger("hide"),a.apply(this,arguments)}}(jQuery); -
backwpup/trunk/backwpup.php
r3249764 r3253259 6 6 * Author: BackWPup – WordPress Backup & Restore Plugin 7 7 * Author URI: https://backwpup.com 8 * Version: 5.0. 58 * Version: 5.0.6 9 9 * Requires at least: 4.9 10 10 * Requires PHP: 7.4 -
backwpup/trunk/changelog.txt
r3249764 r3253259 1 1 == Changelog == 2 = 5.0.6 = 3 Release date: March 10, 2025 4 5 * Fixed: Archive file format Tar generation code to handle long file names 6 * Fixed: Clicking on actions should close other opened sections in Backup History 7 2 8 = 5.0.5 = 3 9 Release date: March 03, 2025 -
backwpup/trunk/inc/class-create-archive.php
r3249764 r3253259 602 602 $chunk_size = 1024 * 1024 * 4; 603 603 $filename = $name_in_archive; 604 $filename_prefix = '';605 606 // Split filename larger than 100 chars607 if (100 < strlen($name_in_archive)) {608 $filename_offset = strlen($name_in_archive) - 100;609 $split_pos = strpos($name_in_archive, '/', $filename_offset);610 611 if ($split_pos === false) {612 $split_pos = strrpos($name_in_archive, '/');613 }614 615 $filename = substr($name_in_archive, $split_pos + 1);616 $filename_prefix = substr($name_in_archive, 0, $split_pos);617 618 if (strlen($filename) > 100) {619 $filename = substr($filename, -100);620 trigger_error(621 sprintf(622 // translators: $1 is the file name.623 esc_html__('File name "%1$s" is too long to be saved correctly in %2$s archive!', 'backwpup'),624 $name_in_archive,625 $this->method626 ),627 E_USER_WARNING628 );629 }630 631 if (155 < strlen($filename_prefix)) {632 trigger_error(633 sprintf(634 // translators: $1 is the file name to use in the archive.635 esc_html__('File path "%1$s" is too long to be saved correctly in %2$s archive!', 'backwpup'),636 $name_in_archive,637 $this->method638 ),639 E_USER_WARNING640 );641 }642 }643 604 644 605 // Get file stat. … … 663 624 $file_stat['mtime'], 664 625 0, 665 $owner, 666 $group, 667 $filename_prefix 668 ); 626 $owner, 627 $group 628 ); 669 629 670 630 $fd = false; … … 717 677 $name_in_archive = trailingslashit($name_in_archive); 718 678 719 $tar_filename = $name_in_archive; 720 $tar_filename_prefix = ''; 721 722 // Split filename larger than 100 chars. 723 if (100 < strlen($name_in_archive)) { 724 $filename_offset = strlen($name_in_archive) - 100; 725 $split_pos = strpos($name_in_archive, '/', $filename_offset); 726 727 if ($split_pos === false) { 728 $split_pos = strrpos(untrailingslashit($name_in_archive), '/'); 729 } 730 731 $tar_filename = substr($name_in_archive, $split_pos + 1); 732 $tar_filename_prefix = substr($name_in_archive, 0, $split_pos); 733 734 if (strlen($tar_filename) > 100) { 735 $tar_filename = substr($tar_filename, -100); 736 trigger_error( 737 sprintf( 738 // translators: $1 is the name of the folder. $2 is the archive name. 739 esc_html__( 740 'Folder name "%1$s" is too long to be saved correctly in %2$s archive!', 741 'backwpup' 742 ), 743 $name_in_archive, 744 $this->method 745 ), 746 E_USER_WARNING 747 ); 748 } 749 750 if (strlen($tar_filename_prefix) > 155) { 751 trigger_error( 752 sprintf( 753 // translators: $1 is the name of the folder. $2 is the archive name. 754 esc_html__( 755 'Folder path "%1$s" is too long to be saved correctly in %2$s archive!', 756 'backwpup' 757 ), 758 $name_in_archive, 759 $this->method 760 ), 761 E_USER_WARNING 762 ); 763 } 764 } 679 $tar_filename = $name_in_archive; 765 680 766 681 $file_stat = @stat($folder_name); … … 777 692 $file_stat['mtime'], 778 693 5, 779 $owner, 780 $group, 781 $tar_filename_prefix 782 ); 694 $owner, 695 $group 696 ); 783 697 784 698 $this->fwrite($header); … … 837 751 /** 838 752 * Make Tar Headers. 839 * 840 * @param string $name The name of the file or directory. Known as Item. 841 * @param string $mode the permissions for the item 842 * @param int $uid the owner ID 843 * @param int $gid the group ID 844 * @param int $size the size of the item 845 * @param int $mtime the time of the last modification 846 * @param int $typeflag The type of the item. 0 for File and 5 for Directory. 847 * @param string $owner the owner Name 848 * @param string $group the group Name 849 * @param string $prefix the item prefix 850 * 753 * 754 * @param string $name The name of the file or directory. Known as Item. 755 * @param string $mode the permissions for the item. 756 * @param int $uid the owner ID. 757 * @param int $gid the group ID. 758 * @param int $size the size of the item. 759 * @param int $mtime the time of the last modification. 760 * @param int $typeflag The type of the item. 0 for File and 5 for Directory. 761 * @param string $owner the owner Name. 762 * @param string $group the group Name. 763 * 851 764 * @return mixed|string 852 */ 853 private function make_tar_headers($name, $mode, $uid, $gid, $size, $mtime, $typeflag, $owner, $group, $prefix) 854 { 855 // Generate the TAR header for this file 856 $chunk = pack( 857 'a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12', 858 $name, //name of file 100 859 sprintf('%07o', $mode), //file mode 8 860 sprintf('%07o', $uid), //owner user ID 8 861 sprintf('%07o', $gid), //owner group ID 8 862 sprintf('%011o', $size), //length of file in bytes 12 863 sprintf('%011o', $mtime), //modify time of file 12 864 ' ', //checksum for header 8 865 $typeflag, //type of file 0 or null = File, 5=Dir 866 '', //name of linked file 100 867 'ustar', //USTAR indicator 6 868 '00', //USTAR version 2 869 $owner, //owner user name 32 870 $group, //owner group name 32 871 '', //device major number 8 872 '', //device minor number 8 873 $prefix, //prefix for file name 155 874 '' 875 ); //fill block 12 876 877 // Computes the unsigned Checksum of a file's header 878 $checksum = 0; 765 */ 766 private function make_tar_headers( $name, $mode, $uid, $gid, $size, $mtime, $typeflag, $owner, $group ) { 767 $headers = ''; 768 $orig_name = $name; 769 $prefix = ''; 770 771 // Attempt to split filename larger than 100 chars. 772 if ( 100 < strlen( $name ) ) { 773 $filename_offset = strlen( $name ) - 100; 774 $split_pos = strpos( $name, '/', $filename_offset ); 775 776 if ( false === $split_pos ) { 777 $split_pos = strrpos( $name, '/' ); 778 } 779 780 $prefix = substr( $name, 0, $split_pos ); 781 $name = substr( $name, $split_pos + 1 ); 782 } 783 784 // Handle long filenames. (gnu tar format) 785 // If the name is longer than 100 or the prefix is longer than 155 we 786 // need to encode the name as a preceeding chunk with a @LongLink 787 // header and truncate the filename in the actual header that we write. 788 if ( strlen( $name ) > 100 || strlen( $prefix ) > 155 ) { 789 $longlink_content = $orig_name . "\0"; 790 791 $longlink_header = $this->make_tar_headers( 792 '@LongLink', 793 '0000777', 794 0, 795 0, 796 strlen( $longlink_content ), 797 time(), 798 'L', 799 'root', 800 'root' 801 ); 802 803 // Add ending null byte, and pack into binary to a multiple of 512. 804 $chunk_count = ceil( strlen( $longlink_content ) / 512 ); 805 $packed_size = $chunk_count * 512; 806 $packed_content = pack( 'a' . $packed_size, $longlink_content ); 807 808 $headers .= $longlink_header . $packed_content; 809 // Truncate name for actual header. 810 $name = substr( $orig_name, 0, 100 ); 811 $prefix = ''; 812 } 813 814 // Generate the TAR header for this file. 815 $chunk = pack( 816 'a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12', 817 $name, // name of file 100. 818 sprintf( '%07o', $mode ), // file mode 8. 819 sprintf( '%07o', $uid ), // owner user ID 8. 820 sprintf( '%07o', $gid ), // owner group ID 8. 821 sprintf( '%011o', $size ), // length of file in bytes 12. 822 sprintf( '%011o', $mtime ), // modify time of file 12. 823 ' ', // checksum for header 8. 824 $typeflag, // type of file 0 or null = File, 5=Dir. 825 '', // name of linked file 100. 826 'ustar', // USTAR indicator 6. 827 ' ', // USTAR Version (00 for ustar, double-space for gnutar) 2. 828 $owner, // owner user name 32. 829 $group, // owner group name 32. 830 '', // device major number 8. 831 '', // device minor number 8. 832 $prefix, // prefix for file name 155. 833 '' 834 ); // fill block 12. 835 836 // Computes the unsigned Checksum of a file's header. 837 $checksum = 0; 879 838 880 839 for ($i = 0; $i < 512; ++$i) { … … 882 841 } 883 842 884 $checksum = pack('a8', sprintf('%07o', $checksum)); 885 886 return substr_replace($chunk, $checksum, 148, 8); 887 } 843 $checksum = pack( 'a8', sprintf( '%07o', $checksum ) ); 844 $chunk = substr_replace( $chunk, $checksum, 148, 8 ); 845 846 return $headers . $chunk; 847 } 888 848 889 849 /** -
backwpup/trunk/languages/backwpup.pot
r3249764 r3253259 7 7 "Content-Type: text/plain; charset=UTF-8\n" 8 8 "Content-Transfer-Encoding: 8bit\n" 9 "POT-Creation-Date: 2025-03- 03 14:01+0000\n"9 "POT-Creation-Date: 2025-03-10 10:19+0000\n" 10 10 "X-Poedit-Basepath: ..\n" 11 11 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" … … 390 390 msgstr "" 391 391 392 #. translators: $1 is the file name. 393 #: inc/class-create-archive.php:623 394 msgid "File name \"%1$s\" is too long to be saved correctly in %2$s archive!" 395 msgstr "" 396 397 #. translators: $1 is the file name to use in the archive. 398 #: inc/class-create-archive.php:635 399 msgid "File path \"%1$s\" is too long to be saved correctly in %2$s archive!" 400 msgstr "" 401 402 #: inc/class-create-archive.php:677 392 #: inc/class-create-archive.php:637 403 393 msgid "Cannot open source file %s for archiving. Writing an empty file." 404 394 msgstr "" 405 395 406 #. translators: $1 is the name of the folder. $2 is the archive name. 407 #: inc/class-create-archive.php:739 408 msgid "Folder name \"%1$s\" is too long to be saved correctly in %2$s archive!" 409 msgstr "" 410 411 #. translators: $1 is the name of the folder. $2 is the archive name. 412 #: inc/class-create-archive.php:754 413 msgid "Folder path \"%1$s\" is too long to be saved correctly in %2$s archive!" 414 msgstr "" 415 416 #: inc/class-create-archive.php:822 396 #: inc/class-create-archive.php:736 417 397 msgid "If %s will be added to your backup archive, the archive will be too large for operations with this PHP Version. You might want to consider splitting the backup job in multiple jobs with less files each." 418 398 msgstr "" 419 399 420 #: inc/class-create-archive.php: 900, inc/class-create-archive.php:901400 #: inc/class-create-archive.php:860, inc/class-create-archive.php:861 421 401 msgid "Unknown" 422 402 msgstr "" 423 403 424 404 #. translators: $1 is the filename to add into the archive. 425 #: inc/class-create-archive.php: 936405 #: inc/class-create-archive.php:896 426 406 msgid "Cannot open source file %s." 427 407 msgstr "" -
backwpup/trunk/readme.txt
r3249764 r3253259 6 6 Tested up to: 6.7.1 7 7 Requires PHP: 7.4 8 Stable tag: 5.0. 58 Stable tag: 5.0.6 9 9 License: GPLv2+ 10 10 … … 203 203 204 204 205 == Changelog == 205 == Changelog == 206 = 5.0.6 = 207 Release date: March 10, 2025 208 209 * Fixed: Archive file format Tar generation code to handle long file names 210 * Fixed: Clicking on actions should close other opened sections in Backup History 211 206 212 = 5.0.5 = 207 213 Release date: March 03, 2025 -
backwpup/trunk/vendor/composer/installed.php
r3249764 r3253259 2 2 'root' => array( 3 3 'name' => 'inpsyde/backwpup-pro', 4 'pretty_version' => '5.0. 5',5 'version' => '5.0. 5.0',6 'reference' => ' f94c705cd995f3383ebd213778032c4682e35771',4 'pretty_version' => '5.0.6', 5 'version' => '5.0.6.0', 6 'reference' => '70377c7302f1d67d016f74f5e9e3840f9c245626', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 225 225 ), 226 226 'inpsyde/backwpup-pro' => array( 227 'pretty_version' => '5.0. 5',228 'version' => '5.0. 5.0',229 'reference' => ' f94c705cd995f3383ebd213778032c4682e35771',227 'pretty_version' => '5.0.6', 228 'version' => '5.0.6.0', 229 'reference' => '70377c7302f1d67d016f74f5e9e3840f9c245626', 230 230 'type' => 'wordpress-plugin', 231 231 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.