Version Description
- Tested up to WordPress 5.8.1
- Fixed warnings in PHP 8 and adjusted ob_clean functions (Thank you @jrevillini)
- Added force stop for restoration and migration process
- Added force stop for backup process (troubleshooting option)
- Added splitting option for restore and migration process
- Fixed STEP display in process window for restore and backup
- Adjusted logs output for restore and backup process
- Updated database engine for export and import using new technique
- Added new option to specify export queries per file and restore batch
- Implemented splitting n into CLI restoration (disabled by default)
Download this release
Release Info
Developer | iclyde |
Plugin | Backup Migration |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.1.4
- admin/js/backup-migration.min.js +1 -1
- backup-backup.php +2 -2
- includes/ajax.php +204 -0
- includes/bypasser.php +1 -1
- includes/check/checker.php +1 -1
- includes/constants.php +18 -3
- includes/dashboard/chapter/other_config.php +36 -0
- includes/dashboard/chapter/troubleshooting.php +18 -0
- includes/dashboard/chapter/what_backed_up.php +4 -0
- includes/dashboard/translations.php +9 -0
- includes/database/better-backup.php +5 -5
- includes/database/better-restore.php +158 -18
- includes/database/smart-sort.php +1059 -0
- includes/extracter/extract.php +131 -12
- includes/htaccess/default.json +2 -0
- includes/initializer.php +4 -4
- includes/zipper/src/zip.php +3 -3
- readme.txt +26 -14
admin/js/backup-migration.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(0,function(t){var e={animation:"fade",animationDuration:350,content:null,contentAsHTML:!1,contentCloning:!1,debug:!0,delay:300,delayTouch:[300,500],functionInit:null,functionBefore:null,functionReady:null,functionAfter:null,functionFormat:null,IEmin:6,interactive:!1,multiple:!1,parent:null,plugins:["sideTip"],repositionOnScroll:!1,restoration:"none",selfDestruction:!0,theme:[],timer:0,trackerInterval:500,trackOrigin:!1,trackTooltip:!1,trigger:"hover",triggerClose:{click:!1,mouseleave:!1,originClick:!1,scroll:!1,tap:!1,touchleave:!1},triggerOpen:{click:!1,mouseenter:!1,tap:!1,touchstart:!1},updateAnimation:"rotate",zIndex:9999999},i="undefined"!=typeof window?window:null,o={hasTouchCapability:!(!i||!("ontouchstart"in i||i.DocumentTouch&&i.document instanceof i.DocumentTouch||i.navigator.maxTouchPoints)),hasTransitions:function(){if(!i)return!1;var t=(i.document.body||i.document.documentElement).style,e="transition",o=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof t[e])return!0;e=e.charAt(0).toUpperCase()+e.substr(1);for(var n=0;n<o.length;n++)if("string"==typeof t[o[n]+e])return!0;return!1}(),IE:!1,semVer:"4.2.8",window:i},n=function(){this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__instancesLatestArr=[],this.__plugins={},this._env=o};function s(t){this.$container,this.constraints=null,this.__$tooltip,this.__init(t)}function r(e,i){var o=!0;return t.each(e,function(t,n){if(void 0===i[t]||e[t]!==i[t])return o=!1,!1}),o}function a(e){var i=e.attr("id"),n=i?o.window.document.getElementById(i):null;return n?n===e[0]:t.contains(o.window.document.body,e[0])}n.prototype={__bridge:function(e,i,o){if(!i[o]){var n=function(){};n.prototype=e;var s=new n;s.__init&&s.__init(i),t.each(e,function(t,e){0!=t.indexOf("__")&&(i[t]||(i[t]=function(){return s[t].apply(s,Array.prototype.slice.apply(arguments))},i[t].bridged=s))}),i[o]=s}return this},__setWindow:function(t){return o.window=t,this},_getRuler:function(t){return new s(t)},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_plugin:function(e){if("string"==typeof e){var i=e,o=null;return i.indexOf(".")>0?o=this.__plugins[i]:t.each(this.__plugins,function(t,e){if(e.name.substring(e.name.length-i.length-1)=="."+i)return o=e,!1}),o}if(e.name.indexOf(".")<0)throw new Error("Plugins must be namespaced");return this.__plugins[e.name]=e,e.core&&this.__bridge(e.core,this,e.name),this},_trigger:function(){var t=Array.prototype.slice.apply(arguments);return"string"==typeof t[0]&&(t[0]={type:t[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,t),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,t),this},instances:function(e){var i=[];return t(e||".tooltipstered").each(function(){var e=t(this),o=e.data("tooltipster-ns");o&&t.each(o,function(t,o){i.push(e.data(o))})}),i},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(e){return t((e?e+" ":"")+".tooltipstered").toArray()},setDefaults:function(i){return t.extend(e,i),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.tooltipster=new n,t.Tooltipster=function(e,i){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace="tooltipster-"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state="closed",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(e,i)},t.Tooltipster.prototype={__init:function(i,n){var s=this;if(s._$origin=t(i),s.__options=t.extend(!0,{},e,n),s.__optionsFormat(),!o.IE||o.IE>=s.__options.IEmin){var r=null;if(void 0===s._$origin.data("tooltipster-initialTitle")&&(void 0===(r=s._$origin.attr("title"))&&(r=null),s._$origin.data("tooltipster-initialTitle",r)),null!==s.__options.content)s.__contentSet(s.__options.content);else{var a,l=s._$origin.attr("data-tooltip-content");l&&(a=t(l)),a&&a[0]?s.__contentSet(a.first()):s.__contentSet(r)}s._$origin.removeAttr("title").addClass("tooltipstered"),s.__prepareOrigin(),s.__prepareGC(),t.each(s.__options.plugins,function(t,e){s._plug(e)}),o.hasTouchCapability&&t(o.window.document.body).on("touchmove."+s.__namespace+"-triggerOpen",function(t){s._touchRecordEvent(t)}),s._on("created",function(){s.__prepareTooltip()})._on("repositioned",function(t){s.__lastPosition=t.position})}else s.__options.disabled=!0},__contentInsert:function(){var t=this._$tooltip.find(".tooltipster-content"),e=this.__Content;return this._trigger({type:"format",content:this.__Content,format:function(t){e=t}}),this.__options.functionFormat&&(e=this.__options.functionFormat.call(this,this,{origin:this._$origin[0]},this.__Content)),"string"!=typeof e||this.__options.contentAsHTML?t.empty().append(e):t.text(e),this},__contentSet:function(e){return e instanceof t&&this.__options.contentCloning&&(e=e.clone(!0)),this.__Content=e,this._trigger({type:"updated",content:e}),this},__destroyError:function(){throw new Error("This tooltip has been destroyed and cannot execute your method call.")},__geometry:function(){var e=this._$origin,i=this._$origin.is("area");if(i){var n=this._$origin.parent().attr("name");e=t('img[usemap="#'+n+'"]')}var s=e[0].getBoundingClientRect(),r=t(o.window.document),a=t(o.window),l=e,c={available:{document:null,window:null},document:{size:{height:r.height(),width:r.width()}},window:{scroll:{left:o.window.scrollX||o.window.document.documentElement.scrollLeft,top:o.window.scrollY||o.window.document.documentElement.scrollTop},size:{height:a.height(),width:a.width()}},origin:{fixedLineage:!1,offset:{},size:{height:s.bottom-s.top,width:s.right-s.left},usemapImage:i?e[0]:null,windowOffset:{bottom:s.bottom,left:s.left,right:s.right,top:s.top}}};if(i){var u=this._$origin.attr("shape"),p=this._$origin.attr("coords");if(p&&(p=p.split(","),t.map(p,function(t,e){p[e]=parseInt(t)})),"default"!=u)switch(u){case"circle":var d=p[0],_=p[1],f=p[2],h=_-f,m=d-f;c.origin.size.height=2*f,c.origin.size.width=c.origin.size.height,c.origin.windowOffset.left+=m,c.origin.windowOffset.top+=h;break;case"rect":var g=p[0],b=p[1],w=p[2],v=p[3];c.origin.size.height=v-b,c.origin.size.width=w-g,c.origin.windowOffset.left+=g,c.origin.windowOffset.top+=b;break;case"poly":for(var y=0,k=0,x=0,$=0,C="even",T=0;T<p.length;T++){var I=p[T];"even"==C?(I>x&&(x=I,0===T&&(y=x)),I<y&&(y=I),C="odd"):(I>$&&($=I,1==T&&(k=$)),I<k&&(k=I),C="even")}c.origin.size.height=$-k,c.origin.size.width=x-y,c.origin.windowOffset.left+=y,c.origin.windowOffset.top+=k}}for(this._trigger({type:"geometry",edit:function(t){c.origin.size.height=t.height,c.origin.windowOffset.left=t.left,c.origin.windowOffset.top=t.top,c.origin.size.width=t.width},geometry:{height:c.origin.size.height,left:c.origin.windowOffset.left,top:c.origin.windowOffset.top,width:c.origin.size.width}}),c.origin.windowOffset.right=c.origin.windowOffset.left+c.origin.size.width,c.origin.windowOffset.bottom=c.origin.windowOffset.top+c.origin.size.height,c.origin.offset.left=c.origin.windowOffset.left+c.window.scroll.left,c.origin.offset.top=c.origin.windowOffset.top+c.window.scroll.top,c.origin.offset.bottom=c.origin.offset.top+c.origin.size.height,c.origin.offset.right=c.origin.offset.left+c.origin.size.width,c.available.document={bottom:{height:c.document.size.height-c.origin.offset.bottom,width:c.document.size.width},left:{height:c.document.size.height,width:c.origin.offset.left},right:{height:c.document.size.height,width:c.document.size.width-c.origin.offset.right},top:{height:c.origin.offset.top,width:c.document.size.width}},c.available.window={bottom:{height:Math.max(c.window.size.height-Math.max(c.origin.windowOffset.bottom,0),0),width:c.window.size.width},left:{height:c.window.size.height,width:Math.max(c.origin.windowOffset.left,0)},right:{height:c.window.size.height,width:Math.max(c.window.size.width-Math.max(c.origin.windowOffset.right,0),0)},top:{height:Math.max(c.origin.windowOffset.top,0),width:c.window.size.width}};"html"!=l[0].tagName.toLowerCase();){if("fixed"==l.css("position")){c.origin.fixedLineage=!0;break}l=l.parent()}return c},__optionsFormat:function(){return"number"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),"number"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),"number"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),"string"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),null===this.__options.parent?this.__options.parent=t(o.window.document.body):"string"==typeof this.__options.parent&&(this.__options.parent=t(this.__options.parent)),"hover"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):"click"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger("options"),this},__prepareGC:function(){var e=this;return e.__options.selfDestruction?e.__garbageCollector=setInterval(function(){var i=(new Date).getTime();e.__touchEvents=t.grep(e.__touchEvents,function(t,e){return i-t.time>6e4}),a(e._$origin)||e.close(function(){e.destroy()})},2e4):clearInterval(e.__garbageCollector),e},__prepareOrigin:function(){var t=this;if(t._$origin.off("."+t.__namespace+"-triggerOpen"),o.hasTouchCapability&&t._$origin.on("touchstart."+t.__namespace+"-triggerOpen touchend."+t.__namespace+"-triggerOpen touchcancel."+t.__namespace+"-triggerOpen",function(e){t._touchRecordEvent(e)}),t.__options.triggerOpen.click||t.__options.triggerOpen.tap&&o.hasTouchCapability){var e="";t.__options.triggerOpen.click&&(e+="click."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.tap&&o.hasTouchCapability&&(e+="touchend."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){t._touchIsMeaningfulEvent(e)&&t._open(e)})}if(t.__options.triggerOpen.mouseenter||t.__options.triggerOpen.touchstart&&o.hasTouchCapability){e="";t.__options.triggerOpen.mouseenter&&(e+="mouseenter."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.touchstart&&o.hasTouchCapability&&(e+="touchstart."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){!t._touchIsTouchEvent(e)&&t._touchIsEmulatedEvent(e)||(t.__pointerIsOverOrigin=!0,t._openShortly(e))})}if(t.__options.triggerClose.mouseleave||t.__options.triggerClose.touchleave&&o.hasTouchCapability){e="";t.__options.triggerClose.mouseleave&&(e+="mouseleave."+t.__namespace+"-triggerOpen "),t.__options.triggerClose.touchleave&&o.hasTouchCapability&&(e+="touchend."+t.__namespace+"-triggerOpen touchcancel."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){t._touchIsMeaningfulEvent(e)&&(t.__pointerIsOverOrigin=!1)})}return t},__prepareTooltip:function(){var e=this,i=e.__options.interactive?"auto":"";return e._$tooltip.attr("id",e.__namespace).css({"pointer-events":i,zIndex:e.__options.zIndex}),t.each(e.__previousThemes,function(t,i){e._$tooltip.removeClass(i)}),t.each(e.__options.theme,function(t,i){e._$tooltip.addClass(i)}),e.__previousThemes=t.merge([],e.__options.theme),e},__scrollHandler:function(e){if(this.__options.triggerClose.scroll)this._close(e);else if(a(this._$origin)&&a(this._$tooltip)){var i=null;if(e.target===o.window.document)this.__Geometry.origin.fixedLineage||this.__options.repositionOnScroll&&this.reposition(e);else{i=this.__geometry();var n=!1;if("fixed"!=this._$origin.css("position")&&this.__$originParents.each(function(e,o){var s=t(o),r=s.css("overflow-x"),a=s.css("overflow-y");if("visible"!=r||"visible"!=a){var l=o.getBoundingClientRect();if("visible"!=r&&(i.origin.windowOffset.left<l.left||i.origin.windowOffset.right>l.right))return n=!0,!1;if("visible"!=a&&(i.origin.windowOffset.top<l.top||i.origin.windowOffset.bottom>l.bottom))return n=!0,!1}if("fixed"==s.css("position"))return!1}),n)this._$tooltip.css("visibility","hidden");else if(this._$tooltip.css("visibility","visible"),this.__options.repositionOnScroll)this.reposition(e);else{var s=i.origin.offset.left-this.__Geometry.origin.offset.left,r=i.origin.offset.top-this.__Geometry.origin.offset.top;this._$tooltip.css({left:this.__lastPosition.coord.left+s,top:this.__lastPosition.coord.top+r})}}this._trigger({type:"scroll",event:e,geo:i})}return this},__stateSet:function(t){return this.__state=t,this._trigger({type:"state",state:t}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,t.each(this.__timeouts.close,function(t,e){clearTimeout(e)}),this.__timeouts.close=[],this},__trackerStart:function(){var t=this,e=t._$tooltip.find(".tooltipster-content");return t.__options.trackTooltip&&(t.__contentBcr=e[0].getBoundingClientRect()),t.__tracker=setInterval(function(){if(a(t._$origin)&&a(t._$tooltip)){if(t.__options.trackOrigin){var i=t.__geometry(),o=!1;r(i.origin.size,t.__Geometry.origin.size)&&(t.__Geometry.origin.fixedLineage?r(i.origin.windowOffset,t.__Geometry.origin.windowOffset)&&(o=!0):r(i.origin.offset,t.__Geometry.origin.offset)&&(o=!0)),o||(t.__options.triggerClose.mouseleave?t._close():t.reposition())}if(t.__options.trackTooltip){var n=e[0].getBoundingClientRect();n.height===t.__contentBcr.height&&n.width===t.__contentBcr.width||(t.reposition(),t.__contentBcr=n)}}else t._close()},t.__options.trackerInterval),t},_close:function(e,i,n){var s=this,r=!0;if(s._trigger({type:"close",event:e,stop:function(){r=!1}}),r||n){i&&s.__callbacks.close.push(i),s.__callbacks.open=[],s.__timeoutsClear();var a=function(){t.each(s.__callbacks.close,function(t,i){i.call(s,s,{event:e,origin:s._$origin[0]})}),s.__callbacks.close=[]};if("closed"!=s.__state){var l=!0,c=(new Date).getTime()+s.__options.animationDuration[1];if("disappearing"==s.__state&&c>s.__closingTime&&s.__options.animationDuration[1]>0&&(l=!1),l){s.__closingTime=c,"disappearing"!=s.__state&&s.__stateSet("disappearing");var u=function(){clearInterval(s.__tracker),s._trigger({type:"closing",event:e}),s._$tooltip.off("."+s.__namespace+"-triggerClose").removeClass("tooltipster-dying"),t(o.window).off("."+s.__namespace+"-triggerClose"),s.__$originParents.each(function(e,i){t(i).off("scroll."+s.__namespace+"-triggerClose")}),s.__$originParents=null,t(o.window.document.body).off("."+s.__namespace+"-triggerClose"),s._$origin.off("."+s.__namespace+"-triggerClose"),s._off("dismissable"),s.__stateSet("closed"),s._trigger({type:"after",event:e}),s.__options.functionAfter&&s.__options.functionAfter.call(s,s,{event:e,origin:s._$origin[0]}),a()};o.hasTransitions?(s._$tooltip.css({"-moz-animation-duration":s.__options.animationDuration[1]+"ms","-ms-animation-duration":s.__options.animationDuration[1]+"ms","-o-animation-duration":s.__options.animationDuration[1]+"ms","-webkit-animation-duration":s.__options.animationDuration[1]+"ms","animation-duration":s.__options.animationDuration[1]+"ms","transition-duration":s.__options.animationDuration[1]+"ms"}),s._$tooltip.clearQueue().removeClass("tooltipster-show").addClass("tooltipster-dying"),s.__options.animationDuration[1]>0&&s._$tooltip.delay(s.__options.animationDuration[1]),s._$tooltip.queue(u)):s._$tooltip.stop().fadeOut(s.__options.animationDuration[1],u)}}else a()}return s},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(e,i){var n=this;if(!n.__destroying&&a(n._$origin)&&n.__enabled){var s=!0;if("closed"==n.__state&&(n._trigger({type:"before",event:e,stop:function(){s=!1}}),s&&n.__options.functionBefore&&(s=n.__options.functionBefore.call(n,n,{event:e,origin:n._$origin[0]}))),!1!==s&&null!==n.__Content){i&&n.__callbacks.open.push(i),n.__callbacks.close=[],n.__timeoutsClear();var r,l=function(){"stable"!=n.__state&&n.__stateSet("stable"),t.each(n.__callbacks.open,function(t,e){e.call(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}),n.__callbacks.open=[]};if("closed"!==n.__state)r=0,"disappearing"===n.__state?(n.__stateSet("appearing"),o.hasTransitions?(n._$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-show"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(l)):n._$tooltip.stop().fadeIn(l)):"stable"==n.__state&&l();else{if(n.__stateSet("appearing"),r=n.__options.animationDuration[0],n.__contentInsert(),n.reposition(e,!0),o.hasTransitions?(n._$tooltip.addClass("tooltipster-"+n.__options.animation).addClass("tooltipster-initial").css({"-moz-animation-duration":n.__options.animationDuration[0]+"ms","-ms-animation-duration":n.__options.animationDuration[0]+"ms","-o-animation-duration":n.__options.animationDuration[0]+"ms","-webkit-animation-duration":n.__options.animationDuration[0]+"ms","animation-duration":n.__options.animationDuration[0]+"ms","transition-duration":n.__options.animationDuration[0]+"ms"}),setTimeout(function(){"closed"!=n.__state&&(n._$tooltip.addClass("tooltipster-show").removeClass("tooltipster-initial"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(l))},0)):n._$tooltip.css("display","none").fadeIn(n.__options.animationDuration[0],l),n.__trackerStart(),t(o.window).on("resize."+n.__namespace+"-triggerClose",function(e){var i=t(document.activeElement);(i.is("input")||i.is("textarea"))&&t.contains(n._$tooltip[0],i[0])||n.reposition(e)}).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)}),n.__$originParents=n._$origin.parents(),n.__$originParents.each(function(e,i){t(i).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)})}),n.__options.triggerClose.mouseleave||n.__options.triggerClose.touchleave&&o.hasTouchCapability){n._on("dismissable",function(t){t.dismissable?t.delay?(d=setTimeout(function(){n._close(t.event)},t.delay),n.__timeouts.close.push(d)):n._close(t):clearTimeout(d)});var c=n._$origin,u="",p="",d=null;n.__options.interactive&&(c=c.add(n._$tooltip)),n.__options.triggerClose.mouseleave&&(u+="mouseenter."+n.__namespace+"-triggerClose ",p+="mouseleave."+n.__namespace+"-triggerClose "),n.__options.triggerClose.touchleave&&o.hasTouchCapability&&(u+="touchstart."+n.__namespace+"-triggerClose",p+="touchend."+n.__namespace+"-triggerClose touchcancel."+n.__namespace+"-triggerClose"),c.on(p,function(t){if(n._touchIsTouchEvent(t)||!n._touchIsEmulatedEvent(t)){var e="mouseleave"==t.type?n.__options.delay:n.__options.delayTouch;n._trigger({delay:e[1],dismissable:!0,event:t,type:"dismissable"})}}).on(u,function(t){!n._touchIsTouchEvent(t)&&n._touchIsEmulatedEvent(t)||n._trigger({dismissable:!1,event:t,type:"dismissable"})})}n.__options.triggerClose.originClick&&n._$origin.on("click."+n.__namespace+"-triggerClose",function(t){n._touchIsTouchEvent(t)||n._touchIsEmulatedEvent(t)||n._close(t)}),(n.__options.triggerClose.click||n.__options.triggerClose.tap&&o.hasTouchCapability)&&setTimeout(function(){if("closed"!=n.__state){var e="",i=t(o.window.document.body);n.__options.triggerClose.click&&(e+="click."+n.__namespace+"-triggerClose "),n.__options.triggerClose.tap&&o.hasTouchCapability&&(e+="touchend."+n.__namespace+"-triggerClose"),i.on(e,function(e){n._touchIsMeaningfulEvent(e)&&(n._touchRecordEvent(e),n.__options.interactive&&t.contains(n._$tooltip[0],e.target)||n._close(e))}),n.__options.triggerClose.tap&&o.hasTouchCapability&&i.on("touchstart."+n.__namespace+"-triggerClose",function(t){n._touchRecordEvent(t)})}},0),n._trigger("ready"),n.__options.functionReady&&n.__options.functionReady.call(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}if(n.__options.timer>0){d=setTimeout(function(){n._close()},n.__options.timer+r);n.__timeouts.close.push(d)}}}return n},_openShortly:function(t){var e=this,i=!0;if("stable"!=e.__state&&"appearing"!=e.__state&&!e.__timeouts.open&&(e._trigger({type:"start",event:t,stop:function(){i=!1}}),i)){var o=0==t.type.indexOf("touch")?e.__options.delayTouch:e.__options.delay;o[0]?e.__timeouts.open=setTimeout(function(){e.__timeouts.open=null,e.__pointerIsOverOrigin&&e._touchIsMeaningfulEvent(t)?(e._trigger("startend"),e._open(t)):e._trigger("startcancel")},o[0]):(e._trigger("startend"),e._open(t))}return e},_optionsExtract:function(e,i){var o=this,n=t.extend(!0,{},i),s=o.__options[e];return s||(s={},t.each(i,function(t,e){var i=o.__options[t];void 0!==i&&(s[t]=i)})),t.each(n,function(e,i){void 0!==s[e]&&("object"!=typeof i||i instanceof Array||null==i||"object"!=typeof s[e]||s[e]instanceof Array||null==s[e]?n[e]=s[e]:t.extend(n[e],s[e]))}),n},_plug:function(e){var i=t.tooltipster._plugin(e);if(!i)throw new Error('The "'+e+'" plugin is not defined');return i.instance&&t.tooltipster.__bridge(i.instance,this,i.name),this},_touchIsEmulatedEvent:function(t){for(var e=!1,i=(new Date).getTime(),o=this.__touchEvents.length-1;o>=0;o--){var n=this.__touchEvents[o];if(!(i-n.time<500))break;n.target===t.target&&(e=!0)}return e},_touchIsMeaningfulEvent:function(t){return this._touchIsTouchEvent(t)&&!this._touchSwiped(t.target)||!this._touchIsTouchEvent(t)&&!this._touchIsEmulatedEvent(t)},_touchIsTouchEvent:function(t){return 0==t.type.indexOf("touch")},_touchRecordEvent:function(t){return this._touchIsTouchEvent(t)&&(t.time=(new Date).getTime(),this.__touchEvents.push(t)),this},_touchSwiped:function(t){for(var e=!1,i=this.__touchEvents.length-1;i>=0;i--){var o=this.__touchEvents[i];if("touchmove"==o.type){e=!0;break}if("touchstart"==o.type&&t===o.target)break}return e},_trigger:function(){var e=Array.prototype.slice.apply(arguments);return"string"==typeof e[0]&&(e[0]={type:e[0]}),e[0].instance=this,e[0].origin=this._$origin?this._$origin[0]:null,e[0].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,e),t.tooltipster._trigger.apply(t.tooltipster,e),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,e),this},_unplug:function(e){var i=this;if(i[e]){var o=t.tooltipster._plugin(e);o.instance&&t.each(o.instance,function(t,o){i[t]&&i[t].bridged===i[e]&&delete i[t]}),i[e].__destroy&&i[e].__destroy(),delete i[e]}return i},close:function(t){return this.__destroyed?this.__destroyError():this._close(null,t),this},content:function(t){var e=this;if(void 0===t)return e.__Content;if(e.__destroyed)e.__destroyError();else if(e.__contentSet(t),null!==e.__Content){if("closed"!==e.__state&&(e.__contentInsert(),e.reposition(),e.__options.updateAnimation))if(o.hasTransitions){var i=e.__options.updateAnimation;e._$tooltip.addClass("tooltipster-update-"+i),setTimeout(function(){"closed"!=e.__state&&e._$tooltip.removeClass("tooltipster-update-"+i)},1e3)}else e._$tooltip.fadeTo(200,.5,function(){"closed"!=e.__state&&e._$tooltip.fadeTo(200,1)})}else e._close();return e},destroy:function(){var e=this;if(e.__destroyed)e.__destroyError();else{"closed"!=e.__state?e.option("animationDuration",0)._close(null,null,!0):e.__timeoutsClear(),e._trigger("destroy"),e.__destroyed=!0,e._$origin.removeData(e.__namespace).off("."+e.__namespace+"-triggerOpen"),t(o.window.document.body).off("."+e.__namespace+"-triggerOpen");var i=e._$origin.data("tooltipster-ns");if(i)if(1===i.length){var n=null;"previous"==e.__options.restoration?n=e._$origin.data("tooltipster-initialTitle"):"current"==e.__options.restoration&&(n="string"==typeof e.__Content?e.__Content:t("<div></div>").append(e.__Content).html()),n&&e._$origin.attr("title",n),e._$origin.removeClass("tooltipstered"),e._$origin.removeData("tooltipster-ns").removeData("tooltipster-initialTitle")}else i=t.grep(i,function(t,i){return t!==e.__namespace}),e._$origin.data("tooltipster-ns",i);e._trigger("destroyed"),e._off(),e.off(),e.__Content=null,e.__$emitterPrivate=null,e.__$emitterPublic=null,e.__options.parent=null,e._$origin=null,e._$tooltip=null,t.tooltipster.__instancesLatestArr=t.grep(t.tooltipster.__instancesLatestArr,function(t,i){return e!==t}),clearInterval(e.__garbageCollector)}return e},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){if(!this.__destroyed)return this._$origin[0];this.__destroyError()},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(t){return this.close(t)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(t){return this.__destroyed?this.__destroyError():this._open(null,t),this},option:function(e,i){return void 0===i?this.__options[e]:(this.__destroyed?this.__destroyError():(this.__options[e]=i,this.__optionsFormat(),t.inArray(e,["trigger","triggerClose","triggerOpen"])>=0&&this.__prepareOrigin(),"selfDestruction"===e&&this.__prepareGC()),this)},reposition:function(t,e){return this.__destroyed?this.__destroyError():"closed"!=this.__state&&a(this._$origin)&&(e||a(this._$tooltip))&&(e||this._$tooltip.detach(),this.__Geometry=this.__geometry(),this._trigger({type:"reposition",event:t,helper:{geo:this.__Geometry}})),this},show:function(t){return this.open(t)},status:function(){return{destroyed:this.__destroyed,enabled:this.__enabled,open:"closed"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.fn.tooltipster=function(){var i=Array.prototype.slice.apply(arguments);if(0===this.length)return this;if("string"==typeof i[0]){var o="#*$~&";return this.each(function(){var e=t(this).data("tooltipster-ns"),n=e?t(this).data(e[0]):null;if(!n)throw new Error("You called Tooltipster's \""+i[0]+'" method on an uninitialized element');if("function"!=typeof n[i[0]])throw new Error('Unknown method "'+i[0]+'"');this.length>1&&"content"==i[0]&&(i[1]instanceof t||"object"==typeof i[1]&&null!=i[1]&&i[1].tagName)&&!n.__options.contentCloning&&n.__options.debug;var s=n[i[0]](i[1],i[2]);if(s!==n||"instance"===i[0])return o=s,!1}),"#*$~&"!==o?o:this}t.tooltipster.__instancesLatestArr=[];var n=i[0]&&void 0!==i[0].multiple,s=n&&i[0].multiple||!n&&e.multiple,r=i[0]&&void 0!==i[0].content,a=r&&i[0].content||!r&&e.content,l=i[0]&&void 0!==i[0].contentCloning,c=(l&&i[0].contentCloning,i[0]&&void 0!==i[0].debug);c&&i[0].debug;return this.length>1&&(a instanceof t||"object"==typeof a&&null!=a&&a.tagName),this.each(function(){var e=!1,o=t(this),n=o.data("tooltipster-ns"),r=null;n?s&&(e=!0):e=!0,e&&(r=new t.Tooltipster(this,i[0]),n||(n=[]),n.push(r.__namespace),o.data("tooltipster-ns",n),o.data(r.__namespace,r),r.__options.functionInit&&r.__options.functionInit.call(r,r,{origin:this}),r._trigger("init")),t.tooltipster.__instancesLatestArr.push(r)}),this},s.prototype={__init:function(e){this.__$tooltip=e,this.__$tooltip.css({left:0,overflow:"hidden",position:"absolute",top:0}).find(".tooltipster-content").css("overflow","auto"),this.$container=t('<div class="tooltipster-ruler"></div>').append(this.__$tooltip).appendTo(o.window.document.body)},__forceRedraw:function(){var t=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(t)},constrain:function(t,e){return this.constraints={width:t,height:e},this.__$tooltip.css({display:"block",height:"",overflow:"auto",width:t}),this},destroy:function(){this.__$tooltip.detach().find(".tooltipster-content").css({display:"",overflow:""}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:"",height:"",overflow:"visible",width:""}),this},measure:function(){this.__forceRedraw();var t=this.__$tooltip[0].getBoundingClientRect(),e={size:{height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}};if(this.constraints){var i=this.__$tooltip.find(".tooltipster-content"),n=this.__$tooltip.outerHeight(),s=i[0].getBoundingClientRect(),r={height:n<=this.constraints.height,width:t.width<=this.constraints.width&&s.width>=i[0].scrollWidth-1};e.fits=r.height&&r.width}return o.IE&&o.IE<=11&&e.size.width!==o.window.document.documentElement.clientWidth&&(e.size.width=Math.ceil(e.size.width)+1),e}};var l=navigator.userAgent.toLowerCase();-1!=l.indexOf("msie")?o.IE=parseInt(l.split("msie")[1]):-1!==l.toLowerCase().indexOf("trident")&&-1!==l.indexOf(" rv:11")?o.IE=11:-1!=l.toLowerCase().indexOf("edge/")&&(o.IE=parseInt(l.toLowerCase().split("edge/")[1])),t.tooltipster._plugin({name:"tooltipster.sideTip",instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:"top",viewportAware:!0}},__init:function(t){var e=this;e.__instance=t,e.__namespace="tooltipster-sideTip-"+Math.round(1e6*Math.random()),e.__previousState="closed",e.__options,e.__optionsFormat(),e.__instance._on("state."+e.__namespace,function(t){"closed"==t.state?e.__close():"appearing"==t.state&&"closed"==e.__previousState&&e.__create(),e.__previousState=t.state}),e.__instance._on("options."+e.__namespace,function(){e.__optionsFormat()}),e.__instance._on("reposition."+e.__namespace,function(t){e.__reposition(t.event,t.helper)})},__close:function(){this.__instance.content()instanceof t&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var e=t('<div class="tooltipster-base tooltipster-sidetip"><div class="tooltipster-box"><div class="tooltipster-content"></div></div><div class="tooltipster-arrow"><div class="tooltipster-arrow-uncropped"><div class="tooltipster-arrow-border"></div><div class="tooltipster-arrow-background"></div></div></div></div>');this.__options.arrow||e.find(".tooltipster-box").css("margin",0).end().find(".tooltipster-arrow").hide(),this.__options.minWidth&&e.css("min-width",this.__options.minWidth+"px"),this.__options.maxWidth&&e.css("max-width",this.__options.maxWidth+"px"),this.__instance._$tooltip=e,this.__instance._trigger("created")},__destroy:function(){this.__instance._off("."+self.__namespace)},__optionsFormat:function(){if(this.__options=this.__instance._optionsExtract("tooltipster.sideTip",this.__defaults()),this.__options.position&&(this.__options.side=this.__options.position),"object"!=typeof this.__options.distance&&(this.__options.distance=[this.__options.distance]),this.__options.distance.length<4&&(void 0===this.__options.distance[1]&&(this.__options.distance[1]=this.__options.distance[0]),void 0===this.__options.distance[2]&&(this.__options.distance[2]=this.__options.distance[0]),void 0===this.__options.distance[3]&&(this.__options.distance[3]=this.__options.distance[1])),this.__options.distance={top:this.__options.distance[0],right:this.__options.distance[1],bottom:this.__options.distance[2],left:this.__options.distance[3]},"string"==typeof this.__options.side){this.__options.side=[this.__options.side,{top:"bottom",right:"left",bottom:"top",left:"right"}[this.__options.side]],"left"==this.__options.side[0]||"right"==this.__options.side[0]?this.__options.side.push("top","bottom"):this.__options.side.push("right","left")}6===t.tooltipster._env.IE&&!0!==this.__options.arrow&&(this.__options.arrow=!1)},__reposition:function(e,i){var o,n=this,s=n.__targetFind(i),r=[];n.__instance._$tooltip.detach();var a=n.__instance._$tooltip.clone(),l=t.tooltipster._getRuler(a),c=!1,u=n.__instance.option("animation");switch(u&&a.removeClass("tooltipster-"+u),t.each(["window","document"],function(o,u){var p=null;if(n.__instance._trigger({container:u,helper:i,satisfied:c,takeTest:function(t){p=t},results:r,type:"positionTest"}),1==p||0!=p&&0==c&&("window"!=u||n.__options.viewportAware))for(o=0;o<n.__options.side.length;o++){var d={horizontal:0,vertical:0},_=n.__options.side[o];"top"==_||"bottom"==_?d.vertical=n.__options.distance[_]:d.horizontal=n.__options.distance[_],n.__sideChange(a,_),t.each(["natural","constrained"],function(t,o){if(p=null,n.__instance._trigger({container:u,event:e,helper:i,mode:o,results:r,satisfied:c,side:_,takeTest:function(t){p=t},type:"positionTest"}),1==p||0!=p&&0==c){var a={container:u,distance:d,fits:null,mode:o,outerSize:null,side:_,size:null,target:s[_],whole:null},f=("natural"==o?l.free():l.constrain(i.geo.available[u][_].width-d.horizontal,i.geo.available[u][_].height-d.vertical)).measure();if(a.size=f.size,a.outerSize={height:f.size.height+d.vertical,width:f.size.width+d.horizontal},"natural"==o?i.geo.available[u][_].width>=a.outerSize.width&&i.geo.available[u][_].height>=a.outerSize.height?a.fits=!0:a.fits=!1:a.fits=f.fits,"window"==u&&(a.fits?a.whole="top"==_||"bottom"==_?i.geo.origin.windowOffset.right>=n.__options.minIntersection&&i.geo.window.size.width-i.geo.origin.windowOffset.left>=n.__options.minIntersection:i.geo.origin.windowOffset.bottom>=n.__options.minIntersection&&i.geo.window.size.height-i.geo.origin.windowOffset.top>=n.__options.minIntersection:a.whole=!1),r.push(a),a.whole)c=!0;else if("natural"==a.mode&&(a.fits||a.size.width<=i.geo.available[u][_].width))return!1}})}}),n.__instance._trigger({edit:function(t){r=t},event:e,helper:i,results:r,type:"positionTested"}),r.sort(function(t,e){return t.whole&&!e.whole?-1:!t.whole&&e.whole?1:t.whole&&e.whole?(i=n.__options.side.indexOf(t.side))<(o=n.__options.side.indexOf(e.side))?-1:i>o?1:"natural"==t.mode?-1:1:t.fits&&!e.fits?-1:!t.fits&&e.fits?1:t.fits&&e.fits?(i=n.__options.side.indexOf(t.side))<(o=n.__options.side.indexOf(e.side))?-1:i>o?1:"natural"==t.mode?-1:1:"document"==t.container&&"bottom"==t.side&&"natural"==t.mode?-1:1;var i,o}),(o=r[0]).coord={},o.side){case"left":case"right":o.coord.top=Math.floor(o.target-o.size.height/2);break;case"bottom":case"top":o.coord.left=Math.floor(o.target-o.size.width/2)}switch(o.side){case"left":o.coord.left=i.geo.origin.windowOffset.left-o.outerSize.width;break;case"right":o.coord.left=i.geo.origin.windowOffset.right+o.distance.horizontal;break;case"top":o.coord.top=i.geo.origin.windowOffset.top-o.outerSize.height;break;case"bottom":o.coord.top=i.geo.origin.windowOffset.bottom+o.distance.vertical}"window"==o.container?"top"==o.side||"bottom"==o.side?o.coord.left<0?i.geo.origin.windowOffset.right-this.__options.minIntersection>=0?o.coord.left=0:o.coord.left=i.geo.origin.windowOffset.right-this.__options.minIntersection-1:o.coord.left>i.geo.window.size.width-o.size.width&&(i.geo.origin.windowOffset.left+this.__options.minIntersection<=i.geo.window.size.width?o.coord.left=i.geo.window.size.width-o.size.width:o.coord.left=i.geo.origin.windowOffset.left+this.__options.minIntersection+1-o.size.width):o.coord.top<0?i.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?o.coord.top=0:o.coord.top=i.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:o.coord.top>i.geo.window.size.height-o.size.height&&(i.geo.origin.windowOffset.top+this.__options.minIntersection<=i.geo.window.size.height?o.coord.top=i.geo.window.size.height-o.size.height:o.coord.top=i.geo.origin.windowOffset.top+this.__options.minIntersection+1-o.size.height):(o.coord.left>i.geo.window.size.width-o.size.width&&(o.coord.left=i.geo.window.size.width-o.size.width),o.coord.left<0&&(o.coord.left=0)),n.__sideChange(a,o.side),i.tooltipClone=a[0],i.tooltipParent=n.__instance.option("parent").parent[0],i.mode=o.mode,i.whole=o.whole,i.origin=n.__instance._$origin[0],i.tooltip=n.__instance._$tooltip[0],delete o.container,delete o.fits,delete o.mode,delete o.outerSize,delete o.whole,o.distance=o.distance.horizontal||o.distance.vertical;var p,d,_,f=t.extend(!0,{},o);if(n.__instance._trigger({edit:function(t){o=t},event:e,helper:i,position:f,type:"position"}),n.__options.functionPosition){var h=n.__options.functionPosition.call(n,n.__instance,i,f);h&&(o=h)}l.destroy(),"top"==o.side||"bottom"==o.side?(p={prop:"left",val:o.target-o.coord.left},d=o.size.width-this.__options.minIntersection):(p={prop:"top",val:o.target-o.coord.top},d=o.size.height-this.__options.minIntersection),p.val<this.__options.minIntersection?p.val=this.__options.minIntersection:p.val>d&&(p.val=d),_=i.geo.origin.fixedLineage?i.geo.origin.windowOffset:{left:i.geo.origin.windowOffset.left+i.geo.window.scroll.left,top:i.geo.origin.windowOffset.top+i.geo.window.scroll.top},o.coord={left:_.left+(o.coord.left-i.geo.origin.windowOffset.left),top:_.top+(o.coord.top-i.geo.origin.windowOffset.top)},n.__sideChange(n.__instance._$tooltip,o.side),i.geo.origin.fixedLineage?n.__instance._$tooltip.css("position","fixed"):n.__instance._$tooltip.css("position",""),n.__instance._$tooltip.css({left:o.coord.left,top:o.coord.top,height:o.size.height,width:o.size.width}).find(".tooltipster-arrow").css({left:"",top:""}).css(p.prop,p.val),n.__instance._$tooltip.appendTo(n.__instance.option("parent")),n.__instance._trigger({type:"repositioned",event:e,position:o})},__sideChange:function(t,e){t.removeClass("tooltipster-bottom").removeClass("tooltipster-left").removeClass("tooltipster-right").removeClass("tooltipster-top").addClass("tooltipster-"+e)},__targetFind:function(t){var e={},i=this.__instance._$origin[0].getClientRects();i.length>1&&(1==this.__instance._$origin.css("opacity")&&(this.__instance._$origin.css("opacity",.99),i=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1)));if(i.length<2)e.top=Math.floor(t.geo.origin.windowOffset.left+t.geo.origin.size.width/2),e.bottom=e.top,e.left=Math.floor(t.geo.origin.windowOffset.top+t.geo.origin.size.height/2),e.right=e.left;else{var o=i[0];e.top=Math.floor(o.left+(o.right-o.left)/2),o=i.length>2?i[Math.ceil(i.length/2)-1]:i[0],e.right=Math.floor(o.top+(o.bottom-o.top)/2),o=i[i.length-1],e.bottom=Math.floor(o.left+(o.right-o.left)/2),o=i.length>2?i[Math.ceil((i.length+1)/2)-1]:i[i.length-1],e.left=Math.floor(o.top+(o.bottom-o.top)/2)}return e}}})}),jQuery(document).ready(function($){var fchunker_upload={fchunker:function(t){$.extend(t),$.upId&&$.upUrl&&($.domHtml=$("#"+$.upId).html(),$.upInputId=$.upId+"_input")},fchunker_limitFileSize:function(t,e){for(var i=["KB","MB","GB"],o=e.toUpperCase(),n=0,s=0;s<i.length;s++){var r=o.indexOf(i[s]);if(r>-1){n=parseInt(o.substr(0,r))*Math.pow(1024,s+1);break}}return!(t.size>n)},upErrorMsg:function(t){$.upError=t},upStop:function(t){$.upError=t},upStatus:function(){return!$.upError||("function"==typeof $.upStop&&$.upStop($.upError),!1)},fchunker_getPercent:function(t,e){if(t=parseFloat(t),e=parseFloat(e),isNaN(t)||isNaN(e))return"-";return e<=0?0:Math.round(t/e*1e4)/100},fchunker_upload:function(t,e){$.upError="",$.tempFile=$("#"+$.upInputId)[0].files[0],"file"==t&&($.tempFile=e);var i=$.tempFile;if(!i)return!1;"function"==typeof $.upStart&&$.upStart();var o=i.name,n=o.lastIndexOf("."),s=o.length,r=o.substring(n+1,s);if($.upType&&(uptype=$.upType.split(","),-1==$.inArray(r,uptype)&&($.upError="Type error: Error-"+r)),$.upMaxSize&&($.fchunker_limitFileSize(i,$.upMaxSize+"MB")||($.upError="Error")),0==$.upStatus())return!1;$.taskStart=+new Date,setTimeout("jQuery.fchunker_upload_core()","100")},fchunker_upload_core:function(){var file=$.tempFile;if(!file)return!1;$.upShardSize||($.upShardSize=2);for(var filename=file.name,size=file.size,index1=filename.lastIndexOf("."),index2=filename.length,suffix=filename.substring(index1+1,index2),shardSize=1024*$.upShardSize*1024,succeed=0,shardCount=Math.ceil(size/shardSize),re=[],start,end=0,i=0;i<shardCount;++i)re[i]=[],start=i*shardSize,end=Math.min(size,start+shardSize),re[i].file_data=file.slice(start,end),re[i].file_name=filename,re[i].file_size=size;const URL=$.upUrl;var i2=0,i3=1,fcs=Array(),xhr=new XMLHttpRequest;function ajaxStack(stack){if(0!=$.upStatus()){var form=new FormData;stack[i2]&&(fcs=stack[i2],form.append("file_data",fcs.file_data),form.append("file_name",fcs.file_name),form.append("file_size",fcs.file_size),form.append("file_total",shardCount),form.append("file_index",i3),form.append("taskStart",$.taskStart),form.append("action","backup_migration"),form.append("token","bmi"),form.append("f","upload-backup"),xhr.open("POST",URL,!0),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.setRequestHeader("HTTP_X_REQUESTED_WITH","XMLHttpRequest"),xhr.onload=function(){ajaxStack(stack)},xhr.onreadystatechange=function(){if(0!=$.upStatus()&&4==xhr.readyState&&200==xhr.status){var data=xhr.responseText?eval("("+xhr.responseText+")"):"";++succeed;var cent=$.fchunker_getPercent(succeed,shardCount);"function"==typeof $.upEvent&&$.upEvent(cent),100==cent?setTimeout(function(){"function"==typeof $.upCallBack&&$.upCallBack(data)},500):"function"==typeof $.upCallBack&&$.upCallBack(data)}},xhr.send(form),i2++,i3++,form.delete("file_data"),form.delete("file_name"),form.delete("file_size"),form.delete("file_total"),form.delete("taskStart"),form.delete("file_index"),form.delete("action"),form.delete("token"),form.delete("f"))}}ajaxStack(re),re=null,file=null}};$.extend(fchunker_upload)}),jQuery(window).on("load",function(){setTimeout(function(){jQuery("#bmi").css({opacity:0}),jQuery("#bmi-preload").css({opacity:1}),jQuery("#bmi-preload").animate({opacity:0},150,function(){jQuery("#bmi-preload").remove(),jQuery("#bmi").css({display:"block"}),jQuery.bmi.dropdowns.init(),setTimeout(function(){jQuery("#wpfooter").show(200),jQuery("#bmi").animate({opacity:1},350)},100)})},50)}),jQuery(document).ready(function(t){let e=!1;t.extend({bmi:{clipboard:function(e){try{const i=document.createElement("textarea");return i.value=e,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i),t.bmi.alert("success",t("#bmi-success-copy").text(),3e3),!0}catch(e){return console.log(e),t.bmi.alert("warning",t("#bmi-failed-copy").text(),3e3),!1}},alert:function(e="default",i="---",o=7e3){t(".bmi-notification-box").length<=0&&t("body").find("#bmi").prepend(t('<div class="bmi-notification-box"></div>')),e="default"==e?"":"success"==e?" is-success":"warning"==e?" is-warning":"error"==e?" is-danger":" is-info";let n=Math.floor(Math.random()*Math.floor(64e3)),s=`<div style="display: none;" id="ntf-${n}" class="bmi-notification${e}">\n <button class="bmi-times-button" onclick="jQuery.bmi.hideAlert(this)">×</button>\n <div class="bmi-cf">\n <div class="bmi-left bmi-alert-icon"><div class="bmi-icon-bg"></div></div>\n <div class="bmi-left bmi-alert-msg-title">\n <div class="bmi-title${e}">Backup Migration</div>\n <div>${i}</div>\n </div>\n </div>\n </div>`;t(".bmi-notification-box").prepend(s);let r=t(`#ntf-${n}`);r.css({opacity:0,display:"block"});let a=r.outerWidth();r.outerHeight();r.css({right:"-35vw","font-size":"0px",width:0,padding:0,opacity:"0"}),r.animate({right:"15px",width:a,padding:"1rem 2rem 1rem 1.5rem",opacity:"1"},{duration:200,queue:!1}),r.animate({"font-size":"16px"},{duration:300,queue:!1}),setTimeout(()=>{t(`#ntf-${n}`).css({width:""})},250),setTimeout(()=>{r.animate({"font-size":"0px"},{duration:200,queue:!1}),r.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){r.remove()})},o)},_msg:function(e){"msg"==e.status&&(void 0===e.level&&(e.level="info"),t.bmi.alert(e.level,e.why,3e3),console.log("Backup-migration: ","["+e.level.toUpperCase()+"]",e.why))},hideAlert:function(e){let i=t(e).parents(".bmi-notification");i.animate({"font-size":"0px"},{duration:200,queue:!1}),i.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){i.remove()})},modal:function(e=!1){let i=!1;return 0!=e&&(i=document.getElementById(e)),{clearModal:function(){i.querySelectorAll(".customselect").forEach(function(t){t.classList.remove("active")}),i.querySelectorAll('input[type="text"]').forEach(function(t){t.value="",t.setAttribute("value","")})},open:function(e=function(){}){i.classList.add("before-open"),setTimeout(function(){i.classList.add("open"),t("html")[0].style.overflowY="hidden",setTimeout(e,410)},10)},close:function(e=function(){}){i.offsetWidth>0&&i.offsetHeight>0?(i.classList.add("before-close"),setTimeout(function(){i.classList.add("closed"),setTimeout(function(){i.classList.remove("before-open"),i.classList.remove("open"),i.classList.remove("before-close"),i.classList.remove("closed"),t.bmi.modal(i.id).clearModal(),e()},410)},10)):(i.classList.remove("before-open"),i.classList.remove("open"),i.classList.remove("before-close"),i.classList.remove("closed"),e()),t("html")[0].style.overflowY="auto"},closeAll:function(){document.querySelectorAll(".modal").forEach(function(e){t.bmi.modal(e.id).close()}),t("html")[0].style.overflowY="auto"}}},json:function(e){return new Promise(function(i,o){try{return i(JSON.parse(e))}catch(n){if("string"!=typeof e)return o(!1);{let n=t.bmi.reverse(e).indexOf("}");n=0==n?e.length:-n,e=e.slice(e.indexOf("{"),n);try{return i(JSON.parse(e))}catch(t){return o(!1)}}}})},reverse:function(e){return"string"==typeof e?""===e?"":t.bmi.reverse(e.substr(1))+e.charAt(0):e},ajax:function(e,i={}){return new Promise(function(o,n){function s(t,i){i||(i=t),console.log("------- BACKUP MIGRATION ERROR START -------"),!1===t?(console.log("Call: ",e),console.log("Status: ",i.status),console.log("Error: ",i.responseText)):console.log(i),console.log("-------- BACKUP MIGRATION ERROR END --------\n\n"),n(t,i.responseText)}i.action="backup_migration",i.token="bmi",i.f=e,t.post(ajaxurl,i).done(e=>{t.bmi.json(e).then(function(t){o(t)}).catch(function(t){s("json")})}).fail(t=>{s(!1,t)})})},tooltips:{init:function(){let e={delay:200,debug:!1,delayTouch:[100,200],interactive:!1,distance:0,side:"top",contentAsHTML:!1,maxWidth:460,triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["bmi-tooltip","bmi-tt-default","bmi-tt-default-customized"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)}},i=t(".tooltip"),o=t(".tooltip-html"),n=t(".premium-wrapper"),s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0;for(let o=0;o<i.length;++o){let n=i[o],s=n.getAttribute("data-top"),r=n.getAttribute("side"),a=JSON.parse(JSON.stringify(e));a.content=n.getAttribute("tooltip"),s&&(a.distance=parseInt(s)),r&&r.trim().length>0&&(a.side=r),t(n).tooltipster(a)}for(let e=0;e<o.length;++e){let i=o[e],n=i.getAttribute("side"),r=JSON.parse(JSON.stringify(s));r.content=i.getAttribute("tooltip"),n&&n.trim().length>0&&(r.side=n),t(i).tooltipster(r)}for(let i=0;i<n.length;++i){let o=n[i],s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0,s.maxWidth=500,o.getAttribute("tooltip")?s.content=o.getAttribute("tooltip"):s.content=t("#premium-tooltip")[0].innerHTML,o.getAttribute("side")&&(s.side=o.getAttribute("side")),t(o).tooltipster(s)}},hideAll:function(e=!1){function i(){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}e?i():setTimeout(i,10)}},collapsers:{toggle:function(i){if(!0===e)return;e=!0;let o=i.getAttribute("group");i.classList.contains("active")?t.bmi.collapsers.close(i):t.bmi.collapsers.open(i,o)},open:function(i,o){t.bmi.collapsers.closeGroup(o),t(i).addClass("active"),t(i).find(".content").show(300),setTimeout(function(){e=!1},300)},close:function(i){t(i).removeClass("active"),t(i).find(".content").hide(300),setTimeout(function(){e=!1},300)},closeGroup:function(i){t('.collapser[group="'+i+'"]').removeClass("active"),t('.collapser[group="'+i+'"]').find(".content").hide(300),setTimeout(function(){e=!1},300)},closeAll:function(){t(".collapser").removeClass("active"),t(".collapser").find(".content").hide(300),setTimeout(function(){e=!1},300)}},isUrlValid:function(t){return!!new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i").test(t)},bytesToHuman:function(t,e,i,o,n){return(e=Math,i=e.log,o=1024,n=i(t)/i(o)|0,t/e.pow(o,n)).toFixed(2)+" "+(n?"KMGTPEZY"[--n]+"B":"Bytes")},getCurrentBackups:function(e=function(){}){t("#reloading-bm-list").length>0&&"none"==t("#reloading-bm-list")[0].style.display&&(t("#reloading-bm-list").show(),t.bmi.ajax("get-current-backups",{}).then(function(i){t("#reloading-bm-list").hide(),e(i)}).catch(function(t){console.log(t)}))},fillWithNewBackups:function(e,i=function(){}){backups={},t("#bmi_restore_tbody").html("");let o=t("#bmi-manual-locked").text().trim(),n=Object.keys(e).sort(function(t,i){return+new Date(e[t][1].replace(/\-/g,"/"))-+new Date(e[i][1].replace(/\-/g,"/"))}),s=0;for(;s<n.length;++s){let i=n[s],r="locked"===e[i][5];i=(i=i.replace(/ /g,"")).trim();let a="bmi_br_backup_"+s,l=t(".br_tr_template").clone();l.removeClass("br_tr_template"),l[0].style.display="none",l.find(".br_label").attr("for",a),l.find(".br_checkbox").attr("id",a),l.find(".bc-download-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP&backup-id="+i),l.find(".bc-logs-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP_LOGS&backup-id="+i),l.find(".br_date").text(e[i][1]),l.find(".br_name").text(i),l.find(".br_size").text(t.bmi.bytesToHuman(e[i][4])+" ("+e[i][2]+")"),0!=(""+e[i][6]).trim().length&&e[i][6]+""!="false"||(l.find(".bc-locked-btn").addClass("forever"),l.find(".bc-locked-btn").attr("tooltip",o),r=!0),r?l.find(".bc-unlocked-btn").hide():l.find(".bc-locked-btn").hide(),l.prependTo("#bmi_restore_tbody"),e[i].push(i),backups[a]=e[i]}if(0==s){let e=t("#bmi_restore_tbody").data("empty");t("#bmi_restore_tbody").html('<tr><td class="center text-muted" colspan="100%">'+e+"</td></tr>")}t.bmi.tooltips.init(),t.bmi.showMoreBackups(),i()},showMoreBackups:function(e){backups={};let i=t("#bmi_restore_tbody").find("tr:hidden");for(let e=0;e<i.length&&e<10;++e)setTimeout(function(){t(i[e]).show(300)},50*e);i.length-10<=0?t("#load-more-backups-wrp").hide(300):t("#load-more-backups-wrp").show(300)},reloadBackups:function(e=function(){}){t.bmi.getCurrentBackups(function(i){t.bmi.fillWithNewBackups(i.backups,function(){e(),t("#backups-select-all").prop("checked",!1),t(".del-all-btn-wrp").hide(300)})})},hideAllLists:function(){let e=t(".dropdown-open");if(!(e.length<=0))for(let i=0;i<e.length;++i){let o=t(e[i]);o.hasClass("ignored-open")?o.removeClass("ignored-open"):(o.hide(300),o.removeClass("dropdown-open"),t(o[0].closest(".bmi-dropdown")).removeClass("active"))}},setOption:function(e,i=null,o=!1){let n=e.find(".dropdown-options");e.attr("data-optioner")&&(n=t(".optioner-"+e.attr("data-optioner"))),n.find(".active-option").removeClass("active-option"),!1!==o&&(i=n.find('.dropdown-option[data-value="'+o+'"]')),t(i).hasClass("active-option")||(e.find(".dropdown-title").text(i.text()),e.attr("data-selected",i.data("value")),i.addClass("active-option"),!1===o&&e.change(),t.bmi.hideAllLists())},prepareFile:function(e,i){let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(i)),o.setAttribute("download",e),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),t.bmi.alert("success",t("#bmi-download-should-start").text(),3e3)}}})}),jQuery(document).ready(function(t){t(".collapser .header").on("click",function(e){e.preventDefault();let i=t(this).parent(".collapser")[0];t.bmi.collapsers.toggle(i)}),t(".bmi_will_collapse").on("change",function(e){e.preventDefault();let i=!1;"radio"==this.getAttribute("type")&&"false"==this.getAttribute("value")&&(i=!0),$child=t(this).data("if-checked"),!0!==this.checked||i?t("#"+$child).hide(300):t("#"+$child).show(300)}),t(".collapser-openner").on("click",function(e){e.preventDefault();let i="configuration",o=t(this).data("el");t(this).data("group")&&(i=t(this).data("group")),t.bmi.collapsers.open(o,i),setTimeout(function(){t([document.documentElement,document.body]).animate({scrollTop:t(o).offset().top-50+"px"},300)},300)}),function(){let e=t(".bmi_will_collapse");for(let i=0;i<e.length;++i){let o=!1;$trigger=e[i],$child=t($trigger).data("if-checked"),"radio"==$trigger.getAttribute("type")&&"false"==$trigger.getAttribute("value")&&(o=!0),!0===$trigger.checked?t("#"+$child).show():t("#"+$child).hide()}}()}),jQuery(document).ready(function(t){var e=!0,i=!1;t.bmi.crons=function(){function o(){!function(e,i){t.bmi.ajax("calculate-cron",e).then(function(e){"success"==e.status?i(e):(i(!1),t.bmi._msg(e))}).catch(function(t){i(!1),console.log(t)})}({type:t('[data-id="cron-period"]').attr("data-selected"),day:t('[data-id="cron-day"]').attr("data-selected"),week:t('[data-id="cron-week"]').attr("data-selected"),hour:t('[data-id="cron-hour"]').attr("data-selected"),minute:t('[data-id="cron-minute"]').attr("data-selected"),keep:t('[data-id="cron-keep-backups"]').attr("data-selected"),enabled:!0==!t("#cron-btn-toggle")[0].checked},function(i){"success"===i.status&&!1!==i?(t(".cron-time-server").tooltipster("option","interactive",!1),t(".cron-time-server").tooltipster("option","contentAsHTML",!0),!0===t("#cron-btn-toggle")[0].checked&&(i.data="---"),t(".cron-time-server").tooltipster("content","<b>"+t("#bmi-next-cron").text()+"</b>"+i.data+"<br><b>"+t("#bmi-current-time").text()+"</b>"+i.currdata),e?e=!1:t.bmi.alert("success",t("#bmi-cron-updated").text(),1500)):e?e=!1:t.bmi.alert("error",t("#bmi-cron-updated-fail").text(),2500)})}function n(e){"month"==e?(t(".cron-the").show(),t('[data-id="cron-day"]').show(),t('[data-id="cron-week"]').hide(),t("#cron-on-word").show()):"week"==e?(t(".cron-the").hide(),t('[data-id="cron-day"]').hide(),t('[data-id="cron-week"]').show(),t("#cron-on-word").show()):(t(".cron-the").hide(),t('[data-id="cron-day"]').hide(),t('[data-id="cron-week"]').hide(),t("#cron-on-word").hide())}!0!==i&&(i=!0,t("#bmi").on("change",'[data-id="cron-period"]',function(t){o(),n(t.target.getAttribute("data-selected"))}),t("#bmi").on("change",'[data-id="cron-day"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-week"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-hour"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-minute"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-keep-backups"]',function(t){t.target.getAttribute("data-selected");o()}),t("#i-backup-cron").on("click",function(){t(".cron-backups").find(".turned-off").is(":visible")&&(t("#cron-btn-toggle").prop("checked",!1),t(".cron-backups").removeClass("disabled"),o(),t(".cron-backups").find(".turned-on").css({opacity:0}),t(".cron-backups").find(".turned-off").css({opacity:0}),t(".cron-backups").find(".turned-on").show(),t(".cron-backups").find(".turned-on").css({opacity:1}),setTimeout(function(){t(".cron-backups").find(".turned-off").hide()},300))}),t("#cron-btn-toggle").on("change",function(){this.checked?t(".cron-backups").addClass("disabled"):t(".cron-backups").removeClass("disabled"),o()}),n(t('[data-id="cron-period"]')[0].getAttribute("data-selected")),o())}}),jQuery(document).ready(function(t){t.bmi.dropdowns={init:function(){let e=t("#bmi");function i(e="null",i="---"){let o=t(".option-template").clone();return o.removeClass("option-template"),o.attr("data-value",e),o.text(i),o}function o(o){if("none"!=o.style.display){o.style.display="none";let n=t(o),s=n.find("option"),r=function(e="---"){let i=t(".dropdown-template").clone();return i.removeClass("dropdown-template"),i.find(".dropdown-title").text(e),i}(function(t){let e="";for(let i=0;i<t.length;++i){let o=t[i].innerText;e.length<o.length&&(e=o)}return e}(s));r=function(e,o){let n=t(e).find(".dropdown-options");t(e).attr("data-optioner")&&(n=t(".optioner-"+t(e).attr("data-optioner")));for(let t=0;t<o.length;++t){let e=o[t];n.append(i(e.value,e.innerText))}return e}(r,s);let a=s[0].value,l=o.getAttribute("data-parent"),c=o.getAttribute("data-classes"),u="true"===o.getAttribute("data-hide");if(n.attr("data-def")&&(a=n.attr("data-def")),t(r).attr("data-id",o.id),t(r).attr("class",((null!=c?c:"")+" bmi-dropdown").trim()),t(r).insertBefore(n),null!==l){let e=parseInt(864197532*Math.random()+123456789);t(r).attr("data-optioner",e),t(r).find(".dropdown-options").attr("data-oparent",e),t(r).find(".dropdown-options").addClass("optioner-"+e),t(r).find(".dropdown-options").appendTo(l),t(l).css({position:"relative"})}let p=t(r).clone();if(!p)return;p[0].style.visibility="hidden",e.append(p);let d=p.width();p.remove(),t.bmi.setOption(t(r),null,a),t(r).find(".dropdown-title")[0].style.minWidth=d+10+"px",u&&t(r).hide()}}!function(){let t=e.find("select");for(let e=0;e<t.length;++e)o(t[e])}(),t.bmi.crons(),e.on("click",function(e){t(e.target).hasClass("bmi-dropdown")||e.target.closest(".bmi-dropdown")||t.bmi.hideAllLists()}),e.on("click",".dropdown-title",function(e){$dropdown=t(e.target.closest(".bmi-dropdown")),function(e){let i=e.find(".dropdown-options");if(e.attr("data-optioner")){(i=t(".optioner-"+e.attr("data-optioner"))).css({position:"absolute"});let o=e[0].offsetWidth,n=e[0].offsetLeft+240,s=e[0].offsetTop+e[0].offsetHeight+5;i.css({maxWidth:o+"px",minWidth:o+"px",top:s+"px",left:n+"px"})}i.hasClass("dropdown-open")?(e.removeClass("active"),i.removeClass("dropdown-open"),i.hide(300)):(e.addClass("active"),i.addClass("dropdown-open"),i.addClass("ignored-open"),i.show(300))}($dropdown),t.bmi.hideAllLists()}),e.on("click",".dropdown-option",function(e){t(e.target.closest(".dropdown-options")).attr("data-oparent")?($dropdown=t('.bmi-dropdown[data-optioner="'+t(e.target.closest(".dropdown-options")).attr("data-oparent")+'"]'),$option=t(e.target),t.bmi.setOption($dropdown,$option)):($dropdown=t(e.target.closest(".bmi-dropdown")),$option=t(e.target),t.bmi.setOption($dropdown,$option))})}}}),jQuery(document).ready(function(t){var e,i,o=!1,n=!1,s=0;let r=0,a=0,l=null,c=null,u=null,p=!1,d=!1,_=4500,f=!1,h=!1,m=null,g=!1,b=!1,w=!1,v={};function y(e){return $cb=t("#"+e).is(":checked"),!0===$cb?"true":"false"}function k(){return size=0,t("#files-group-plugins").is(":checked")&&(size+=parseInt(t('label[for="files-group-plugins"]').find(".value").attr("bytes"))),t("#files-group-uploads").is(":checked")&&(size+=parseInt(t('label[for="files-group-uploads"]').find(".value").attr("bytes"))),t("#files-group-themes").is(":checked")&&(size+=parseInt(t('label[for="files-group-themes"]').find(".value").attr("bytes"))),t("#files-group-other-contents").is(":checked")&&(size+=parseInt(t('label[for="files-group-other-contents"]').find(".value").attr("bytes"))),t("#files-group-wp-install").is(":checked")&&(size+=parseInt(t('label[for="files-group-wp-install"]').find(".value").attr("bytes"))),size}function x(e,i){if(a+=1,r+=parseInt(i.bytes),i.bytes<=1e4)t("#bmi-scan-"+e).find(".value").text("(0 MB)");else{let o=(parseInt(i.bytes)/1024/1024).toFixed(2);t("#bmi-scan-"+e).find(".value").text("("+o+" MB)")}t("#bmi-scan-"+e).find(".value").attr("bytes",parseInt(i.bytes)),5==a&&(t("#bmi-scan-total").find(".value").text("("+t.bmi.bytesToHuman(r)+")"),t("#bmi-scan-total").find(".value").attr("bytes",parseInt(r)),T())}function $(e){t.bmi.ajax("scan-directory",{folder:e}).then(function(t){x(e,t)}).catch(function(t){x(t,{bytes:"0",readable:"0 B"})})}function C(e=!1,i=function(){}){t.bmi.ajax("is-running-backup",{}).then(function(o){"success"==o.status?i(!1):1==e?i(!0):t.bmi._msg(o)}).catch(function(t){i(!1),console.log(t)})}function T(){let e=parseInt(t("#bmi-scan-total").find(".value").attr("bytes")),i=parseInt(k());t("#files-group-backup").is(":checked")||(e=0,i=0);let o=((e-i)/1024/1024).toFixed(2),n=(i/1024/1024).toFixed(2);"0.00"==o&&(o="0"),"0.00"==n&&(n="0"),t("#esta-exclude").text(o+" MB"),t("#esta-size-for").text(n+" MB")}function I(){t("#prenotice-modal .prenotice").hide(),t("#prenotice-size").text(t.bmi.bytesToHuman(k())),t(".prenotic-3").show(),"true"!==y("database-group-backup")||"true"!==y("database-group-backup")||"true"===y("files-group-backup")&&("true"!==y("files-group-plugins")&&"true"!==y("files-group-themes")&&"true"!==y("files-group-uploads")&&"true"!==y("files-group-wp-install")&&y("files-group-other-contents"),1)||t(".prenotic-6").show(),"true"===y("database-group-backup")||"true"===y("database-group-backup")||"true"!==y("files-group-backup")||"true"!==y("files-group-plugins")&&"true"!==y("files-group-themes")&&"true"!==y("files-group-uploads")&&"true"!==y("files-group-wp-install")&&"true"!==y("files-group-other-contents")||t(".prenotic-5").show(),"true"===y("database-group-backup")&&"true"===y("files-group-backup")&&"true"===y("files-group-plugins")&&"true"===y("files-group-themes")&&"true"===y("files-group-uploads")&&"true"===y("files-group-other-contents")||t(".prenotic-4").show(),t("#prenotice-modal .prenotice:visible").css({background:""});let e=t("#prenotice-modal .prenotice"),i=[];for(let t=0;t<e.length;++t)"none"!==e[t].style.display&&i.push(e[t]);for(let t=0;t<i.length;t+=2)i[t].style.background="#f8f8f8"}function O(t,e=function(){}){let i=window.location.protocol.includes("https");t=t.includes("https")?t.slice(5):t.slice(4),t=i?"https"+t:"http"+t;try{window.XMLHttpRequest?xmlhttp=new XMLHttpRequest:xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"),xmlhttp.onloadend=function(){4==xmlhttp.readyState&&200==xmlhttp.status?e(xmlhttp.responseText):e(!1)},xmlhttp.open("GET",t),xmlhttp.send()}catch(t){e(!1)}}function E(i,r){if(!1===i)return;let a=i.split("\n"),c=s;s=a.length,c>0&&c--;for(let i=c;i<a.length;++i){let c=a[i],u=document.createElement("DIV"),_="";if("[INFO]"==c.substr(0,6))_="blue";else if("[SUCCESS]"==c.substr(0,9))_="green";else if("[WARN]"==c.substr(0,6))_="orange";else if("[ERROR]"==c.substr(0,7))_="red";else if("[END-CODE]"==c.substr(0,10))_="hide_so_much";else if("[STEP]"==c.substr(0,6))u.classList.add("bold"),u.classList.add("step"),t("#restore-progress-modal").hasClass("open")?t("#restore_current_step").text(c.slice(29)):t("#current_step").text(c.slice(29));else if(c&&c.trim().length>0&&"["!=c[0]){s--;continue}_.length>0&&u.classList.add(_),u.style.display="none",u.innerText=c,setTimeout(function(){if(r.appendChild(u),c&&c.trim().includes("[END-CODE]")&&(!0===h||!0===w||!0===b)){let i=c;!0===b?i.includes("001")?(l=".cli_download",b=!1,t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%",J(!0)):Q():!0===w?(i.includes("001")?setTimeout(function(){W()},1e3):Q(),d=!1,w=!1):(h=!1,i.includes("001")&&(o=!0,n=!0,clearTimeout(e),p=!1,D({filename:m},!0)),i.includes("002")&&P(),i.includes("003")&&(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3)))}t(u).show(55),r.scrollTop=r.scrollHeight},55*i)}setTimeout(function(){r.scrollTop=r.scrollHeight},110)}function z(e=0,s=1e3,r=null){if(c==e)return;c=e,clearInterval(i);let a=parseFloat(t(".progress-percentage")[0].style.left)-1;if(t("#restore-progress-modal").hasClass("open")&&(a=parseFloat(t("#restore-progress-modal .progress-percentage")[0].style.left)-1),a>e&&0!=e)return;let l=e-a,u=a,d=Math.abs(Math.floor(s/l));i=setInterval(function(){if(u+=1,t("#restore-progress-modal").hasClass("open")?(t("#restore-progress-modal .progress-active-bar")[0].style.width=u.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].style.left=u.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].innerText=u.toFixed(0)+"%"):(t(".progress-active-bar")[0].style.width=u.toFixed(2)+"%",t(".progress-percentage")[0].style.left=u.toFixed(2)+"%",t(".progress-percentage")[0].innerText=u.toFixed(0)+"%"),u>=100&&clearInterval(i),u>=100&&null!=r&&(c=null,t("#backup-progress-modal").hasClass("open"))){o=!0,n=!0,D(r,0==p)}u>e&&clearInterval(i)},d)}t("#live-log-toggle").on("click",function(){t(".expanded-logs").length>0?t(this).text(t(this).data("hide")):t(this).text(t(this).data("show")),t("#live-log-wrapper").toggleClass("expanded-logs")}),t("#backup-stop").on("click",function(){t.bmi.ajax("stop-backup",{}).then(function(e){"success"==e.status?t.bmi.alert("success",t("#bmi-abort-soon").text(),3e3):t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#bmi_restore_tbody").on("click",".bc-unlocked-btn",function(e){e.preventDefault();let i=e.target,o=i.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("lock-backup",{filename:o}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-lock-success").text(),6e3),t(i.closest("tr").querySelector(".bc-unlocked-btn")).hide(),t(i.closest("tr").querySelector(".bc-locked-btn")).show()):(t.bmi.alert("error",t("#bmi-lock-error").text(),8e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#files-group-backup").on("change",T),t(".basic-file-exlusion").on("change",'input[type="checkbox"]',T),t("#bmi_restore_tbody").on("click",".bc-locked-btn",function(e){if(e.preventDefault(),t(e.target).hasClass("forever"))return;let i=e.target,o=i.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("unlock-backup",{filename:o}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-unlock-success").text(),3e3),t(i.closest("tr").querySelector(".bc-locked-btn")).hide(),t(i.closest("tr").querySelector(".bc-unlocked-btn")).show()):(t.bmi.alert("error",t("#bmi-unlock-error").text(),3e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#bmi_restore_tbody").on("click",".bc-url-btn",function(e){let i=e.target.closest("tr").querySelector(".bc-download-btn").getAttribute("href");t.bmi.clipboard(i)}),t("#bmi_restore_tbody").on("click",".bc-remove-btn",function(e){let i=e.target.closest("tr").querySelector(".br_name").innerText.trim();u=[i],t("#delete-confirm-modal").find(".text2").hide(),t("#delete-confirm-modal").find(".text1").show(),t.bmi.modal("delete-confirm-modal").open()}),t("#sure_delete").on("click",function(){t.bmi.ajax("delete-backup",{filenames:u}).then(function(e){u=null,"success"==e.status?(t.bmi.reloadBackups(),t.bmi.modal("delete-confirm-modal").close(),t.bmi.alert("success",t("#bmi-remove-success").text(),3e3)):(t.bmi.alert("warning",t("#bmi-remove-error").text(),3e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#add-exclusion-rule").on("click",function(e){e.preventDefault();let i=t(".exclusion_template").clone();i[0].classList.remove("exclusion_template"),i[0].style.display="none",t("#bmi_exclusion_rules").append(i),i.show(300)}),t("#bmi_exclusion_rules").on("click",".kill-exclusion-rule",function(e){e.preventDefault(),$el=e.target,$parent=$el.closest(".exclude-row"),$parent&&(t($parent).hide(300),setTimeout(function(){$parent.remove()},320))}),t("#i-backup-creator").on("click",function(){if(!isNaN(k()))return k()/1024/1024>1e3*parseInt(t("#BMI_REV").text().trim())?j():void("true"===y("database-group-backup")||"true"===y("files-group-backup")&&("true"===y("files-group-plugins")||"true"===y("files-group-themes")||"true"===y("files-group-uploads")||"true"===y("files-group-wp-install")||"true"===y("files-group-other-contents"))?(I(),C(!1,function(){t.bmi.modal("prenotice-modal").open()})):t.bmi.alert("warning",t("#bmi-no-selected").text(),3e3));t.bmi.alert("warning",t("#bmi-preb-processing").text(),3e3)}),t("#BFFSIN").on("change",function(t){let e=parseInt(this.value);isNaN(e)?this.value=1:this.value=e>9999?9999:e<=0?1:e}),t(".save-btn").on("click",function(e){e.preventDefault();let i={},o=t(this.closest(".save-action")).data("save");if(o){if("save-storage"==o)i.directory=t("#bmi_path_storage_default").val(),i.access="true"===t('[name="radioAccessViaLink"]:checked').val()?"true":"false";else if("save-file-config"==o){i.database_group=y("database-group-backup"),i.files_group=y("files-group-backup"),i["files-group-plugins"]=y("files-group-plugins"),i["files-group-uploads"]=y("files-group-uploads"),i["files-group-themes"]=y("files-group-themes"),i["files-group-other-contents"]=y("files-group-other-contents"),i["files-group-wp-install"]=y("files-group-wp-install"),i.files_by_filters=y("files_by_filters"),i.ex_b_fs=y("ex_b_fs"),i.BFFSIN=t("#BFFSIN").val()?t("#BFFSIN").val():"1",i.ex_b_names=y("ex_b_names"),i.ex_b_fpaths=y("ex_b_fpaths"),i.ex_b_dpaths=y("ex_b_dpaths");let e=[],o=t("#bmi_exclusion_rules").find(".exclude-row");for(let i=0;i<o.length;++i){let n=t(o[i]),s=n.find(".exclusion_txt").val(),r=n.find(".exclusion_position").find(".bmi-dropdown").data("selected")+"",a=n.find(".exclusion_where").find(".bmi-dropdown").data("selected")+"";e.push({txt:s,pos:r,whr:a})}i["dynamic-names"]=e,i["dynamic-fpaths-names"]=t("#dynamic-fpaths-names").val().split("\n"),i["dynamic-dpaths-names"]=t("#dynamic-dpaths-names").val().split("\n")}else if("store-config"==o)i.name=t("#backup_filename").val().trim();else{if("save-other-options"!=o)return;i.email=t("#email-for-notices").val().trim(),i.email_title=t("#email-title-for-notices").val().trim(),i.schedule_issues=y("scheduled-issues"),i.experiment_timeout=y("experimental-timeout"),i.experimental_hard_timeout=y("experimental-hard-timeout"),i.php_cli_disable_others=y("cli-disable-others"),i.php_cli_manual_path=t("#cli-manual-path").val().trim(),i.download_technique=y("download-technique"),i.uninstall_config=y("uninstalling-configs"),i.uninstall_backups=y("uninstalling-backups"),i.normal_timeout=y("normal-timeout")}t.bmi.ajax(o,i).then(function(e){"success"==e.status?e.errors<=0?(t.bmi.alert("success",t("#bmi-save-success").text(),3e3),t.bmi.collapsers.closeAll()):t.bmi.alert("warning",t("#bmi-save-issues").text(),3e3):t.bmi._msg(e)}).catch(function(t){console.log(t)})}}),t(".close-chapters").on("click",function(e){e.preventDefault(),t.bmi.collapsers.closeAll()}),t("#rescan-for-backups").on("click",function(){t.bmi.reloadBackups()}),t(".storage-checkbox").on("click",function(){let e=t(this).attr("data-toggle"),i=t(t(this)[0].closest(".tab2-item"));t(this).is(":checked")?(t("#"+e).show(300),i.addClass("activeList")):(t("#"+e).hide(300),i.removeClass("activeList"))});var S=0;function A(e=function(){}){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_full.log&backup-id=current&t="+ +new Date,function(i){if(!i)return e();let o=i.split("\n").slice(0,1)[0];""===o.trim()?(o=i.split("\n").slice(0,2)[1],i=i.split("\n").slice(2).join("\n")):i=i.split("\n").slice(1).join("\n");let n=t(".log-wrapper").find("pre")[0],s=t("#bmi-making-archive").text().trim();if(o&&0!=o&&void 0!==o&&t("#current_step").text().trim().slice(0,s.length)==s){let e=document.getElementById("bmi_counter_magic");if(e){let i=parseInt(e.innerText);S=parseInt(o.split("/")[0]),isNaN(i)||isNaN(S)||(z(parseInt(o.split("/")[0])/parseInt(o.split("/")[1])*100),async function(t,e,i,o){let n=null,s=function(r){if(S>i)return;n||(n=r);let a=Math.min((r-n)/o,1);t.innerText=Math.floor(a*(i-e)+e),a<1&&window.requestAnimationFrame(s)};window.requestAnimationFrame(s)}(e,i,S,2e3),"---"===t("#bmi_magic_max_count").text()&&100!=parseInt(o.split("/")[1])&&(t("#bmi_magic_max_count").text(parseInt(o.split("/")[1])),t("#entire_magic_counter").is(":hidden")&&t("#entire_magic_counter").show()))}else{let e=parseInt(o.split("/")[1]);100==e&&(e="---"),t("#current_step").html(s+' <span id="entire_magic_counter">(<span id="bmi_counter_magic">0</span>/<span id="bmi_magic_max_count">'+e+"</span>)</span>"),(isNaN(parseInt(e))||"---"==e)&&t("#entire_magic_counter").hide()}}i&&0!=i&&void 0!==i&&E(i,n),e()})}function B(){t(".log-wrapper").find("pre")[0].innerText="",z(0),setTimeout(function(){A(function(){!function t(){A(function(){clearTimeout(e),e=setTimeout(function(){!0===p&&t()},1500)})}()})},300)}function R(i=!0){!0===i&&(t(".log-wrapper").find("pre")[0].innerText="",z(0)),N(function(){clearTimeout(e),function t(){N(function(){e=setTimeout(function(){!0!==d&&!0!==b||t()},800)})}()})}function L(t=function(){}){C(!0,function(e){t(e)})}function M(e=!1,i=function(){}){t.bmi.ajax("reset-latest",{}).then(function(o){!0===e?i():"success"==o.status?(i(),t.bmi.modal("backup-progress-modal").open()):t.bmi._msg(o)}).catch(function(t){console.log(t)})}function D(s,r=!1){(o&&n||r)&&setTimeout(function(){p=!1,t("#backup-progress-modal").hasClass("open")&&(t.bmi.modal("backup-progress-modal").close(),"true"==t('[name="radioAccessViaLink"]:checked').val()?t("#accessible-at-section").show():t("#accessible-at-section").hide(),t.bmi.modal("backup-success-modal").open()),clearInterval(i),clearTimeout(e);let o=t("#BMI_BLOG_URL").text().trim()+"?backup-migration=BMI_BACKUP&backup-id="+s.filename+"&t="+ +new Date,n=t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=o,t("#download-backup-url").attr("href",o),t("#download-backup-log-url").attr("href",n),t.bmi.reloadBackups(),setTimeout(function(){clearInterval(i),t(".log-wrapper").find("pre")[0].innerText="",t(".progress-active-bar")[0].style.width="0%",t(".progress-percentage")[0].style.left="0%",t(".progress-percentage")[0].innerText="0%"},300)},700)}function P(i=!1){setTimeout(function(){C(!0,function(o){if(!0===o)return;t.bmi.modal("backup-progress-modal").close(),clearTimeout(e),t.bmi.modal("backup-progress-modal").close(),t("#backup-error-pre").text(t("#bmi-loading-translation").text().trim()),t.bmi.modal("backup-error-modal").open(),O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,function(o){if(clearTimeout(e),0!=o||i){let e=t("#backup-error-pre")[0];t("#backup-error-pre").text(""),s=0,E(o,e)}else P(!0)})})},2e3)}function j(){t.bmi.modal("bfs-modal").open()}function q(e){let i=e.status,o=parseInt(e.errors),n=parseInt(e.iteratio),s=parseInt(e.sf);if(!0===i&&-1===n)return g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),D({filename:m},!0);if(!isNaN(s)&&s>-1&&(g.filessofar=s),!isNaN(n)&&n>-1&&(g.iteratio+=1),isNaN(o)||o>0||0==i){if(!isNaN(o)&&o>4)return h=!1,m=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),P();setTimeout(function(){return H(g,o)},1500)}else H(g,o)}function H(t,e=0){!1===g&&(t.iteratio=0,g=t),function(t,e,i=0){let o=new XMLHttpRequest;o.open("POST",t.url,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Content-Accept","*/*"),o.setRequestHeader("Access-Control-Allow-Origin","*"),o.setRequestHeader("Content-ConfigDir",t.config_dir),o.setRequestHeader("Content-Content",t.content_dir),o.setRequestHeader("Content-Backups",t.backup_dir),o.setRequestHeader("Content-Identy",t.identy),o.setRequestHeader("Content-Url",t.url),o.setRequestHeader("Content-Abs",t.abs_dir),o.setRequestHeader("Content-Dir",t.root_dir),o.setRequestHeader("Content-Manifest",t.manifest),o.setRequestHeader("Content-Name",t.backupname),o.setRequestHeader("Content-Safelimit",t.safelimit),o.setRequestHeader("Content-Start",t.start),o.setRequestHeader("Content-Filessofar",t.filessofar),o.setRequestHeader("Content-Total",t.total_files),o.setRequestHeader("Content-Rev",t.rev),o.setRequestHeader("Content-It",t.iteratio),o.setRequestHeader("Content-Browser",!0),o.onload=function(){if(200===o.status){let t=o.getResponseHeader("Content-Finished");if(void 0!==t&&t&&"true"==t)return e({status:!0,iteratio:-1,sf:-1,errors:i=0});let n=o.getResponseHeader("Content-It"),s=o.getResponseHeader("Content-Filessofar");return e(void 0!==n&&n?{status:!0,iteratio:n,sf:s,errors:i}:{status:!1,iteratio:-1,sf:-1,errors:++i})}return e({status:!1,iteratio:-1,sf:-1,errors:++i})},o.onerror=function(){return e({status:!1,iteratio:-1,sf:-1,errors:++i})},o.send()}(g,q,e)}function F(e=function(){}){L(function(i){!0===i?t("#backup-progress-modal").hasClass("open")||(!1===p&&(o=!1,p=!0,f=!0),t("#bmi-ongoing-backup").show(300)):(t("#bmi-ongoing-backup").is(":visible")&&t("#bmi-ongoing-backup").hide(300),t("#backup-progress-modal").hasClass("open")&&!0===f?(!0===p&&(p=!1),f=!1,t.bmi.getCurrentBackups(function(e){t.bmi.fillWithNewBackups(e.backups,function(){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,function(e){if(!1===e)t.bmi.modal("backup-progress-modal").close();else{let i="Backup process aborted",o="[ERROR]";if((e=e.split("\n"))[e.length-1].includes(i)||e[e.length-2].includes(i))t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3);else if(e[e.length-1].includes(o)||e[e.length-2].includes(o))P();else{t.bmi.modal("backup-progress-modal").close(),t.bmi.modal("backup-success-modal").open();let e=t(t("#bmi_restore_tbody").find("tr")[0]).find(".bc-download-btn").attr("href");t("#download-backup-url").attr({href:e}),t("#text-input-copy").val(e)}}})})})):!0!==p||t("#backup-progress-modal").hasClass("open")||(p=!1,t.bmi.reloadBackups())),e()})}function N(e=function(){}){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration_full.log&backup-id=current&t="+ +new Date,function(i){if(!i)return e();let o=i.split("\n").slice(0,1)[0];if(i=i.split("\n").slice(1).join("\n"),!1===o||isNaN(parseFloat(o)))return e();let n=t("#restore-live-log-wrapper").find("pre")[0];i.includes("<")||i.includes(">")||i&&0!=i&&void 0!==i&&E(i,n),z(o),e()})}function G(e=function(){}){t.bmi.ajax("htaccess-litespeed",{}).then(function(t){setTimeout(function(){e(!0)},400)}).catch(function(t){e(!1),console.log(t)})}function U(e=function(){},i=!1){t.bmi.ajax("migration-locked",{}).then(function(o){"success"==o.status?e(!0):(i||t.bmi._msg(o),e(!1))}).catch(function(t){console.log(t)})}function Q(e=""){U(function(e){e&&setTimeout(function(){if(!t("#restore-progress-modal").hasClass("open"))return;d=!1,b=!1,t("#restore-error-pre").text(t("#bmi-loading-translation").text().trim()),O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration.log&backup-id=current&t="+ +new Date,function(e){if(0==e)setTimeout(function(){Q()},1500);else{let i=t("#restore-error-pre")[0];t("#restore-error-pre").text(""),s=0,E(e,i)}}),t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-error-modal").open()},1e3)},!0)}function W(){t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-success-modal").open(),setTimeout(function(){t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%"},500),w=!1}function J(o=!1,n=null){let r=l;if(!r||r.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#pre-restore-modal").hasClass("open")&&t.bmi.modal("pre-restore-modal").close(),t("#restore-progress-modal").hasClass("open")||t.bmi.modal("restore-progress-modal").open(),o||(t("#restore-live-log-wrapper").find("pre")[0].innerText=""),null==n&&(s=0,d=!0,clearTimeout(e),M(!0,function(){G(function(){N(function(){!function o(n,s,r,a=!1,l="false",c={}){null==r&&R(!0);t.bmi.ajax("restore-backup",{file:n,remote:s,secret:r,ignoreRunning:l,tmpname:a,options:c}).then(function(r){if("cli"===r.status){v={l:r.login,u:r.url},w=!0;let t=document.querySelector(".hide_so_much");if(t){let e=t.innerText;e.includes("001")?setTimeout(function(){W()},1e3):Q(),d=!1,w=!1}}else"success"===r.status?(v={l:r.login,u:r.url},N(function(){setTimeout(function(){clearInterval(i),clearTimeout(e),d=!1,t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-success-modal").open(),setTimeout(function(){t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%"},500)},1500)})):"secret"===r.status?(r.options.step=parseInt(r.options.step)+1,o(n,s,r.secret,r.tmp,"true",r.options)):"restore_ongoing"===r.status?(void 0!==r.options.firstDB&&(r.options.firstDB=!1),void 0!==r.options.dbFinished?!0!==r.options.dbFinished&&"true"!==r.options.dbFinished&&"1"!==r.options.dbFinished||(r.options.step=parseInt(r.options.step)+1):(r.options.step=parseInt(r.options.step)+1,4!=r.options.step&&"4"!=r.options.step||void 0===r.options.repeat_export||!0!==r.options.repeat_export&&"true"!==r.options.repeat_export&&"1"!==r.options.repeat_export||(r.options.step=3,r.options.firstExtract="false")),o(n,s,r.secret,r.tmp,"true",r.options)):"error"===r.status?setTimeout(function(){clearInterval(i),clearTimeout(e),Q()},1e3):(t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").close(),t.bmi._msg(r))}).catch(function(t,e){Q(e),console.log(t)})}(r,o,n)})})}))}function X(){return t("#bmi_restore_tbody").find('input[type="checkbox"]:checked')}function K(e){e.preventDefault(),t("#format-tip-wrp")[0].style.minWidth="calc(100% - 120px)","none"===t("#format-tip-wrp")[0].style.display?t("#format-tip-wrp").show(300):t("#format-tip-wrp").hide(300)}t("#configuration-reset-absolute").on("click",function(e){e.preventDefault(),t.bmi.ajax("reset-configuration",{}).then(function(e){"success"==e.status?window.location.reload():t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#download-site-infos").on("click",function(e){e.preventDefault(),t.bmi.ajax("get-site-data",{}).then(function(e){"success"==e.status?t.bmi.prepareFile("bmi-site-info.debug",JSON.stringify(e.data)):t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#start-entire-backup").on("click",function(){t.bmi.modal("prenotice-modal").close(),t(".backup-minimize").removeClass("disabled"),clearTimeout(e),M(!1,function(){G(function(){f=!1,o=!1,p=!0,t.bmi.ajax("create-backup",{estaminated_size:k()}).then(function(s){if("success"==s.status)o=!0,clearTimeout(e),p=!1,A(function(){setTimeout(function(){D(s,!0)},350)});else if("background"==s.status){h=!0,m=s.filename;let i=document.querySelector(".hide_so_much");if(i){let s=i.innerText;s.includes("001")&&(o=!0,n=!0,clearTimeout(e),p=!1,D({filename:m},!0)),s.includes("002")&&P(),s.includes("003")&&(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3))}}else"background_hard"==s.status?(h=!0,m=s.filename,s.settings.url=s.url,t.bmi.alert("success",t("#bmi-received-hard").text(),3e3),t(".backup-minimize").addClass("disabled"),t("#backup-progress-modal").hasClass("open")||t.bmi.modal("backup-progress-modal").open(),window.onbeforeunload=function(){return"Backup in progress..."},H(s.settings)):(p=!1,setTimeout(function(){clearInterval(i),t(".log-wrapper").find("pre")[0].innerText="",t(".progress-active-bar")[0].style.width="0%",t(".progress-percentage")[0].style.left="0%",t(".progress-percentage")[0].innerText="0%"},300),t.bmi._msg(s),t("#backup-progress-modal").hasClass("open")&&(void 0!==s.bfs?j():P()))}).catch(function(e){t("#backup-progress-modal").hasClass("open")&&P(),console.log(e)}),s=0,p=!0,B()})})}),t("#open_trouble_extenstion").on("click",function(){t("#trouble_extenstion").hasClass("openned")?(t("#trouble_extenstion").hide(300),t("#trouble_extenstion").removeClass("openned"),t(this).removeClass("active")):(t("#trouble_extenstion").show(300),t("#trouble_extenstion").addClass("openned"),t(this).addClass("active"))}),t("#switch-show-trs").on("click",function(){let e=this.dataset.see,i=this.dataset.hide,o=t(".hide-show-tr");t(this).hasClass("shown")?(o.hide(300),t(this).removeClass("shown"),this.innerText=e):(o.show(300),t(this).addClass("shown"),this.innerText=i)}),t("#ex_b_fs").on("change",function(){t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}),t("#show-upload-area").on("click",function(){t(".upload_area").hasClass("hidden")?(t(".upload_area").show(300),t(".upload_area").removeClass("hidden"),t([document.documentElement,document.body]).animate({scrollTop:t(this).offset().top-50+"px"},300)):(t(".upload_area").hide(300),t(".upload_area").addClass("hidden"))}),t(".bmi-copper").on("click",function(e){e.preventDefault();let i=t("#"+this.getAttribute("data-copy"))[0];i.value&&i.value.length>0?t.bmi.clipboard(i.value):t.bmi.clipboard(i.innerText)}),t("#bmi_restore_tbody").on("click",".restore-btn",function(e){U(function(i){if(i){let i=e.target.closest("tr").querySelector(".br_name").innerText;if(l=i,!i||i.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#restore-ok").prop("checked",!1),t.bmi.modal("pre-restore-modal").open()}})}),t("#quick-download-migration").on("click",function(){let e=t("#bm-d-url").val();t.bmi.isUrlValid(e)?U(function(i){i&&(e.length>0?(l=-100,t("#restore-ok").prop("checked",!1),t.bmi.modal("pre-restore-modal").open()):t.bmi.alert("warning",t("#bmi-invalid-url").text(),5e3))}):t.bmi.alert("warning",t("#bmi-invalid-url").text(),5e3)}),t("#restore-start-sure").on("click",function(){t("#restore-ok").is(":checked")?-100===l?(l=null,t("#restore-live-log-wrapper").find("pre")[0].innerText="",U(function(o){M(!0,function(){G(function(){if(o){let o=t("#bm-d-url").val();t("#restore_current_step").text(t("#bmi-downloading-remote").text()),t.bmi.ajax("download-backup",{url:o}).then(function(o){clearInterval(i),clearTimeout(e),"success"===o.status?(t.bmi.reloadBackups(),l=o.name,setTimeout(function(){clearInterval(i),t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%",t("#restore_current_step").text(t("#bmi-restoring-prepare").text()),setTimeout(function(){J(!0)},300)},600)):"cli_download"==o.status?(b=!0,R(!1)):"error"===o.status?Q():(t.bmi._msg(o),Q())}).catch(function(t,e){Q(e),console.log(t)}),t("#restore-live-log-wrapper").find("pre")[0].innerText="",s=0,d=!0,R(),t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").open()}})})})):J():t.bmi.alert("warning",t("#bmi-restore-require-checkmark").text(),3e3)}),t(".backup-minimize").on("click",function(){L(function(e){!0===e?t("#bmi-ongoing-backup").show(300):t("#bmi-ongoing-backup").hide()})}),function t(){F(function(){setTimeout(function(){t()},_)})}(),t("#bmi-ongoing-backup").on("click",function(){L(function(e){!0===e?(s=0,B(),t.bmi.modal("backup-progress-modal").open()):(t.bmi.alert("info",t("#bmi-bc-ended").text(),3e3),t.bmi.reloadBackups()),t("#bmi-ongoing-backup").hide(300)})}),t("#bmi_support_chat").on("click",function(){if(0===t("#support-bmi").length){t("#bmi").append('<script id="support-bmi" src="'+t("#bmi-support-url-translation").val()+'" async><\/script>'),setTimeout(function(){t("#bmi_support_chat").hide()},100);var e=!1;let i=setInterval(function(){1==e&&clearInterval(i),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t("#bmi_restore_tbody").on("change",'input[type="checkbox"]',function(e){let i=X().length;i>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300),i==t("#bmi_restore_tbody").find('input[type="checkbox"]').length?t("#backups-select-all").prop("checked",!0):t("#backups-select-all").prop("checked",!1)}),t("#fix-uname-issues").on("click",function(e){e.preventDefault(),t.bmi.ajax("fix_uname_issues",{}).then(function(e){t.bmi.alert("success",t("#bmi-default-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-default-fail").text(),3e3)})}),t("#revert-uname-issues").on("click",function(e){e.preventDefault(),t.bmi.ajax("revert_uname_issues",{}).then(function(e){t.bmi.alert("success",t("#bmi-default-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-default-fail").text(),3e3)})}),t("#backups-select-all").on("change",function(){!0===this.checked?t("#bmi_restore_tbody").find('input[type="checkbox"]').prop("checked",!0):t("#bmi_restore_tbody").find('input[type="checkbox"]').prop("checked",!1),X().length>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300)}),t(".lrn-mr-btn, .closer-learn-more").on("click",function(){t(".learn_more_about_cron").hasClass("open")?(t(".learn_more_about_cron").removeClass("open"),t(".learn_more_about_cron").hide(300),t(".lrn-mr-btn").show(),t(".lrn-mr-btn").css({opacity:0}),t(".lrn-mr-btn").animate({opacity:1},300)):(t(".learn_more_about_cron").addClass("open"),t(".learn_more_about_cron").show(300),t(".lrn-mr-btn").css({opacity:1}),t(".lrn-mr-btn").animate({opacity:0},300,function(){t(".lrn-mr-btn").hide()}))}),t("#bmi-error-toggle").on("click",function(){t(".error-body").hasClass("open")?(t(".error-body").hide(300),t(".error-body").removeClass("open"),t("#bmi-error-toggle").text(t("#bmi-error-toggle").data("expand"))):(t(".error-body").show(300),t(".error-body").addClass("open"),t("#bmi-error-toggle").text(t("#bmi-error-toggle").data("collapse")))}),t("#bmi_send_test_mail").on("click",function(e){e.preventDefault(),t.bmi.ajax("send-test-mail",{}).then(function(e){t.bmi.alert("success",t("#bmi-email-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-email-fail").text(),3e3)})}),t("#bmi-error-dismiss").on("click",function(){t(".error-noticer").hide(300),setTimeout(function(){t(".error-noticer").remove()},330),t.bmi.ajax("dismiss-error-notice",{}).then(function(t){}).catch(function(t){})}),t(".deleteAllSelected").on("click",function(){let e=X(),i=[];for(let t=0;t<e.length;++t){let o=e[t].closest("tr");i.push(o.querySelector(".br_name").innerText)}t("#delete-confirm-modal").find(".text1").hide(),t("#delete-confirm-modal").find(".text2").show();let o=i.length;o<=0||(t("#backup-multiple-del-count").text(o),o>1?(t("#del-only-one").hide(),t("#del-more-than-one").show()):(t("#del-more-than-one").hide(),t("#del-only-one").show()),u=i,t.bmi.modal("delete-confirm-modal").open())}),t("#load-more-backups").on("click",function(e){e.preventDefault(),t.bmi.showMoreBackups()}),t("#show-format-tip").on("click",K),t("#hide-format-tip").on("click",K),t(".go-to-marbs").on("click",function(e){e.preventDefault(),document.getElementById("marbs").click(),t.bmi.modal().closeAll()}),t(".site-reloader").on("click",function(){let t=v.u+"?backup-migration=AFTER_RESTORE&backup-id="+v.l+"&progress-id=4u70L051n&t="+ +new Date;window.location=t}),async function(){$("plugins"),$("uploads"),$("themes"),$("contents_others"),$("wordpress")}(),t.bmi.ajax("get-dynamic-names",{}).then(function(e){let i=e.data;if(t("#bmi_exclusion_rules").text(""),void 0!==i&&void 0!==i.length){for(let e=0;e<i.length;++e){let o=t(".exclusion_template").clone();o.removeClass("exclusion_template"),o.find(".exclusion_txt").val(i[e].txt);let n=o.find(".exclusion_position").find("select"),s=o.find(".exclusion_where").find("select");n&&(n[0].setAttribute("data-def",i[e].pos),s&&(s[0].setAttribute("data-def",i[e].whr),t("#bmi_exclusion_rules").append(o),o.find(".exclusion_position").find(".bmi-dropdown").length>0&&t.bmi.setOption(o.find(".exclusion_position").find(".bmi-dropdown"),null,i[e].pos),o.find(".exclusion_where").find(".bmi-dropdown").length>0&&t.bmi.setOption(o.find(".exclusion_where").find(".bmi-dropdown"),null,i[e].whr)))}t("#dynamic-fpaths-names").text(e["dynamic-fpaths-names"].join("\n")),t("#dynamic-dpaths-names").text(e["dynamic-dpaths-names"].join("\n"))}}).catch(function(t){console.log(t)}),t.bmi.reloadBackups(),function(){let e=1e3*parseInt(t("#server-time-auto").attr("data-time")),i=new Date(e);t("#server-time-auto").text(i.toUTCString()),setInterval(function(){e+=1e3,i=new Date(e),t("#server-time-auto").text(i.toUTCString())},1e3),t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}()}),jQuery(document).ready(function(t){t(".modal-opener").on("click",function(e){this.getAttribute("data-modal")&&""!=this.getAttribute("data-modal")&&(e.preventDefault(),this.getAttribute("data-close")&&t.bmi.modal(this.getAttribute("data-close")).close(),t.bmi.modal(this.getAttribute("data-modal")).open())}),t(".modal-closer").on("click",function(e){this.getAttribute("data-close")&&""!=this.getAttribute("data-close")?(e.preventDefault(),t.bmi.modal(this.getAttribute("data-close")).close()):this.closest(".modal")&&(e.preventDefault(),t("#"+this.closest(".modal").getAttribute("id")).length>0&&t.bmi.modal(this.closest(".modal").getAttribute("id")).close())}),t(".modal-close").on("click",function(e){this.closest(".modal")&&(e.preventDefault(),t.bmi.modal(this.closest(".modal").id).close())}),t(".modal").on("click",function(e){e.target!=this||t(e.target).hasClass("modal-no-close")||t.bmi.modal(this.id).close()})}),jQuery(document).ready(function(t){t.bmi.tooltips.init();let e,i=-1,o=!1,n="";for(let t=0;t<12;++t)n+="<div></div>";function s(o){clearInterval(e),0==o?(t(".upload-progress-bar").find("span")[0].style.width=o+"%",t(".upload-percentage").text(o+"%")):100==o?(t(".upload-progress-bar").find("span")[0].style.width=o+"%",t(".upload-percentage").text(o+"%")):function(o=0,n=1e3){if(i==o)return;i=o,clearInterval(e);let s=parseInt(t(".upload-percentage").text())-1;if(s>o&&0!=o)return;let r=o-s,a=s,l=Math.abs(Math.floor(n/r));e=setInterval(function(){a+=1,t(".upload-progress-bar").find("span")[0].style.width=a+"%",t(".upload-percentage").text(a+"%"),a>=100&&(clearInterval(e),i=null)},l)}(o,1e3)}t(".spinner-loader").html(n).addClass("lds-spinner"),t.fchunker({upId:"upid",upShardSize:"5",upMaxSize:"2000",upUrl:ajaxurl,upType:"zip",upCallBack:function(e){var i=e.status,n=e.message;e.url,Math.random();2==i&&(setTimeout(function(){t("#drop-area").show(300),t(".upload-progress").hide(300)},100),t.bmi.alert("success",t("#bmi-upload-end").text(),3e3),t.bmi.modal("upload-success-modal").open(),t.bmi.reloadBackups()),1==i&&(o||(t.bmi.alert("success",t("#bmi-upload-start").text(),3e3),o=!0)),0==i&&(t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300)),5==i&&(t.bmi.modal("upload-invalid-manifest-modal").open(),t("#drop-area").show(300),t(".upload-progress").hide(300)),3==i&&(s(100),t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300))},upEvent:function(t){s(t)},upStop:function(e){s(0),setTimeout(function(){t("#drop-area").show(300),t(".upload-progress").hide(300)},100),e.includes("Type error")?(t.bmi.modal("upload-wrong-file-modal").open(),t.bmi.alert("warning",t("#bmi-upload-wrong").text(),3e3)):e.includes("File already exists")?(t.bmi.modal("upload-exist-file-modal").open(),t.bmi.alert("warning",t("#bmi-upload-exists").text(),3e3)):(t.bmi.alert("error",t("#bmi-upload-error").text(),3e3),console.error(e))},upStart:function(){o=!1,i=-1,s(0),setTimeout(function(){t("#drop-area").hide(300),t(".upload-progress").show(300)},100)}})}),jQuery(document).ready(function(t){function e(t){for(let e=0;e<t.length;++e){let i=t[e].closest(".container-radio");i&&void 0!=typeof i.classList&&(i.classList.remove("active"),!0===t[e].checked&&i.classList.add("active"))}}t('input[type="radio"]').on("change",function(){let t=this.getAttribute("name");this.closest(".container-radio");e(document.querySelectorAll('[name="'+t+'"]'))}),e(document.getElementById("bmi").querySelectorAll('input[type="radio"]'))}),jQuery(document).ready(function(t){let e=!1;t(".tabs").on("click",".tab",function(i){if(this.classList.contains("active"))return;if(!0===e)return;e=!0,t.bmi.collapsers.closeAll();let o=this.getAttribute("data-point");"manage-restore-wrapper"==o?(t("#create-backup-wrapper").hide(300),t('[data-point="create-backup-wrapper"]').removeClass("active")):"create-backup-wrapper"==o&&(t("#manage-restore-wrapper").hide(300),t('[data-point="manage-restore-wrapper"]').removeClass("active")),t("#"+o).show(300),t(this).addClass("active"),setTimeout(function(){e=!1},320)})}),jQuery(document).ready(function(t){let e=document.getElementById("drop-area");function i(t){t.preventDefault(),t.stopPropagation()}function o(t){e.classList.add("highlight")}function n(t){e.classList.remove("highlight")}e&&(["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,i,!1)}),["dragenter","dragover"].forEach(t=>{e.addEventListener(t,o,!1),document.querySelector("body").addEventListener(t,o,!1)}),["dragleave","drop","mouseleave"].forEach(t=>{e.addEventListener(t,n,!1)}),t("body, #drop-area").on("mouseleave dragleave drop",function(){n()}),e.addEventListener("drop",function(t){!function(t){t=[...t],jQuery.fchunker_upload("file",t[0])}(t.dataTransfer.files)},!1))});
|
1 |
+
!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(0,function(t){var e={animation:"fade",animationDuration:350,content:null,contentAsHTML:!1,contentCloning:!1,debug:!0,delay:300,delayTouch:[300,500],functionInit:null,functionBefore:null,functionReady:null,functionAfter:null,functionFormat:null,IEmin:6,interactive:!1,multiple:!1,parent:null,plugins:["sideTip"],repositionOnScroll:!1,restoration:"none",selfDestruction:!0,theme:[],timer:0,trackerInterval:500,trackOrigin:!1,trackTooltip:!1,trigger:"hover",triggerClose:{click:!1,mouseleave:!1,originClick:!1,scroll:!1,tap:!1,touchleave:!1},triggerOpen:{click:!1,mouseenter:!1,tap:!1,touchstart:!1},updateAnimation:"rotate",zIndex:9999999},i="undefined"!=typeof window?window:null,o={hasTouchCapability:!(!i||!("ontouchstart"in i||i.DocumentTouch&&i.document instanceof i.DocumentTouch||i.navigator.maxTouchPoints)),hasTransitions:function(){if(!i)return!1;var t=(i.document.body||i.document.documentElement).style,e="transition",o=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof t[e])return!0;e=e.charAt(0).toUpperCase()+e.substr(1);for(var n=0;n<o.length;n++)if("string"==typeof t[o[n]+e])return!0;return!1}(),IE:!1,semVer:"4.2.8",window:i},n=function(){this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__instancesLatestArr=[],this.__plugins={},this._env=o};function s(t){this.$container,this.constraints=null,this.__$tooltip,this.__init(t)}function r(e,i){var o=!0;return t.each(e,function(t,n){if(void 0===i[t]||e[t]!==i[t])return o=!1,!1}),o}function a(e){var i=e.attr("id"),n=i?o.window.document.getElementById(i):null;return n?n===e[0]:t.contains(o.window.document.body,e[0])}n.prototype={__bridge:function(e,i,o){if(!i[o]){var n=function(){};n.prototype=e;var s=new n;s.__init&&s.__init(i),t.each(e,function(t,e){0!=t.indexOf("__")&&(i[t]||(i[t]=function(){return s[t].apply(s,Array.prototype.slice.apply(arguments))},i[t].bridged=s))}),i[o]=s}return this},__setWindow:function(t){return o.window=t,this},_getRuler:function(t){return new s(t)},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_plugin:function(e){if("string"==typeof e){var i=e,o=null;return i.indexOf(".")>0?o=this.__plugins[i]:t.each(this.__plugins,function(t,e){if(e.name.substring(e.name.length-i.length-1)=="."+i)return o=e,!1}),o}if(e.name.indexOf(".")<0)throw new Error("Plugins must be namespaced");return this.__plugins[e.name]=e,e.core&&this.__bridge(e.core,this,e.name),this},_trigger:function(){var t=Array.prototype.slice.apply(arguments);return"string"==typeof t[0]&&(t[0]={type:t[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,t),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,t),this},instances:function(e){var i=[];return t(e||".tooltipstered").each(function(){var e=t(this),o=e.data("tooltipster-ns");o&&t.each(o,function(t,o){i.push(e.data(o))})}),i},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(e){return t((e?e+" ":"")+".tooltipstered").toArray()},setDefaults:function(i){return t.extend(e,i),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.tooltipster=new n,t.Tooltipster=function(e,i){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace="tooltipster-"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state="closed",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(e,i)},t.Tooltipster.prototype={__init:function(i,n){var s=this;if(s._$origin=t(i),s.__options=t.extend(!0,{},e,n),s.__optionsFormat(),!o.IE||o.IE>=s.__options.IEmin){var r=null;if(void 0===s._$origin.data("tooltipster-initialTitle")&&(void 0===(r=s._$origin.attr("title"))&&(r=null),s._$origin.data("tooltipster-initialTitle",r)),null!==s.__options.content)s.__contentSet(s.__options.content);else{var a,l=s._$origin.attr("data-tooltip-content");l&&(a=t(l)),a&&a[0]?s.__contentSet(a.first()):s.__contentSet(r)}s._$origin.removeAttr("title").addClass("tooltipstered"),s.__prepareOrigin(),s.__prepareGC(),t.each(s.__options.plugins,function(t,e){s._plug(e)}),o.hasTouchCapability&&t(o.window.document.body).on("touchmove."+s.__namespace+"-triggerOpen",function(t){s._touchRecordEvent(t)}),s._on("created",function(){s.__prepareTooltip()})._on("repositioned",function(t){s.__lastPosition=t.position})}else s.__options.disabled=!0},__contentInsert:function(){var t=this._$tooltip.find(".tooltipster-content"),e=this.__Content;return this._trigger({type:"format",content:this.__Content,format:function(t){e=t}}),this.__options.functionFormat&&(e=this.__options.functionFormat.call(this,this,{origin:this._$origin[0]},this.__Content)),"string"!=typeof e||this.__options.contentAsHTML?t.empty().append(e):t.text(e),this},__contentSet:function(e){return e instanceof t&&this.__options.contentCloning&&(e=e.clone(!0)),this.__Content=e,this._trigger({type:"updated",content:e}),this},__destroyError:function(){throw new Error("This tooltip has been destroyed and cannot execute your method call.")},__geometry:function(){var e=this._$origin,i=this._$origin.is("area");if(i){var n=this._$origin.parent().attr("name");e=t('img[usemap="#'+n+'"]')}var s=e[0].getBoundingClientRect(),r=t(o.window.document),a=t(o.window),l=e,c={available:{document:null,window:null},document:{size:{height:r.height(),width:r.width()}},window:{scroll:{left:o.window.scrollX||o.window.document.documentElement.scrollLeft,top:o.window.scrollY||o.window.document.documentElement.scrollTop},size:{height:a.height(),width:a.width()}},origin:{fixedLineage:!1,offset:{},size:{height:s.bottom-s.top,width:s.right-s.left},usemapImage:i?e[0]:null,windowOffset:{bottom:s.bottom,left:s.left,right:s.right,top:s.top}}};if(i){var p=this._$origin.attr("shape"),u=this._$origin.attr("coords");if(u&&(u=u.split(","),t.map(u,function(t,e){u[e]=parseInt(t)})),"default"!=p)switch(p){case"circle":var d=u[0],_=u[1],f=u[2],h=_-f,m=d-f;c.origin.size.height=2*f,c.origin.size.width=c.origin.size.height,c.origin.windowOffset.left+=m,c.origin.windowOffset.top+=h;break;case"rect":var g=u[0],b=u[1],w=u[2],v=u[3];c.origin.size.height=v-b,c.origin.size.width=w-g,c.origin.windowOffset.left+=g,c.origin.windowOffset.top+=b;break;case"poly":for(var y=0,k=0,x=0,C=0,$="even",T=0;T<u.length;T++){var I=u[T];"even"==$?(I>x&&(x=I,0===T&&(y=x)),I<y&&(y=I),$="odd"):(I>C&&(C=I,1==T&&(k=C)),I<k&&(k=I),$="even")}c.origin.size.height=C-k,c.origin.size.width=x-y,c.origin.windowOffset.left+=y,c.origin.windowOffset.top+=k}}for(this._trigger({type:"geometry",edit:function(t){c.origin.size.height=t.height,c.origin.windowOffset.left=t.left,c.origin.windowOffset.top=t.top,c.origin.size.width=t.width},geometry:{height:c.origin.size.height,left:c.origin.windowOffset.left,top:c.origin.windowOffset.top,width:c.origin.size.width}}),c.origin.windowOffset.right=c.origin.windowOffset.left+c.origin.size.width,c.origin.windowOffset.bottom=c.origin.windowOffset.top+c.origin.size.height,c.origin.offset.left=c.origin.windowOffset.left+c.window.scroll.left,c.origin.offset.top=c.origin.windowOffset.top+c.window.scroll.top,c.origin.offset.bottom=c.origin.offset.top+c.origin.size.height,c.origin.offset.right=c.origin.offset.left+c.origin.size.width,c.available.document={bottom:{height:c.document.size.height-c.origin.offset.bottom,width:c.document.size.width},left:{height:c.document.size.height,width:c.origin.offset.left},right:{height:c.document.size.height,width:c.document.size.width-c.origin.offset.right},top:{height:c.origin.offset.top,width:c.document.size.width}},c.available.window={bottom:{height:Math.max(c.window.size.height-Math.max(c.origin.windowOffset.bottom,0),0),width:c.window.size.width},left:{height:c.window.size.height,width:Math.max(c.origin.windowOffset.left,0)},right:{height:c.window.size.height,width:Math.max(c.window.size.width-Math.max(c.origin.windowOffset.right,0),0)},top:{height:Math.max(c.origin.windowOffset.top,0),width:c.window.size.width}};"html"!=l[0].tagName.toLowerCase();){if("fixed"==l.css("position")){c.origin.fixedLineage=!0;break}l=l.parent()}return c},__optionsFormat:function(){return"number"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),"number"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),"number"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),"string"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),null===this.__options.parent?this.__options.parent=t(o.window.document.body):"string"==typeof this.__options.parent&&(this.__options.parent=t(this.__options.parent)),"hover"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):"click"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger("options"),this},__prepareGC:function(){var e=this;return e.__options.selfDestruction?e.__garbageCollector=setInterval(function(){var i=(new Date).getTime();e.__touchEvents=t.grep(e.__touchEvents,function(t,e){return i-t.time>6e4}),a(e._$origin)||e.close(function(){e.destroy()})},2e4):clearInterval(e.__garbageCollector),e},__prepareOrigin:function(){var t=this;if(t._$origin.off("."+t.__namespace+"-triggerOpen"),o.hasTouchCapability&&t._$origin.on("touchstart."+t.__namespace+"-triggerOpen touchend."+t.__namespace+"-triggerOpen touchcancel."+t.__namespace+"-triggerOpen",function(e){t._touchRecordEvent(e)}),t.__options.triggerOpen.click||t.__options.triggerOpen.tap&&o.hasTouchCapability){var e="";t.__options.triggerOpen.click&&(e+="click."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.tap&&o.hasTouchCapability&&(e+="touchend."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){t._touchIsMeaningfulEvent(e)&&t._open(e)})}if(t.__options.triggerOpen.mouseenter||t.__options.triggerOpen.touchstart&&o.hasTouchCapability){e="";t.__options.triggerOpen.mouseenter&&(e+="mouseenter."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.touchstart&&o.hasTouchCapability&&(e+="touchstart."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){!t._touchIsTouchEvent(e)&&t._touchIsEmulatedEvent(e)||(t.__pointerIsOverOrigin=!0,t._openShortly(e))})}if(t.__options.triggerClose.mouseleave||t.__options.triggerClose.touchleave&&o.hasTouchCapability){e="";t.__options.triggerClose.mouseleave&&(e+="mouseleave."+t.__namespace+"-triggerOpen "),t.__options.triggerClose.touchleave&&o.hasTouchCapability&&(e+="touchend."+t.__namespace+"-triggerOpen touchcancel."+t.__namespace+"-triggerOpen"),t._$origin.on(e,function(e){t._touchIsMeaningfulEvent(e)&&(t.__pointerIsOverOrigin=!1)})}return t},__prepareTooltip:function(){var e=this,i=e.__options.interactive?"auto":"";return e._$tooltip.attr("id",e.__namespace).css({"pointer-events":i,zIndex:e.__options.zIndex}),t.each(e.__previousThemes,function(t,i){e._$tooltip.removeClass(i)}),t.each(e.__options.theme,function(t,i){e._$tooltip.addClass(i)}),e.__previousThemes=t.merge([],e.__options.theme),e},__scrollHandler:function(e){if(this.__options.triggerClose.scroll)this._close(e);else if(a(this._$origin)&&a(this._$tooltip)){var i=null;if(e.target===o.window.document)this.__Geometry.origin.fixedLineage||this.__options.repositionOnScroll&&this.reposition(e);else{i=this.__geometry();var n=!1;if("fixed"!=this._$origin.css("position")&&this.__$originParents.each(function(e,o){var s=t(o),r=s.css("overflow-x"),a=s.css("overflow-y");if("visible"!=r||"visible"!=a){var l=o.getBoundingClientRect();if("visible"!=r&&(i.origin.windowOffset.left<l.left||i.origin.windowOffset.right>l.right))return n=!0,!1;if("visible"!=a&&(i.origin.windowOffset.top<l.top||i.origin.windowOffset.bottom>l.bottom))return n=!0,!1}if("fixed"==s.css("position"))return!1}),n)this._$tooltip.css("visibility","hidden");else if(this._$tooltip.css("visibility","visible"),this.__options.repositionOnScroll)this.reposition(e);else{var s=i.origin.offset.left-this.__Geometry.origin.offset.left,r=i.origin.offset.top-this.__Geometry.origin.offset.top;this._$tooltip.css({left:this.__lastPosition.coord.left+s,top:this.__lastPosition.coord.top+r})}}this._trigger({type:"scroll",event:e,geo:i})}return this},__stateSet:function(t){return this.__state=t,this._trigger({type:"state",state:t}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,t.each(this.__timeouts.close,function(t,e){clearTimeout(e)}),this.__timeouts.close=[],this},__trackerStart:function(){var t=this,e=t._$tooltip.find(".tooltipster-content");return t.__options.trackTooltip&&(t.__contentBcr=e[0].getBoundingClientRect()),t.__tracker=setInterval(function(){if(a(t._$origin)&&a(t._$tooltip)){if(t.__options.trackOrigin){var i=t.__geometry(),o=!1;r(i.origin.size,t.__Geometry.origin.size)&&(t.__Geometry.origin.fixedLineage?r(i.origin.windowOffset,t.__Geometry.origin.windowOffset)&&(o=!0):r(i.origin.offset,t.__Geometry.origin.offset)&&(o=!0)),o||(t.__options.triggerClose.mouseleave?t._close():t.reposition())}if(t.__options.trackTooltip){var n=e[0].getBoundingClientRect();n.height===t.__contentBcr.height&&n.width===t.__contentBcr.width||(t.reposition(),t.__contentBcr=n)}}else t._close()},t.__options.trackerInterval),t},_close:function(e,i,n){var s=this,r=!0;if(s._trigger({type:"close",event:e,stop:function(){r=!1}}),r||n){i&&s.__callbacks.close.push(i),s.__callbacks.open=[],s.__timeoutsClear();var a=function(){t.each(s.__callbacks.close,function(t,i){i.call(s,s,{event:e,origin:s._$origin[0]})}),s.__callbacks.close=[]};if("closed"!=s.__state){var l=!0,c=(new Date).getTime()+s.__options.animationDuration[1];if("disappearing"==s.__state&&c>s.__closingTime&&s.__options.animationDuration[1]>0&&(l=!1),l){s.__closingTime=c,"disappearing"!=s.__state&&s.__stateSet("disappearing");var p=function(){clearInterval(s.__tracker),s._trigger({type:"closing",event:e}),s._$tooltip.off("."+s.__namespace+"-triggerClose").removeClass("tooltipster-dying"),t(o.window).off("."+s.__namespace+"-triggerClose"),s.__$originParents.each(function(e,i){t(i).off("scroll."+s.__namespace+"-triggerClose")}),s.__$originParents=null,t(o.window.document.body).off("."+s.__namespace+"-triggerClose"),s._$origin.off("."+s.__namespace+"-triggerClose"),s._off("dismissable"),s.__stateSet("closed"),s._trigger({type:"after",event:e}),s.__options.functionAfter&&s.__options.functionAfter.call(s,s,{event:e,origin:s._$origin[0]}),a()};o.hasTransitions?(s._$tooltip.css({"-moz-animation-duration":s.__options.animationDuration[1]+"ms","-ms-animation-duration":s.__options.animationDuration[1]+"ms","-o-animation-duration":s.__options.animationDuration[1]+"ms","-webkit-animation-duration":s.__options.animationDuration[1]+"ms","animation-duration":s.__options.animationDuration[1]+"ms","transition-duration":s.__options.animationDuration[1]+"ms"}),s._$tooltip.clearQueue().removeClass("tooltipster-show").addClass("tooltipster-dying"),s.__options.animationDuration[1]>0&&s._$tooltip.delay(s.__options.animationDuration[1]),s._$tooltip.queue(p)):s._$tooltip.stop().fadeOut(s.__options.animationDuration[1],p)}}else a()}return s},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(e,i){var n=this;if(!n.__destroying&&a(n._$origin)&&n.__enabled){var s=!0;if("closed"==n.__state&&(n._trigger({type:"before",event:e,stop:function(){s=!1}}),s&&n.__options.functionBefore&&(s=n.__options.functionBefore.call(n,n,{event:e,origin:n._$origin[0]}))),!1!==s&&null!==n.__Content){i&&n.__callbacks.open.push(i),n.__callbacks.close=[],n.__timeoutsClear();var r,l=function(){"stable"!=n.__state&&n.__stateSet("stable"),t.each(n.__callbacks.open,function(t,e){e.call(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}),n.__callbacks.open=[]};if("closed"!==n.__state)r=0,"disappearing"===n.__state?(n.__stateSet("appearing"),o.hasTransitions?(n._$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-show"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(l)):n._$tooltip.stop().fadeIn(l)):"stable"==n.__state&&l();else{if(n.__stateSet("appearing"),r=n.__options.animationDuration[0],n.__contentInsert(),n.reposition(e,!0),o.hasTransitions?(n._$tooltip.addClass("tooltipster-"+n.__options.animation).addClass("tooltipster-initial").css({"-moz-animation-duration":n.__options.animationDuration[0]+"ms","-ms-animation-duration":n.__options.animationDuration[0]+"ms","-o-animation-duration":n.__options.animationDuration[0]+"ms","-webkit-animation-duration":n.__options.animationDuration[0]+"ms","animation-duration":n.__options.animationDuration[0]+"ms","transition-duration":n.__options.animationDuration[0]+"ms"}),setTimeout(function(){"closed"!=n.__state&&(n._$tooltip.addClass("tooltipster-show").removeClass("tooltipster-initial"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(l))},0)):n._$tooltip.css("display","none").fadeIn(n.__options.animationDuration[0],l),n.__trackerStart(),t(o.window).on("resize."+n.__namespace+"-triggerClose",function(e){var i=t(document.activeElement);(i.is("input")||i.is("textarea"))&&t.contains(n._$tooltip[0],i[0])||n.reposition(e)}).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)}),n.__$originParents=n._$origin.parents(),n.__$originParents.each(function(e,i){t(i).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)})}),n.__options.triggerClose.mouseleave||n.__options.triggerClose.touchleave&&o.hasTouchCapability){n._on("dismissable",function(t){t.dismissable?t.delay?(d=setTimeout(function(){n._close(t.event)},t.delay),n.__timeouts.close.push(d)):n._close(t):clearTimeout(d)});var c=n._$origin,p="",u="",d=null;n.__options.interactive&&(c=c.add(n._$tooltip)),n.__options.triggerClose.mouseleave&&(p+="mouseenter."+n.__namespace+"-triggerClose ",u+="mouseleave."+n.__namespace+"-triggerClose "),n.__options.triggerClose.touchleave&&o.hasTouchCapability&&(p+="touchstart."+n.__namespace+"-triggerClose",u+="touchend."+n.__namespace+"-triggerClose touchcancel."+n.__namespace+"-triggerClose"),c.on(u,function(t){if(n._touchIsTouchEvent(t)||!n._touchIsEmulatedEvent(t)){var e="mouseleave"==t.type?n.__options.delay:n.__options.delayTouch;n._trigger({delay:e[1],dismissable:!0,event:t,type:"dismissable"})}}).on(p,function(t){!n._touchIsTouchEvent(t)&&n._touchIsEmulatedEvent(t)||n._trigger({dismissable:!1,event:t,type:"dismissable"})})}n.__options.triggerClose.originClick&&n._$origin.on("click."+n.__namespace+"-triggerClose",function(t){n._touchIsTouchEvent(t)||n._touchIsEmulatedEvent(t)||n._close(t)}),(n.__options.triggerClose.click||n.__options.triggerClose.tap&&o.hasTouchCapability)&&setTimeout(function(){if("closed"!=n.__state){var e="",i=t(o.window.document.body);n.__options.triggerClose.click&&(e+="click."+n.__namespace+"-triggerClose "),n.__options.triggerClose.tap&&o.hasTouchCapability&&(e+="touchend."+n.__namespace+"-triggerClose"),i.on(e,function(e){n._touchIsMeaningfulEvent(e)&&(n._touchRecordEvent(e),n.__options.interactive&&t.contains(n._$tooltip[0],e.target)||n._close(e))}),n.__options.triggerClose.tap&&o.hasTouchCapability&&i.on("touchstart."+n.__namespace+"-triggerClose",function(t){n._touchRecordEvent(t)})}},0),n._trigger("ready"),n.__options.functionReady&&n.__options.functionReady.call(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}if(n.__options.timer>0){d=setTimeout(function(){n._close()},n.__options.timer+r);n.__timeouts.close.push(d)}}}return n},_openShortly:function(t){var e=this,i=!0;if("stable"!=e.__state&&"appearing"!=e.__state&&!e.__timeouts.open&&(e._trigger({type:"start",event:t,stop:function(){i=!1}}),i)){var o=0==t.type.indexOf("touch")?e.__options.delayTouch:e.__options.delay;o[0]?e.__timeouts.open=setTimeout(function(){e.__timeouts.open=null,e.__pointerIsOverOrigin&&e._touchIsMeaningfulEvent(t)?(e._trigger("startend"),e._open(t)):e._trigger("startcancel")},o[0]):(e._trigger("startend"),e._open(t))}return e},_optionsExtract:function(e,i){var o=this,n=t.extend(!0,{},i),s=o.__options[e];return s||(s={},t.each(i,function(t,e){var i=o.__options[t];void 0!==i&&(s[t]=i)})),t.each(n,function(e,i){void 0!==s[e]&&("object"!=typeof i||i instanceof Array||null==i||"object"!=typeof s[e]||s[e]instanceof Array||null==s[e]?n[e]=s[e]:t.extend(n[e],s[e]))}),n},_plug:function(e){var i=t.tooltipster._plugin(e);if(!i)throw new Error('The "'+e+'" plugin is not defined');return i.instance&&t.tooltipster.__bridge(i.instance,this,i.name),this},_touchIsEmulatedEvent:function(t){for(var e=!1,i=(new Date).getTime(),o=this.__touchEvents.length-1;o>=0;o--){var n=this.__touchEvents[o];if(!(i-n.time<500))break;n.target===t.target&&(e=!0)}return e},_touchIsMeaningfulEvent:function(t){return this._touchIsTouchEvent(t)&&!this._touchSwiped(t.target)||!this._touchIsTouchEvent(t)&&!this._touchIsEmulatedEvent(t)},_touchIsTouchEvent:function(t){return 0==t.type.indexOf("touch")},_touchRecordEvent:function(t){return this._touchIsTouchEvent(t)&&(t.time=(new Date).getTime(),this.__touchEvents.push(t)),this},_touchSwiped:function(t){for(var e=!1,i=this.__touchEvents.length-1;i>=0;i--){var o=this.__touchEvents[i];if("touchmove"==o.type){e=!0;break}if("touchstart"==o.type&&t===o.target)break}return e},_trigger:function(){var e=Array.prototype.slice.apply(arguments);return"string"==typeof e[0]&&(e[0]={type:e[0]}),e[0].instance=this,e[0].origin=this._$origin?this._$origin[0]:null,e[0].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,e),t.tooltipster._trigger.apply(t.tooltipster,e),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,e),this},_unplug:function(e){var i=this;if(i[e]){var o=t.tooltipster._plugin(e);o.instance&&t.each(o.instance,function(t,o){i[t]&&i[t].bridged===i[e]&&delete i[t]}),i[e].__destroy&&i[e].__destroy(),delete i[e]}return i},close:function(t){return this.__destroyed?this.__destroyError():this._close(null,t),this},content:function(t){var e=this;if(void 0===t)return e.__Content;if(e.__destroyed)e.__destroyError();else if(e.__contentSet(t),null!==e.__Content){if("closed"!==e.__state&&(e.__contentInsert(),e.reposition(),e.__options.updateAnimation))if(o.hasTransitions){var i=e.__options.updateAnimation;e._$tooltip.addClass("tooltipster-update-"+i),setTimeout(function(){"closed"!=e.__state&&e._$tooltip.removeClass("tooltipster-update-"+i)},1e3)}else e._$tooltip.fadeTo(200,.5,function(){"closed"!=e.__state&&e._$tooltip.fadeTo(200,1)})}else e._close();return e},destroy:function(){var e=this;if(e.__destroyed)e.__destroyError();else{"closed"!=e.__state?e.option("animationDuration",0)._close(null,null,!0):e.__timeoutsClear(),e._trigger("destroy"),e.__destroyed=!0,e._$origin.removeData(e.__namespace).off("."+e.__namespace+"-triggerOpen"),t(o.window.document.body).off("."+e.__namespace+"-triggerOpen");var i=e._$origin.data("tooltipster-ns");if(i)if(1===i.length){var n=null;"previous"==e.__options.restoration?n=e._$origin.data("tooltipster-initialTitle"):"current"==e.__options.restoration&&(n="string"==typeof e.__Content?e.__Content:t("<div></div>").append(e.__Content).html()),n&&e._$origin.attr("title",n),e._$origin.removeClass("tooltipstered"),e._$origin.removeData("tooltipster-ns").removeData("tooltipster-initialTitle")}else i=t.grep(i,function(t,i){return t!==e.__namespace}),e._$origin.data("tooltipster-ns",i);e._trigger("destroyed"),e._off(),e.off(),e.__Content=null,e.__$emitterPrivate=null,e.__$emitterPublic=null,e.__options.parent=null,e._$origin=null,e._$tooltip=null,t.tooltipster.__instancesLatestArr=t.grep(t.tooltipster.__instancesLatestArr,function(t,i){return e!==t}),clearInterval(e.__garbageCollector)}return e},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){if(!this.__destroyed)return this._$origin[0];this.__destroyError()},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(t){return this.close(t)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(t){return this.__destroyed?this.__destroyError():this._open(null,t),this},option:function(e,i){return void 0===i?this.__options[e]:(this.__destroyed?this.__destroyError():(this.__options[e]=i,this.__optionsFormat(),t.inArray(e,["trigger","triggerClose","triggerOpen"])>=0&&this.__prepareOrigin(),"selfDestruction"===e&&this.__prepareGC()),this)},reposition:function(t,e){return this.__destroyed?this.__destroyError():"closed"!=this.__state&&a(this._$origin)&&(e||a(this._$tooltip))&&(e||this._$tooltip.detach(),this.__Geometry=this.__geometry(),this._trigger({type:"reposition",event:t,helper:{geo:this.__Geometry}})),this},show:function(t){return this.open(t)},status:function(){return{destroyed:this.__destroyed,enabled:this.__enabled,open:"closed"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.fn.tooltipster=function(){var i=Array.prototype.slice.apply(arguments);if(0===this.length)return this;if("string"==typeof i[0]){var o="#*$~&";return this.each(function(){var e=t(this).data("tooltipster-ns"),n=e?t(this).data(e[0]):null;if(!n)throw new Error("You called Tooltipster's \""+i[0]+'" method on an uninitialized element');if("function"!=typeof n[i[0]])throw new Error('Unknown method "'+i[0]+'"');this.length>1&&"content"==i[0]&&(i[1]instanceof t||"object"==typeof i[1]&&null!=i[1]&&i[1].tagName)&&!n.__options.contentCloning&&n.__options.debug;var s=n[i[0]](i[1],i[2]);if(s!==n||"instance"===i[0])return o=s,!1}),"#*$~&"!==o?o:this}t.tooltipster.__instancesLatestArr=[];var n=i[0]&&void 0!==i[0].multiple,s=n&&i[0].multiple||!n&&e.multiple,r=i[0]&&void 0!==i[0].content,a=r&&i[0].content||!r&&e.content,l=i[0]&&void 0!==i[0].contentCloning,c=(l&&i[0].contentCloning,i[0]&&void 0!==i[0].debug);c&&i[0].debug;return this.length>1&&(a instanceof t||"object"==typeof a&&null!=a&&a.tagName),this.each(function(){var e=!1,o=t(this),n=o.data("tooltipster-ns"),r=null;n?s&&(e=!0):e=!0,e&&(r=new t.Tooltipster(this,i[0]),n||(n=[]),n.push(r.__namespace),o.data("tooltipster-ns",n),o.data(r.__namespace,r),r.__options.functionInit&&r.__options.functionInit.call(r,r,{origin:this}),r._trigger("init")),t.tooltipster.__instancesLatestArr.push(r)}),this},s.prototype={__init:function(e){this.__$tooltip=e,this.__$tooltip.css({left:0,overflow:"hidden",position:"absolute",top:0}).find(".tooltipster-content").css("overflow","auto"),this.$container=t('<div class="tooltipster-ruler"></div>').append(this.__$tooltip).appendTo(o.window.document.body)},__forceRedraw:function(){var t=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(t)},constrain:function(t,e){return this.constraints={width:t,height:e},this.__$tooltip.css({display:"block",height:"",overflow:"auto",width:t}),this},destroy:function(){this.__$tooltip.detach().find(".tooltipster-content").css({display:"",overflow:""}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:"",height:"",overflow:"visible",width:""}),this},measure:function(){this.__forceRedraw();var t=this.__$tooltip[0].getBoundingClientRect(),e={size:{height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}};if(this.constraints){var i=this.__$tooltip.find(".tooltipster-content"),n=this.__$tooltip.outerHeight(),s=i[0].getBoundingClientRect(),r={height:n<=this.constraints.height,width:t.width<=this.constraints.width&&s.width>=i[0].scrollWidth-1};e.fits=r.height&&r.width}return o.IE&&o.IE<=11&&e.size.width!==o.window.document.documentElement.clientWidth&&(e.size.width=Math.ceil(e.size.width)+1),e}};var l=navigator.userAgent.toLowerCase();-1!=l.indexOf("msie")?o.IE=parseInt(l.split("msie")[1]):-1!==l.toLowerCase().indexOf("trident")&&-1!==l.indexOf(" rv:11")?o.IE=11:-1!=l.toLowerCase().indexOf("edge/")&&(o.IE=parseInt(l.toLowerCase().split("edge/")[1])),t.tooltipster._plugin({name:"tooltipster.sideTip",instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:"top",viewportAware:!0}},__init:function(t){var e=this;e.__instance=t,e.__namespace="tooltipster-sideTip-"+Math.round(1e6*Math.random()),e.__previousState="closed",e.__options,e.__optionsFormat(),e.__instance._on("state."+e.__namespace,function(t){"closed"==t.state?e.__close():"appearing"==t.state&&"closed"==e.__previousState&&e.__create(),e.__previousState=t.state}),e.__instance._on("options."+e.__namespace,function(){e.__optionsFormat()}),e.__instance._on("reposition."+e.__namespace,function(t){e.__reposition(t.event,t.helper)})},__close:function(){this.__instance.content()instanceof t&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var e=t('<div class="tooltipster-base tooltipster-sidetip"><div class="tooltipster-box"><div class="tooltipster-content"></div></div><div class="tooltipster-arrow"><div class="tooltipster-arrow-uncropped"><div class="tooltipster-arrow-border"></div><div class="tooltipster-arrow-background"></div></div></div></div>');this.__options.arrow||e.find(".tooltipster-box").css("margin",0).end().find(".tooltipster-arrow").hide(),this.__options.minWidth&&e.css("min-width",this.__options.minWidth+"px"),this.__options.maxWidth&&e.css("max-width",this.__options.maxWidth+"px"),this.__instance._$tooltip=e,this.__instance._trigger("created")},__destroy:function(){this.__instance._off("."+self.__namespace)},__optionsFormat:function(){if(this.__options=this.__instance._optionsExtract("tooltipster.sideTip",this.__defaults()),this.__options.position&&(this.__options.side=this.__options.position),"object"!=typeof this.__options.distance&&(this.__options.distance=[this.__options.distance]),this.__options.distance.length<4&&(void 0===this.__options.distance[1]&&(this.__options.distance[1]=this.__options.distance[0]),void 0===this.__options.distance[2]&&(this.__options.distance[2]=this.__options.distance[0]),void 0===this.__options.distance[3]&&(this.__options.distance[3]=this.__options.distance[1])),this.__options.distance={top:this.__options.distance[0],right:this.__options.distance[1],bottom:this.__options.distance[2],left:this.__options.distance[3]},"string"==typeof this.__options.side){this.__options.side=[this.__options.side,{top:"bottom",right:"left",bottom:"top",left:"right"}[this.__options.side]],"left"==this.__options.side[0]||"right"==this.__options.side[0]?this.__options.side.push("top","bottom"):this.__options.side.push("right","left")}6===t.tooltipster._env.IE&&!0!==this.__options.arrow&&(this.__options.arrow=!1)},__reposition:function(e,i){var o,n=this,s=n.__targetFind(i),r=[];n.__instance._$tooltip.detach();var a=n.__instance._$tooltip.clone(),l=t.tooltipster._getRuler(a),c=!1,p=n.__instance.option("animation");switch(p&&a.removeClass("tooltipster-"+p),t.each(["window","document"],function(o,p){var u=null;if(n.__instance._trigger({container:p,helper:i,satisfied:c,takeTest:function(t){u=t},results:r,type:"positionTest"}),1==u||0!=u&&0==c&&("window"!=p||n.__options.viewportAware))for(o=0;o<n.__options.side.length;o++){var d={horizontal:0,vertical:0},_=n.__options.side[o];"top"==_||"bottom"==_?d.vertical=n.__options.distance[_]:d.horizontal=n.__options.distance[_],n.__sideChange(a,_),t.each(["natural","constrained"],function(t,o){if(u=null,n.__instance._trigger({container:p,event:e,helper:i,mode:o,results:r,satisfied:c,side:_,takeTest:function(t){u=t},type:"positionTest"}),1==u||0!=u&&0==c){var a={container:p,distance:d,fits:null,mode:o,outerSize:null,side:_,size:null,target:s[_],whole:null},f=("natural"==o?l.free():l.constrain(i.geo.available[p][_].width-d.horizontal,i.geo.available[p][_].height-d.vertical)).measure();if(a.size=f.size,a.outerSize={height:f.size.height+d.vertical,width:f.size.width+d.horizontal},"natural"==o?i.geo.available[p][_].width>=a.outerSize.width&&i.geo.available[p][_].height>=a.outerSize.height?a.fits=!0:a.fits=!1:a.fits=f.fits,"window"==p&&(a.fits?a.whole="top"==_||"bottom"==_?i.geo.origin.windowOffset.right>=n.__options.minIntersection&&i.geo.window.size.width-i.geo.origin.windowOffset.left>=n.__options.minIntersection:i.geo.origin.windowOffset.bottom>=n.__options.minIntersection&&i.geo.window.size.height-i.geo.origin.windowOffset.top>=n.__options.minIntersection:a.whole=!1),r.push(a),a.whole)c=!0;else if("natural"==a.mode&&(a.fits||a.size.width<=i.geo.available[p][_].width))return!1}})}}),n.__instance._trigger({edit:function(t){r=t},event:e,helper:i,results:r,type:"positionTested"}),r.sort(function(t,e){return t.whole&&!e.whole?-1:!t.whole&&e.whole?1:t.whole&&e.whole?(i=n.__options.side.indexOf(t.side))<(o=n.__options.side.indexOf(e.side))?-1:i>o?1:"natural"==t.mode?-1:1:t.fits&&!e.fits?-1:!t.fits&&e.fits?1:t.fits&&e.fits?(i=n.__options.side.indexOf(t.side))<(o=n.__options.side.indexOf(e.side))?-1:i>o?1:"natural"==t.mode?-1:1:"document"==t.container&&"bottom"==t.side&&"natural"==t.mode?-1:1;var i,o}),(o=r[0]).coord={},o.side){case"left":case"right":o.coord.top=Math.floor(o.target-o.size.height/2);break;case"bottom":case"top":o.coord.left=Math.floor(o.target-o.size.width/2)}switch(o.side){case"left":o.coord.left=i.geo.origin.windowOffset.left-o.outerSize.width;break;case"right":o.coord.left=i.geo.origin.windowOffset.right+o.distance.horizontal;break;case"top":o.coord.top=i.geo.origin.windowOffset.top-o.outerSize.height;break;case"bottom":o.coord.top=i.geo.origin.windowOffset.bottom+o.distance.vertical}"window"==o.container?"top"==o.side||"bottom"==o.side?o.coord.left<0?i.geo.origin.windowOffset.right-this.__options.minIntersection>=0?o.coord.left=0:o.coord.left=i.geo.origin.windowOffset.right-this.__options.minIntersection-1:o.coord.left>i.geo.window.size.width-o.size.width&&(i.geo.origin.windowOffset.left+this.__options.minIntersection<=i.geo.window.size.width?o.coord.left=i.geo.window.size.width-o.size.width:o.coord.left=i.geo.origin.windowOffset.left+this.__options.minIntersection+1-o.size.width):o.coord.top<0?i.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?o.coord.top=0:o.coord.top=i.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:o.coord.top>i.geo.window.size.height-o.size.height&&(i.geo.origin.windowOffset.top+this.__options.minIntersection<=i.geo.window.size.height?o.coord.top=i.geo.window.size.height-o.size.height:o.coord.top=i.geo.origin.windowOffset.top+this.__options.minIntersection+1-o.size.height):(o.coord.left>i.geo.window.size.width-o.size.width&&(o.coord.left=i.geo.window.size.width-o.size.width),o.coord.left<0&&(o.coord.left=0)),n.__sideChange(a,o.side),i.tooltipClone=a[0],i.tooltipParent=n.__instance.option("parent").parent[0],i.mode=o.mode,i.whole=o.whole,i.origin=n.__instance._$origin[0],i.tooltip=n.__instance._$tooltip[0],delete o.container,delete o.fits,delete o.mode,delete o.outerSize,delete o.whole,o.distance=o.distance.horizontal||o.distance.vertical;var u,d,_,f=t.extend(!0,{},o);if(n.__instance._trigger({edit:function(t){o=t},event:e,helper:i,position:f,type:"position"}),n.__options.functionPosition){var h=n.__options.functionPosition.call(n,n.__instance,i,f);h&&(o=h)}l.destroy(),"top"==o.side||"bottom"==o.side?(u={prop:"left",val:o.target-o.coord.left},d=o.size.width-this.__options.minIntersection):(u={prop:"top",val:o.target-o.coord.top},d=o.size.height-this.__options.minIntersection),u.val<this.__options.minIntersection?u.val=this.__options.minIntersection:u.val>d&&(u.val=d),_=i.geo.origin.fixedLineage?i.geo.origin.windowOffset:{left:i.geo.origin.windowOffset.left+i.geo.window.scroll.left,top:i.geo.origin.windowOffset.top+i.geo.window.scroll.top},o.coord={left:_.left+(o.coord.left-i.geo.origin.windowOffset.left),top:_.top+(o.coord.top-i.geo.origin.windowOffset.top)},n.__sideChange(n.__instance._$tooltip,o.side),i.geo.origin.fixedLineage?n.__instance._$tooltip.css("position","fixed"):n.__instance._$tooltip.css("position",""),n.__instance._$tooltip.css({left:o.coord.left,top:o.coord.top,height:o.size.height,width:o.size.width}).find(".tooltipster-arrow").css({left:"",top:""}).css(u.prop,u.val),n.__instance._$tooltip.appendTo(n.__instance.option("parent")),n.__instance._trigger({type:"repositioned",event:e,position:o})},__sideChange:function(t,e){t.removeClass("tooltipster-bottom").removeClass("tooltipster-left").removeClass("tooltipster-right").removeClass("tooltipster-top").addClass("tooltipster-"+e)},__targetFind:function(t){var e={},i=this.__instance._$origin[0].getClientRects();i.length>1&&(1==this.__instance._$origin.css("opacity")&&(this.__instance._$origin.css("opacity",.99),i=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1)));if(i.length<2)e.top=Math.floor(t.geo.origin.windowOffset.left+t.geo.origin.size.width/2),e.bottom=e.top,e.left=Math.floor(t.geo.origin.windowOffset.top+t.geo.origin.size.height/2),e.right=e.left;else{var o=i[0];e.top=Math.floor(o.left+(o.right-o.left)/2),o=i.length>2?i[Math.ceil(i.length/2)-1]:i[0],e.right=Math.floor(o.top+(o.bottom-o.top)/2),o=i[i.length-1],e.bottom=Math.floor(o.left+(o.right-o.left)/2),o=i.length>2?i[Math.ceil((i.length+1)/2)-1]:i[i.length-1],e.left=Math.floor(o.top+(o.bottom-o.top)/2)}return e}}})}),jQuery(document).ready(function($){var fchunker_upload={fchunker:function(t){$.extend(t),$.upId&&$.upUrl&&($.domHtml=$("#"+$.upId).html(),$.upInputId=$.upId+"_input")},fchunker_limitFileSize:function(t,e){for(var i=["KB","MB","GB"],o=e.toUpperCase(),n=0,s=0;s<i.length;s++){var r=o.indexOf(i[s]);if(r>-1){n=parseInt(o.substr(0,r))*Math.pow(1024,s+1);break}}return!(t.size>n)},upErrorMsg:function(t){$.upError=t},upStop:function(t){$.upError=t},upStatus:function(){return!$.upError||("function"==typeof $.upStop&&$.upStop($.upError),!1)},fchunker_getPercent:function(t,e){if(t=parseFloat(t),e=parseFloat(e),isNaN(t)||isNaN(e))return"-";return e<=0?0:Math.round(t/e*1e4)/100},fchunker_upload:function(t,e){$.upError="",$.tempFile=$("#"+$.upInputId)[0].files[0],"file"==t&&($.tempFile=e);var i=$.tempFile;if(!i)return!1;"function"==typeof $.upStart&&$.upStart();var o=i.name,n=o.lastIndexOf("."),s=o.length,r=o.substring(n+1,s);if($.upType&&(uptype=$.upType.split(","),-1==$.inArray(r,uptype)&&($.upError="Type error: Error-"+r)),$.upMaxSize&&($.fchunker_limitFileSize(i,$.upMaxSize+"MB")||($.upError="Error")),0==$.upStatus())return!1;$.taskStart=+new Date,setTimeout("jQuery.fchunker_upload_core()","100")},fchunker_upload_core:function(){var file=$.tempFile;if(!file)return!1;$.upShardSize||($.upShardSize=2);for(var filename=file.name,size=file.size,index1=filename.lastIndexOf("."),index2=filename.length,suffix=filename.substring(index1+1,index2),shardSize=1024*$.upShardSize*1024,succeed=0,shardCount=Math.ceil(size/shardSize),re=[],start,end=0,i=0;i<shardCount;++i)re[i]=[],start=i*shardSize,end=Math.min(size,start+shardSize),re[i].file_data=file.slice(start,end),re[i].file_name=filename,re[i].file_size=size;const URL=$.upUrl;var i2=0,i3=1,fcs=Array(),xhr=new XMLHttpRequest;function ajaxStack(stack){if(0!=$.upStatus()){var form=new FormData;stack[i2]&&(fcs=stack[i2],form.append("file_data",fcs.file_data),form.append("file_name",fcs.file_name),form.append("file_size",fcs.file_size),form.append("file_total",shardCount),form.append("file_index",i3),form.append("taskStart",$.taskStart),form.append("action","backup_migration"),form.append("token","bmi"),form.append("f","upload-backup"),xhr.open("POST",URL,!0),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.setRequestHeader("HTTP_X_REQUESTED_WITH","XMLHttpRequest"),xhr.onload=function(){ajaxStack(stack)},xhr.onreadystatechange=function(){if(0!=$.upStatus()&&4==xhr.readyState&&200==xhr.status){var data=xhr.responseText?eval("("+xhr.responseText+")"):"";++succeed;var cent=$.fchunker_getPercent(succeed,shardCount);"function"==typeof $.upEvent&&$.upEvent(cent),100==cent?setTimeout(function(){"function"==typeof $.upCallBack&&$.upCallBack(data)},500):"function"==typeof $.upCallBack&&$.upCallBack(data)}},xhr.send(form),i2++,i3++,form.delete("file_data"),form.delete("file_name"),form.delete("file_size"),form.delete("file_total"),form.delete("taskStart"),form.delete("file_index"),form.delete("action"),form.delete("token"),form.delete("f"))}}ajaxStack(re),re=null,file=null}};$.extend(fchunker_upload)}),jQuery(window).on("load",function(){setTimeout(function(){jQuery("#bmi").css({opacity:0}),jQuery("#bmi-preload").css({opacity:1}),jQuery("#bmi-preload").animate({opacity:0},150,function(){jQuery("#bmi-preload").remove(),jQuery("#bmi").css({display:"block"}),jQuery.bmi.dropdowns.init(),setTimeout(function(){jQuery("#wpfooter").show(200),jQuery("#bmi").animate({opacity:1},350)},100)})},50)}),jQuery(document).ready(function(t){let e=!1;t.extend({bmi:{clipboard:function(e){try{const i=document.createElement("textarea");return i.value=e,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i),t.bmi.alert("success",t("#bmi-success-copy").text(),3e3),!0}catch(e){return console.log(e),t.bmi.alert("warning",t("#bmi-failed-copy").text(),3e3),!1}},alert:function(e="default",i="---",o=7e3){t(".bmi-notification-box").length<=0&&t("body").find("#bmi").prepend(t('<div class="bmi-notification-box"></div>')),e="default"==e?"":"success"==e?" is-success":"warning"==e?" is-warning":"error"==e?" is-danger":" is-info";let n=Math.floor(Math.random()*Math.floor(64e3)),s=`<div style="display: none;" id="ntf-${n}" class="bmi-notification${e}">\n <button class="bmi-times-button" onclick="jQuery.bmi.hideAlert(this)">×</button>\n <div class="bmi-cf">\n <div class="bmi-left bmi-alert-icon"><div class="bmi-icon-bg"></div></div>\n <div class="bmi-left bmi-alert-msg-title">\n <div class="bmi-title${e}">Backup Migration</div>\n <div>${i}</div>\n </div>\n </div>\n </div>`;t(".bmi-notification-box").prepend(s);let r=t(`#ntf-${n}`);r.css({opacity:0,display:"block"});let a=r.outerWidth();r.outerHeight();r.css({right:"-35vw","font-size":"0px",width:0,padding:0,opacity:"0"}),r.animate({right:"15px",width:a,padding:"1rem 2rem 1rem 1.5rem",opacity:"1"},{duration:200,queue:!1}),r.animate({"font-size":"16px"},{duration:300,queue:!1}),setTimeout(()=>{t(`#ntf-${n}`).css({width:""})},250),setTimeout(()=>{r.animate({"font-size":"0px"},{duration:200,queue:!1}),r.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){r.remove()})},o)},_msg:function(e){"msg"==e.status&&(void 0===e.level&&(e.level="info"),t.bmi.alert(e.level,e.why,3e3),console.log("Backup-migration: ","["+e.level.toUpperCase()+"]",e.why))},hideAlert:function(e){let i=t(e).parents(".bmi-notification");i.animate({"font-size":"0px"},{duration:200,queue:!1}),i.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){i.remove()})},modal:function(e=!1){let i=!1;return 0!=e&&(i=document.getElementById(e)),{clearModal:function(){i.querySelectorAll(".customselect").forEach(function(t){t.classList.remove("active")}),i.querySelectorAll('input[type="text"]').forEach(function(t){t.value="",t.setAttribute("value","")})},open:function(e=function(){}){i.classList.add("before-open"),setTimeout(function(){i.classList.add("open"),t("html")[0].style.overflowY="hidden",setTimeout(e,410)},10)},close:function(e=function(){}){i.offsetWidth>0&&i.offsetHeight>0?(i.classList.add("before-close"),setTimeout(function(){i.classList.add("closed"),setTimeout(function(){i.classList.remove("before-open"),i.classList.remove("open"),i.classList.remove("before-close"),i.classList.remove("closed"),t.bmi.modal(i.id).clearModal(),e()},410)},10)):(i.classList.remove("before-open"),i.classList.remove("open"),i.classList.remove("before-close"),i.classList.remove("closed"),e()),t("html")[0].style.overflowY="auto"},closeAll:function(){document.querySelectorAll(".modal").forEach(function(e){t.bmi.modal(e.id).close()}),t("html")[0].style.overflowY="auto"}}},json:function(e){return new Promise(function(i,o){try{return i(JSON.parse(e))}catch(n){if("string"!=typeof e)return o(!1);{let n=t.bmi.reverse(e).indexOf("}");n=0==n?e.length:-n,e=e.slice(e.indexOf("{"),n);try{return i(JSON.parse(e))}catch(t){return o(!1)}}}})},reverse:function(e){return"string"==typeof e?""===e?"":t.bmi.reverse(e.substr(1))+e.charAt(0):e},ajax:function(e,i={}){return new Promise(function(o,n){function s(t,i){i||(i=t),console.log("------- BACKUP MIGRATION ERROR START -------"),!1===t?(console.log("Call: ",e),console.log("Status: ",i.status),console.log("Error: ",i.responseText)):console.log(i),console.log("-------- BACKUP MIGRATION ERROR END --------\n\n"),n(t,i.responseText)}i.action="backup_migration",i.token="bmi",i.f=e,t.post(ajaxurl,i).done(e=>{t.bmi.json(e).then(function(t){o(t)}).catch(function(t){s("json")})}).fail(t=>{s(!1,t)})})},tooltips:{init:function(){let e={delay:200,debug:!1,delayTouch:[100,200],interactive:!1,distance:0,side:"top",contentAsHTML:!1,maxWidth:460,triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["bmi-tooltip","bmi-tt-default","bmi-tt-default-customized"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)}},i=t(".tooltip"),o=t(".tooltip-html"),n=t(".premium-wrapper"),s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0;for(let o=0;o<i.length;++o){let n=i[o],s=n.getAttribute("data-top"),r=n.getAttribute("side"),a=JSON.parse(JSON.stringify(e));a.content=n.getAttribute("tooltip"),s&&(a.distance=parseInt(s)),r&&r.trim().length>0&&(a.side=r),t(n).tooltipster(a)}for(let e=0;e<o.length;++e){let i=o[e],n=i.getAttribute("side"),r=JSON.parse(JSON.stringify(s));r.content=i.getAttribute("tooltip"),n&&n.trim().length>0&&(r.side=n),t(i).tooltipster(r)}for(let i=0;i<n.length;++i){let o=n[i],s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0,s.maxWidth=500,o.getAttribute("tooltip")?s.content=o.getAttribute("tooltip"):s.content=t("#premium-tooltip")[0].innerHTML,o.getAttribute("side")&&(s.side=o.getAttribute("side")),t(o).tooltipster(s)}},hideAll:function(e=!1){function i(){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}e?i():setTimeout(i,10)}},collapsers:{toggle:function(i){if(!0===e)return;e=!0;let o=i.getAttribute("group");i.classList.contains("active")?t.bmi.collapsers.close(i):t.bmi.collapsers.open(i,o)},open:function(i,o){t.bmi.collapsers.closeGroup(o),t(i).addClass("active"),t(i).find(".content").show(300),setTimeout(function(){e=!1},300)},close:function(i){t(i).removeClass("active"),t(i).find(".content").hide(300),setTimeout(function(){e=!1},300)},closeGroup:function(i){t('.collapser[group="'+i+'"]').removeClass("active"),t('.collapser[group="'+i+'"]').find(".content").hide(300),setTimeout(function(){e=!1},300)},closeAll:function(){t(".collapser").removeClass("active"),t(".collapser").find(".content").hide(300),setTimeout(function(){e=!1},300)}},isUrlValid:function(t){return!!new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i").test(t)},bytesToHuman:function(t,e,i,o,n){return(e=Math,i=e.log,o=1024,n=i(t)/i(o)|0,t/e.pow(o,n)).toFixed(2)+" "+(n?"KMGTPEZY"[--n]+"B":"Bytes")},getCurrentBackups:function(e=function(){}){t("#reloading-bm-list").length>0&&"none"==t("#reloading-bm-list")[0].style.display&&(t("#reloading-bm-list").show(),t.bmi.ajax("get-current-backups",{}).then(function(i){t("#reloading-bm-list").hide(),e(i)}).catch(function(t){console.log(t)}))},fillWithNewBackups:function(e,i=function(){}){backups={},t("#bmi_restore_tbody").html("");let o=t("#bmi-manual-locked").text().trim(),n=Object.keys(e).sort(function(t,i){return+new Date(e[t][1].replace(/\-/g,"/"))-+new Date(e[i][1].replace(/\-/g,"/"))}),s=0;for(;s<n.length;++s){let i=n[s],r="locked"===e[i][5];i=(i=i.replace(/ /g,"")).trim();let a="bmi_br_backup_"+s,l=t(".br_tr_template").clone();l.removeClass("br_tr_template"),l[0].style.display="none",l.find(".br_label").attr("for",a),l.find(".br_checkbox").attr("id",a),l.find(".bc-download-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP&backup-id="+i),l.find(".bc-logs-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP_LOGS&backup-id="+i),l.find(".br_date").text(e[i][1]),l.find(".br_name").text(i),l.find(".br_size").text(t.bmi.bytesToHuman(e[i][4])+" ("+e[i][2]+")"),0!=(""+e[i][6]).trim().length&&e[i][6]+""!="false"||(l.find(".bc-locked-btn").addClass("forever"),l.find(".bc-locked-btn").attr("tooltip",o),r=!0),r?l.find(".bc-unlocked-btn").hide():l.find(".bc-locked-btn").hide(),l.prependTo("#bmi_restore_tbody"),e[i].push(i),backups[a]=e[i]}if(0==s){let e=t("#bmi_restore_tbody").data("empty");t("#bmi_restore_tbody").html('<tr><td class="center text-muted" colspan="100%">'+e+"</td></tr>")}t.bmi.tooltips.init(),t.bmi.showMoreBackups(),i()},showMoreBackups:function(e){backups={};let i=t("#bmi_restore_tbody").find("tr:hidden");for(let e=0;e<i.length&&e<10;++e)setTimeout(function(){t(i[e]).show(300)},50*e);i.length-10<=0?t("#load-more-backups-wrp").hide(300):t("#load-more-backups-wrp").show(300)},reloadBackups:function(e=function(){}){t.bmi.getCurrentBackups(function(i){t.bmi.fillWithNewBackups(i.backups,function(){e(),t("#backups-select-all").prop("checked",!1),t(".del-all-btn-wrp").hide(300)})})},hideAllLists:function(){let e=t(".dropdown-open");if(!(e.length<=0))for(let i=0;i<e.length;++i){let o=t(e[i]);o.hasClass("ignored-open")?o.removeClass("ignored-open"):(o.hide(300),o.removeClass("dropdown-open"),t(o[0].closest(".bmi-dropdown")).removeClass("active"))}},setOption:function(e,i=null,o=!1){let n=e.find(".dropdown-options");e.attr("data-optioner")&&(n=t(".optioner-"+e.attr("data-optioner"))),n.find(".active-option").removeClass("active-option"),!1!==o&&(i=n.find('.dropdown-option[data-value="'+o+'"]')),t(i).hasClass("active-option")||(e.find(".dropdown-title").text(i.text()),e.attr("data-selected",i.data("value")),i.addClass("active-option"),!1===o&&e.change(),t.bmi.hideAllLists())},prepareFile:function(e,i){let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(i)),o.setAttribute("download",e),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),t.bmi.alert("success",t("#bmi-download-should-start").text(),3e3)}}})}),jQuery(document).ready(function(t){t(".collapser .header").on("click",function(e){e.preventDefault();let i=t(this).parent(".collapser")[0];t.bmi.collapsers.toggle(i)}),t(".bmi_will_collapse").on("change",function(e){e.preventDefault();let i=!1;"radio"==this.getAttribute("type")&&"false"==this.getAttribute("value")&&(i=!0),$child=t(this).data("if-checked"),!0!==this.checked||i?t("#"+$child).hide(300):t("#"+$child).show(300)}),t(".collapser-openner").on("click",function(e){e.preventDefault();let i="configuration",o=t(this).data("el");t(this).data("group")&&(i=t(this).data("group")),t.bmi.collapsers.open(o,i),setTimeout(function(){t([document.documentElement,document.body]).animate({scrollTop:t(o).offset().top-50+"px"},300)},300)}),function(){let e=t(".bmi_will_collapse");for(let i=0;i<e.length;++i){let o=!1;$trigger=e[i],$child=t($trigger).data("if-checked"),"radio"==$trigger.getAttribute("type")&&"false"==$trigger.getAttribute("value")&&(o=!0),!0===$trigger.checked?t("#"+$child).show():t("#"+$child).hide()}}()}),jQuery(document).ready(function(t){var e=!0,i=!1;t.bmi.crons=function(){function o(){!function(e,i){t.bmi.ajax("calculate-cron",e).then(function(e){"success"==e.status?i(e):(i(!1),t.bmi._msg(e))}).catch(function(t){i(!1),console.log(t)})}({type:t('[data-id="cron-period"]').attr("data-selected"),day:t('[data-id="cron-day"]').attr("data-selected"),week:t('[data-id="cron-week"]').attr("data-selected"),hour:t('[data-id="cron-hour"]').attr("data-selected"),minute:t('[data-id="cron-minute"]').attr("data-selected"),keep:t('[data-id="cron-keep-backups"]').attr("data-selected"),enabled:!0==!t("#cron-btn-toggle")[0].checked},function(i){"success"===i.status&&!1!==i?(t(".cron-time-server").tooltipster("option","interactive",!1),t(".cron-time-server").tooltipster("option","contentAsHTML",!0),!0===t("#cron-btn-toggle")[0].checked&&(i.data="---"),t(".cron-time-server").tooltipster("content","<b>"+t("#bmi-next-cron").text()+"</b>"+i.data+"<br><b>"+t("#bmi-current-time").text()+"</b>"+i.currdata),e?e=!1:t.bmi.alert("success",t("#bmi-cron-updated").text(),1500)):e?e=!1:t.bmi.alert("error",t("#bmi-cron-updated-fail").text(),2500)})}function n(e){"month"==e?(t(".cron-the").show(),t('[data-id="cron-day"]').show(),t('[data-id="cron-week"]').hide(),t("#cron-on-word").show()):"week"==e?(t(".cron-the").hide(),t('[data-id="cron-day"]').hide(),t('[data-id="cron-week"]').show(),t("#cron-on-word").show()):(t(".cron-the").hide(),t('[data-id="cron-day"]').hide(),t('[data-id="cron-week"]').hide(),t("#cron-on-word").hide())}!0!==i&&(i=!0,t("#bmi").on("change",'[data-id="cron-period"]',function(t){o(),n(t.target.getAttribute("data-selected"))}),t("#bmi").on("change",'[data-id="cron-day"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-week"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-hour"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-minute"]',function(t){t.target.getAttribute("data-selected");o()}),t("#bmi").on("change",'[data-id="cron-keep-backups"]',function(t){t.target.getAttribute("data-selected");o()}),t("#i-backup-cron").on("click",function(){t(".cron-backups").find(".turned-off").is(":visible")&&(t("#cron-btn-toggle").prop("checked",!1),t(".cron-backups").removeClass("disabled"),o(),t(".cron-backups").find(".turned-on").css({opacity:0}),t(".cron-backups").find(".turned-off").css({opacity:0}),t(".cron-backups").find(".turned-on").show(),t(".cron-backups").find(".turned-on").css({opacity:1}),setTimeout(function(){t(".cron-backups").find(".turned-off").hide()},300))}),t("#cron-btn-toggle").on("change",function(){this.checked?t(".cron-backups").addClass("disabled"):t(".cron-backups").removeClass("disabled"),o()}),n(t('[data-id="cron-period"]')[0].getAttribute("data-selected")),o())}}),jQuery(document).ready(function(t){t.bmi.dropdowns={init:function(){let e=t("#bmi");function i(e="null",i="---"){let o=t(".option-template").clone();return o.removeClass("option-template"),o.attr("data-value",e),o.text(i),o}function o(o){if("none"!=o.style.display){o.style.display="none";let n=t(o),s=n.find("option"),r=function(e="---"){let i=t(".dropdown-template").clone();return i.removeClass("dropdown-template"),i.find(".dropdown-title").text(e),i}(function(t){let e="";for(let i=0;i<t.length;++i){let o=t[i].innerText;e.length<o.length&&(e=o)}return e}(s));r=function(e,o){let n=t(e).find(".dropdown-options");t(e).attr("data-optioner")&&(n=t(".optioner-"+t(e).attr("data-optioner")));for(let t=0;t<o.length;++t){let e=o[t];n.append(i(e.value,e.innerText))}return e}(r,s);let a=s[0].value,l=o.getAttribute("data-parent"),c=o.getAttribute("data-classes"),p="true"===o.getAttribute("data-hide");if(n.attr("data-def")&&(a=n.attr("data-def")),t(r).attr("data-id",o.id),t(r).attr("class",((null!=c?c:"")+" bmi-dropdown").trim()),t(r).insertBefore(n),null!==l){let e=parseInt(864197532*Math.random()+123456789);t(r).attr("data-optioner",e),t(r).find(".dropdown-options").attr("data-oparent",e),t(r).find(".dropdown-options").addClass("optioner-"+e),t(r).find(".dropdown-options").appendTo(l),t(l).css({position:"relative"})}let u=t(r).clone();if(!u)return;u[0].style.visibility="hidden",e.append(u);let d=u.width();u.remove(),t.bmi.setOption(t(r),null,a),t(r).find(".dropdown-title")[0].style.minWidth=d+10+"px",p&&t(r).hide()}}!function(){let t=e.find("select");for(let e=0;e<t.length;++e)o(t[e])}(),t.bmi.crons(),e.on("click",function(e){t(e.target).hasClass("bmi-dropdown")||e.target.closest(".bmi-dropdown")||t.bmi.hideAllLists()}),e.on("click",".dropdown-title",function(e){$dropdown=t(e.target.closest(".bmi-dropdown")),function(e){let i=e.find(".dropdown-options");if(e.attr("data-optioner")){(i=t(".optioner-"+e.attr("data-optioner"))).css({position:"absolute"});let o=e[0].offsetWidth,n=e[0].offsetLeft+240,s=e[0].offsetTop+e[0].offsetHeight+5;i.css({maxWidth:o+"px",minWidth:o+"px",top:s+"px",left:n+"px"})}i.hasClass("dropdown-open")?(e.removeClass("active"),i.removeClass("dropdown-open"),i.hide(300)):(e.addClass("active"),i.addClass("dropdown-open"),i.addClass("ignored-open"),i.show(300))}($dropdown),t.bmi.hideAllLists()}),e.on("click",".dropdown-option",function(e){t(e.target.closest(".dropdown-options")).attr("data-oparent")?($dropdown=t('.bmi-dropdown[data-optioner="'+t(e.target.closest(".dropdown-options")).attr("data-oparent")+'"]'),$option=t(e.target),t.bmi.setOption($dropdown,$option)):($dropdown=t(e.target.closest(".bmi-dropdown")),$option=t(e.target),t.bmi.setOption($dropdown,$option))})}}}),jQuery(document).ready(function(t){var e,i,o=!1,n=!1,s=0;let r=0,a=0,l=null,c=null,p=null,u=!1,d=!1,_=4500,f=!1,h=!1,m=null,g=!1,b=!1,w=!1,v={};function y(e){return $cb=t("#"+e).is(":checked"),!0===$cb?"true":"false"}function k(){return size=0,t("#files-group-plugins").is(":checked")&&(size+=parseInt(t('label[for="files-group-plugins"]').find(".value").attr("bytes"))),t("#files-group-uploads").is(":checked")&&(size+=parseInt(t('label[for="files-group-uploads"]').find(".value").attr("bytes"))),t("#files-group-themes").is(":checked")&&(size+=parseInt(t('label[for="files-group-themes"]').find(".value").attr("bytes"))),t("#files-group-other-contents").is(":checked")&&(size+=parseInt(t('label[for="files-group-other-contents"]').find(".value").attr("bytes"))),t("#files-group-wp-install").is(":checked")&&(size+=parseInt(t('label[for="files-group-wp-install"]').find(".value").attr("bytes"))),size}function x(e,i){if(a+=1,r+=parseInt(i.bytes),i.bytes<=1e4)t("#bmi-scan-"+e).find(".value").text("(0 MB)");else{let o=(parseInt(i.bytes)/1024/1024).toFixed(2);t("#bmi-scan-"+e).find(".value").text("("+o+" MB)")}t("#bmi-scan-"+e).find(".value").attr("bytes",parseInt(i.bytes)),5==a&&(t("#bmi-scan-total").find(".value").text("("+t.bmi.bytesToHuman(r)+")"),t("#bmi-scan-total").find(".value").attr("bytes",parseInt(r)),T())}function C(e){t.bmi.ajax("scan-directory",{folder:e}).then(function(t){x(e,t)}).catch(function(t){x(t,{bytes:"0",readable:"0 B"})})}function $(e=!1,i=function(){}){t.bmi.ajax("is-running-backup",{}).then(function(o){"success"==o.status?i(!1):1==e?i(!0):t.bmi._msg(o)}).catch(function(t){i(!1),console.log(t)})}function T(){let e=parseInt(t("#bmi-scan-total").find(".value").attr("bytes")),i=parseInt(k());t("#files-group-backup").is(":checked")||(e=0,i=0);let o=((e-i)/1024/1024).toFixed(2),n=(i/1024/1024).toFixed(2);"0.00"==o&&(o="0"),"0.00"==n&&(n="0"),t("#esta-exclude").text(o+" MB"),t("#esta-size-for").text(n+" MB")}function I(){t("#prenotice-modal .prenotice").hide(),t("#prenotice-size").text(t.bmi.bytesToHuman(k())),t(".prenotic-3").show(),"true"!==y("database-group-backup")||"true"!==y("database-group-backup")||"true"===y("files-group-backup")&&("true"!==y("files-group-plugins")&&"true"!==y("files-group-themes")&&"true"!==y("files-group-uploads")&&"true"!==y("files-group-wp-install")&&y("files-group-other-contents"),1)||t(".prenotic-6").show(),"true"===y("database-group-backup")||"true"===y("database-group-backup")||"true"!==y("files-group-backup")||"true"!==y("files-group-plugins")&&"true"!==y("files-group-themes")&&"true"!==y("files-group-uploads")&&"true"!==y("files-group-wp-install")&&"true"!==y("files-group-other-contents")||t(".prenotic-5").show(),"true"===y("database-group-backup")&&"true"===y("files-group-backup")&&"true"===y("files-group-plugins")&&"true"===y("files-group-themes")&&"true"===y("files-group-uploads")&&"true"===y("files-group-other-contents")||t(".prenotic-4").show(),t("#prenotice-modal .prenotice:visible").css({background:""});let e=t("#prenotice-modal .prenotice"),i=[];for(let t=0;t<e.length;++t)"none"!==e[t].style.display&&i.push(e[t]);for(let t=0;t<i.length;t+=2)i[t].style.background="#f8f8f8"}function O(t,e=function(){}){let i=window.location.protocol.includes("https");t=t.includes("https")?t.slice(5):t.slice(4),t=i?"https"+t:"http"+t;try{window.XMLHttpRequest?xmlhttp=new XMLHttpRequest:xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"),xmlhttp.onloadend=function(){4==xmlhttp.readyState&&200==xmlhttp.status?e(xmlhttp.responseText):e(!1)},xmlhttp.open("GET",t),xmlhttp.send()}catch(t){e(!1)}}function E(i,r){if(!1===i)return;let a=i.split("\n"),c=s;s=a.length,c>0&&c--;for(let i=c;i<a.length;++i){let c=a[i],p=document.createElement("DIV"),_="";if("[INFO]"==c.substr(0,6))_="blue";else if("[SUCCESS]"==c.substr(0,9))_="green";else if("[WARN]"==c.substr(0,6))_="orange";else if("[ERROR]"==c.substr(0,7))_="red";else if("[END-CODE]"==c.substr(0,10))_="hide_so_much";else if("[STEP]"==c.substr(0,6))p.classList.add("bold"),p.classList.add("step"),t("#restore-progress-modal").hasClass("open")?t("#restore_current_step").text(c.slice(29)):t("#current_step").text(c.slice(29));else if(c&&c.trim().length>0&&"["!=c[0]){s--;continue}_.length>0&&p.classList.add(_),p.style.display="none",p.innerText=c,setTimeout(function(){if(r.appendChild(p),c&&c.trim().includes("[END-CODE]")&&(!0===h||!0===w||!0===b)){let i=c;!0===b?i.includes("001")?(l=".cli_download",b=!1,t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%",J(!0)):Q():!0===w?(i.includes("001")?setTimeout(function(){W()},1e3):Q(),d=!1,w=!1):(h=!1,i.includes("001")&&(o=!0,n=!0,clearTimeout(e),u=!1,D({filename:m},!0)),i.includes("002")&&P(),i.includes("003")&&(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3)))}t(p).show(55),r.scrollTop=r.scrollHeight},55*i)}setTimeout(function(){r.scrollTop=r.scrollHeight},110)}function z(e=0,s=1e3,r=null){if(c==e)return;c=e,clearInterval(i);let a=parseFloat(t(".progress-percentage")[0].style.left)-1;if(t("#restore-progress-modal").hasClass("open")&&(a=parseFloat(t("#restore-progress-modal .progress-percentage")[0].style.left)-1),a>e&&0!=e)return;let l=e-a,p=a,d=Math.abs(Math.floor(s/l));i=setInterval(function(){if(p+=1,t("#restore-progress-modal").hasClass("open")?(t("#restore-progress-modal .progress-active-bar")[0].style.width=p.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].style.left=p.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].innerText=p.toFixed(0)+"%"):(t(".progress-active-bar")[0].style.width=p.toFixed(2)+"%",t(".progress-percentage")[0].style.left=p.toFixed(2)+"%",t(".progress-percentage")[0].innerText=p.toFixed(0)+"%"),p>=100&&clearInterval(i),p>=100&&null!=r&&(c=null,t("#backup-progress-modal").hasClass("open"))){o=!0,n=!0,D(r,0==u)}p>e&&clearInterval(i)},d)}t("#live-log-toggle").on("click",function(){t(".expanded-logs").length>0?t(this).text(t(this).data("hide")):t(this).text(t(this).data("show")),t("#live-log-wrapper").toggleClass("expanded-logs")}),t("#backup-stop").on("click",function(){t.bmi.ajax("stop-backup",{}).then(function(e){"success"==e.status?t.bmi.alert("success",t("#bmi-abort-soon").text(),3e3):t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#bmi-force-backup-to-stop").on("click",function(e){e.preventDefault(),t.bmi.alert("info",t("#bmi-force-stop-in-progress").text(),3e3),t.bmi.ajax("force-backup-to-stop").then(function(e){t.bmi.alert("success",t("#bmi-force-stop-success").text(),6e3)}).catch(function(e){t.bmi.alert("error",t("#failed-to-stop").text(),6e3),console.log(e)})}),t("#bmi-force-restore-to-stop").on("click",function(e){e.preventDefault(),t.bmi.alert("info",t("#bmi-force-stop-in-progress").text(),3e3),t.bmi.ajax("force-restore-to-stop").then(function(e){t.bmi.alert("success",t("#bmi-force-stop-success").text(),6e3)}).catch(function(e){t.bmi.alert("error",t("#failed-to-stop").text(),6e3),console.log(e)})}),t("#bmi_restore_tbody").on("click",".bc-unlocked-btn",function(e){e.preventDefault();let i=e.target,o=i.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("lock-backup",{filename:o}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-lock-success").text(),6e3),t(i.closest("tr").querySelector(".bc-unlocked-btn")).hide(),t(i.closest("tr").querySelector(".bc-locked-btn")).show()):(t.bmi.alert("error",t("#bmi-lock-error").text(),8e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#files-group-backup").on("change",T),t(".basic-file-exlusion").on("change",'input[type="checkbox"]',T),t("#bmi_restore_tbody").on("click",".bc-locked-btn",function(e){if(e.preventDefault(),t(e.target).hasClass("forever"))return;let i=e.target,o=i.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("unlock-backup",{filename:o}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-unlock-success").text(),3e3),t(i.closest("tr").querySelector(".bc-locked-btn")).hide(),t(i.closest("tr").querySelector(".bc-unlocked-btn")).show()):(t.bmi.alert("error",t("#bmi-unlock-error").text(),3e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#bmi_restore_tbody").on("click",".bc-url-btn",function(e){let i=e.target.closest("tr").querySelector(".bc-download-btn").getAttribute("href");t.bmi.clipboard(i)}),t("#bmi_restore_tbody").on("click",".bc-remove-btn",function(e){let i=e.target.closest("tr").querySelector(".br_name").innerText.trim();p=[i],t("#delete-confirm-modal").find(".text2").hide(),t("#delete-confirm-modal").find(".text1").show(),t.bmi.modal("delete-confirm-modal").open()}),t("#sure_delete").on("click",function(){t.bmi.ajax("delete-backup",{filenames:p}).then(function(e){p=null,"success"==e.status?(t.bmi.reloadBackups(),t.bmi.modal("delete-confirm-modal").close(),t.bmi.alert("success",t("#bmi-remove-success").text(),3e3)):(t.bmi.alert("warning",t("#bmi-remove-error").text(),3e3),console.error("BMI Backend error: ",e))}).catch(function(t){console.log(t)})}),t("#add-exclusion-rule").on("click",function(e){e.preventDefault();let i=t(".exclusion_template").clone();i[0].classList.remove("exclusion_template"),i[0].style.display="none",t("#bmi_exclusion_rules").append(i),i.show(300)}),t("#bmi_exclusion_rules").on("click",".kill-exclusion-rule",function(e){e.preventDefault(),$el=e.target,$parent=$el.closest(".exclude-row"),$parent&&(t($parent).hide(300),setTimeout(function(){$parent.remove()},320))}),t("#i-backup-creator").on("click",function(){if(!isNaN(k()))return k()/1024/1024>1e3*parseInt(t("#BMI_REV").text().trim())?j():void("true"===y("database-group-backup")||"true"===y("files-group-backup")&&("true"===y("files-group-plugins")||"true"===y("files-group-themes")||"true"===y("files-group-uploads")||"true"===y("files-group-wp-install")||"true"===y("files-group-other-contents"))?(I(),$(!1,function(){t.bmi.modal("prenotice-modal").open()})):t.bmi.alert("warning",t("#bmi-no-selected").text(),3e3));t.bmi.alert("warning",t("#bmi-preb-processing").text(),3e3)}),t("#BFFSIN").on("change",function(t){let e=parseInt(this.value);isNaN(e)?this.value=1:this.value=e>9999?9999:e<=0?1:e}),t(".save-btn").on("click",function(e){e.preventDefault();let i={},o=t(this.closest(".save-action")).data("save");if(o){if("save-storage"==o)i.directory=t("#bmi_path_storage_default").val(),i.access="true"===t('[name="radioAccessViaLink"]:checked').val()?"true":"false";else if("save-file-config"==o){i.database_group=y("database-group-backup"),i.files_group=y("files-group-backup"),i["files-group-plugins"]=y("files-group-plugins"),i["files-group-uploads"]=y("files-group-uploads"),i["files-group-themes"]=y("files-group-themes"),i["files-group-other-contents"]=y("files-group-other-contents"),i["files-group-wp-install"]=y("files-group-wp-install"),i.files_by_filters=y("files_by_filters"),i.ex_b_fs=y("ex_b_fs"),i.BFFSIN=t("#BFFSIN").val()?t("#BFFSIN").val():"1",i.ex_b_names=y("ex_b_names"),i.ex_b_fpaths=y("ex_b_fpaths"),i.ex_b_dpaths=y("ex_b_dpaths");let e=[],o=t("#bmi_exclusion_rules").find(".exclude-row");for(let i=0;i<o.length;++i){let n=t(o[i]),s=n.find(".exclusion_txt").val(),r=n.find(".exclusion_position").find(".bmi-dropdown").data("selected")+"",a=n.find(".exclusion_where").find(".bmi-dropdown").data("selected")+"";e.push({txt:s,pos:r,whr:a})}i["dynamic-names"]=e,i["dynamic-fpaths-names"]=t("#dynamic-fpaths-names").val().split("\n"),i["dynamic-dpaths-names"]=t("#dynamic-dpaths-names").val().split("\n")}else if("store-config"==o)i.name=t("#backup_filename").val().trim();else{if("save-other-options"!=o)return;i.email=t("#email-for-notices").val().trim(),i.email_title=t("#email-title-for-notices").val().trim(),i.schedule_issues=y("scheduled-issues"),i.experiment_timeout=y("experimental-timeout"),i.experimental_hard_timeout=y("experimental-hard-timeout"),i.php_cli_disable_others=y("cli-disable-others"),i.php_cli_manual_path=t("#cli-manual-path").val().trim(),i.download_technique=y("download-technique"),i.uninstall_config=y("uninstalling-configs"),i.uninstall_backups=y("uninstalling-backups"),i.normal_timeout=y("normal-timeout"),i.db_queries_amount=t("#db_queries_amount").val().trim(),i["bmi-restore-splitting"]=y("bmi-restore-splitting")}t.bmi.ajax(o,i).then(function(e){"success"==e.status?e.errors<=0?(t.bmi.alert("success",t("#bmi-save-success").text(),3e3),t.bmi.collapsers.closeAll()):t.bmi.alert("warning",t("#bmi-save-issues").text(),3e3):t.bmi._msg(e)}).catch(function(t){console.log(t)})}}),t(".close-chapters").on("click",function(e){e.preventDefault(),t.bmi.collapsers.closeAll()}),t("#rescan-for-backups").on("click",function(){t.bmi.reloadBackups()}),t(".storage-checkbox").on("click",function(){let e=t(this).attr("data-toggle"),i=t(t(this)[0].closest(".tab2-item"));t(this).is(":checked")?(t("#"+e).show(300),i.addClass("activeList")):(t("#"+e).hide(300),i.removeClass("activeList"))});var S=0;function A(e=function(){}){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_full.log&backup-id=current&t="+ +new Date,function(i){if(!i)return e();let o=i.split("\n").slice(0,1)[0];""===o.trim()?(o=i.split("\n").slice(0,2)[1],i=i.split("\n").slice(2).join("\n")):i=i.split("\n").slice(1).join("\n");let n=t(".log-wrapper").find("pre")[0],s=t("#bmi-making-archive").text().trim();if(o&&0!=o&&void 0!==o&&t("#current_step").text().trim().slice(0,s.length)==s){let e=document.getElementById("bmi_counter_magic");if(e){let i=parseInt(e.innerText);S=parseInt(o.split("/")[0]),isNaN(i)||isNaN(S)||(z(parseInt(o.split("/")[0])/parseInt(o.split("/")[1])*100),async function(t,e,i,o){let n=null,s=function(r){if(S>i)return;n||(n=r);let a=Math.min((r-n)/o,1);t.innerText=Math.floor(a*(i-e)+e),a<1&&window.requestAnimationFrame(s)};window.requestAnimationFrame(s)}(e,i,S,2e3),"---"===t("#bmi_magic_max_count").text()&&100!=parseInt(o.split("/")[1])&&(t("#bmi_magic_max_count").text(parseInt(o.split("/")[1])),t("#entire_magic_counter").is(":hidden")&&t("#entire_magic_counter").show()))}else{let e=parseInt(o.split("/")[1]);100==e&&(e="---"),t("#current_step").html(s+' <span id="entire_magic_counter">(<span id="bmi_counter_magic">0</span>/<span id="bmi_magic_max_count">'+e+"</span>)</span>"),(isNaN(parseInt(e))||"---"==e)&&t("#entire_magic_counter").hide()}}i&&0!=i&&void 0!==i&&E(i,n),e()})}function B(){t(".log-wrapper").find("pre")[0].innerText="",z(0),setTimeout(function(){A(function(){!function t(){A(function(){clearTimeout(e),e=setTimeout(function(){!0===u&&t()},1500)})}()})},300)}function R(i=!0){!0===i&&(t(".log-wrapper").find("pre")[0].innerText="",z(0)),N(function(){clearTimeout(e),function t(){N(function(){e=setTimeout(function(){!0!==d&&!0!==b||t()},800)})}()})}function L(t=function(){}){$(!0,function(e){t(e)})}function M(e=!1,i=function(){}){t.bmi.ajax("reset-latest",{}).then(function(o){!0===e?i():"success"==o.status?(i(),t.bmi.modal("backup-progress-modal").open()):t.bmi._msg(o)}).catch(function(t){console.log(t)})}function D(s,r=!1){(o&&n||r)&&setTimeout(function(){u=!1,t("#backup-progress-modal").hasClass("open")&&(t.bmi.modal("backup-progress-modal").close(),"true"==t('[name="radioAccessViaLink"]:checked').val()?t("#accessible-at-section").show():t("#accessible-at-section").hide(),t.bmi.modal("backup-success-modal").open()),clearInterval(i),clearTimeout(e);let o=t("#BMI_BLOG_URL").text().trim()+"?backup-migration=BMI_BACKUP&backup-id="+s.filename+"&t="+ +new Date,n=t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=o,t("#download-backup-url").attr("href",o),t("#download-backup-log-url").attr("href",n),t.bmi.reloadBackups(),setTimeout(function(){clearInterval(i),t(".log-wrapper").find("pre")[0].innerText="",t(".progress-active-bar")[0].style.width="0%",t(".progress-percentage")[0].style.left="0%",t(".progress-percentage")[0].innerText="0%"},300)},700)}function P(i=!1){setTimeout(function(){$(!0,function(o){if(!0===o)return;t.bmi.modal("backup-progress-modal").close(),clearTimeout(e),t.bmi.modal("backup-progress-modal").close(),t("#backup-error-pre").text(t("#bmi-loading-translation").text().trim()),t.bmi.modal("backup-error-modal").open(),O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,function(o){if(clearTimeout(e),0!=o||i){let e=t("#backup-error-pre")[0];t("#backup-error-pre").text(""),s=0,E(o,e)}else P(!0)})})},2e3)}function j(){t.bmi.modal("bfs-modal").open()}function q(e){let i=e.status,o=parseInt(e.errors),n=parseInt(e.iteratio),s=parseInt(e.sf);if(!0===i&&-1===n)return g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),D({filename:m},!0);if(!isNaN(s)&&s>-1&&(g.filessofar=s),!isNaN(n)&&n>-1&&(g.iteratio+=1),isNaN(o)||o>0||0==i){if(!isNaN(o)&&o>4)return h=!1,m=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),P();setTimeout(function(){return F(g,o)},1500)}else F(g,o)}function F(t,e=0){!1===g&&(t.iteratio=0,g=t),function(t,e,i=0){let o=new XMLHttpRequest;o.open("POST",t.url,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Content-Accept","*/*"),o.setRequestHeader("Access-Control-Allow-Origin","*"),o.setRequestHeader("Content-ConfigDir",t.config_dir),o.setRequestHeader("Content-Content",t.content_dir),o.setRequestHeader("Content-Backups",t.backup_dir),o.setRequestHeader("Content-Identy",t.identy),o.setRequestHeader("Content-Url",t.url),o.setRequestHeader("Content-Abs",t.abs_dir),o.setRequestHeader("Content-Dir",t.root_dir),o.setRequestHeader("Content-Manifest",t.manifest),o.setRequestHeader("Content-Name",t.backupname),o.setRequestHeader("Content-Safelimit",t.safelimit),o.setRequestHeader("Content-Start",t.start),o.setRequestHeader("Content-Filessofar",t.filessofar),o.setRequestHeader("Content-Total",t.total_files),o.setRequestHeader("Content-Rev",t.rev),o.setRequestHeader("Content-It",t.iteratio),o.setRequestHeader("Content-Browser",!0),o.onload=function(){if(200===o.status){let t=o.getResponseHeader("Content-Finished");if(void 0!==t&&t&&"true"==t)return e({status:!0,iteratio:-1,sf:-1,errors:i=0});let n=o.getResponseHeader("Content-It"),s=o.getResponseHeader("Content-Filessofar");return e(void 0!==n&&n?{status:!0,iteratio:n,sf:s,errors:i}:{status:!1,iteratio:-1,sf:-1,errors:++i})}return e({status:!1,iteratio:-1,sf:-1,errors:++i})},o.onerror=function(){return e({status:!1,iteratio:-1,sf:-1,errors:++i})},o.send()}(g,q,e)}function H(e=function(){}){L(function(i){!0===i?t("#backup-progress-modal").hasClass("open")||(!1===u&&(o=!1,u=!0,f=!0),t("#bmi-ongoing-backup").show(300)):(t("#bmi-ongoing-backup").is(":visible")&&t("#bmi-ongoing-backup").hide(300),t("#backup-progress-modal").hasClass("open")&&!0===f?(!0===u&&(u=!1),f=!1,t.bmi.getCurrentBackups(function(e){t.bmi.fillWithNewBackups(e.backups,function(){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,function(e){if(!1===e)t.bmi.modal("backup-progress-modal").close();else{let i="Backup process aborted",o="[ERROR]";if((e=e.split("\n"))[e.length-1].includes(i)||e[e.length-2].includes(i))t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3);else if(e[e.length-1].includes(o)||e[e.length-2].includes(o))P();else{t.bmi.modal("backup-progress-modal").close(),t.bmi.modal("backup-success-modal").open();let e=t(t("#bmi_restore_tbody").find("tr")[0]).find(".bc-download-btn").attr("href");t("#download-backup-url").attr({href:e}),t("#text-input-copy").val(e)}}})})})):!0!==u||t("#backup-progress-modal").hasClass("open")||(u=!1,t.bmi.reloadBackups())),e()})}function N(e=function(){}){O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration_full.log&backup-id=current&t="+ +new Date,function(i){if(!i)return e();let o=i.split("\n").slice(0,1)[0];if(i=i.split("\n").slice(1).join("\n"),!1===o||isNaN(parseFloat(o)))return e();let n=t("#restore-live-log-wrapper").find("pre")[0];i.includes("<")||i.includes(">")||i&&0!=i&&void 0!==i&&E(i,n),z(o),e()})}function G(e=function(){}){t.bmi.ajax("htaccess-litespeed",{}).then(function(t){setTimeout(function(){e(!0)},400)}).catch(function(t){e(!1),console.log(t)})}function U(e=function(){},i=!1){t.bmi.ajax("migration-locked",{}).then(function(o){"success"==o.status?e(!0):(i||t.bmi._msg(o),e(!1))}).catch(function(t){console.log(t)})}function Q(e=""){U(function(e){e&&setTimeout(function(){if(!t("#restore-progress-modal").hasClass("open"))return;d=!1,b=!1,t("#restore-error-pre").text(t("#bmi-loading-translation").text().trim()),O(t("#BMI_BLOG_URL").text().trim()+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration.log&backup-id=current&t="+ +new Date,function(e){if(0==e)setTimeout(function(){Q()},1500);else{let i=t("#restore-error-pre")[0];t("#restore-error-pre").text(""),s=0,E(e,i)}}),t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-error-modal").open()},1e3)},!0)}function W(){t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-success-modal").open(),setTimeout(function(){t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%"},500),w=!1}function J(o=!1,n=null){let r=l;if(!r||r.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#pre-restore-modal").hasClass("open")&&t.bmi.modal("pre-restore-modal").close(),t("#restore-progress-modal").hasClass("open")||t.bmi.modal("restore-progress-modal").open(),o||(t("#restore-live-log-wrapper").find("pre")[0].innerText=""),null==n&&(s=0,d=!0,clearTimeout(e),M(!0,function(){G(function(){N(function(){!function o(n,s,r,a=!1,l="false",c={}){null==r&&R(!0);t.bmi.ajax("restore-backup",{file:n,remote:s,secret:r,ignoreRunning:l,tmpname:a,options:c}).then(function(r){if("cli"===r.status){v={l:r.login,u:r.url},w=!0;let t=document.querySelector(".hide_so_much");if(t){let e=t.innerText;e.includes("001")?setTimeout(function(){W()},1e3):Q(),d=!1,w=!1}}else"success"===r.status?(v={l:r.login,u:r.url},N(function(){setTimeout(function(){clearInterval(i),clearTimeout(e),d=!1,t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-success-modal").open(),setTimeout(function(){t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%"},500)},1500)})):"secret"===r.status?(r.options.step=parseInt(r.options.step)+1,o(n,s,r.secret,r.tmp,"true",r.options)):"restore_ongoing"===r.status?(void 0!==r.options.firstDB&&(r.options.firstDB=!1),void 0!==r.options.dbFinished?!0!==r.options.dbFinished&&"true"!==r.options.dbFinished&&"1"!==r.options.dbFinished||(r.options.step=parseInt(r.options.step)+1):void 0!==r.options.dbConvertionFinished?"true"!==r.options.dbConvertionFinished&&!0!==r.options.dbConvertionFinished||(r.options.step=parseInt(r.options.step)+1):(r.options.step=parseInt(r.options.step)+1,4!=r.options.step&&"4"!=r.options.step||void 0===r.options.repeat_export||!0!==r.options.repeat_export&&"true"!==r.options.repeat_export&&"1"!==r.options.repeat_export||(r.options.step=3,r.options.firstExtract="false")),o(n,s,r.secret,r.tmp,"true",r.options)):"error"===r.status?setTimeout(function(){clearInterval(i),clearTimeout(e),Q()},1e3):(t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").close(),t.bmi._msg(r))}).catch(function(t,e){Q(e),console.log(t)})}(r,o,n)})})}))}function X(){return t("#bmi_restore_tbody").find('input[type="checkbox"]:checked')}function K(e){e.preventDefault(),t("#format-tip-wrp")[0].style.minWidth="calc(100% - 120px)","none"===t("#format-tip-wrp")[0].style.display?t("#format-tip-wrp").show(300):t("#format-tip-wrp").hide(300)}t("#configuration-reset-absolute").on("click",function(e){e.preventDefault(),t.bmi.ajax("reset-configuration",{}).then(function(e){"success"==e.status?window.location.reload():t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#download-site-infos").on("click",function(e){e.preventDefault(),t.bmi.ajax("get-site-data",{}).then(function(e){"success"==e.status?t.bmi.prepareFile("bmi-site-info.debug",JSON.stringify(e.data)):t.bmi._msg(e)}).catch(function(t){console.log(t)})}),t("#start-entire-backup").on("click",function(){t.bmi.modal("prenotice-modal").close(),t(".backup-minimize").removeClass("disabled"),clearTimeout(e),M(!1,function(){G(function(){f=!1,o=!1,u=!0,t.bmi.ajax("create-backup",{estaminated_size:k()}).then(function(s){if("success"==s.status)o=!0,clearTimeout(e),u=!1,A(function(){setTimeout(function(){D(s,!0)},350)});else if("background"==s.status){h=!0,m=s.filename;let i=document.querySelector(".hide_so_much");if(i){let s=i.innerText;s.includes("001")&&(o=!0,n=!0,clearTimeout(e),u=!1,D({filename:m},!0)),s.includes("002")&&P(),s.includes("003")&&(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3))}}else"background_hard"==s.status?(h=!0,m=s.filename,s.settings.url=s.url,t.bmi.alert("success",t("#bmi-received-hard").text(),3e3),t(".backup-minimize").addClass("disabled"),t("#backup-progress-modal").hasClass("open")||t.bmi.modal("backup-progress-modal").open(),window.onbeforeunload=function(){return"Backup in progress..."},F(s.settings)):(u=!1,setTimeout(function(){clearInterval(i),t(".log-wrapper").find("pre")[0].innerText="",t(".progress-active-bar")[0].style.width="0%",t(".progress-percentage")[0].style.left="0%",t(".progress-percentage")[0].innerText="0%"},300),t.bmi._msg(s),t("#backup-progress-modal").hasClass("open")&&(void 0!==s.bfs?j():P()))}).catch(function(e){t("#backup-progress-modal").hasClass("open")&&P(),console.log(e)}),s=0,u=!0,B()})})}),t("#open_trouble_extenstion").on("click",function(){t("#trouble_extenstion").hasClass("openned")?(t("#trouble_extenstion").hide(300),t("#trouble_extenstion").removeClass("openned"),t(this).removeClass("active")):(t("#trouble_extenstion").show(300),t("#trouble_extenstion").addClass("openned"),t(this).addClass("active"))}),t("#switch-show-trs").on("click",function(){let e=this.dataset.see,i=this.dataset.hide,o=t(".hide-show-tr");t(this).hasClass("shown")?(o.hide(300),t(this).removeClass("shown"),this.innerText=e):(o.show(300),t(this).addClass("shown"),this.innerText=i)}),t("#ex_b_fs").on("change",function(){t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}),t("#show-upload-area").on("click",function(){t(".upload_area").hasClass("hidden")?(t(".upload_area").show(300),t(".upload_area").removeClass("hidden"),t([document.documentElement,document.body]).animate({scrollTop:t(this).offset().top-50+"px"},300)):(t(".upload_area").hide(300),t(".upload_area").addClass("hidden"))}),t(".bmi-copper").on("click",function(e){e.preventDefault();let i=t("#"+this.getAttribute("data-copy"))[0];i.value&&i.value.length>0?t.bmi.clipboard(i.value):t.bmi.clipboard(i.innerText)}),t("#bmi_restore_tbody").on("click",".restore-btn",function(e){U(function(i){if(i){let i=e.target.closest("tr").querySelector(".br_name").innerText;if(l=i,!i||i.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#restore-ok").prop("checked",!1),t.bmi.modal("pre-restore-modal").open()}})}),t("#quick-download-migration").on("click",function(){let e=t("#bm-d-url").val();t.bmi.isUrlValid(e)?U(function(i){i&&(e.length>0?(l=-100,t("#restore-ok").prop("checked",!1),t.bmi.modal("pre-restore-modal").open()):t.bmi.alert("warning",t("#bmi-invalid-url").text(),5e3))}):t.bmi.alert("warning",t("#bmi-invalid-url").text(),5e3)}),t("#restore-start-sure").on("click",function(){t("#restore-ok").is(":checked")?-100===l?(l=null,t("#restore-live-log-wrapper").find("pre")[0].innerText="",U(function(o){M(!0,function(){G(function(){if(o){let o=t("#bm-d-url").val();t("#restore_current_step").text(t("#bmi-downloading-remote").text()),t.bmi.ajax("download-backup",{url:o}).then(function(o){clearInterval(i),clearTimeout(e),"success"===o.status?(t.bmi.reloadBackups(),l=o.name,setTimeout(function(){clearInterval(i),t("#restore-progress-modal .progress-active-bar")[0].style.width="0%",t("#restore-progress-modal .progress-percentage")[0].style.left="0%",t("#restore-progress-modal .progress-percentage")[0].innerText="0%",t("#restore_current_step").text(t("#bmi-restoring-prepare").text()),setTimeout(function(){J(!0)},300)},600)):"cli_download"==o.status?(b=!0,R(!1)):"error"===o.status?Q():(t.bmi._msg(o),Q())}).catch(function(t,e){Q(e),console.log(t)}),t("#restore-live-log-wrapper").find("pre")[0].innerText="",s=0,d=!0,R(),t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").open()}})})})):J():t.bmi.alert("warning",t("#bmi-restore-require-checkmark").text(),3e3)}),t(".backup-minimize").on("click",function(){L(function(e){!0===e?t("#bmi-ongoing-backup").show(300):t("#bmi-ongoing-backup").hide()})}),function t(){H(function(){setTimeout(function(){t()},_)})}(),t("#bmi-ongoing-backup").on("click",function(){L(function(e){!0===e?(s=0,B(),t.bmi.modal("backup-progress-modal").open()):(t.bmi.alert("info",t("#bmi-bc-ended").text(),3e3),t.bmi.reloadBackups()),t("#bmi-ongoing-backup").hide(300)})}),t("#bmi_support_chat").on("click",function(){if(0===t("#support-bmi").length){t("#bmi").append('<script id="support-bmi" src="'+t("#bmi-support-url-translation").val()+'" async><\/script>'),setTimeout(function(){t("#bmi_support_chat").hide()},100);var e=!1;let i=setInterval(function(){1==e&&clearInterval(i),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t("#bmi_restore_tbody").on("change",'input[type="checkbox"]',function(e){let i=X().length;i>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300),i==t("#bmi_restore_tbody").find('input[type="checkbox"]').length?t("#backups-select-all").prop("checked",!0):t("#backups-select-all").prop("checked",!1)}),t("#fix-uname-issues").on("click",function(e){e.preventDefault(),t.bmi.ajax("fix_uname_issues",{}).then(function(e){t.bmi.alert("success",t("#bmi-default-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-default-fail").text(),3e3)})}),t("#revert-uname-issues").on("click",function(e){e.preventDefault(),t.bmi.ajax("revert_uname_issues",{}).then(function(e){t.bmi.alert("success",t("#bmi-default-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-default-fail").text(),3e3)})}),t("#backups-select-all").on("change",function(){!0===this.checked?t("#bmi_restore_tbody").find('input[type="checkbox"]').prop("checked",!0):t("#bmi_restore_tbody").find('input[type="checkbox"]').prop("checked",!1),X().length>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300)}),t(".lrn-mr-btn, .closer-learn-more").on("click",function(){t(".learn_more_about_cron").hasClass("open")?(t(".learn_more_about_cron").removeClass("open"),t(".learn_more_about_cron").hide(300),t(".lrn-mr-btn").show(),t(".lrn-mr-btn").css({opacity:0}),t(".lrn-mr-btn").animate({opacity:1},300)):(t(".learn_more_about_cron").addClass("open"),t(".learn_more_about_cron").show(300),t(".lrn-mr-btn").css({opacity:1}),t(".lrn-mr-btn").animate({opacity:0},300,function(){t(".lrn-mr-btn").hide()}))}),t("#bmi-error-toggle").on("click",function(){t(".error-body").hasClass("open")?(t(".error-body").hide(300),t(".error-body").removeClass("open"),t("#bmi-error-toggle").text(t("#bmi-error-toggle").data("expand"))):(t(".error-body").show(300),t(".error-body").addClass("open"),t("#bmi-error-toggle").text(t("#bmi-error-toggle").data("collapse")))}),t("#bmi_send_test_mail").on("click",function(e){e.preventDefault(),t.bmi.ajax("send-test-mail",{}).then(function(e){t.bmi.alert("success",t("#bmi-email-success").text(),3e3)}).catch(function(e){t.bmi.alert("error",t("#bmi-email-fail").text(),3e3)})}),t("#bmi-error-dismiss").on("click",function(){t(".error-noticer").hide(300),setTimeout(function(){t(".error-noticer").remove()},330),t.bmi.ajax("dismiss-error-notice",{}).then(function(t){}).catch(function(t){})}),t(".deleteAllSelected").on("click",function(){let e=X(),i=[];for(let t=0;t<e.length;++t){let o=e[t].closest("tr");i.push(o.querySelector(".br_name").innerText)}t("#delete-confirm-modal").find(".text1").hide(),t("#delete-confirm-modal").find(".text2").show();let o=i.length;o<=0||(t("#backup-multiple-del-count").text(o),o>1?(t("#del-only-one").hide(),t("#del-more-than-one").show()):(t("#del-more-than-one").hide(),t("#del-only-one").show()),p=i,t.bmi.modal("delete-confirm-modal").open())}),t("#load-more-backups").on("click",function(e){e.preventDefault(),t.bmi.showMoreBackups()}),t("#show-format-tip").on("click",K),t("#hide-format-tip").on("click",K),t(".go-to-marbs").on("click",function(e){e.preventDefault(),document.getElementById("marbs").click(),t.bmi.modal().closeAll()}),t(".site-reloader").on("click",function(){let t=v.u+"?backup-migration=AFTER_RESTORE&backup-id="+v.l+"&progress-id=4u70L051n&t="+ +new Date;window.location=t}),async function(){C("plugins"),C("uploads"),C("themes"),C("contents_others"),C("wordpress")}(),t.bmi.ajax("get-dynamic-names",{}).then(function(e){let i=e.data;if(t("#bmi_exclusion_rules").text(""),void 0!==i&&void 0!==i.length){for(let e=0;e<i.length;++e){let o=t(".exclusion_template").clone();o.removeClass("exclusion_template"),o.find(".exclusion_txt").val(i[e].txt);let n=o.find(".exclusion_position").find("select"),s=o.find(".exclusion_where").find("select");n&&(n[0].setAttribute("data-def",i[e].pos),s&&(s[0].setAttribute("data-def",i[e].whr),t("#bmi_exclusion_rules").append(o),o.find(".exclusion_position").find(".bmi-dropdown").length>0&&t.bmi.setOption(o.find(".exclusion_position").find(".bmi-dropdown"),null,i[e].pos),o.find(".exclusion_where").find(".bmi-dropdown").length>0&&t.bmi.setOption(o.find(".exclusion_where").find(".bmi-dropdown"),null,i[e].whr)))}t("#dynamic-fpaths-names").text(e["dynamic-fpaths-names"].join("\n")),t("#dynamic-dpaths-names").text(e["dynamic-dpaths-names"].join("\n"))}}).catch(function(t){console.log(t)}),t.bmi.reloadBackups(),function(){let e=1e3*parseInt(t("#server-time-auto").attr("data-time")),i=new Date(e);t("#server-time-auto").text(i.toUTCString()),setInterval(function(){e+=1e3,i=new Date(e),t("#server-time-auto").text(i.toUTCString())},1e3),t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}()}),jQuery(document).ready(function(t){t(".modal-opener").on("click",function(e){this.getAttribute("data-modal")&&""!=this.getAttribute("data-modal")&&(e.preventDefault(),this.getAttribute("data-close")&&t.bmi.modal(this.getAttribute("data-close")).close(),t.bmi.modal(this.getAttribute("data-modal")).open())}),t(".modal-closer").on("click",function(e){this.getAttribute("data-close")&&""!=this.getAttribute("data-close")?(e.preventDefault(),t.bmi.modal(this.getAttribute("data-close")).close()):this.closest(".modal")&&(e.preventDefault(),t("#"+this.closest(".modal").getAttribute("id")).length>0&&t.bmi.modal(this.closest(".modal").getAttribute("id")).close())}),t(".modal-close").on("click",function(e){this.closest(".modal")&&(e.preventDefault(),t.bmi.modal(this.closest(".modal").id).close())}),t(".modal").on("click",function(e){e.target!=this||t(e.target).hasClass("modal-no-close")||t.bmi.modal(this.id).close()})}),jQuery(document).ready(function(t){t.bmi.tooltips.init();let e,i=-1,o=!1,n="";for(let t=0;t<12;++t)n+="<div></div>";function s(o){clearInterval(e),0==o?(t(".upload-progress-bar").find("span")[0].style.width=o+"%",t(".upload-percentage").text(o+"%")):100==o?(t(".upload-progress-bar").find("span")[0].style.width=o+"%",t(".upload-percentage").text(o+"%")):function(o=0,n=1e3){if(i==o)return;i=o,clearInterval(e);let s=parseInt(t(".upload-percentage").text())-1;if(s>o&&0!=o)return;let r=o-s,a=s,l=Math.abs(Math.floor(n/r));e=setInterval(function(){a+=1,t(".upload-progress-bar").find("span")[0].style.width=a+"%",t(".upload-percentage").text(a+"%"),a>=100&&(clearInterval(e),i=null)},l)}(o,1e3)}t(".spinner-loader").html(n).addClass("lds-spinner"),t.fchunker({upId:"upid",upShardSize:"5",upMaxSize:"2000",upUrl:ajaxurl,upType:"zip",upCallBack:function(e){var i=e.status,n=e.message;e.url,Math.random();2==i&&(setTimeout(function(){t("#drop-area").show(300),t(".upload-progress").hide(300)},100),t.bmi.alert("success",t("#bmi-upload-end").text(),3e3),t.bmi.modal("upload-success-modal").open(),t.bmi.reloadBackups()),1==i&&(o||(t.bmi.alert("success",t("#bmi-upload-start").text(),3e3),o=!0)),0==i&&(t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300)),5==i&&(t.bmi.modal("upload-invalid-manifest-modal").open(),t("#drop-area").show(300),t(".upload-progress").hide(300)),3==i&&(s(100),t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300))},upEvent:function(t){s(t)},upStop:function(e){s(0),setTimeout(function(){t("#drop-area").show(300),t(".upload-progress").hide(300)},100),e.includes("Type error")?(t.bmi.modal("upload-wrong-file-modal").open(),t.bmi.alert("warning",t("#bmi-upload-wrong").text(),3e3)):e.includes("File already exists")?(t.bmi.modal("upload-exist-file-modal").open(),t.bmi.alert("warning",t("#bmi-upload-exists").text(),3e3)):(t.bmi.alert("error",t("#bmi-upload-error").text(),3e3),console.error(e))},upStart:function(){o=!1,i=-1,s(0),setTimeout(function(){t("#drop-area").hide(300),t(".upload-progress").show(300)},100)}})}),jQuery(document).ready(function(t){function e(t){for(let e=0;e<t.length;++e){let i=t[e].closest(".container-radio");i&&void 0!=typeof i.classList&&(i.classList.remove("active"),!0===t[e].checked&&i.classList.add("active"))}}t('input[type="radio"]').on("change",function(){let t=this.getAttribute("name");this.closest(".container-radio");e(document.querySelectorAll('[name="'+t+'"]'))}),e(document.getElementById("bmi").querySelectorAll('input[type="radio"]'))}),jQuery(document).ready(function(t){let e=!1;t(".tabs").on("click",".tab",function(i){if(this.classList.contains("active"))return;if(!0===e)return;e=!0,t.bmi.collapsers.closeAll();let o=this.getAttribute("data-point");"manage-restore-wrapper"==o?(t("#create-backup-wrapper").hide(300),t('[data-point="create-backup-wrapper"]').removeClass("active")):"create-backup-wrapper"==o&&(t("#manage-restore-wrapper").hide(300),t('[data-point="manage-restore-wrapper"]').removeClass("active")),t("#"+o).show(300),t(this).addClass("active"),setTimeout(function(){e=!1},320)})}),jQuery(document).ready(function(t){let e=document.getElementById("drop-area");function i(t){t.preventDefault(),t.stopPropagation()}function o(t){e.classList.add("highlight")}function n(t){e.classList.remove("highlight")}e&&(["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,i,!1)}),["dragenter","dragover"].forEach(t=>{e.addEventListener(t,o,!1),document.querySelector("body").addEventListener(t,o,!1)}),["dragleave","drop","mouseleave"].forEach(t=>{e.addEventListener(t,n,!1)}),t("body, #drop-area").on("mouseleave dragleave drop",function(){n()}),e.addEventListener("drop",function(t){!function(t){t=[...t],jQuery.fchunker_upload("file",t[0])}(t.dataTransfer.files)},!1))});
|
backup-backup.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Author URI: https://backupbliss.com/
|
8 |
* Plugin URI: https://backupbliss.com
|
9 |
* Text Domain: backup-backup
|
10 |
-
* Version: 1.1.
|
11 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
12 |
|
13 |
// Exit on direct access
|
@@ -21,7 +21,7 @@
|
|
21 |
define('BMI_DEBUG', false);
|
22 |
}
|
23 |
if (!defined('BMI_VERSION')) {
|
24 |
-
define('BMI_VERSION', '1.1.
|
25 |
}
|
26 |
if (!defined('BMI_ROOT_DIR')) {
|
27 |
define('BMI_ROOT_DIR', __DIR__);
|
7 |
* Author URI: https://backupbliss.com/
|
8 |
* Plugin URI: https://backupbliss.com
|
9 |
* Text Domain: backup-backup
|
10 |
+
* Version: 1.1.4
|
11 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
12 |
|
13 |
// Exit on direct access
|
21 |
define('BMI_DEBUG', false);
|
22 |
}
|
23 |
if (!defined('BMI_VERSION')) {
|
24 |
+
define('BMI_VERSION', '1.1.4');
|
25 |
}
|
26 |
if (!defined('BMI_ROOT_DIR')) {
|
27 |
define('BMI_ROOT_DIR', __DIR__);
|
includes/ajax.php
CHANGED
@@ -98,6 +98,10 @@
|
|
98 |
BMP::res($this->continueRestoreProcess());
|
99 |
} elseif ($this->post['f'] == 'htaccess-litespeed') {
|
100 |
BMP::res($this->fixLitespeed());
|
|
|
|
|
|
|
|
|
101 |
} elseif ($this->post['f'] == 'debugging') {
|
102 |
BMP::res($this->debugging());
|
103 |
} else {
|
@@ -552,6 +556,11 @@
|
|
552 |
$zip_progress->log(__("Web server: Not available", 'backup-backup'), 'info');
|
553 |
}
|
554 |
$zip_progress->log(__("Max execution time (in seconds): ", 'backup-backup') . @ini_get('max_execution_time'), 'info');
|
|
|
|
|
|
|
|
|
|
|
555 |
$zip_progress->log(__("Checking if backup dir is writable...", 'backup-backup'), 'info');
|
556 |
|
557 |
if (defined('BMI_BACKUP_PRO')) {
|
@@ -1009,6 +1018,8 @@
|
|
1009 |
}
|
1010 |
}
|
1011 |
|
|
|
|
|
1012 |
// Check file size
|
1013 |
$zippath = BMP::fixSlashes(BMI_BACKUPS) . DIRECTORY_SEPARATOR . $this->post['file'];
|
1014 |
if (!$ignoreRunCheck) {
|
@@ -1430,6 +1441,8 @@
|
|
1430 |
$title_empty = __('Title field is required, please fill it.', 'backup-backup');
|
1431 |
$email_empty = __('Email field cannot be empty, please fill it.', 'backup-backup');
|
1432 |
$cli_no_exist = __('Path to executable that you provided for PHP CLI does not exist.', 'backup-backup');
|
|
|
|
|
1433 |
|
1434 |
$email = trim($this->post['email']); // OTHER:EMAIL
|
1435 |
$email_title = trim($this->post['email_title']); // OTHER:EMAIL:TITLE
|
@@ -1440,6 +1453,8 @@
|
|
1440 |
$php_cli_disable_others = $this->post['php_cli_disable_others'] === 'true' ? true : false; // OTHER:CLI:DISABLE
|
1441 |
$normal_timeout = $this->post['normal_timeout'] === 'true' ? true : false; // OTHER:USE:TIMEOUT:NORMAL
|
1442 |
$insecure_download = $this->post['download_technique'] === 'true' ? true : false; // OTHER:DOWNLOAD:DIRECT
|
|
|
|
|
1443 |
$uninstall_config = $this->post['uninstall_config'] === 'true' ? true : false; // OTHER:UNINSTALL:CONFIGS
|
1444 |
$uninstall_backups = $this->post['uninstall_backups'] === 'true' ? true : false; // OTHER:UNINSTALL:BACKUPS
|
1445 |
|
@@ -1452,6 +1467,10 @@
|
|
1452 |
$experiment_timeout_hard = false;
|
1453 |
}
|
1454 |
|
|
|
|
|
|
|
|
|
1455 |
if (strlen($email) <= 0) {
|
1456 |
return ['status' => 'msg', 'why' => $email_empty, 'level' => 'warning'];
|
1457 |
}
|
@@ -1470,6 +1489,12 @@
|
|
1470 |
if ($php_cli_manual_path != '' && !file_exists($php_cli_manual_path)) {
|
1471 |
return ['status' => 'msg', 'why' => $cli_no_exist, 'level' => 'warning'];
|
1472 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
|
1474 |
$error = 0;
|
1475 |
if (!Dashboard\bmi_set_config('OTHER:EMAIL', $email)) {
|
@@ -1496,6 +1521,9 @@
|
|
1496 |
if (!Dashboard\bmi_set_config('OTHER:USE:TIMEOUT:NORMAL', $normal_timeout)) {
|
1497 |
$error++;
|
1498 |
}
|
|
|
|
|
|
|
1499 |
if (!Dashboard\bmi_set_config('OTHER:DOWNLOAD:DIRECT', $insecure_download)) {
|
1500 |
$error++;
|
1501 |
}
|
@@ -1505,6 +1533,9 @@
|
|
1505 |
if (!Dashboard\bmi_set_config('OTHER:UNINSTALL:BACKUPS', $uninstall_backups)) {
|
1506 |
$error++;
|
1507 |
}
|
|
|
|
|
|
|
1508 |
|
1509 |
return ['status' => 'success', 'errors' => $error];
|
1510 |
}
|
@@ -2141,6 +2172,179 @@
|
|
2141 |
delete_option('bmi_display_email_issues');
|
2142 |
}
|
2143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2144 |
public function debugging() {
|
2145 |
}
|
2146 |
}
|
98 |
BMP::res($this->continueRestoreProcess());
|
99 |
} elseif ($this->post['f'] == 'htaccess-litespeed') {
|
100 |
BMP::res($this->fixLitespeed());
|
101 |
+
} elseif ($this->post['f'] == 'force-backup-to-stop') {
|
102 |
+
BMP::res($this->forceBackupToStop());
|
103 |
+
} elseif ($this->post['f'] == 'force-restore-to-stop') {
|
104 |
+
BMP::res($this->forceRestoreToStop());
|
105 |
} elseif ($this->post['f'] == 'debugging') {
|
106 |
BMP::res($this->debugging());
|
107 |
} else {
|
556 |
$zip_progress->log(__("Web server: Not available", 'backup-backup'), 'info');
|
557 |
}
|
558 |
$zip_progress->log(__("Max execution time (in seconds): ", 'backup-backup') . @ini_get('max_execution_time'), 'info');
|
559 |
+
|
560 |
+
if (defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
|
561 |
+
$zip_progress->log(__('Max rows per query (this site): ', 'backup-backup') . BMI_DB_MAX_ROWS_PER_QUERY, 'info');
|
562 |
+
}
|
563 |
+
|
564 |
$zip_progress->log(__("Checking if backup dir is writable...", 'backup-backup'), 'info');
|
565 |
|
566 |
if (defined('BMI_BACKUP_PRO')) {
|
1018 |
}
|
1019 |
}
|
1020 |
|
1021 |
+
$migration->log(__("Restore process initialized successfully.", 'backup-backup'), 'success');
|
1022 |
+
|
1023 |
// Check file size
|
1024 |
$zippath = BMP::fixSlashes(BMI_BACKUPS) . DIRECTORY_SEPARATOR . $this->post['file'];
|
1025 |
if (!$ignoreRunCheck) {
|
1441 |
$title_empty = __('Title field is required, please fill it.', 'backup-backup');
|
1442 |
$email_empty = __('Email field cannot be empty, please fill it.', 'backup-backup');
|
1443 |
$cli_no_exist = __('Path to executable that you provided for PHP CLI does not exist.', 'backup-backup');
|
1444 |
+
$db_query_too_low = __('The value for query amount cannot be smaller than 15.', 'backup-backup');
|
1445 |
+
$db_query_too_much = __('The value for query amount cannot be larger than 15000.', 'backup-backup');
|
1446 |
|
1447 |
$email = trim($this->post['email']); // OTHER:EMAIL
|
1448 |
$email_title = trim($this->post['email_title']); // OTHER:EMAIL:TITLE
|
1453 |
$php_cli_disable_others = $this->post['php_cli_disable_others'] === 'true' ? true : false; // OTHER:CLI:DISABLE
|
1454 |
$normal_timeout = $this->post['normal_timeout'] === 'true' ? true : false; // OTHER:USE:TIMEOUT:NORMAL
|
1455 |
$insecure_download = $this->post['download_technique'] === 'true' ? true : false; // OTHER:DOWNLOAD:DIRECT
|
1456 |
+
$db_query_size = isset($this->post['db_queries_amount']) ? trim($this->post['db_queries_amount']) : '1000'; // OTHER:DB:QUERIES
|
1457 |
+
$db_restore_splitting = $this->post['bmi-restore-splitting'] === 'true' ? true : false; // OTHER:RESTORE:SPLITTING
|
1458 |
$uninstall_config = $this->post['uninstall_config'] === 'true' ? true : false; // OTHER:UNINSTALL:CONFIGS
|
1459 |
$uninstall_backups = $this->post['uninstall_backups'] === 'true' ? true : false; // OTHER:UNINSTALL:BACKUPS
|
1460 |
|
1467 |
$experiment_timeout_hard = false;
|
1468 |
}
|
1469 |
|
1470 |
+
if (!is_numeric($db_query_size) || empty($db_query_size)) {
|
1471 |
+
$db_query_size = "1000";
|
1472 |
+
}
|
1473 |
+
|
1474 |
if (strlen($email) <= 0) {
|
1475 |
return ['status' => 'msg', 'why' => $email_empty, 'level' => 'warning'];
|
1476 |
}
|
1489 |
if ($php_cli_manual_path != '' && !file_exists($php_cli_manual_path)) {
|
1490 |
return ['status' => 'msg', 'why' => $cli_no_exist, 'level' => 'warning'];
|
1491 |
}
|
1492 |
+
if (intval($db_query_size) > 15000) {
|
1493 |
+
return ['status' => 'msg', 'why' => $db_query_too_much, 'level' => 'warning'];
|
1494 |
+
}
|
1495 |
+
if (intval($db_query_size) < 15) {
|
1496 |
+
return ['status' => 'msg', 'why' => $db_query_too_low, 'level' => 'warning'];
|
1497 |
+
}
|
1498 |
|
1499 |
$error = 0;
|
1500 |
if (!Dashboard\bmi_set_config('OTHER:EMAIL', $email)) {
|
1521 |
if (!Dashboard\bmi_set_config('OTHER:USE:TIMEOUT:NORMAL', $normal_timeout)) {
|
1522 |
$error++;
|
1523 |
}
|
1524 |
+
if (!Dashboard\bmi_set_config('OTHER:DB:QUERIES', $db_query_size)) {
|
1525 |
+
$error++;
|
1526 |
+
}
|
1527 |
if (!Dashboard\bmi_set_config('OTHER:DOWNLOAD:DIRECT', $insecure_download)) {
|
1528 |
$error++;
|
1529 |
}
|
1533 |
if (!Dashboard\bmi_set_config('OTHER:UNINSTALL:BACKUPS', $uninstall_backups)) {
|
1534 |
$error++;
|
1535 |
}
|
1536 |
+
if (!Dashboard\bmi_set_config('OTHER:RESTORE:SPLITTING', $db_restore_splitting)) {
|
1537 |
+
$error++;
|
1538 |
+
}
|
1539 |
|
1540 |
return ['status' => 'success', 'errors' => $error];
|
1541 |
}
|
2172 |
delete_option('bmi_display_email_issues');
|
2173 |
}
|
2174 |
|
2175 |
+
// recursive removal
|
2176 |
+
private function rrmdir($dir) {
|
2177 |
+
|
2178 |
+
if (is_dir($dir)) {
|
2179 |
+
|
2180 |
+
$objects = scandir($dir);
|
2181 |
+
foreach ($objects as $object) {
|
2182 |
+
|
2183 |
+
if ($object != "." && $object != "..") {
|
2184 |
+
|
2185 |
+
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . DIRECTORY_SEPARATOR . $object)) {
|
2186 |
+
|
2187 |
+
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
|
2188 |
+
|
2189 |
+
} else {
|
2190 |
+
|
2191 |
+
@unlink($dir . DIRECTORY_SEPARATOR . $object);
|
2192 |
+
|
2193 |
+
}
|
2194 |
+
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
}
|
2198 |
+
|
2199 |
+
@rmdir($dir);
|
2200 |
+
|
2201 |
+
} else {
|
2202 |
+
|
2203 |
+
if (file_exists($dir) && is_file($dir)) {
|
2204 |
+
|
2205 |
+
@unlink($dir);
|
2206 |
+
|
2207 |
+
}
|
2208 |
+
|
2209 |
+
}
|
2210 |
+
|
2211 |
+
}
|
2212 |
+
|
2213 |
+
public function forceBackupToStop() {
|
2214 |
+
|
2215 |
+
$filesToBeRemoved = [];
|
2216 |
+
|
2217 |
+
foreach (scandir(BMI_ROOT_DIR . DIRECTORY_SEPARATOR . 'tmp') as $filename) {
|
2218 |
+
|
2219 |
+
if (in_array($filename, ['.', '..'])) continue;
|
2220 |
+
$path = BMI_ROOT_DIR . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $filename;
|
2221 |
+
$filesToBeRemoved[] = $path;
|
2222 |
+
|
2223 |
+
}
|
2224 |
+
|
2225 |
+
$allowedFiles = ['wp-config.php', '.htaccess', '.litespeed', '.default.json'];
|
2226 |
+
foreach (glob(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.*') as $filename) {
|
2227 |
+
|
2228 |
+
$basename = basename($filename);
|
2229 |
+
|
2230 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2231 |
+
if (is_file($filename) && !in_array($basename, $allowedFiles)) {
|
2232 |
+
$filesToBeRemoved[] = $filename;
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
foreach (glob(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'BMI-*', GLOB_ONLYDIR) as $filename) {
|
2238 |
+
|
2239 |
+
$basename = basename($filename);
|
2240 |
+
|
2241 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2242 |
+
if (is_dir($filename) && !in_array($filename, $allowedFiles)) {
|
2243 |
+
$filesToBeRemoved[] = $filename;
|
2244 |
+
}
|
2245 |
+
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
foreach (glob(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'bg-BMI-*', GLOB_ONLYDIR) as $filename) {
|
2249 |
+
|
2250 |
+
$basename = basename($filename);
|
2251 |
+
|
2252 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2253 |
+
if (is_dir($filename) && !in_array($filename, $allowedFiles)) {
|
2254 |
+
$filesToBeRemoved[] = $filename;
|
2255 |
+
}
|
2256 |
+
|
2257 |
+
}
|
2258 |
+
|
2259 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.backup_cli_lock';
|
2260 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.backup_cli_lock_ended';
|
2261 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.backup_cli_lock_end';
|
2262 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.running';
|
2263 |
+
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'db_tables';
|
2264 |
+
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'bmi_backup_manifest.json';
|
2265 |
+
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'files_latest.list';
|
2266 |
+
|
2267 |
+
foreach ($filesToBeRemoved as $file) {
|
2268 |
+
$this->rrmdir($file);
|
2269 |
+
}
|
2270 |
+
|
2271 |
+
return ['status' => 'success'];
|
2272 |
+
|
2273 |
+
}
|
2274 |
+
|
2275 |
+
public function forceRestoreToStop() {
|
2276 |
+
|
2277 |
+
$filesToBeRemoved = [];
|
2278 |
+
|
2279 |
+
foreach (scandir(BMI_ROOT_DIR . DIRECTORY_SEPARATOR . 'tmp') as $filename) {
|
2280 |
+
|
2281 |
+
if (in_array($filename, ['.', '..'])) continue;
|
2282 |
+
$path = BMI_ROOT_DIR . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $filename;
|
2283 |
+
$filesToBeRemoved[] = $path;
|
2284 |
+
|
2285 |
+
}
|
2286 |
+
|
2287 |
+
foreach (glob(untrailingslashit(ABSPATH) . DIRECTORY_SEPARATOR . 'backup-migration_??????????') as $filename) {
|
2288 |
+
|
2289 |
+
$basename = basename($filename);
|
2290 |
+
|
2291 |
+
if (is_dir($filename) && !in_array($basename, ['.', '..'])) {
|
2292 |
+
$filesToBeRemoved[] = $filename;
|
2293 |
+
}
|
2294 |
+
|
2295 |
+
}
|
2296 |
+
|
2297 |
+
$allowedFiles = ['wp-config.php', '.htaccess', '.litespeed', '.default.json'];
|
2298 |
+
foreach (glob(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.*') as $filename) {
|
2299 |
+
|
2300 |
+
$basename = basename($filename);
|
2301 |
+
|
2302 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2303 |
+
if (is_file($filename) && !in_array($basename, $allowedFiles)) {
|
2304 |
+
$filesToBeRemoved[] = $filename;
|
2305 |
+
}
|
2306 |
+
|
2307 |
+
}
|
2308 |
+
|
2309 |
+
foreach (glob(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'restore_scan_*') as $filename) {
|
2310 |
+
|
2311 |
+
$basename = basename($filename);
|
2312 |
+
|
2313 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2314 |
+
if (is_file($filename) && !in_array($basename, $allowedFiles)) {
|
2315 |
+
$filesToBeRemoved[] = $filename;
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
}
|
2319 |
+
|
2320 |
+
foreach (glob(untrailingslashit(ABSPATH) . DIRECTORY_SEPARATOR . 'wp-config.??????????.php') as $filename) {
|
2321 |
+
|
2322 |
+
$basename = basename($filename);
|
2323 |
+
|
2324 |
+
if (in_array($basename, ['.', '..'])) continue;
|
2325 |
+
if (is_file($filename) && !in_array($filename, $allowedFiles)) {
|
2326 |
+
$filesToBeRemoved[] = $filename;
|
2327 |
+
}
|
2328 |
+
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.autologin';
|
2332 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.migration_lock';
|
2333 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.migration_lock_cli';
|
2334 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.migration_lock_cli_end';
|
2335 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.migration_lock_ended';
|
2336 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.cli_download_last';
|
2337 |
+
$filesToBeRemoved[] = BMI_BACKUPS . '/.running';
|
2338 |
+
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.restore_secret';
|
2339 |
+
|
2340 |
+
foreach ($filesToBeRemoved as $file) {
|
2341 |
+
$this->rrmdir($file);
|
2342 |
+
}
|
2343 |
+
|
2344 |
+
return ['status' => 'success'];
|
2345 |
+
|
2346 |
+
}
|
2347 |
+
|
2348 |
public function debugging() {
|
2349 |
}
|
2350 |
}
|
includes/bypasser.php
CHANGED
@@ -388,7 +388,7 @@
|
|
388 |
|
389 |
$this->output->log('Finalizing backup', 'STEP');
|
390 |
$this->output->log('Closing files and archives', 'STEP');
|
391 |
-
$this->output->log('Archiving of ' . $this->total_files . ' files took: ' . (microtime(true) - floatval($this->backupstart)) . 's', 'INFO');
|
392 |
$this->output->log('#001', 'END-CODE');
|
393 |
|
394 |
if (!BMI_CLI_REQUEST) {
|
388 |
|
389 |
$this->output->log('Finalizing backup', 'STEP');
|
390 |
$this->output->log('Closing files and archives', 'STEP');
|
391 |
+
$this->output->log('Archiving of ' . $this->total_files . ' files took: ' . number_format(microtime(true) - floatval($this->backupstart), 2) . 's', 'INFO');
|
392 |
$this->output->log('#001', 'END-CODE');
|
393 |
|
394 |
if (!BMI_CLI_REQUEST) {
|
includes/check/checker.php
CHANGED
@@ -43,7 +43,7 @@ class BMI_Checker {
|
|
43 |
$this->logs(__('Requires at least ', 'backup-backup') . $size . __(' bytes.', 'backup-backup') . ' [' . BMP::humanSize($size) . ']');
|
44 |
if ($this->is_enabled('disk_free_space') && intval(disk_free_space(BMI_BACKUPS)) > 100) {
|
45 |
|
46 |
-
$this->logs(__('Disk free space function is not disabled - using...', 'backup-backup'));
|
47 |
$this->logs(__('Checking this path/partition: ', 'backup-backup') . BMI_BACKUPS);
|
48 |
$free = intval(disk_free_space(BMI_BACKUPS));
|
49 |
$this->logs(__('There is ', 'backup-backup') . number_format($free / 1024 / 1024, 2) . __(' MB free.', 'backup-backup') . ' [' . BMP::humanSize($free) . ']', 'SUCCESS');
|
43 |
$this->logs(__('Requires at least ', 'backup-backup') . $size . __(' bytes.', 'backup-backup') . ' [' . BMP::humanSize($size) . ']');
|
44 |
if ($this->is_enabled('disk_free_space') && intval(disk_free_space(BMI_BACKUPS)) > 100) {
|
45 |
|
46 |
+
$this->logs(__('Disk free space function is not disabled - using it...', 'backup-backup'));
|
47 |
$this->logs(__('Checking this path/partition: ', 'backup-backup') . BMI_BACKUPS);
|
48 |
$free = intval(disk_free_space(BMI_BACKUPS));
|
49 |
$this->logs(__('There is ', 'backup-backup') . number_format($free / 1024 / 1024, 2) . __(' MB free.', 'backup-backup') . ' [' . BMP::humanSize($free) . ']', 'SUCCESS');
|
includes/constants.php
CHANGED
@@ -24,9 +24,6 @@
|
|
24 |
if (!defined('BMI_CONFIG_DIR')) {
|
25 |
define('BMI_CONFIG_DIR', dirname(BMI_CONFIG_PATH));
|
26 |
}
|
27 |
-
if (!defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
|
28 |
-
define('BMI_DB_MAX_ROWS_PER_QUERY', 250);
|
29 |
-
}
|
30 |
if (!defined('BMI_REV')) {
|
31 |
define('BMI_REV', 2);
|
32 |
}
|
@@ -34,6 +31,24 @@
|
|
34 |
// Load configuration
|
35 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'config.php';
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
// Default constants
|
38 |
if (!defined('BMI_CLI_EXECUTABLE')) {
|
39 |
$php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
|
24 |
if (!defined('BMI_CONFIG_DIR')) {
|
25 |
define('BMI_CONFIG_DIR', dirname(BMI_CONFIG_PATH));
|
26 |
}
|
|
|
|
|
|
|
27 |
if (!defined('BMI_REV')) {
|
28 |
define('BMI_REV', 2);
|
29 |
}
|
31 |
// Load configuration
|
32 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'config.php';
|
33 |
|
34 |
+
// Database queries amount
|
35 |
+
if (!defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
|
36 |
+
$db_queries = Dashboard\bmi_get_config('OTHER:DB:QUERIES');
|
37 |
+
if (is_numeric($db_queries)) {
|
38 |
+
$db_queries = intval($db_queries);
|
39 |
+
|
40 |
+
if ($db_queries > 15000 || $db_queries < 15) {
|
41 |
+
$db_queries = 1000;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
if (!isset($db_queries) || is_null($db_queries) || !is_numeric($db_queries)) {
|
46 |
+
$db_queries = 1000;
|
47 |
+
}
|
48 |
+
|
49 |
+
define('BMI_DB_MAX_ROWS_PER_QUERY', $db_queries);
|
50 |
+
}
|
51 |
+
|
52 |
// Default constants
|
53 |
if (!defined('BMI_CLI_EXECUTABLE')) {
|
54 |
$php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
|
includes/dashboard/chapter/other_config.php
CHANGED
@@ -14,6 +14,8 @@
|
|
14 |
$experimental_info_1 = __('Use this option if you have full access to your server and you know how to make basic configuration of the server. Wrong configuration may give you hick-ups without error due to e.g. web server server timeout (for small sites below 300 MB this is the best option).', 'backup-backup');
|
15 |
$experimental_info_2 = __('Use this option before the third one, it should work fine on SSD/NVMe hostings even for huge backups - but still may timeout if you are running on slow drive high I/O.', 'backup-backup');
|
16 |
$experimental_info_3 = __('This option will require you to not close the backup window since it will use your connection to keep the backup in parts, it will disable automatic backups. Use this only if all of the above does not work. Recommended for huge sites +100k files / 5+ GB.', 'backup-backup');
|
|
|
|
|
17 |
|
18 |
?>
|
19 |
|
@@ -357,6 +359,40 @@
|
|
357 |
</div>
|
358 |
</div>
|
359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
<!-- -->
|
361 |
<div class="mm mbl">
|
362 |
<div class="f20 bold">
|
14 |
$experimental_info_1 = __('Use this option if you have full access to your server and you know how to make basic configuration of the server. Wrong configuration may give you hick-ups without error due to e.g. web server server timeout (for small sites below 300 MB this is the best option).', 'backup-backup');
|
15 |
$experimental_info_2 = __('Use this option before the third one, it should work fine on SSD/NVMe hostings even for huge backups - but still may timeout if you are running on slow drive high I/O.', 'backup-backup');
|
16 |
$experimental_info_3 = __('This option will require you to not close the backup window since it will use your connection to keep the backup in parts, it will disable automatic backups. Use this only if all of the above does not work. Recommended for huge sites +100k files / 5+ GB.', 'backup-backup');
|
17 |
+
$db_query_info = __('Lower value means slower process but more stable restore, higher value means quicker backup and restore but it may be unstable (depends on database server performance). Default value: 1000.', 'backup-backup');
|
18 |
+
$sqlsplitting = __('This will split the SQL files (before migration or restore) into parts, which should make the process more stable and also allows to track the progress more precisely.', 'backup-backup');
|
19 |
|
20 |
?>
|
21 |
|
359 |
</div>
|
360 |
</div>
|
361 |
|
362 |
+
<!-- -->
|
363 |
+
<div class="mm mbl mtl">
|
364 |
+
|
365 |
+
<div class="f20 bold">
|
366 |
+
<?php _e("Database export settings", 'backup-backup'); ?>
|
367 |
+
</div>
|
368 |
+
<div class="mtll">
|
369 |
+
<span class="relative">
|
370 |
+
<?php _e("Adjust queries amount per batch for your ", 'backup-backup'); ?> <b><?php _e("database", 'backup-backup'); ?></b>
|
371 |
+
<span class="bmi-info-icon tooltip" tooltip="<?php echo $db_query_info; ?>"></span>
|
372 |
+
</span>
|
373 |
+
</div>
|
374 |
+
|
375 |
+
<div class="lh40 cf">
|
376 |
+
<div class="left mw250 lh65">
|
377 |
+
<?php _e("Queries per batch for import/export: ", 'backup-backup'); ?>
|
378 |
+
</div>
|
379 |
+
<div class="left">
|
380 |
+
<?php $query_amount = sanitize_text_field(bmi_get_config('OTHER:DB:QUERIES')); ?>
|
381 |
+
<label for="db_queries_amount">
|
382 |
+
<input type="number" id="db_queries_amount" class="bmi-text-input small" value="<?php echo $query_amount; ?>" placeholder="1000" min="15" max="15000" />
|
383 |
+
</label>
|
384 |
+
</div>
|
385 |
+
</div>
|
386 |
+
|
387 |
+
<div class="lh40">
|
388 |
+
<label for="bmi-restore-splitting">
|
389 |
+
<input type="checkbox" id="bmi-restore-splitting"<?php bmi_try_checked('OTHER:RESTORE:SPLITTING'); ?> />
|
390 |
+
<span class="relative"><?php _e("Enable SQL-Splitting for migration process.", 'backup-backup'); ?> <span class="bmi-info-icon tooltip" tooltip="<?php echo $sqlsplitting; ?>"></span></span>
|
391 |
+
</label>
|
392 |
+
</div>
|
393 |
+
|
394 |
+
</div>
|
395 |
+
|
396 |
<!-- -->
|
397 |
<div class="mm mbl">
|
398 |
<div class="f20 bold">
|
includes/dashboard/chapter/troubleshooting.php
CHANGED
@@ -175,6 +175,24 @@
|
|
175 |
</a>
|
176 |
</div>
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
<div class="mm mtl semibold">
|
179 |
<?php _e("Error: php_uname is disabled for security reasons", 'backup-backup'); ?>
|
180 |
</div>
|
175 |
</a>
|
176 |
</div>
|
177 |
|
178 |
+
<div class="mm mtl semibold">
|
179 |
+
<?php _e("Backup/restore process issues", 'backup-backup'); ?>
|
180 |
+
</div>
|
181 |
+
|
182 |
+
<div class="mm mtll f16 lh28">
|
183 |
+
<?php _e("If you are sure the backup process is not running but you can't run it: ", 'backup-backup'); ?>
|
184 |
+
<a href="#!" id="bmi-force-backup-to-stop" class="nodec hoverable secondary">
|
185 |
+
<?php _e("Force the process to stop.", 'backup-backup'); ?>
|
186 |
+
</a>
|
187 |
+
<br>
|
188 |
+
<?php _e("If you are sure the restore process is not running but you can't run it: ", 'backup-backup'); ?>
|
189 |
+
<a href="#!" id="bmi-force-restore-to-stop" class="nodec hoverable secondary">
|
190 |
+
<?php _e("Force the restoration to stop.", 'backup-backup'); ?>
|
191 |
+
</a>
|
192 |
+
<br>
|
193 |
+
<span><?php _e('* If the process is still running after killing, that means it probably still running (for real), wait a bit for it to fail then.', 'backup-backup'); ?></span>
|
194 |
+
</div>
|
195 |
+
|
196 |
<div class="mm mtl semibold">
|
197 |
<?php _e("Error: php_uname is disabled for security reasons", 'backup-backup'); ?>
|
198 |
</div>
|
includes/dashboard/chapter/what_backed_up.php
CHANGED
@@ -22,6 +22,10 @@
|
|
22 |
$tooltip_exclude_file = __("Enter the paths to the files you want to exclude from your backup (one per line).", 'backup-backup');
|
23 |
$tooltip_exclude_path = __("Enter the paths to the directories/folders you want to exclude from your backup (one per line).", 'backup-backup');
|
24 |
$tooltip_premium_details = __("You can already exclude files based on filters (click on “Yes” below), however in the premium plugin you’ll also be able to browse through them.", 'backup-backup') . "<br><br>";
|
|
|
|
|
|
|
|
|
25 |
if (defined('BMI_PREMIUM_TOOLTIP')) {
|
26 |
$tooltip_premium_details .= str_replace('"', "'", BMI_PREMIUM_TOOLTIP);
|
27 |
$tooltip_smart_exclusion = str_replace('"', "'", BMI_PREMIUM_TOOLTIP);
|
22 |
$tooltip_exclude_file = __("Enter the paths to the files you want to exclude from your backup (one per line).", 'backup-backup');
|
23 |
$tooltip_exclude_path = __("Enter the paths to the directories/folders you want to exclude from your backup (one per line).", 'backup-backup');
|
24 |
$tooltip_premium_details = __("You can already exclude files based on filters (click on “Yes” below), however in the premium plugin you’ll also be able to browse through them.", 'backup-backup') . "<br><br>";
|
25 |
+
|
26 |
+
$tooltip_files = str_replace('"', '“', $tooltip_files);
|
27 |
+
$tooltip_premium_details = str_replace('"', '“', $tooltip_premium_details);
|
28 |
+
|
29 |
if (defined('BMI_PREMIUM_TOOLTIP')) {
|
30 |
$tooltip_premium_details .= str_replace('"', "'", BMI_PREMIUM_TOOLTIP);
|
31 |
$tooltip_smart_exclusion = str_replace('"', "'", BMI_PREMIUM_TOOLTIP);
|
includes/dashboard/translations.php
CHANGED
@@ -130,6 +130,15 @@
|
|
130 |
<div id="bmi-loading-translation">
|
131 |
<?php _e("Loading...", 'backup-backup') ?>
|
132 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
<div id="BMI_URL_ROOT"><?php echo plugin_dir_url(BMI_ROOT_FILE); ?></div>
|
134 |
<div id="BMI_BLOG_URL"><?php echo get_site_url(); ?></div>
|
135 |
<div id="BMI_REV"><?php echo BMI_REV; ?></div>
|
130 |
<div id="bmi-loading-translation">
|
131 |
<?php _e("Loading...", 'backup-backup') ?>
|
132 |
</div>
|
133 |
+
<div id="failed-to-stop">
|
134 |
+
<?php _e("We could not stop the process due to some issues on your server (maybe file permissions).", 'backup-backup') ?>
|
135 |
+
</div>
|
136 |
+
<div id="bmi-force-stop-in-progress">
|
137 |
+
<?php _e("Stopping the process, it will be confirmed...", 'backup-backup') ?>
|
138 |
+
</div>
|
139 |
+
<div id="bmi-force-stop-success">
|
140 |
+
<?php _e("The process should be stopped now.", 'backup-backup') ?>
|
141 |
+
</div>
|
142 |
<div id="BMI_URL_ROOT"><?php echo plugin_dir_url(BMI_ROOT_FILE); ?></div>
|
143 |
<div id="BMI_BLOG_URL"><?php echo get_site_url(); ?></div>
|
144 |
<div id="BMI_REV"><?php echo BMI_REV; ?></div>
|
includes/database/better-backup.php
CHANGED
@@ -97,7 +97,7 @@ class BMI_Database_Exporter {
|
|
97 |
|
98 |
$this->table_prefix = time();
|
99 |
$this->init_start = microtime(true);
|
100 |
-
$this->logger->log("Memory usage after initialization: " . (memory_get_usage() / 1024 / 1024) . " MB", 'INFO');
|
101 |
|
102 |
}
|
103 |
|
@@ -111,25 +111,25 @@ class BMI_Database_Exporter {
|
|
111 |
// Table names
|
112 |
$this->get_table_names_and_sizes();
|
113 |
$this->logger->log("Scan found $this->total_tables tables ($this->total_rows rows), estimated total size: $this->total_size MB.", 'INFO');
|
114 |
-
$this->logger->log("Memory usage after getting table names: " . (memory_get_usage() / 1024 / 1024) . " MB ", 'INFO');
|
115 |
|
116 |
// Recipes
|
117 |
$this->logger->log("Getting table recipes...", 'INFO');
|
118 |
$this->table_recipes();
|
119 |
$this->logger->log("Table recipes have been exported.", 'INFO');
|
120 |
-
$this->logger->log("Memory usage after loading recipes: " . (memory_get_usage() / 1024 / 1024) . " MB ", 'INFO');
|
121 |
|
122 |
// Save Recipes
|
123 |
$this->logger->log("Saving recipes...", 'INFO');
|
124 |
$this->save_recipes();
|
125 |
$this->logger->log("Recipes saved.", 'INFO');
|
126 |
-
$this->logger->log("Memory usage after recipe off-load: " . (memory_get_usage() / 1024 / 1024) . " MB", 'INFO');
|
127 |
|
128 |
// Tables data
|
129 |
$this->logger->log("Exporting table data...", 'INFO');
|
130 |
$this->get_tables_data();
|
131 |
$this->logger->log("Table data exported.", 'INFO');
|
132 |
-
$this->logger->log("Memory usage after data export: " . (memory_get_usage() / 1024 / 1024) . " MB", 'INFO');
|
133 |
|
134 |
$end = number_format(microtime(true) - $this->init_start, 4);
|
135 |
$this->logger->log("Entire process took: $end s", 'INFO');
|
97 |
|
98 |
$this->table_prefix = time();
|
99 |
$this->init_start = microtime(true);
|
100 |
+
$this->logger->log("Memory usage after initialization: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
101 |
|
102 |
}
|
103 |
|
111 |
// Table names
|
112 |
$this->get_table_names_and_sizes();
|
113 |
$this->logger->log("Scan found $this->total_tables tables ($this->total_rows rows), estimated total size: $this->total_size MB.", 'INFO');
|
114 |
+
$this->logger->log("Memory usage after getting table names: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB ", 'INFO');
|
115 |
|
116 |
// Recipes
|
117 |
$this->logger->log("Getting table recipes...", 'INFO');
|
118 |
$this->table_recipes();
|
119 |
$this->logger->log("Table recipes have been exported.", 'INFO');
|
120 |
+
$this->logger->log("Memory usage after loading recipes: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB ", 'INFO');
|
121 |
|
122 |
// Save Recipes
|
123 |
$this->logger->log("Saving recipes...", 'INFO');
|
124 |
$this->save_recipes();
|
125 |
$this->logger->log("Recipes saved.", 'INFO');
|
126 |
+
$this->logger->log("Memory usage after recipe off-load: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
127 |
|
128 |
// Tables data
|
129 |
$this->logger->log("Exporting table data...", 'INFO');
|
130 |
$this->get_tables_data();
|
131 |
$this->logger->log("Table data exported.", 'INFO');
|
132 |
+
$this->logger->log("Memory usage after data export: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
133 |
|
134 |
$end = number_format(microtime(true) - $this->init_start, 4);
|
135 |
$this->logger->log("Entire process took: $end s", 'INFO');
|
includes/database/better-restore.php
CHANGED
@@ -11,6 +11,7 @@ namespace BMI\Plugin\Database;
|
|
11 |
|
12 |
// Use
|
13 |
use BMI\Plugin\BMI_Logger AS Logger;
|
|
|
14 |
use BMI\Plugin\Progress\BMI_ZipProgress AS Progress;
|
15 |
|
16 |
// Exit on direct access
|
@@ -39,7 +40,7 @@ class BMI_Database_Importer {
|
|
39 |
*
|
40 |
* @return self
|
41 |
*/
|
42 |
-
function __construct($storage, $total_queries, $old_abspath, $old_domain, $new_domain, &$logger, $isCLI) {
|
43 |
|
44 |
/**
|
45 |
* WP Global Database variable
|
@@ -63,6 +64,10 @@ class BMI_Database_Importer {
|
|
63 |
// $this->storage = trailingslashit(__DIR__) . 'data';
|
64 |
$this->storage = $storage;
|
65 |
$this->total_queries = intval($total_queries);
|
|
|
|
|
|
|
|
|
66 |
|
67 |
/**
|
68 |
* Domain(s) configuration
|
@@ -122,7 +127,8 @@ class BMI_Database_Importer {
|
|
122 |
*/
|
123 |
public function showFirstLogs() {
|
124 |
|
125 |
-
$this->logger->log("
|
|
|
126 |
|
127 |
}
|
128 |
|
@@ -134,7 +140,7 @@ class BMI_Database_Importer {
|
|
134 |
public function showEndLogs() {
|
135 |
|
136 |
$from_start = number_format(microtime(true) - $this->init_start, 4);
|
137 |
-
$this->logger->log("Total time to insert $this->xi queries took $from_start seconds.", 'INFO');
|
138 |
|
139 |
}
|
140 |
|
@@ -147,7 +153,7 @@ class BMI_Database_Importer {
|
|
147 |
|
148 |
$this->logger->log("Loading file list...", 'INFO');
|
149 |
$this->load_file_list();
|
150 |
-
$this->logger->log("
|
151 |
|
152 |
$this->logger->log("Restoring tables using temporary name...", 'INFO');
|
153 |
$this->restore_tables();
|
@@ -284,7 +290,7 @@ class BMI_Database_Importer {
|
|
284 |
$this->load_file_list();
|
285 |
|
286 |
if ($first_db == true) {
|
287 |
-
$this->logger->log("
|
288 |
}
|
289 |
|
290 |
return $this->files;
|
@@ -348,16 +354,20 @@ class BMI_Database_Importer {
|
|
348 |
*/
|
349 |
public function alter_names() {
|
350 |
|
|
|
|
|
351 |
foreach ($this->table_names_alter as $final_name => $tmp_name) {
|
352 |
|
353 |
$sql = "DROP TABLE IF EXISTS `$final_name`;";
|
354 |
-
$this->run_query($sql);
|
355 |
|
356 |
$sql = "ALTER TABLE `$tmp_name` RENAME TO `$final_name`;";
|
357 |
-
$this->run_query($sql);
|
358 |
|
359 |
}
|
360 |
|
|
|
|
|
361 |
}
|
362 |
|
363 |
/**
|
@@ -689,7 +699,7 @@ class BMI_Database_Importer {
|
|
689 |
*
|
690 |
* Notice: Please unset($query) after this method otherwise we will lose memory
|
691 |
*/
|
692 |
-
private function run_query(&$query) {
|
693 |
|
694 |
$this->xi++;
|
695 |
if ($this->owndb === true) $this->db->query($query);
|
@@ -707,19 +717,39 @@ class BMI_Database_Importer {
|
|
707 |
$queries_total = $this->total_queries;
|
708 |
$queries_progress = number_format(($queries_so_far / $queries_total) * 100, 2);
|
709 |
|
710 |
-
$
|
711 |
-
$
|
712 |
-
|
713 |
-
|
714 |
|
715 |
-
if (
|
716 |
-
$
|
|
|
|
|
|
|
|
|
717 |
}
|
718 |
-
|
719 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
720 |
}
|
721 |
|
722 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
|
724 |
}
|
725 |
|
@@ -736,12 +766,122 @@ class BMI_Database_Importer {
|
|
736 |
foreach ($files as $index => $filename) {
|
737 |
|
738 |
if (in_array($filename, ['.', '..'])) continue;
|
739 |
-
if (substr($filename, -4) != '.sql') continue;
|
740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
$this->files[] = trailingslashit($this->storage) . $filename;
|
742 |
|
743 |
}
|
744 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
return $this->files;
|
746 |
|
747 |
}
|
11 |
|
12 |
// Use
|
13 |
use BMI\Plugin\BMI_Logger AS Logger;
|
14 |
+
use BMI\Plugin\Backup_Migration_Plugin as BMP;
|
15 |
use BMI\Plugin\Progress\BMI_ZipProgress AS Progress;
|
16 |
|
17 |
// Exit on direct access
|
40 |
*
|
41 |
* @return self
|
42 |
*/
|
43 |
+
function __construct($storage, $total_queries, $old_abspath, $old_domain, $new_domain, &$logger, $isCLI, $conversionStats) {
|
44 |
|
45 |
/**
|
46 |
* WP Global Database variable
|
64 |
// $this->storage = trailingslashit(__DIR__) . 'data';
|
65 |
$this->storage = $storage;
|
66 |
$this->total_queries = intval($total_queries);
|
67 |
+
// $this->total_queries = $this->conversionStats['total_queries'];
|
68 |
+
|
69 |
+
// Conversion stats
|
70 |
+
$this->conversionStats = $conversionStats;
|
71 |
|
72 |
/**
|
73 |
* Domain(s) configuration
|
127 |
*/
|
128 |
public function showFirstLogs() {
|
129 |
|
130 |
+
$this->logger->log("Initializing database import V2 enginge...", 'INFO');
|
131 |
+
$this->logger->log("Initialized successfully, memory usage: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'SUCCESS');
|
132 |
|
133 |
}
|
134 |
|
140 |
public function showEndLogs() {
|
141 |
|
142 |
$from_start = number_format(microtime(true) - $this->init_start, 4);
|
143 |
+
$this->logger->log("Total time to insert " . $this->xi . " queries took " . $from_start . " seconds.", 'INFO');
|
144 |
|
145 |
}
|
146 |
|
153 |
|
154 |
$this->logger->log("Loading file list...", 'INFO');
|
155 |
$this->load_file_list();
|
156 |
+
$this->logger->log("File list loaded, memory usage: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'SUCCESS');
|
157 |
|
158 |
$this->logger->log("Restoring tables using temporary name...", 'INFO');
|
159 |
$this->restore_tables();
|
290 |
$this->load_file_list();
|
291 |
|
292 |
if ($first_db == true) {
|
293 |
+
$this->logger->log("File list loaded, memory usage: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'SUCCESS');
|
294 |
}
|
295 |
|
296 |
return $this->files;
|
354 |
*/
|
355 |
public function alter_names() {
|
356 |
|
357 |
+
$this->logger->log(__('Switching tables to new ones and removing old ones.', 'backup-backup'), 'STEP');
|
358 |
+
|
359 |
foreach ($this->table_names_alter as $final_name => $tmp_name) {
|
360 |
|
361 |
$sql = "DROP TABLE IF EXISTS `$final_name`;";
|
362 |
+
$this->run_query($sql, true);
|
363 |
|
364 |
$sql = "ALTER TABLE `$tmp_name` RENAME TO `$final_name`;";
|
365 |
+
$this->run_query($sql, true);
|
366 |
|
367 |
}
|
368 |
|
369 |
+
$this->logger->log(__('Tables replaced successfully.', 'backup-backup'), 'SUCCESS');
|
370 |
+
|
371 |
}
|
372 |
|
373 |
/**
|
699 |
*
|
700 |
* Notice: Please unset($query) after this method otherwise we will lose memory
|
701 |
*/
|
702 |
+
private function run_query(&$query, $isAlter = false) {
|
703 |
|
704 |
$this->xi++;
|
705 |
if ($this->owndb === true) $this->db->query($query);
|
717 |
$queries_total = $this->total_queries;
|
718 |
$queries_progress = number_format(($queries_so_far / $queries_total) * 100, 2);
|
719 |
|
720 |
+
$halfProgress = true;
|
721 |
+
if (isset($this->conversionStats['total_queries'])) {
|
722 |
+
$halfProgress = false;
|
723 |
+
}
|
724 |
|
725 |
+
if (!$isAlter) {
|
726 |
+
if ($halfProgress) {
|
727 |
+
$this->logger->progress(50 + ($queries_progress / 2));
|
728 |
+
} else {
|
729 |
+
$this->logger->progress(75 + ($queries_progress / 4));
|
730 |
+
}
|
731 |
}
|
732 |
+
|
733 |
+
$match_output = [];
|
734 |
+
preg_match('/(.*)_(\d+)\_of\_(\d+)/', $filename, $match_output); // 1 (table name), 2 (part), 3 (total parts)
|
735 |
+
|
736 |
+
$size = "";
|
737 |
+
|
738 |
+
if (file_exists($this->current_file)) {
|
739 |
+
$size = ", size: " . BMP::humanSize(filesize($this->current_file));
|
740 |
}
|
741 |
|
742 |
+
if (!$isAlter) {
|
743 |
+
if (sizeof($match_output) >= 3) {
|
744 |
+
|
745 |
+
$this->logger->log("Finished " . $queries_so_far . "/" . $queries_total . " (" . $queries_progress . "%)" . " for " . $match_output[1] . " table (part: " . $match_output[2] . "/" . $match_output[3] . $size . ").", 'INFO');
|
746 |
+
|
747 |
+
} else {
|
748 |
+
|
749 |
+
$this->logger->log("Finished " . $queries_so_far . "/" . $queries_total . " (" . $queries_progress . "%)" . " for " . $filename . " table (part: 1/1)", 'INFO');
|
750 |
+
|
751 |
+
}
|
752 |
+
}
|
753 |
|
754 |
}
|
755 |
|
766 |
foreach ($files as $index => $filename) {
|
767 |
|
768 |
if (in_array($filename, ['.', '..'])) continue;
|
|
|
769 |
|
770 |
+
$filePath = trailingslashit($this->storage) . $filename;
|
771 |
+
if (is_dir($filePath)) {
|
772 |
+
|
773 |
+
$splitedFiles = scandir($filePath);
|
774 |
+
foreach ($splitedFiles as $splitedIndex => $splitedFilename) {
|
775 |
+
|
776 |
+
if (in_array($splitedFilename, ['.', '..', 'bmi_converted_completed_tables'])) continue;
|
777 |
+
if (substr($splitedFilename, -4) != '.sql') continue;
|
778 |
+
|
779 |
+
$this->files[] = trailingslashit($this->storage) . trailingslashit($filename) . $splitedFilename;
|
780 |
+
|
781 |
+
}
|
782 |
+
|
783 |
+
continue;
|
784 |
+
|
785 |
+
}
|
786 |
+
|
787 |
+
if (substr($filename, -4) != '.sql') continue;
|
788 |
$this->files[] = trailingslashit($this->storage) . $filename;
|
789 |
|
790 |
}
|
791 |
|
792 |
+
$this->sortFiles();
|
793 |
+
|
794 |
+
return $this->files;
|
795 |
+
|
796 |
+
}
|
797 |
+
|
798 |
+
private function sortFiles() {
|
799 |
+
|
800 |
+
$files = $this->files;
|
801 |
+
|
802 |
+
$tmp_files = [];
|
803 |
+
for ($i = 0; $i < sizeof($files); ++$i) {
|
804 |
+
|
805 |
+
$file = $files[$i];
|
806 |
+
|
807 |
+
$name = [];
|
808 |
+
preg_match('/^(.*)\.sql$/', basename($file), $name); // 1
|
809 |
+
|
810 |
+
$order = [];
|
811 |
+
$name = $name[1];
|
812 |
+
preg_match('/^(.*)\_((\d+)\_of\_(\d+))$/', $name, $order); // 1, 3, 4
|
813 |
+
|
814 |
+
$tablename = $name;
|
815 |
+
|
816 |
+
if (sizeof($order) >= 3) {
|
817 |
+
$tablename = $order[1];
|
818 |
+
}
|
819 |
+
|
820 |
+
if (!isset($tmp_files[$tablename])) {
|
821 |
+
$tmp_files[$tablename] = [];
|
822 |
+
}
|
823 |
+
|
824 |
+
$tmp_files[$tablename][] = $file;
|
825 |
+
|
826 |
+
}
|
827 |
+
|
828 |
+
ksort($tmp_files);
|
829 |
+
$files = [];
|
830 |
+
|
831 |
+
foreach ($tmp_files as $table => $sqlfiles) {
|
832 |
+
|
833 |
+
usort($sqlfiles, function ($a, $b) {
|
834 |
+
|
835 |
+
$nameA = [];
|
836 |
+
preg_match('/^(.*)\.sql$/', basename($a), $nameA); // 1
|
837 |
+
|
838 |
+
$nameB = [];
|
839 |
+
preg_match('/^(.*)\.sql$/', basename($b), $nameB); // 1
|
840 |
+
|
841 |
+
$nameA = $nameA[1];
|
842 |
+
$nameB = $nameB[1];
|
843 |
+
|
844 |
+
$orderA = [];
|
845 |
+
preg_match('/^(.*)\_((\d+)\_of\_(\d+))$/', $nameA, $orderA); // 1, 3, 4
|
846 |
+
|
847 |
+
$orderB = [];
|
848 |
+
preg_match('/^(.*)\_((\d+)\_of\_(\d+))$/', $nameB, $orderB); // 1, 3, 4
|
849 |
+
|
850 |
+
if (sizeof($orderA) >= 3 && sizeof($orderB) >= 3) {
|
851 |
+
|
852 |
+
if (intval($orderA[3]) > intval($orderB[3])) {
|
853 |
+
|
854 |
+
return 1;
|
855 |
+
|
856 |
+
} else if (intval($orderA[3]) < intval($orderB[3])) {
|
857 |
+
|
858 |
+
return -1;
|
859 |
+
|
860 |
+
} else {
|
861 |
+
|
862 |
+
return 0;
|
863 |
+
|
864 |
+
}
|
865 |
+
|
866 |
+
} else {
|
867 |
+
|
868 |
+
return 1;
|
869 |
+
|
870 |
+
}
|
871 |
+
|
872 |
+
});
|
873 |
+
|
874 |
+
for ($i = 0; $i < sizeof($sqlfiles); ++$i) {
|
875 |
+
|
876 |
+
$files[] = $sqlfiles[$i];
|
877 |
+
|
878 |
+
}
|
879 |
+
|
880 |
+
}
|
881 |
+
|
882 |
+
unset($tmp_files);
|
883 |
+
|
884 |
+
$this->files = $files;
|
885 |
return $this->files;
|
886 |
|
887 |
}
|
includes/database/smart-sort.php
ADDED
@@ -0,0 +1,1059 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Author: Mikołaj `iClyde` Chodorowski
|
5 |
+
* Contact: kontakt@iclyde.pl
|
6 |
+
* Package: Backup Migration – WP Plugin
|
7 |
+
* Version: 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Namespace
|
11 |
+
namespace BMI\Plugin\Database;
|
12 |
+
|
13 |
+
// Use
|
14 |
+
use BMI\Plugin\BMI_Logger AS Logger;
|
15 |
+
use BMI\Plugin\Progress\BMI_ZipProgress AS Progress;
|
16 |
+
|
17 |
+
|
18 |
+
// // Exit on direct access
|
19 |
+
if (!defined('ABSPATH')) exit;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Database sort method
|
23 |
+
* Usage: Create new object and use "sortUnsorted" function
|
24 |
+
*/
|
25 |
+
class BMI_Database_Sorting {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Path to database files made with V2 engine
|
29 |
+
*/
|
30 |
+
private $db_files_root;
|
31 |
+
private $output_file_stream;
|
32 |
+
private $name_of_finished_tables_dir = 'bmi_converted_completed_tables';
|
33 |
+
private $progress;
|
34 |
+
private $isCLI;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* __construct - description
|
38 |
+
*
|
39 |
+
* @param {string} $db_root Path to database files
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
function __construct($db_root, &$progress, $isCLI) {
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Set path to the root directory
|
46 |
+
*/
|
47 |
+
$this->db_files_root = $db_root;
|
48 |
+
$this->progress = $progress;
|
49 |
+
$this->isCLI = $isCLI;
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* sortUnsorted - Main function which dynamically sorts the tables (main function)
|
55 |
+
*
|
56 |
+
* @param {array} $processData = [] Data of process to be continued or empty array to start
|
57 |
+
* Requires keys [ 'index', 'insert', 'file', 'table_name', 'dir', 'unique', 'destinationFile' ]
|
58 |
+
* Optional key: convertionFinished
|
59 |
+
*
|
60 |
+
* @return array of [ 'index', 'insert', 'file', 'table_name', 'dir', 'unique', 'destinationFile' ]
|
61 |
+
*/
|
62 |
+
public function sortUnsorted($processData = []) {
|
63 |
+
|
64 |
+
// Sort the SQL files into directories
|
65 |
+
$this->putDatabaseFilesInDirectories();
|
66 |
+
|
67 |
+
// Split files into partial files (query per batch)
|
68 |
+
$process = $this->splitFilesInSeparateDirectories($processData);
|
69 |
+
|
70 |
+
// Check if all tables finished and move them outside completed directory
|
71 |
+
if ($this->doesTablesFinished()) {
|
72 |
+
|
73 |
+
// Move them outside
|
74 |
+
$this->moveAllConvertedTables();
|
75 |
+
|
76 |
+
// Check if process finished
|
77 |
+
if ($this->isCLI || (is_array($process) && array_key_exists('completed', $process) && $process['completed'] == 'yes')) {
|
78 |
+
$process['convertionFinished'] = 'yes';
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
// Return process for that
|
84 |
+
return $process;
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* doesTablesFinished - Checks if there is any table that didn't finish
|
90 |
+
*
|
91 |
+
* @return {bool} true or false
|
92 |
+
*/
|
93 |
+
private function doesTablesFinished() {
|
94 |
+
|
95 |
+
// Scan all files in root
|
96 |
+
$allFiles = scandir($this->db_files_root);
|
97 |
+
$files = array_diff($allFiles, array('.', '..', $this->name_of_finished_tables_dir));
|
98 |
+
|
99 |
+
// If no other directories here that means nothing to convert left
|
100 |
+
if (sizeof($files) <= 0) {
|
101 |
+
|
102 |
+
// Return true for that
|
103 |
+
return true;
|
104 |
+
|
105 |
+
} else {
|
106 |
+
|
107 |
+
// Otherwise it's false
|
108 |
+
return false;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* putDatabaseFilesInDirectories - It puts all SQL files into table directories
|
116 |
+
* Does nothing if the root directory does not contain any SQL files
|
117 |
+
*
|
118 |
+
* @return void
|
119 |
+
*/
|
120 |
+
private function putDatabaseFilesInDirectories() {
|
121 |
+
|
122 |
+
// Scan all files in root
|
123 |
+
$allFiles = scandir($this->db_files_root);
|
124 |
+
$files = array_diff($allFiles, array('.', '..'));
|
125 |
+
|
126 |
+
// For each found file make sure it's SQL and run merge function
|
127 |
+
foreach ($files as $index => $filename) {
|
128 |
+
|
129 |
+
// Exclude non .sql files
|
130 |
+
if (substr($filename, -4) != '.sql') continue;
|
131 |
+
|
132 |
+
// It may be directory with .sql ending, make sure it's not
|
133 |
+
$pathToFile = $this->db_files_root . DIRECTORY_SEPARATOR . $filename;
|
134 |
+
if (is_dir($pathToFile)) continue;
|
135 |
+
|
136 |
+
// Merge the file
|
137 |
+
$this->mergeFileWithDirectory($filename);
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* mergeFileWithDirectory - Merges the file into proper directory
|
145 |
+
*
|
146 |
+
* @param {string} $filename File name which is located in root
|
147 |
+
* @return bool true on success false on failed file move
|
148 |
+
*/
|
149 |
+
private function mergeFileWithDirectory($filename) {
|
150 |
+
|
151 |
+
// Suffix size which stands for ending ".sql"
|
152 |
+
$suffix_size = 4;
|
153 |
+
|
154 |
+
// Match output for table name with different name than just table
|
155 |
+
// It may happen when our support used their tools for optimization
|
156 |
+
$match_output = [];
|
157 |
+
preg_match('/_(\d+)\_of\_(\d+)/', $filename, $match_output);
|
158 |
+
|
159 |
+
// If that's the case, add suffix size as we don't need that info here
|
160 |
+
if (sizeof($match_output) > 0) {
|
161 |
+
$suffix_size += strlen($match_output[0]);
|
162 |
+
}
|
163 |
+
|
164 |
+
// If we know the suffix size, get table name
|
165 |
+
$table_name = substr($filename, 0, -$suffix_size);
|
166 |
+
|
167 |
+
// Prepare future paths of the file
|
168 |
+
$dest_dir = $this->db_files_root . DIRECTORY_SEPARATOR . $table_name;
|
169 |
+
$source_path = $this->db_files_root . DIRECTORY_SEPARATOR . $filename;
|
170 |
+
$dest_path = $dest_dir . DIRECTORY_SEPARATOR . $filename;
|
171 |
+
|
172 |
+
// Check if the directory exists and if it's not make new one
|
173 |
+
if (!file_exists($dest_dir) && !is_dir($dest_dir)) {
|
174 |
+
@mkdir($dest_dir, 0755, true);
|
175 |
+
}
|
176 |
+
|
177 |
+
// Check if the files is not an duplicate and make sure both will be merged
|
178 |
+
$tries = 2;
|
179 |
+
while (file_exists($dest_path)) {
|
180 |
+
|
181 |
+
// If file exists already add number at the suffix and try again until unique name
|
182 |
+
$dest_path = substr($dest_path, 0, -4) . '_' . $tries . '.sql';
|
183 |
+
$tries++;
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
// If we're sure move the file to correct directory
|
188 |
+
if (rename($source_path, $dest_path)) {
|
189 |
+
|
190 |
+
// Return true on success
|
191 |
+
return true;
|
192 |
+
|
193 |
+
} else {
|
194 |
+
|
195 |
+
// Return false on fail
|
196 |
+
return false;
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* countAllFilesAndQueries - Counts all files inside directory and returns all query count
|
204 |
+
*
|
205 |
+
* @return {array} of total_queries, total_size, all_tables and all_files
|
206 |
+
*/
|
207 |
+
public function countAllFilesAndQueries() {
|
208 |
+
|
209 |
+
// Scan all files in root
|
210 |
+
$allFiles = scandir($this->db_files_root);
|
211 |
+
$folders = array_diff($allFiles, array('.', '..', $this->name_of_finished_tables_dir));
|
212 |
+
|
213 |
+
// Tables
|
214 |
+
$tables = [];
|
215 |
+
|
216 |
+
// Files
|
217 |
+
$files = [];
|
218 |
+
|
219 |
+
// Total size
|
220 |
+
$total_size = 0;
|
221 |
+
|
222 |
+
// For each found file make sure it's SQL and run merge function
|
223 |
+
foreach ($folders as $index => $filename) {
|
224 |
+
|
225 |
+
// Path to that file/directory
|
226 |
+
$pathToFile = $this->db_files_root . DIRECTORY_SEPARATOR . $filename;
|
227 |
+
|
228 |
+
// Hanlde only dirs
|
229 |
+
if (is_dir($pathToFile)) {
|
230 |
+
|
231 |
+
// Add table information
|
232 |
+
$tables[$filename] = 0;
|
233 |
+
|
234 |
+
// Scan SQL files
|
235 |
+
$allSQLFiles = scandir($pathToFile);
|
236 |
+
$allSQLFilesParsed = array_diff($allSQLFiles, array('.', '..'));
|
237 |
+
|
238 |
+
// Go throught these files
|
239 |
+
foreach ($allSQLFilesParsed as $indexSQL => $filenameSQL) {
|
240 |
+
|
241 |
+
// Exclude non .sql files
|
242 |
+
if (substr($filenameSQL, -4) != '.sql') continue;
|
243 |
+
|
244 |
+
// Get size of that file
|
245 |
+
$size = filesize($pathToFile . DIRECTORY_SEPARATOR . $filenameSQL);
|
246 |
+
|
247 |
+
// Add size in total and table
|
248 |
+
$tables[$filename] += $size;
|
249 |
+
$total_size += $size;
|
250 |
+
|
251 |
+
// Add that file to all files
|
252 |
+
$files[] = $filenameSQL;
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
}
|
259 |
+
|
260 |
+
// Prepare stats variable
|
261 |
+
$stats = [
|
262 |
+
'total_queries' => (sizeof($files) * 5),
|
263 |
+
'total_size' => $total_size,
|
264 |
+
'all_tables' => $tables,
|
265 |
+
'all_files' => $files
|
266 |
+
];
|
267 |
+
|
268 |
+
return $stats;
|
269 |
+
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* countTablesDuringProcess - Counts tables even during process
|
274 |
+
*
|
275 |
+
* @return array $done, $progress, $total
|
276 |
+
*/
|
277 |
+
private function countTablesDuringProcess() {
|
278 |
+
|
279 |
+
$theFinalCount = 0;
|
280 |
+
$progressCount = 0;
|
281 |
+
$doneCount = 0;
|
282 |
+
|
283 |
+
// Scan all files in root (now everything should be directory)
|
284 |
+
$allFiles = scandir($this->db_files_root);
|
285 |
+
$files = array_diff($allFiles, array('.', '..', $this->name_of_finished_tables_dir));
|
286 |
+
|
287 |
+
foreach ($files as $index => $filename) {
|
288 |
+
if (is_dir($this->db_files_root . DIRECTORY_SEPARATOR . $filename)) {
|
289 |
+
$theFinalCount++;
|
290 |
+
$progressCount++;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
$doneDir = $this->db_files_root . DIRECTORY_SEPARATOR . $this->name_of_finished_tables_dir;
|
295 |
+
if (file_exists($doneDir) && is_dir($doneDir)) {
|
296 |
+
|
297 |
+
$allDoneFiles = scandir($doneDir);
|
298 |
+
$doneFiles = array_diff($allDoneFiles, array('.', '..'));
|
299 |
+
|
300 |
+
foreach ($doneFiles as $index => $filename) {
|
301 |
+
if (is_dir($doneDir . DIRECTORY_SEPARATOR . $filename)) {
|
302 |
+
$theFinalCount++;
|
303 |
+
$doneCount++;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
return [
|
310 |
+
'done' => $doneCount,
|
311 |
+
'in_progress' => $progressCount,
|
312 |
+
'total' => $theFinalCount
|
313 |
+
];
|
314 |
+
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* logFinished - Shows progress of the process in the log file
|
319 |
+
*
|
320 |
+
* @return void
|
321 |
+
*/
|
322 |
+
private function logFinished($dir, $filename) {
|
323 |
+
|
324 |
+
$counts = $this->countTablesDuringProcess();
|
325 |
+
|
326 |
+
$progress = ($counts['done'] + 1) . '/' . $counts['total'] . ' (' . number_format((($counts['done'] + 1) / $counts['total']) * 100, 2) . '%)';
|
327 |
+
$translated = __('Finished %progress%: %filename% table, total of %parts% parts.', 'backup-backup');
|
328 |
+
|
329 |
+
// Get part amount
|
330 |
+
$partsAll = scandir($dir);
|
331 |
+
$parts = sizeof(array_diff($partsAll, array('.', '..', $this->name_of_finished_tables_dir)));
|
332 |
+
|
333 |
+
$theLog = str_replace('%progress%', $progress, $translated);
|
334 |
+
$theLog = str_replace('%filename%', $filename, $theLog);
|
335 |
+
$theLog = str_replace('%parts%', $parts, $theLog);
|
336 |
+
|
337 |
+
$this->progress->log($theLog, 'SUCCESS');
|
338 |
+
|
339 |
+
$percentage = number_format((($counts['done'] + 1) / $counts['total']) * 100, 2);
|
340 |
+
$this->progress->progress((50 + ($percentage / 4)), 'INFO');
|
341 |
+
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* splitInDirectories - Splits file into parts inside proper directory
|
346 |
+
* @param {array} $processData Process data to be continued
|
347 |
+
*
|
348 |
+
* @return void
|
349 |
+
*/
|
350 |
+
private function splitFilesInSeparateDirectories($processData = []) {
|
351 |
+
|
352 |
+
// Local process variable
|
353 |
+
$process = [];
|
354 |
+
|
355 |
+
// Scan all files in root (now everything should be directory)
|
356 |
+
$allFiles = scandir($this->db_files_root);
|
357 |
+
$files = array_diff($allFiles, array('.', '..', $this->name_of_finished_tables_dir));
|
358 |
+
|
359 |
+
// Loop all tables and split them one by one
|
360 |
+
foreach ($files as $index => $filename) {
|
361 |
+
|
362 |
+
// Prepate path to the SQL file which should be converted
|
363 |
+
$dir = $this->db_files_root . DIRECTORY_SEPARATOR . $filename;
|
364 |
+
|
365 |
+
// Always double check if it's directory otherwise we may get some unexpected errors
|
366 |
+
if (!is_dir($dir)) continue;
|
367 |
+
|
368 |
+
// Log the new file which will be processed
|
369 |
+
$destinationFile = $this->makeDestinationFilename($dir, $filename);
|
370 |
+
$destinationIndex = $destinationFile['index'];
|
371 |
+
|
372 |
+
// Log only if it's first batch
|
373 |
+
if ($destinationIndex == 1) {
|
374 |
+
$this->progress->log(str_replace('%s', $filename, __('Starting conversion of: %s table.', 'backup-backup')), 'INFO');
|
375 |
+
}
|
376 |
+
|
377 |
+
// Dynamically find file to shrink and split it
|
378 |
+
$process = $this->splitFileInTableDirectory($dir, $filename, $processData);
|
379 |
+
|
380 |
+
// If it's not CLI use batching
|
381 |
+
if (!$this->isCLI) {
|
382 |
+
|
383 |
+
// If process finished
|
384 |
+
if (is_array($process) && array_key_exists('completed', $process) && $process['completed'] == 'yes') {
|
385 |
+
|
386 |
+
// Show in the log file the progress
|
387 |
+
$this->logFinished($dir, $filename);
|
388 |
+
|
389 |
+
// Check if directory for completed tables exist and make it if it is not
|
390 |
+
$doneDirectory = $this->db_files_root . DIRECTORY_SEPARATOR . $this->name_of_finished_tables_dir;
|
391 |
+
if (!file_exists($doneDirectory) && !is_dir($doneDirectory)) {
|
392 |
+
@mkdir($doneDirectory, 0755, true);
|
393 |
+
}
|
394 |
+
|
395 |
+
// Move the table into completed directory
|
396 |
+
rename($dir, $doneDirectory . DIRECTORY_SEPARATOR . $filename);
|
397 |
+
|
398 |
+
// Return process even empty
|
399 |
+
return $process;
|
400 |
+
|
401 |
+
} else {
|
402 |
+
|
403 |
+
// If didn't finished that table return process data for next batch to finish
|
404 |
+
return $process;
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
} else {
|
409 |
+
|
410 |
+
// Show in the log file the progress
|
411 |
+
$this->logFinished($dir, $filename);
|
412 |
+
|
413 |
+
// Check if directory for completed tables exist and make it if it is not
|
414 |
+
$doneDirectory = $this->db_files_root . DIRECTORY_SEPARATOR . $this->name_of_finished_tables_dir;
|
415 |
+
if (!file_exists($doneDirectory) && !is_dir($doneDirectory)) {
|
416 |
+
@mkdir($doneDirectory, 0755, true);
|
417 |
+
}
|
418 |
+
|
419 |
+
// Move the table into completed directory
|
420 |
+
rename($dir, $doneDirectory . DIRECTORY_SEPARATOR . $filename);
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* splitFileInTableDirectory - Splits file into parts for easier progress read and performance
|
430 |
+
*
|
431 |
+
* @param {string} $dir Path to parent directory of table SQL files
|
432 |
+
* @param {string} $table_name Table name (current directory name)
|
433 |
+
* @param {array} $processData Process data to be continued
|
434 |
+
* @return void
|
435 |
+
*/
|
436 |
+
private function splitFileInTableDirectory($dir, $table_name, $processData = []) {
|
437 |
+
|
438 |
+
// Prepare local var for process data
|
439 |
+
$process = [];
|
440 |
+
|
441 |
+
// Get all database files inside that directory (it can contain multiple files alrady)
|
442 |
+
$allFiles = scandir($dir);
|
443 |
+
$files = array_diff($allFiles, array('.', '..'));
|
444 |
+
|
445 |
+
// Loop throught all of them and apply splitting
|
446 |
+
foreach ($files as $index => $filename) {
|
447 |
+
|
448 |
+
// Just to triple check that parent is a valid directory
|
449 |
+
if (!is_dir($dir)) continue;
|
450 |
+
|
451 |
+
// Prepare exact path to the SQL file
|
452 |
+
$file = $dir . DIRECTORY_SEPARATOR . $filename;
|
453 |
+
|
454 |
+
// Run splitting function for that file
|
455 |
+
$process = $this->splitDatabaseFile($file, $dir, $table_name, $processData);
|
456 |
+
|
457 |
+
// Break each query if not CLI
|
458 |
+
if (!$this->isCLI) {
|
459 |
+
break;
|
460 |
+
}
|
461 |
+
|
462 |
+
}
|
463 |
+
|
464 |
+
// If CLI only rename files without return
|
465 |
+
if ($this->isCLI) {
|
466 |
+
|
467 |
+
// Rename splited files
|
468 |
+
$this->renameSplitedFiles($dir);
|
469 |
+
|
470 |
+
} else {
|
471 |
+
|
472 |
+
// Check if process for that table completed and rename if so
|
473 |
+
if (is_array($process) && array_key_exists('completed', $process) && $process['completed'] == 'yes') {
|
474 |
+
|
475 |
+
// Rename splited files
|
476 |
+
$this->renameSplitedFiles($dir);
|
477 |
+
|
478 |
+
// Return empty process data as we will iterate new file in next batch
|
479 |
+
return [
|
480 |
+
'index' => 0,
|
481 |
+
'insert' => 'no',
|
482 |
+
'completed' => 'yes'
|
483 |
+
];
|
484 |
+
|
485 |
+
} else {
|
486 |
+
|
487 |
+
// Or just return process data for future use (next batch)
|
488 |
+
return $process;
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
}
|
493 |
+
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* logPartial - Logs partial progress to the output log
|
498 |
+
*
|
499 |
+
* @param {string} $dir Directory of the table
|
500 |
+
* @param {string} $table_name Name of the table
|
501 |
+
* @return void
|
502 |
+
*/
|
503 |
+
private function logPartial($dir, $table_name) {
|
504 |
+
|
505 |
+
// Get part amount
|
506 |
+
$partsAll = scandir($dir);
|
507 |
+
$parts = sizeof(array_diff($partsAll, array('.', '..', $this->name_of_finished_tables_dir)));
|
508 |
+
$parts = $parts - 1;
|
509 |
+
|
510 |
+
// Prepare log string
|
511 |
+
$logString = __('Finished part %part% of %table% table.', 'backup-backup');
|
512 |
+
$logString = str_replace('%table%', $table_name, $logString);
|
513 |
+
$logString = str_replace('%part%', $parts, $logString);
|
514 |
+
|
515 |
+
// Log the string to output
|
516 |
+
$this->progress->log($logString, 'INFO');
|
517 |
+
|
518 |
+
}
|
519 |
+
|
520 |
+
/**
|
521 |
+
* splitDatabaseFile - Splits a SQL file into parts
|
522 |
+
*
|
523 |
+
* @param {string} $file Name of the SQL File
|
524 |
+
* @param {string} $dir Full path to the SQL file
|
525 |
+
* @param {string} $table_name Name of the table to which SQL file belong
|
526 |
+
* @param {array} $processData Process data to be continued
|
527 |
+
* @return void
|
528 |
+
*/
|
529 |
+
private function splitDatabaseFile($file, $dir, $table_name, $processData = []) {
|
530 |
+
|
531 |
+
// Make destionation file and prepare output file stream
|
532 |
+
$destinationFile = $this->makeDestinationFilename($dir, $table_name);
|
533 |
+
$destinationFile = $destinationFile['file'];
|
534 |
+
|
535 |
+
// Local variables required for the process
|
536 |
+
$table_unique = 0;
|
537 |
+
$is_converted = false;
|
538 |
+
$query_started = false;
|
539 |
+
$custom_vars_started = false;
|
540 |
+
$values_started = false;
|
541 |
+
$insert_next = false;
|
542 |
+
$last_seek = 0;
|
543 |
+
|
544 |
+
// Resolve not finished process
|
545 |
+
if (!$isCLI && is_array($processData) && !empty($processData)) {
|
546 |
+
|
547 |
+
// Should be file path $file_path & $file (check if the file exist)
|
548 |
+
if (array_key_exists('file', $processData) && file_exists($processData['file'])) {
|
549 |
+
|
550 |
+
// Set existing file path
|
551 |
+
$file = $processData['file'];
|
552 |
+
|
553 |
+
// Should be int<make sure> of $last_seek
|
554 |
+
if (array_key_exists('index', $processData)) {
|
555 |
+
$last_seek = intval($processData['index']) + 1;
|
556 |
+
}
|
557 |
+
|
558 |
+
// Yes | No values {string} of $insert_next
|
559 |
+
if (array_key_exists('insert', $processData)) {
|
560 |
+
$ins = $processData['insert'];
|
561 |
+
|
562 |
+
if ($ins == 'yes') $insert_next = true;
|
563 |
+
else $insert_next = false;
|
564 |
+
}
|
565 |
+
|
566 |
+
// Table name of $table_name
|
567 |
+
if (array_key_exists('table_name', $processData)) {
|
568 |
+
$table_name = $processData['table_name'];
|
569 |
+
}
|
570 |
+
|
571 |
+
// Directory of that table $dir
|
572 |
+
if (array_key_exists('dir', $processData)) {
|
573 |
+
$dir = $processData['dir'];
|
574 |
+
}
|
575 |
+
|
576 |
+
// Unique for that table $table_unique
|
577 |
+
if (array_key_exists('unique', $processData)) {
|
578 |
+
$table_unique = $processData['unique'];
|
579 |
+
}
|
580 |
+
|
581 |
+
// Destination File (output) of $destinationFile
|
582 |
+
if (array_key_exists('destinationFile', $processData)) {
|
583 |
+
$destinationFile = $processData['destinationFile'];
|
584 |
+
}
|
585 |
+
|
586 |
+
}
|
587 |
+
|
588 |
+
}
|
589 |
+
|
590 |
+
// Open stream for output file
|
591 |
+
$this->output_file_stream = fopen($destinationFile, 'a+');
|
592 |
+
|
593 |
+
// Keep original filename
|
594 |
+
$file_path = $file;
|
595 |
+
|
596 |
+
// Open SplObject for seek-based reading
|
597 |
+
$file = new \SplFileObject($file);
|
598 |
+
|
599 |
+
// Go to last line to check how many lines are there
|
600 |
+
$file->seek($file->getSize());
|
601 |
+
|
602 |
+
// Calculate total lines in that file
|
603 |
+
$total_lines = $file->key() + 1;
|
604 |
+
|
605 |
+
for ($i = $last_seek; $i < $total_lines; ++$i) {
|
606 |
+
|
607 |
+
// Start seek frrom the loop index
|
608 |
+
$file->seek($i);
|
609 |
+
|
610 |
+
// Get line into string and trim it (it contains new line at the end)
|
611 |
+
$line = trim($file->current());
|
612 |
+
|
613 |
+
// Variable for that line, if it's a comment or not
|
614 |
+
$hasComment = false;
|
615 |
+
|
616 |
+
// Check this only if the size of line is below 24
|
617 |
+
// Otherwise it's not a comment line and we can ignore that check for better performance
|
618 |
+
if (strlen($line) < 24) {
|
619 |
+
|
620 |
+
// List of all our comments
|
621 |
+
$c_fs = "/* CONVERTED DB FILE */";
|
622 |
+
$q_s = "/* QUERY START */";
|
623 |
+
$q_e = "/* QUERY END */";
|
624 |
+
$cq_s = "/* CUSTOM VARS START */";
|
625 |
+
$cq_e = "/* CUSTOM VARS END */";
|
626 |
+
$v_s = "/* VALUES START */";
|
627 |
+
$v_e = "/* VALUES END */";
|
628 |
+
|
629 |
+
// If it's converted already ignore the file
|
630 |
+
if ($line === $c_fs) {
|
631 |
+
|
632 |
+
// Mark as converted (it output file be removed by this)
|
633 |
+
$is_converted = true;
|
634 |
+
|
635 |
+
// And break the loop, no need to continue
|
636 |
+
break;
|
637 |
+
|
638 |
+
}
|
639 |
+
|
640 |
+
// Check if it's a query start comment and adjust local variables for that for future know
|
641 |
+
if ($line === $q_s) {
|
642 |
+
$query_started = true;
|
643 |
+
$hasComment = true;
|
644 |
+
}
|
645 |
+
|
646 |
+
// Check if it's a custom variable section start comment and adjust local variables for that for future know
|
647 |
+
if ($line === $cq_s) {
|
648 |
+
$custom_vars_started = true;
|
649 |
+
$hasComment = true;
|
650 |
+
}
|
651 |
+
|
652 |
+
// Check if it's a values section start comment and adjust local variables for that for future know
|
653 |
+
if ($line === $v_s) {
|
654 |
+
$values_started = true;
|
655 |
+
$hasComment = true;
|
656 |
+
}
|
657 |
+
|
658 |
+
// If we are behind a heading insert this line into new output file
|
659 |
+
if ($insert_next && $hasComment) {
|
660 |
+
|
661 |
+
// Add new line as we trimed it before
|
662 |
+
$line .= "\n";
|
663 |
+
|
664 |
+
// Push this to output file
|
665 |
+
$this->insertIntoOutputFile($line, $table_name);
|
666 |
+
|
667 |
+
// If we already added this line continue to new line
|
668 |
+
continue;
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
+
// Handle query ending comment
|
673 |
+
if ($line === $q_e) {
|
674 |
+
|
675 |
+
// Adjust local variable for that file
|
676 |
+
$query_started = false;
|
677 |
+
|
678 |
+
// If it's below heading, add new output and generate new heading for output file
|
679 |
+
if ($insert_next) {
|
680 |
+
|
681 |
+
// Add double ending – it looks much better for our eyes :)
|
682 |
+
$line .= "\n\n";
|
683 |
+
|
684 |
+
// Add this line
|
685 |
+
$this->insertIntoOutputFile($line, $table_name);
|
686 |
+
|
687 |
+
// Close the file as we split per query, we will need new one for new query
|
688 |
+
fclose($this->output_file_stream);
|
689 |
+
|
690 |
+
// Check if it's end of the file add 4 lines offset for empty lines
|
691 |
+
// If it's not the end make new heading, otherwise remove new output file
|
692 |
+
if (($i + 4) < $total_lines) {
|
693 |
+
|
694 |
+
// Make new destination file
|
695 |
+
$destinationFile = $this->makeDestinationFilename($dir, $table_name);
|
696 |
+
$destinationFile = $destinationFile['file'];
|
697 |
+
|
698 |
+
// Log partial progress
|
699 |
+
$this->logPartial($dir, $table_name);
|
700 |
+
|
701 |
+
// Open new stream for new output file
|
702 |
+
$this->output_file_stream = fopen($destinationFile, 'a+');
|
703 |
+
|
704 |
+
// Generate new heading
|
705 |
+
$heading = $this->generateNewHeading($table_unique, $table_name);
|
706 |
+
|
707 |
+
// Put the heading into new file
|
708 |
+
$this->insertIntoOutputFile($heading, $table_name);
|
709 |
+
|
710 |
+
// Technically only few bytes but with 200 tables it may be few MBs :)
|
711 |
+
// Always unset variables if you don't need them anymore
|
712 |
+
unset($heading);
|
713 |
+
|
714 |
+
if (!$this->isCLI) {
|
715 |
+
|
716 |
+
// Check if the output file is open and close it if it is
|
717 |
+
$file = null;
|
718 |
+
if (get_resource_type($this->output_file_stream) === 'file') {
|
719 |
+
fclose($this->output_file_stream);
|
720 |
+
}
|
721 |
+
|
722 |
+
// Return latest insert query
|
723 |
+
return [
|
724 |
+
'index' => $i,
|
725 |
+
'insert' => ($insert_next == true ? 'yes' : 'no'),
|
726 |
+
'file' => $file_path,
|
727 |
+
'table_name' => $table_name,
|
728 |
+
'dir' => $dir,
|
729 |
+
'unique' => $table_unique,
|
730 |
+
'destinationFile' => $destinationFile
|
731 |
+
];
|
732 |
+
|
733 |
+
}
|
734 |
+
|
735 |
+
} else {
|
736 |
+
|
737 |
+
// Log partial progress
|
738 |
+
$this->logPartial($dir, $table_name);
|
739 |
+
|
740 |
+
}
|
741 |
+
|
742 |
+
// Continue to new line as we handled this one already
|
743 |
+
continue;
|
744 |
+
|
745 |
+
}
|
746 |
+
|
747 |
+
}
|
748 |
+
|
749 |
+
// Handle Custom Variables ending comment
|
750 |
+
if ($line === $cq_e) {
|
751 |
+
|
752 |
+
// Adjust local variables for next loops
|
753 |
+
$custom_vars_started = false;
|
754 |
+
|
755 |
+
}
|
756 |
+
|
757 |
+
// Handle values ending
|
758 |
+
if ($line === $v_e) {
|
759 |
+
|
760 |
+
// Adjust local variables for next loops
|
761 |
+
$values_started = false;
|
762 |
+
|
763 |
+
// If it's after heading add this line into new output file
|
764 |
+
if ($insert_next) {
|
765 |
+
|
766 |
+
// Add new line as we trimed it before
|
767 |
+
$line .= "\n";
|
768 |
+
|
769 |
+
// Insert that line into new file
|
770 |
+
$this->insertIntoOutputFile($line, $table_name);
|
771 |
+
|
772 |
+
// As we added the line continue to new one
|
773 |
+
continue;
|
774 |
+
|
775 |
+
}
|
776 |
+
|
777 |
+
}
|
778 |
+
|
779 |
+
}
|
780 |
+
|
781 |
+
// Check if the line is not a comment
|
782 |
+
if (!$hasComment) {
|
783 |
+
|
784 |
+
// If the line should be a part of query handle that case
|
785 |
+
if ($query_started === true) {
|
786 |
+
|
787 |
+
// If it's after heading allow to add this line to new output file
|
788 |
+
if ($insert_next) {
|
789 |
+
|
790 |
+
// Add new line as we trimed it earlier
|
791 |
+
$line .= "\n";
|
792 |
+
|
793 |
+
// Insert the line into new file
|
794 |
+
$this->insertIntoOutputFile($line, $table_name);
|
795 |
+
|
796 |
+
// As we added that line continue to new one
|
797 |
+
continue;
|
798 |
+
|
799 |
+
}
|
800 |
+
|
801 |
+
}
|
802 |
+
|
803 |
+
// Handle custom variables
|
804 |
+
if ($custom_vars_started === true) {
|
805 |
+
|
806 |
+
// We are interested only into PRE TABLE NAME which contains unique timestamp
|
807 |
+
if (strpos($line, 'PRE_TABLE_NAME')) {
|
808 |
+
|
809 |
+
// Prepare variable for preg match output
|
810 |
+
$output = [];
|
811 |
+
|
812 |
+
// Run the preg match function to find the
|
813 |
+
preg_match('/\`(.*)\`/', $line, $output);
|
814 |
+
|
815 |
+
// Get the unique value from regex output
|
816 |
+
$unique = substr($output[1], 0, 10);
|
817 |
+
|
818 |
+
// Set the local variable to found unique for future use in the heading
|
819 |
+
$table_unique = $unique;
|
820 |
+
|
821 |
+
// As we went throught old heading let the script know that it can insert new lines in next loops
|
822 |
+
$insert_next = true;
|
823 |
+
|
824 |
+
// Prepare new heading for file which will be used in next loops
|
825 |
+
$heading = $this->generateNewHeading($unique, $table_name);
|
826 |
+
|
827 |
+
// Insert that heading
|
828 |
+
$this->insertIntoOutputFile($heading, $table_name);
|
829 |
+
|
830 |
+
}
|
831 |
+
|
832 |
+
}
|
833 |
+
|
834 |
+
// Handle casual variable line
|
835 |
+
if ($values_started === true) {
|
836 |
+
|
837 |
+
// If it can insert new output handle it
|
838 |
+
if ($insert_next) {
|
839 |
+
|
840 |
+
// Insert that line into new file
|
841 |
+
$this->insertIntoOutputFile($line, $table_name);
|
842 |
+
|
843 |
+
// Free up the memory as this line may be actually above few MBs.
|
844 |
+
unset($line);
|
845 |
+
|
846 |
+
// Continue to new line as we inserted this one already
|
847 |
+
continue;
|
848 |
+
|
849 |
+
}
|
850 |
+
|
851 |
+
}
|
852 |
+
|
853 |
+
}
|
854 |
+
|
855 |
+
// Free up the memory as this line may be actually above few MBs.
|
856 |
+
unset($line);
|
857 |
+
|
858 |
+
}
|
859 |
+
|
860 |
+
// $total_lines
|
861 |
+
// File size: $file->getSize() / 1024 / 1024
|
862 |
+
|
863 |
+
// Check if the output file is open and close it if it is
|
864 |
+
if (get_resource_type($this->output_file_stream) === 'file') {
|
865 |
+
fclose($this->output_file_stream);
|
866 |
+
}
|
867 |
+
|
868 |
+
// If the file was already converted
|
869 |
+
if ($is_converted === false) {
|
870 |
+
|
871 |
+
// Empty the SplFileObject stream
|
872 |
+
$file = null;
|
873 |
+
|
874 |
+
// Remove new output file as there's nothing to do with it
|
875 |
+
@unlink($file_path);
|
876 |
+
|
877 |
+
} else {
|
878 |
+
|
879 |
+
// If the convert finished, remove source file as we now have splited files
|
880 |
+
@unlink($destinationFile);
|
881 |
+
|
882 |
+
}
|
883 |
+
|
884 |
+
// Empty SplFileObject stream
|
885 |
+
$file = null;
|
886 |
+
|
887 |
+
// Only if not CLI
|
888 |
+
if (!$this->isCLI) {
|
889 |
+
|
890 |
+
// Return empty process data as we will iterate new file in next batch
|
891 |
+
return [
|
892 |
+
'index' => 0,
|
893 |
+
'insert' => 'no',
|
894 |
+
'completed' => 'yes'
|
895 |
+
];
|
896 |
+
|
897 |
+
}
|
898 |
+
|
899 |
+
}
|
900 |
+
|
901 |
+
/**
|
902 |
+
* makeHeading - Generates new heading (converted) for output file
|
903 |
+
*
|
904 |
+
* @param {string/int} $unique Unique timestamp generated during backup (all tables have to be part of it)
|
905 |
+
* @param {string} $table_name Table name of current file, required to generate the heading
|
906 |
+
* @return {string} New heading
|
907 |
+
*/
|
908 |
+
private function generateNewHeading($unique, $table_name) {
|
909 |
+
|
910 |
+
$heading = '';
|
911 |
+
|
912 |
+
$heading .= "/* CONVERTED DB FILE */\n\n";
|
913 |
+
$heading .= "/* QUERY START */\n";
|
914 |
+
$heading .= "SET foreign_key_checks = 0;\n";
|
915 |
+
$heading .= "/* QUERY END */\n";
|
916 |
+
$heading .= "\n";
|
917 |
+
$heading .= "/* QUERY START */\n";
|
918 |
+
$heading .= "SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';\n";
|
919 |
+
$heading .= "/* QUERY END */\n";
|
920 |
+
$heading .= "\n";
|
921 |
+
$heading .= "/* QUERY START */\n";
|
922 |
+
$heading .= "SET time_zone = '+00:00';\n";
|
923 |
+
$heading .= "/* QUERY END */\n";
|
924 |
+
$heading .= "\n";
|
925 |
+
$heading .= "/* QUERY START */\n";
|
926 |
+
$heading .= "SET NAMES 'utf8';\n";
|
927 |
+
$heading .= "/* QUERY END */\n";
|
928 |
+
$heading .= "\n";
|
929 |
+
$heading .= "/* CUSTOM VARS START */\n";
|
930 |
+
$heading .= "/* REAL_TABLE_NAME: `" . $table_name . "`; */\n";
|
931 |
+
$heading .= "/* PRE_TABLE_NAME: `" . $unique . "_" . $table_name . "`; */\n";
|
932 |
+
$heading .= "/* CUSTOM VARS END */\n";
|
933 |
+
$heading .= "\n";
|
934 |
+
|
935 |
+
return $heading;
|
936 |
+
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* insertIntoOutputFile - Puts and output data into new (current) file
|
941 |
+
*
|
942 |
+
* @param {string} &$line Pointer to line, to save the memory
|
943 |
+
* @param {string} $table_name Table name, may be useful for future use
|
944 |
+
* @return void
|
945 |
+
*/
|
946 |
+
private function insertIntoOutputFile(&$line, $table_name) {
|
947 |
+
|
948 |
+
fwrite($this->output_file_stream, $line);
|
949 |
+
|
950 |
+
}
|
951 |
+
|
952 |
+
/**
|
953 |
+
* destinationFile - Makes unique destionation file name
|
954 |
+
*
|
955 |
+
* @param {string} $dir Full path to the SQL file
|
956 |
+
* @param {string} $table_name Name of the table to which SQL file belong
|
957 |
+
* @return {string} name of the destionation SQL file
|
958 |
+
*/
|
959 |
+
private function makeDestinationFilename($dir, $table_name) {
|
960 |
+
|
961 |
+
// Start from file number one
|
962 |
+
$i = 1;
|
963 |
+
|
964 |
+
// Make an assumption that it will be the first file
|
965 |
+
$file = $table_name . '_' . $i . '.sql';
|
966 |
+
|
967 |
+
// Loop until it find unqiue name
|
968 |
+
while (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
|
969 |
+
|
970 |
+
// Increment each iteration for new filename
|
971 |
+
$i++;
|
972 |
+
|
973 |
+
// Set new name to check
|
974 |
+
$file = $table_name . '_' . $i . '.sql';
|
975 |
+
|
976 |
+
}
|
977 |
+
|
978 |
+
// Return final file name
|
979 |
+
return ['file' => $dir . DIRECTORY_SEPARATOR . $file, 'index' => $i];
|
980 |
+
|
981 |
+
}
|
982 |
+
|
983 |
+
/**
|
984 |
+
*
|
985 |
+
* renameSplitedFiles - Renames all files after splitting into sorted SQL files
|
986 |
+
* It also gives better progress experience for the user
|
987 |
+
*
|
988 |
+
* @param {string} $directory Path to directory where the rename function should run
|
989 |
+
* @return void
|
990 |
+
*/
|
991 |
+
private function renameSplitedFiles($directory) {
|
992 |
+
|
993 |
+
// Scan all files after splitting
|
994 |
+
$allFiles = scandir($directory);
|
995 |
+
$files = array_diff($allFiles, array('.', '..'));
|
996 |
+
|
997 |
+
// Loop throught them and add proper number for each
|
998 |
+
foreach ($files as $index => $filename) {
|
999 |
+
|
1000 |
+
// Make new destination name
|
1001 |
+
$newName = substr($filename, 0, -4) . '_of_' . sizeof($files) . '.sql';
|
1002 |
+
|
1003 |
+
// Current file path
|
1004 |
+
$file = $directory . DIRECTORY_SEPARATOR . $filename;
|
1005 |
+
|
1006 |
+
// Final path (after rename)
|
1007 |
+
$finalPathWithName = $directory . DIRECTORY_SEPARATOR . $newName;
|
1008 |
+
|
1009 |
+
// Finally rename the file
|
1010 |
+
rename($file, $finalPathWithName);
|
1011 |
+
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
/**
|
1017 |
+
* moveAllConvertedTables - Moves all completed tables outside
|
1018 |
+
*
|
1019 |
+
* @return void
|
1020 |
+
*/
|
1021 |
+
private function moveAllConvertedTables() {
|
1022 |
+
|
1023 |
+
// Finished directory path
|
1024 |
+
$finishedDBDir = $this->db_files_root . DIRECTORY_SEPARATOR . $this->name_of_finished_tables_dir;
|
1025 |
+
|
1026 |
+
// Check if it exists
|
1027 |
+
if (!file_exists($finishedDBDir) || !is_dir($finishedDBDir)) {
|
1028 |
+
return;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
// Scan all tables in finished directory
|
1032 |
+
$allFiles = scandir($finishedDBDir);
|
1033 |
+
$files = array_diff($allFiles, array('.', '..'));
|
1034 |
+
|
1035 |
+
// Loop throught them and move outside
|
1036 |
+
foreach ($files as $index => $filename) {
|
1037 |
+
|
1038 |
+
// Old path
|
1039 |
+
$old = $this->db_files_root . DIRECTORY_SEPARATOR . $this->name_of_finished_tables_dir . DIRECTORY_SEPARATOR . $filename;
|
1040 |
+
|
1041 |
+
// New path
|
1042 |
+
$new = $this->db_files_root . DIRECTORY_SEPARATOR . $filename;
|
1043 |
+
|
1044 |
+
// Move that directory to parent
|
1045 |
+
rename($old, $new);
|
1046 |
+
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
// Unlink directory that won't be used as it's (and it should) be empty.
|
1050 |
+
if (file_exists($finishedDBDir) && is_dir($finishedDBDir)) {
|
1051 |
+
@rmdir($finishedDBDir);
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
// Return void
|
1055 |
+
return;
|
1056 |
+
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
}
|
includes/extracter/extract.php
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
use BMI\Plugin\Backup_Migration_Plugin as BMP;
|
13 |
use BMI\Plugin\Zipper\Zip as Zip;
|
14 |
use BMI\Plugin\Zipper\BMI_Zipper as ZipManager;
|
|
|
15 |
|
16 |
// Exit on direct access
|
17 |
if (!defined('ABSPATH')) {
|
@@ -31,6 +32,7 @@
|
|
31 |
// Requirements
|
32 |
require_once BMI_INCLUDES . '/database/manager.php';
|
33 |
require_once BMI_INCLUDES . '/database/better-restore.php';
|
|
|
34 |
|
35 |
// IsCLI?
|
36 |
$this->isCLI = $isCLI;
|
@@ -47,12 +49,17 @@
|
|
47 |
// Use specified name if it is in batching mode
|
48 |
if (is_numeric($tmptime)) $this->tmptime = $tmptime;
|
49 |
|
|
|
|
|
|
|
50 |
// Restore start time
|
51 |
$this->start = microtime(true);
|
52 |
|
53 |
// File amount by default 0 later we replace it with scan
|
54 |
$this->fileAmount = 0;
|
55 |
$this->recent_export_seek = 0;
|
|
|
|
|
56 |
|
57 |
// Options
|
58 |
$this->batchStep = 0;
|
@@ -102,6 +109,12 @@
|
|
102 |
if (isset($options['recent_export_seek'])) {
|
103 |
$this->recent_export_seek = intval($options['recent_export_seek']);
|
104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
// Name
|
107 |
$this->tmp = untrailingslashit(ABSPATH) . '/backup-migration_' . $this->tmptime;
|
@@ -396,7 +409,7 @@
|
|
396 |
public function restoreBackupFromFiles($manifest) {
|
397 |
|
398 |
$this->same_domain = untrailingslashit($manifest->dbdomain) == untrailingslashit($this->siteurl) ? true : false;
|
399 |
-
$this->migration->log(__('Restoring files...', 'backup-backup'), 'STEP');
|
400 |
$contentDirectory = $this->WP_CONTENT_DIR;
|
401 |
$pathtowp = DIRECTORY_SEPARATOR . 'wp-content';
|
402 |
if (isset($manifest->config->WP_CONTENT_DIR) && isset($manifest->config->ABSPATH)) {
|
@@ -412,7 +425,7 @@
|
|
412 |
}
|
413 |
|
414 |
$this->replaceAll($pathtowp);
|
415 |
-
$this->migration->log(__('
|
416 |
|
417 |
}
|
418 |
|
@@ -442,14 +455,20 @@
|
|
442 |
public function alter_tables(&$manifest) {
|
443 |
|
444 |
$storage = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
$importer->xi = $this->db_xi;
|
448 |
$importer->init_start = $this->ini_start;
|
449 |
$importer->table_names_alter = $this->table_names_alter;
|
450 |
|
451 |
$importer->alter_names();
|
452 |
-
$importer->showEndLogs();
|
453 |
$this->migration->log(__('Database restored', 'backup-backup'), 'SUCCESS');
|
454 |
|
455 |
}
|
@@ -460,9 +479,14 @@
|
|
460 |
|
461 |
if ($this->firstDB == true) {
|
462 |
$this->migration->log(__('Successfully detected backup created with V2 engine, importing...', 'backup-backup'), 'INFO');
|
|
|
463 |
}
|
464 |
|
465 |
-
$
|
|
|
|
|
|
|
|
|
466 |
|
467 |
if ($this->isCLI) {
|
468 |
|
@@ -526,7 +550,7 @@
|
|
526 |
public function restoreDatabaseDynamic(&$manifest) {
|
527 |
|
528 |
if ($this->firstDB == true) {
|
529 |
-
$this->migration->log(__('Checking
|
530 |
}
|
531 |
|
532 |
if (is_dir($this->tmp . DIRECTORY_SEPARATOR . 'db_tables')) {
|
@@ -898,7 +922,7 @@
|
|
898 |
|
899 |
}
|
900 |
|
901 |
-
// STEP
|
902 |
if ($this->isCLI || $this->batchStep == 7) {
|
903 |
|
904 |
// Get manifest
|
@@ -906,6 +930,96 @@
|
|
906 |
$manifest = $this->getCurrentManifest();
|
907 |
}
|
908 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
909 |
// Try to restore database
|
910 |
if (!$this->isCLI) {
|
911 |
|
@@ -956,7 +1070,8 @@
|
|
956 |
'db_xi' => $this->db_xi,
|
957 |
'ini_start' => $this->ini_start,
|
958 |
'table_names_alter' => $this->table_names_alter,
|
959 |
-
'
|
|
|
960 |
]]);
|
961 |
|
962 |
return;
|
@@ -965,12 +1080,12 @@
|
|
965 |
|
966 |
}
|
967 |
|
968 |
-
// STEP:
|
969 |
-
if ($this->isCLI || $this->batchStep ==
|
970 |
|
971 |
// Rename database from temporary to destination
|
972 |
// And do the rest
|
973 |
-
// Step
|
974 |
|
975 |
// Get manifest
|
976 |
if (!isset($manifest)) {
|
@@ -1007,8 +1122,12 @@
|
|
1007 |
// Make final cleanup
|
1008 |
$this->finalCleanUP();
|
1009 |
|
|
|
|
|
|
|
|
|
1010 |
// Final verbose
|
1011 |
-
$this->migration->log(__('Restore process took: ', 'backup-backup') . (microtime(true) - $this->start) . '
|
1012 |
Logger::log('Site restored...');
|
1013 |
|
1014 |
// Return success
|
12 |
use BMI\Plugin\Backup_Migration_Plugin as BMP;
|
13 |
use BMI\Plugin\Zipper\Zip as Zip;
|
14 |
use BMI\Plugin\Zipper\BMI_Zipper as ZipManager;
|
15 |
+
use BMI\Plugin\Database\BMI_Database_Sorting as SmartDatabaseSort;
|
16 |
|
17 |
// Exit on direct access
|
18 |
if (!defined('ABSPATH')) {
|
32 |
// Requirements
|
33 |
require_once BMI_INCLUDES . '/database/manager.php';
|
34 |
require_once BMI_INCLUDES . '/database/better-restore.php';
|
35 |
+
require_once BMI_INCLUDES . '/database/smart-sort.php';
|
36 |
|
37 |
// IsCLI?
|
38 |
$this->isCLI = $isCLI;
|
49 |
// Use specified name if it is in batching mode
|
50 |
if (is_numeric($tmptime)) $this->tmptime = $tmptime;
|
51 |
|
52 |
+
// Splitting enabled?
|
53 |
+
$this->splitting = Dashboard\bmi_get_config('OTHER:RESTORE:SPLITTING') ? true : false;
|
54 |
+
|
55 |
// Restore start time
|
56 |
$this->start = microtime(true);
|
57 |
|
58 |
// File amount by default 0 later we replace it with scan
|
59 |
$this->fileAmount = 0;
|
60 |
$this->recent_export_seek = 0;
|
61 |
+
$this->processData = [];
|
62 |
+
$this->conversionStats = [];
|
63 |
|
64 |
// Options
|
65 |
$this->batchStep = 0;
|
109 |
if (isset($options['recent_export_seek'])) {
|
110 |
$this->recent_export_seek = intval($options['recent_export_seek']);
|
111 |
}
|
112 |
+
if (isset($options['processData'])) {
|
113 |
+
$this->processData = $options['processData'];
|
114 |
+
}
|
115 |
+
if (isset($options['conversionStats'])) {
|
116 |
+
$this->conversionStats = $options['conversionStats'];
|
117 |
+
}
|
118 |
|
119 |
// Name
|
120 |
$this->tmp = untrailingslashit(ABSPATH) . '/backup-migration_' . $this->tmptime;
|
409 |
public function restoreBackupFromFiles($manifest) {
|
410 |
|
411 |
$this->same_domain = untrailingslashit($manifest->dbdomain) == untrailingslashit($this->siteurl) ? true : false;
|
412 |
+
$this->migration->log(__('Restoring files (this process may take a while)...', 'backup-backup'), 'STEP');
|
413 |
$contentDirectory = $this->WP_CONTENT_DIR;
|
414 |
$pathtowp = DIRECTORY_SEPARATOR . 'wp-content';
|
415 |
if (isset($manifest->config->WP_CONTENT_DIR) && isset($manifest->config->ABSPATH)) {
|
425 |
}
|
426 |
|
427 |
$this->replaceAll($pathtowp);
|
428 |
+
$this->migration->log(__('All files restored successfully.', 'backup-backup'), 'SUCCESS');
|
429 |
|
430 |
}
|
431 |
|
455 |
public function alter_tables(&$manifest) {
|
456 |
|
457 |
$storage = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
458 |
+
|
459 |
+
$queriesAll = $manifest->total_queries;
|
460 |
+
if (isset($this->conversionStats['total_queries'])) {
|
461 |
+
$queriesAll = $this->conversionStats['total_queries'];
|
462 |
+
}
|
463 |
+
|
464 |
+
// $manifest->total_queries # the other solution
|
465 |
+
$importer = new BetterDatabaseImport($storage, $queriesAll, $manifest->config->ABSPATH, $manifest->dbdomain, $this->siteurl, $this->migration, $this->isCLI, $this->conversionStats);
|
466 |
|
467 |
$importer->xi = $this->db_xi;
|
468 |
$importer->init_start = $this->ini_start;
|
469 |
$importer->table_names_alter = $this->table_names_alter;
|
470 |
|
471 |
$importer->alter_names();
|
|
|
472 |
$this->migration->log(__('Database restored', 'backup-backup'), 'SUCCESS');
|
473 |
|
474 |
}
|
479 |
|
480 |
if ($this->firstDB == true) {
|
481 |
$this->migration->log(__('Successfully detected backup created with V2 engine, importing...', 'backup-backup'), 'INFO');
|
482 |
+
$this->migration->log(__('Restoring database...', 'backup-backup'), 'STEP');
|
483 |
}
|
484 |
|
485 |
+
$queriesAll = $manifest->total_queries;
|
486 |
+
if (isset($this->conversionStats['total_queries'])) {
|
487 |
+
$queriesAll = $this->conversionStats['total_queries'];
|
488 |
+
}
|
489 |
+
$importer = new BetterDatabaseImport($storage, $queriesAll, $manifest->config->ABSPATH, $manifest->dbdomain, $this->siteurl, $this->migration, $this->isCLI, $this->conversionStats);
|
490 |
|
491 |
if ($this->isCLI) {
|
492 |
|
550 |
public function restoreDatabaseDynamic(&$manifest) {
|
551 |
|
552 |
if ($this->firstDB == true) {
|
553 |
+
$this->migration->log(__('Checking the database structure...', 'backup-backup'), 'STEP');
|
554 |
}
|
555 |
|
556 |
if (is_dir($this->tmp . DIRECTORY_SEPARATOR . 'db_tables')) {
|
922 |
|
923 |
}
|
924 |
|
925 |
+
// STEP 7
|
926 |
if ($this->isCLI || $this->batchStep == 7) {
|
927 |
|
928 |
// Get manifest
|
930 |
$manifest = $this->getCurrentManifest();
|
931 |
}
|
932 |
|
933 |
+
$wasDisabled = 0;
|
934 |
+
if (!$this->splitting) {
|
935 |
+
|
936 |
+
$this->migration->log(__('Splitting process is disabled in the settings, omitting.', 'backup-backup'), 'INFO');
|
937 |
+
$wasDisabled = 1;
|
938 |
+
|
939 |
+
} else {
|
940 |
+
|
941 |
+
$newDataProcess = $this->processData;
|
942 |
+
$dbFinishedConv = 'false';
|
943 |
+
$db_tables = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
944 |
+
|
945 |
+
if (is_dir($db_tables)) {
|
946 |
+
|
947 |
+
if (empty($this->processData)) {
|
948 |
+
$this->migration->log(__('Converting database files into partial files.', 'backup-backup'), 'STEP');
|
949 |
+
if (defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
|
950 |
+
$this->migration->log(__('Max rows per query (this site): ', 'backup-backup') . BMI_DB_MAX_ROWS_PER_QUERY, 'INFO');
|
951 |
+
}
|
952 |
+
}
|
953 |
+
|
954 |
+
$dbsort = new SmartDatabaseSort($db_tables, $this->migration, $this->isCLI);
|
955 |
+
$process = $dbsort->sortUnsorted($this->processData);
|
956 |
+
|
957 |
+
if (!is_null($process) && isset($process)) {
|
958 |
+
$newDataProcess = $process;
|
959 |
+
}
|
960 |
+
|
961 |
+
if ($this->isCLI || (isset($process['convertionFinished']) && $process['convertionFinished'] == 'yes')) {
|
962 |
+
$this->migration->log(__('Database convertion finished successfully.', 'backup-backup'), 'SUCCESS');
|
963 |
+
|
964 |
+
$this->migration->log(__('Calculating new query size and counts.', 'backup-backup'), 'STEP');
|
965 |
+
$stats = $dbsort->countAllFilesAndQueries();
|
966 |
+
$this->migration->log(__('Calculaion completed, printing details.', 'backup-backup'), 'SUCCESS');
|
967 |
+
|
968 |
+
$this->migration->log(__('Total queries to insert after conversion: ', 'backup-backup') . $stats['total_queries'], 'INFO');
|
969 |
+
$this->migration->log(__('Partial files count after conversion: ', 'backup-backup') . sizeof($stats['all_files']), 'INFO');
|
970 |
+
$this->migration->log(__('Total size of the database: ', 'backup-backup') . BMP::humanSize($stats['total_size']), 'INFO');
|
971 |
+
$this->migration->log(__('Table count to be imported: ', 'backup-backup') . sizeof($stats['all_tables']), 'INFO');
|
972 |
+
|
973 |
+
$this->conversionStats = $stats;
|
974 |
+
|
975 |
+
$dbFinishedConv = 'true';
|
976 |
+
}
|
977 |
+
|
978 |
+
} else {
|
979 |
+
|
980 |
+
if (file_exists($this->tmp . '/bmi_database_backup.sql')) {
|
981 |
+
|
982 |
+
$this->migration->log(__('Ommiting database convert step as the database backup included was not made with V2 engine.', 'backup-backup'), 'WARN');
|
983 |
+
$this->migration->log(__('The process may be less stable if the database is larger than usual.', 'backup-backup'), 'WARN');
|
984 |
+
$dbFinishedConv = 'true';
|
985 |
+
|
986 |
+
} else {
|
987 |
+
|
988 |
+
$this->migration->log(__('Ommiting database convert step as there is no database backup included.', 'backup-backup'), 'INFO');
|
989 |
+
$dbFinishedConv = 'true';
|
990 |
+
|
991 |
+
}
|
992 |
+
|
993 |
+
}
|
994 |
+
|
995 |
+
}
|
996 |
+
|
997 |
+
if (!$this->isCLI) {
|
998 |
+
|
999 |
+
BMP::res(['status' => 'restore_ongoing', 'tmp' => $this->tmptime, 'secret' => $secret, 'options' => [
|
1000 |
+
'code' => $this->code,
|
1001 |
+
'start' => $this->start,
|
1002 |
+
'amount' => $this->fileAmount,
|
1003 |
+
'dbConvertionFinished' => $dbFinishedConv,
|
1004 |
+
'processData' => $newDataProcess,
|
1005 |
+
'conversionStats' => $this->conversionStats,
|
1006 |
+
'step' => 7 + $wasDisabled
|
1007 |
+
]]);
|
1008 |
+
|
1009 |
+
return;
|
1010 |
+
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
// STEP: 8
|
1016 |
+
if ($this->isCLI || $this->batchStep == 8) {
|
1017 |
+
|
1018 |
+
// Get manifest
|
1019 |
+
if (!isset($manifest)) {
|
1020 |
+
$manifest = $this->getCurrentManifest();
|
1021 |
+
}
|
1022 |
+
|
1023 |
// Try to restore database
|
1024 |
if (!$this->isCLI) {
|
1025 |
|
1070 |
'db_xi' => $this->db_xi,
|
1071 |
'ini_start' => $this->ini_start,
|
1072 |
'table_names_alter' => $this->table_names_alter,
|
1073 |
+
'conversionStats' => $this->conversionStats,
|
1074 |
+
'step' => 8
|
1075 |
]]);
|
1076 |
|
1077 |
return;
|
1080 |
|
1081 |
}
|
1082 |
|
1083 |
+
// STEP: 9
|
1084 |
+
if ($this->isCLI || $this->batchStep == 9) {
|
1085 |
|
1086 |
// Rename database from temporary to destination
|
1087 |
// And do the rest
|
1088 |
+
// Step 9 runs only at the end of database import
|
1089 |
|
1090 |
// Get manifest
|
1091 |
if (!isset($manifest)) {
|
1122 |
// Make final cleanup
|
1123 |
$this->finalCleanUP();
|
1124 |
|
1125 |
+
// Touch autologin file
|
1126 |
+
$autologin_file = BMI_BACKUPS . '/.autologin';
|
1127 |
+
touch($autologin_file);
|
1128 |
+
|
1129 |
// Final verbose
|
1130 |
+
$this->migration->log(__('Restore process took: ', 'backup-backup') . number_format(microtime(true) - $this->start, 2) . ' seconds.', 'INFO');
|
1131 |
Logger::log('Site restored...');
|
1132 |
|
1133 |
// Return success
|
includes/htaccess/default.json
CHANGED
@@ -33,6 +33,8 @@
|
|
33 |
"OTHER:DOWNLOAD:DIRECT": false,
|
34 |
"OTHER:CLI:DISABLE": false,
|
35 |
"OTHER:CLI:PATH": "",
|
|
|
|
|
36 |
"CRON:ENABLED": false,
|
37 |
"CRON:TYPE": "month",
|
38 |
"CRON:DAY": "1",
|
33 |
"OTHER:DOWNLOAD:DIRECT": false,
|
34 |
"OTHER:CLI:DISABLE": false,
|
35 |
"OTHER:CLI:PATH": "",
|
36 |
+
"OTHER:DB:QUERIES": "750",
|
37 |
+
"OTHER:RESTORE:SPLITTING": false,
|
38 |
"CRON:ENABLED": false,
|
39 |
"CRON:TYPE": "month",
|
40 |
"CRON:DAY": "1",
|
includes/initializer.php
CHANGED
@@ -820,7 +820,7 @@
|
|
820 |
|
821 |
// Prevent parent directory downloading
|
822 |
if (file_exists($file) && $this->fixSlashes(dirname($file)) == $this->fixSlashes(BMI_BACKUPS)) {
|
823 |
-
|
824 |
|
825 |
@ignore_user_abort(true);
|
826 |
@set_time_limit(16000);
|
@@ -854,7 +854,7 @@
|
|
854 |
exit;
|
855 |
}
|
856 |
} else {
|
857 |
-
|
858 |
header('HTTP/1.0 423 Locked');
|
859 |
if (ob_get_level()) ob_end_clean();
|
860 |
echo __("Backup download is restricted (allowed for admins only).", 'backup-backup');
|
@@ -865,7 +865,7 @@
|
|
865 |
// Only Admin can download backup logs
|
866 |
if (!(current_user_can('administrator') || current_user_can('do_backups'))) return;
|
867 |
|
868 |
-
|
869 |
$backupname = $get_bid;
|
870 |
$file = $this->fixSlashes(BMI_BACKUPS . DIRECTORY_SEPARATOR . $backupname);
|
871 |
|
@@ -919,7 +919,7 @@
|
|
919 |
header('Content-Type: text/plain');
|
920 |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
921 |
http_response_code(200);
|
922 |
-
|
923 |
if ($get_pid == 'complete_logs.log') {
|
924 |
$file = BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'complete_logs.log';
|
925 |
if (ob_get_level()) ob_end_clean();
|
820 |
|
821 |
// Prevent parent directory downloading
|
822 |
if (file_exists($file) && $this->fixSlashes(dirname($file)) == $this->fixSlashes(BMI_BACKUPS)) {
|
823 |
+
if (ob_get_contents()) ob_end_clean();
|
824 |
|
825 |
@ignore_user_abort(true);
|
826 |
@set_time_limit(16000);
|
854 |
exit;
|
855 |
}
|
856 |
} else {
|
857 |
+
if (ob_get_contents()) ob_end_clean();
|
858 |
header('HTTP/1.0 423 Locked');
|
859 |
if (ob_get_level()) ob_end_clean();
|
860 |
echo __("Backup download is restricted (allowed for admins only).", 'backup-backup');
|
865 |
// Only Admin can download backup logs
|
866 |
if (!(current_user_can('administrator') || current_user_can('do_backups'))) return;
|
867 |
|
868 |
+
if (ob_get_contents()) ob_end_clean();
|
869 |
$backupname = $get_bid;
|
870 |
$file = $this->fixSlashes(BMI_BACKUPS . DIRECTORY_SEPARATOR . $backupname);
|
871 |
|
919 |
header('Content-Type: text/plain');
|
920 |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
921 |
http_response_code(200);
|
922 |
+
if (ob_get_contents()) ob_end_clean();
|
923 |
if ($get_pid == 'complete_logs.log') {
|
924 |
$file = BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'complete_logs.log';
|
925 |
if (ob_get_level()) ob_end_clean();
|
includes/zipper/src/zip.php
CHANGED
@@ -232,7 +232,7 @@ class Zip {
|
|
232 |
$this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
233 |
|
234 |
// Log time of ZIP Process
|
235 |
-
$this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . (microtime(true) - $this->start_zip) . 's');
|
236 |
|
237 |
$this->zip_progress->log(__("Finalizing backup", 'backup-backup'), 'STEP');
|
238 |
$this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
@@ -476,7 +476,7 @@ class Zip {
|
|
476 |
$this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
477 |
|
478 |
// Log time of ZIP Process
|
479 |
-
$this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . (microtime(true) - $this->start_zip) . 's');
|
480 |
|
481 |
$this->zip_progress->log(__("Finalizing backup", 'backup-backup'), 'STEP');
|
482 |
$this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
@@ -714,7 +714,7 @@ class Zip {
|
|
714 |
$safe_limit = $this->smartMemory();
|
715 |
|
716 |
// Extract msg
|
717 |
-
$this->zip_progress->log(__('Extracting files (this process can take some time)...', 'backup_migration'), 'STEP');
|
718 |
|
719 |
// Force PCL Zip
|
720 |
$this->lib = 2;
|
232 |
$this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
233 |
|
234 |
// Log time of ZIP Process
|
235 |
+
$this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . number_format(microtime(true) - $this->start_zip, 2) . 's');
|
236 |
|
237 |
$this->zip_progress->log(__("Finalizing backup", 'backup-backup'), 'STEP');
|
238 |
$this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
476 |
$this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
477 |
|
478 |
// Log time of ZIP Process
|
479 |
+
$this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . number_format(microtime(true) - $this->start_zip, 2) . 's');
|
480 |
|
481 |
$this->zip_progress->log(__("Finalizing backup", 'backup-backup'), 'STEP');
|
482 |
$this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
714 |
$safe_limit = $this->smartMemory();
|
715 |
|
716 |
// Extract msg
|
717 |
+
$this->zip_progress->log(__('Extracting files into temporary directory (this process can take some time)...', 'backup_migration'), 'STEP');
|
718 |
|
719 |
// Force PCL Zip
|
720 |
$this->lib = 2;
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: Migrate
|
3 |
Tags: Backup, Migration, Migrate, Backups, Restore, Duplicate
|
4 |
Requires at least: 4.6
|
5 |
-
Tested up to: 5.8
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
@@ -118,6 +118,18 @@ Besides having the most intuitive interface and smoothest user experience, Backu
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 1.1.3 =
|
122 |
* Fixed PHP CLI migration process (in case of different table prefix)
|
123 |
* Restricted access to global logs
|
@@ -270,15 +282,15 @@ Besides having the most intuitive interface and smoothest user experience, Backu
|
|
270 |
|
271 |
== Upgrade Notice ==
|
272 |
|
273 |
-
= 1.1.
|
274 |
-
What's new in 1.1.
|
275 |
-
*
|
276 |
-
*
|
277 |
-
*
|
278 |
-
* Added
|
279 |
-
* Added
|
280 |
-
*
|
281 |
-
*
|
282 |
-
*
|
283 |
-
* Added
|
284 |
-
*
|
2 |
Contributors: Migrate
|
3 |
Tags: Backup, Migration, Migrate, Backups, Restore, Duplicate
|
4 |
Requires at least: 4.6
|
5 |
+
Tested up to: 5.8.1
|
6 |
+
Stable tag: 1.1.4
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 1.1.4 =
|
122 |
+
* Tested up to WordPress 5.8.1
|
123 |
+
* Fixed warnings in PHP 8 and adjusted ob_clean functions (Thank you @jrevillini)
|
124 |
+
* Added force stop for restoration and migration process
|
125 |
+
* Added force stop for backup process (troubleshooting option)
|
126 |
+
* Added splitting option for restore and migration process
|
127 |
+
* Fixed STEP display in process window for restore and backup
|
128 |
+
* Adjusted logs output for restore and backup process
|
129 |
+
* Updated database engine for export and import using new technique
|
130 |
+
* Added new option to specify export queries per file and restore batch
|
131 |
+
* Implemented splitting n into CLI restoration (disabled by default)
|
132 |
+
|
133 |
= 1.1.3 =
|
134 |
* Fixed PHP CLI migration process (in case of different table prefix)
|
135 |
* Restricted access to global logs
|
282 |
|
283 |
== Upgrade Notice ==
|
284 |
|
285 |
+
= 1.1.4 =
|
286 |
+
What's new in 1.1.4?
|
287 |
+
* Tested up to WordPress 5.8.1
|
288 |
+
* Fixed warnings in PHP 8 and adjusted ob_clean functions (Thank you @jrevillini)
|
289 |
+
* Added force stop for restoration and migration process
|
290 |
+
* Added force stop for backup process (troubleshooting option)
|
291 |
+
* Added splitting option for restore and migration process
|
292 |
+
* Fixed STEP display in process window for restore and backup
|
293 |
+
* Adjusted logs output for restore and backup process
|
294 |
+
* Updated database engine for export and import using new technique
|
295 |
+
* Added new option to specify export queries per file and restore batch
|
296 |
+
* Implemented splitting n into CLI restoration (disabled by default)
|