Version Description
- Permanently excluded link files from the backup (directories and files)
- Permanently excluded non-readable files from the backup to prevent errors.
- Applied above exclusion rules to file size calculator in plugin settings
- Removed unused debug dd() function to prevent conflicts
- Adjusted bytes to read converter to display proper size value on string data
- Changed action hook of plugin's settings script and style
- Fixed issues with notices/warnings of unaccessible variables (backup)
- Set new database export engine as default (v4, requires at least v1.2.2 to restore)
- Added possibility to disable space check step, not recommend but may help in some cases
- Updated out of the box backup paths of other plugins - exclusion rules (5 new)
- Fixed temporary files clean-up after restoration (fail and successful)
- Modified default size of query output new value: 2000
- Added support for batching to search & replace step (restoration/migration)
- Added new option for search & replace, allows to set page size default 300
- Removed unused deactivation module from source code
- Added hints of how to properly create support topic
- Fixed close button for restoration/migration process error window
- Adjusted style of logs for database (now current table will be displayed as step)
- Fixed percentages above 100% for database table progress in logs
- Adjusted old v3 database engine to support new search replace method
- Added automatic temporary theme for the time of restoration/migration
- All other plugins will be now automatically disabled during db migration/restoration
- Fixed rare issue when wp-config.php was empty after restoration
- Fixed issues with database restoration of tables with columns using reserved names (like "key")
- Fixed issues with search & replace of tables with columns using reserved names (like "key")
- Added improvements for restoration at TasteWP.com
- Updated v3 restoration engine (old backups) to not activate problematic plugins
- Added batching for database export during backup process (only alternate backup methods)
- Added option which allows to toggle batching technique of database export (disabled by default)
- Fully tested on WordPress 6.1 with PHP 7.4, 8.0 and 8.1
- Fixed Super-Quick Migration automatic restoration continuation
- Fixed download URL and Super-Quick Migration URL displayed after backup process
- Premium: Fixed database table exclusion rules in different backup methods
- Added additional check for non-readable files in legacy backup methods
- Minimized possibility of damaged backup with success window
- Resolved issues with freezing live-log in/with PHP CLI mode
- Fixed multisite restoration while blog domain used www. while new website don't
- Adjusted engine selector for compatibility with older restoration methods
- Adjusted auto-login after restoration to work with forum-like plugins and new version of WP
Download this release
Release Info
Developer | iclyde |
Plugin | Backup Migration |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- admin/js/backup-migration.min.js +1 -1
- analyst/src/helpers.php +0 -11
- backup-backup.php +2 -2
- includes/ajax.php +107 -27
- includes/backup-cli.php +2 -0
- includes/backup-heart.php +3 -1
- includes/bypasser.php +226 -32
- includes/check/checker.php +4 -2
- includes/check/system_info.php +6 -3
- includes/constants.php +18 -2
- includes/dashboard/chapter/other_config.php +45 -2
- includes/dashboard/chapter/troubleshooting.php +1 -1
- includes/dashboard/modals/after-logs-sent.php +6 -2
- includes/dashboard/modals/restore-error-modal.php +1 -1
- includes/database/better-backup-v3.php +148 -53
- includes/database/better-backup.php +1 -1
- includes/database/even-better-restore-v3.php +195 -73
- includes/database/even-better-restore-v4.php +189 -72
- includes/database/search-replace.php +57 -12
- includes/extracter/extract.php +255 -32
- includes/htaccess/default.json +6 -1
- includes/initializer.php +33 -23
- includes/scanner/files.php +17 -0
- includes/zipper/src/zip.php +219 -157
- modules/deactivation/assets/script.js +0 -74
- modules/deactivation/assets/style.css +0 -316
- modules/deactivation/deactivation.php +0 -132
- modules/deactivation/img/dog.webp +0 -0
- modules/deactivation/img/message.svg +0 -4
- modules/deactivation/modal.php +0 -81
- readme.txt +88 -25
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},o="undefined"!=typeof window?window:null,i={hasTouchCapability:!(!o||!("ontouchstart"in o||o.DocumentTouch&&o.document instanceof o.DocumentTouch||o.navigator.maxTouchPoints)),hasTransitions:function(){if(!o)return!1;var t=(o.document.body||o.document.documentElement).style,e="transition",i=["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<i.length;n++)if("string"==typeof t[i[n]+e])return!0;return!1}(),IE:!1,semVer:"4.2.8",window:o},n=function(){this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__instancesLatestArr=[],this.__plugins={},this._env=i};function s(t){this.$container,this.constraints=null,this.__$tooltip,this.__init(t)}function r(e,o){var i=!0;return t.each(e,function(t,n){if(void 0===o[t]||e[t]!==o[t])return i=!1,!1}),i}function a(e){var o=e.attr("id"),n=o?i.window.document.getElementById(o):null;return n?n===e[0]:t.contains(i.window.document.body,e[0])}n.prototype={__bridge:function(e,o,i){if(!o[i]){var n=function(){};n.prototype=e;var s=new n;s.__init&&s.__init(o),t.each(e,function(t,e){0!=t.indexOf("__")&&(o[t]||(o[t]=function(){return s[t].apply(s,Array.prototype.slice.apply(arguments))},o[t].bridged=s))}),o[i]=s}return this},__setWindow:function(t){return i.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 o=e,i=null;return o.indexOf(".")>0?i=this.__plugins[o]:t.each(this.__plugins,function(t,e){if(e.name.substring(e.name.length-o.length-1)=="."+o)return i=e,!1}),i}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 o=[];return t(e||".tooltipstered").each(function(){var e=t(this),i=e.data("tooltipster-ns");i&&t.each(i,function(t,i){o.push(e.data(i))})}),o},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(o){return t.extend(e,o),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.tooltipster=new n,t.Tooltipster=function(e,o){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,o)},t.Tooltipster.prototype={__init:function(o,n){var s=this;if(s._$origin=t(o),s.__options=t.extend(!0,{},e,n),s.__optionsFormat(),!i.IE||i.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)}),i.hasTouchCapability&&t(i.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,o=this._$origin.is("area");if(o){var n=this._$origin.parent().attr("name");e=t('img[usemap="#'+n+'"]')}var s=e[0].getBoundingClientRect(),r=t(i.window.document),a=t(i.window),l=e,c={available:{document:null,window:null},document:{size:{height:r.height(),width:r.width()}},window:{scroll:{left:i.window.scrollX||i.window.document.documentElement.scrollLeft,top:i.window.scrollY||i.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:o?e[0]:null,windowOffset:{bottom:s.bottom,left:s.left,right:s.right,top:s.top}}};if(o){var d=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"!=d)switch(d){case"circle":var p=u[0],f=u[1],_=u[2],m=f-_,h=p-_;c.origin.size.height=2*_,c.origin.size.width=c.origin.size.height,c.origin.windowOffset.left+=h,c.origin.windowOffset.top+=m;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(i.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 o=(new Date).getTime();e.__touchEvents=t.grep(e.__touchEvents,function(t,e){return o-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"),i.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&&i.hasTouchCapability){var e="";t.__options.triggerOpen.click&&(e+="click."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.tap&&i.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&&i.hasTouchCapability){e="";t.__options.triggerOpen.mouseenter&&(e+="mouseenter."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.touchstart&&i.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&&i.hasTouchCapability){e="";t.__options.triggerClose.mouseleave&&(e+="mouseleave."+t.__namespace+"-triggerOpen "),t.__options.triggerClose.touchleave&&i.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,o=e.__options.interactive?"auto":"";return e._$tooltip.attr("id",e.__namespace).css({"pointer-events":o,zIndex:e.__options.zIndex}),t.each(e.__previousThemes,function(t,o){e._$tooltip.removeClass(o)}),t.each(e.__options.theme,function(t,o){e._$tooltip.addClass(o)}),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 o=null;if(e.target===i.window.document)this.__Geometry.origin.fixedLineage||this.__options.repositionOnScroll&&this.reposition(e);else{o=this.__geometry();var n=!1;if("fixed"!=this._$origin.css("position")&&this.__$originParents.each(function(e,i){var s=t(i),r=s.css("overflow-x"),a=s.css("overflow-y");if("visible"!=r||"visible"!=a){var l=i.getBoundingClientRect();if("visible"!=r&&(o.origin.windowOffset.left<l.left||o.origin.windowOffset.right>l.right))return n=!0,!1;if("visible"!=a&&(o.origin.windowOffset.top<l.top||o.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=o.origin.offset.left-this.__Geometry.origin.offset.left,r=o.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:o})}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 o=t.__geometry(),i=!1;r(o.origin.size,t.__Geometry.origin.size)&&(t.__Geometry.origin.fixedLineage?r(o.origin.windowOffset,t.__Geometry.origin.windowOffset)&&(i=!0):r(o.origin.offset,t.__Geometry.origin.offset)&&(i=!0)),i||(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,o,n){var s=this,r=!0;if(s._trigger({type:"close",event:e,stop:function(){r=!1}}),r||n){o&&s.__callbacks.close.push(o),s.__callbacks.open=[],s.__timeoutsClear();var a=function(){t.each(s.__callbacks.close,function(t,o){o.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 d=function(){clearInterval(s.__tracker),s._trigger({type:"closing",event:e}),s._$tooltip.off("."+s.__namespace+"-triggerClose").removeClass("tooltipster-dying"),t(i.window).off("."+s.__namespace+"-triggerClose"),s.__$originParents.each(function(e,o){t(o).off("scroll."+s.__namespace+"-triggerClose")}),s.__$originParents=null,t(i.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()};i.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(d)):s._$tooltip.stop().fadeOut(s.__options.animationDuration[1],d)}}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,o){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){o&&n.__callbacks.open.push(o),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"),i.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),i.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(i.window).on("resize."+n.__namespace+"-triggerClose",function(e){var o=t(document.activeElement);(o.is("input")||o.is("textarea"))&&t.contains(n._$tooltip[0],o[0])||n.reposition(e)}).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)}),n.__$originParents=n._$origin.parents(),n.__$originParents.each(function(e,o){t(o).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)})}),n.__options.triggerClose.mouseleave||n.__options.triggerClose.touchleave&&i.hasTouchCapability){n._on("dismissable",function(t){t.dismissable?t.delay?(p=setTimeout(function(){n._close(t.event)},t.delay),n.__timeouts.close.push(p)):n._close(t):clearTimeout(p)});var c=n._$origin,d="",u="",p=null;n.__options.interactive&&(c=c.add(n._$tooltip)),n.__options.triggerClose.mouseleave&&(d+="mouseenter."+n.__namespace+"-triggerClose ",u+="mouseleave."+n.__namespace+"-triggerClose "),n.__options.triggerClose.touchleave&&i.hasTouchCapability&&(d+="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(d,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&&i.hasTouchCapability)&&setTimeout(function(){if("closed"!=n.__state){var e="",o=t(i.window.document.body);n.__options.triggerClose.click&&(e+="click."+n.__namespace+"-triggerClose "),n.__options.triggerClose.tap&&i.hasTouchCapability&&(e+="touchend."+n.__namespace+"-triggerClose"),o.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&&i.hasTouchCapability&&o.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){p=setTimeout(function(){n._close()},n.__options.timer+r);n.__timeouts.close.push(p)}}}return n},_openShortly:function(t){var e=this,o=!0;if("stable"!=e.__state&&"appearing"!=e.__state&&!e.__timeouts.open&&(e._trigger({type:"start",event:t,stop:function(){o=!1}}),o)){var i=0==t.type.indexOf("touch")?e.__options.delayTouch:e.__options.delay;i[0]?e.__timeouts.open=setTimeout(function(){e.__timeouts.open=null,e.__pointerIsOverOrigin&&e._touchIsMeaningfulEvent(t)?(e._trigger("startend"),e._open(t)):e._trigger("startcancel")},i[0]):(e._trigger("startend"),e._open(t))}return e},_optionsExtract:function(e,o){var i=this,n=t.extend(!0,{},o),s=i.__options[e];return s||(s={},t.each(o,function(t,e){var o=i.__options[t];void 0!==o&&(s[t]=o)})),t.each(n,function(e,o){void 0!==s[e]&&("object"!=typeof o||o instanceof Array||null==o||"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 o=t.tooltipster._plugin(e);if(!o)throw new Error('The "'+e+'" plugin is not defined');return o.instance&&t.tooltipster.__bridge(o.instance,this,o.name),this},_touchIsEmulatedEvent:function(t){for(var e=!1,o=(new Date).getTime(),i=this.__touchEvents.length-1;i>=0;i--){var n=this.__touchEvents[i];if(!(o-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,o=this.__touchEvents.length-1;o>=0;o--){var i=this.__touchEvents[o];if("touchmove"==i.type){e=!0;break}if("touchstart"==i.type&&t===i.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 o=this;if(o[e]){var i=t.tooltipster._plugin(e);i.instance&&t.each(i.instance,function(t,i){o[t]&&o[t].bridged===o[e]&&delete o[t]}),o[e].__destroy&&o[e].__destroy(),delete o[e]}return o},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(i.hasTransitions){var o=e.__options.updateAnimation;e._$tooltip.addClass("tooltipster-update-"+o),setTimeout(function(){"closed"!=e.__state&&e._$tooltip.removeClass("tooltipster-update-"+o)},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(i.window.document.body).off("."+e.__namespace+"-triggerOpen");var o=e._$origin.data("tooltipster-ns");if(o)if(1===o.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 o=t.grep(o,function(t,o){return t!==e.__namespace}),e._$origin.data("tooltipster-ns",o);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,o){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,o){return void 0===o?this.__options[e]:(this.__destroyed?this.__destroyError():(this.__options[e]=o,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 o=Array.prototype.slice.apply(arguments);if(0===this.length)return this;if("string"==typeof o[0]){var i="#*$~&";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 \""+o[0]+'" method on an uninitialized element');if("function"!=typeof n[o[0]])throw new Error('Unknown method "'+o[0]+'"');this.length>1&&"content"==o[0]&&(o[1]instanceof t||"object"==typeof o[1]&&null!=o[1]&&o[1].tagName)&&!n.__options.contentCloning&&n.__options.debug;var s=n[o[0]](o[1],o[2]);if(s!==n||"instance"===o[0])return i=s,!1}),"#*$~&"!==i?i:this}t.tooltipster.__instancesLatestArr=[];var n=o[0]&&void 0!==o[0].multiple,s=n&&o[0].multiple||!n&&e.multiple,r=o[0]&&void 0!==o[0].content,a=r&&o[0].content||!r&&e.content,l=o[0]&&void 0!==o[0].contentCloning,c=(l&&o[0].contentCloning,o[0]&&void 0!==o[0].debug);c&&o[0].debug;return this.length>1&&(a instanceof t||"object"==typeof a&&null!=a&&a.tagName),this.each(function(){var e=!1,i=t(this),n=i.data("tooltipster-ns"),r=null;n?s&&(e=!0):e=!0,e&&(r=new t.Tooltipster(this,o[0]),n||(n=[]),n.push(r.__namespace),i.data("tooltipster-ns",n),i.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(i.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 o=this.__$tooltip.find(".tooltipster-content"),n=this.__$tooltip.outerHeight(),s=o[0].getBoundingClientRect(),r={height:n<=this.constraints.height,width:t.width<=this.constraints.width&&s.width>=o[0].scrollWidth-1};e.fits=r.height&&r.width}return i.IE&&i.IE<=11&&e.size.width!==i.window.document.documentElement.clientWidth&&(e.size.width=Math.ceil(e.size.width)+1),e}};var l=navigator.userAgent.toLowerCase();-1!=l.indexOf("msie")?i.IE=parseInt(l.split("msie")[1]):-1!==l.toLowerCase().indexOf("trident")&&-1!==l.indexOf(" rv:11")?i.IE=11:-1!=l.toLowerCase().indexOf("edge/")&&(i.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,o){var i,n=this,s=n.__targetFind(o),r=[];n.__instance._$tooltip.detach();var a=n.__instance._$tooltip.clone(),l=t.tooltipster._getRuler(a),c=!1,d=n.__instance.option("animation");switch(d&&a.removeClass("tooltipster-"+d),t.each(["window","document"],function(i,d){var u=null;if(n.__instance._trigger({container:d,helper:o,satisfied:c,takeTest:function(t){u=t},results:r,type:"positionTest"}),1==u||0!=u&&0==c&&("window"!=d||n.__options.viewportAware))for(i=0;i<n.__options.side.length;i++){var p={horizontal:0,vertical:0},f=n.__options.side[i];"top"==f||"bottom"==f?p.vertical=n.__options.distance[f]:p.horizontal=n.__options.distance[f],n.__sideChange(a,f),t.each(["natural","constrained"],function(t,i){if(u=null,n.__instance._trigger({container:d,event:e,helper:o,mode:i,results:r,satisfied:c,side:f,takeTest:function(t){u=t},type:"positionTest"}),1==u||0!=u&&0==c){var a={container:d,distance:p,fits:null,mode:i,outerSize:null,side:f,size:null,target:s[f],whole:null},_=("natural"==i?l.free():l.constrain(o.geo.available[d][f].width-p.horizontal,o.geo.available[d][f].height-p.vertical)).measure();if(a.size=_.size,a.outerSize={height:_.size.height+p.vertical,width:_.size.width+p.horizontal},"natural"==i?o.geo.available[d][f].width>=a.outerSize.width&&o.geo.available[d][f].height>=a.outerSize.height?a.fits=!0:a.fits=!1:a.fits=_.fits,"window"==d&&(a.fits?a.whole="top"==f||"bottom"==f?o.geo.origin.windowOffset.right>=n.__options.minIntersection&&o.geo.window.size.width-o.geo.origin.windowOffset.left>=n.__options.minIntersection:o.geo.origin.windowOffset.bottom>=n.__options.minIntersection&&o.geo.window.size.height-o.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<=o.geo.available[d][f].width))return!1}})}}),n.__instance._trigger({edit:function(t){r=t},event:e,helper:o,results:r,type:"positionTested"}),r.sort(function(t,e){return t.whole&&!e.whole?-1:!t.whole&&e.whole?1:t.whole&&e.whole?(o=n.__options.side.indexOf(t.side))<(i=n.__options.side.indexOf(e.side))?-1:o>i?1:"natural"==t.mode?-1:1:t.fits&&!e.fits?-1:!t.fits&&e.fits?1:t.fits&&e.fits?(o=n.__options.side.indexOf(t.side))<(i=n.__options.side.indexOf(e.side))?-1:o>i?1:"natural"==t.mode?-1:1:"document"==t.container&&"bottom"==t.side&&"natural"==t.mode?-1:1;var o,i}),(i=r[0]).coord={},i.side){case"left":case"right":i.coord.top=Math.floor(i.target-i.size.height/2);break;case"bottom":case"top":i.coord.left=Math.floor(i.target-i.size.width/2)}switch(i.side){case"left":i.coord.left=o.geo.origin.windowOffset.left-i.outerSize.width;break;case"right":i.coord.left=o.geo.origin.windowOffset.right+i.distance.horizontal;break;case"top":i.coord.top=o.geo.origin.windowOffset.top-i.outerSize.height;break;case"bottom":i.coord.top=o.geo.origin.windowOffset.bottom+i.distance.vertical}"window"==i.container?"top"==i.side||"bottom"==i.side?i.coord.left<0?o.geo.origin.windowOffset.right-this.__options.minIntersection>=0?i.coord.left=0:i.coord.left=o.geo.origin.windowOffset.right-this.__options.minIntersection-1:i.coord.left>o.geo.window.size.width-i.size.width&&(o.geo.origin.windowOffset.left+this.__options.minIntersection<=o.geo.window.size.width?i.coord.left=o.geo.window.size.width-i.size.width:i.coord.left=o.geo.origin.windowOffset.left+this.__options.minIntersection+1-i.size.width):i.coord.top<0?o.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?i.coord.top=0:i.coord.top=o.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:i.coord.top>o.geo.window.size.height-i.size.height&&(o.geo.origin.windowOffset.top+this.__options.minIntersection<=o.geo.window.size.height?i.coord.top=o.geo.window.size.height-i.size.height:i.coord.top=o.geo.origin.windowOffset.top+this.__options.minIntersection+1-i.size.height):(i.coord.left>o.geo.window.size.width-i.size.width&&(i.coord.left=o.geo.window.size.width-i.size.width),i.coord.left<0&&(i.coord.left=0)),n.__sideChange(a,i.side),o.tooltipClone=a[0],o.tooltipParent=n.__instance.option("parent").parent[0],o.mode=i.mode,o.whole=i.whole,o.origin=n.__instance._$origin[0],o.tooltip=n.__instance._$tooltip[0],delete i.container,delete i.fits,delete i.mode,delete i.outerSize,delete i.whole,i.distance=i.distance.horizontal||i.distance.vertical;var u,p,f,_=t.extend(!0,{},i);if(n.__instance._trigger({edit:function(t){i=t},event:e,helper:o,position:_,type:"position"}),n.__options.functionPosition){var m=n.__options.functionPosition.call(n,n.__instance,o,_);m&&(i=m)}l.destroy(),"top"==i.side||"bottom"==i.side?(u={prop:"left",val:i.target-i.coord.left},p=i.size.width-this.__options.minIntersection):(u={prop:"top",val:i.target-i.coord.top},p=i.size.height-this.__options.minIntersection),u.val<this.__options.minIntersection?u.val=this.__options.minIntersection:u.val>p&&(u.val=p),f=o.geo.origin.fixedLineage?o.geo.origin.windowOffset:{left:o.geo.origin.windowOffset.left+o.geo.window.scroll.left,top:o.geo.origin.windowOffset.top+o.geo.window.scroll.top},i.coord={left:f.left+(i.coord.left-o.geo.origin.windowOffset.left),top:f.top+(i.coord.top-o.geo.origin.windowOffset.top)},n.__sideChange(n.__instance._$tooltip,i.side),o.geo.origin.fixedLineage?n.__instance._$tooltip.css("position","fixed"):n.__instance._$tooltip.css("position",""),n.__instance._$tooltip.css({left:i.coord.left,top:i.coord.top,height:i.size.height,width:i.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:i})},__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={},o=this.__instance._$origin[0].getClientRects();o.length>1&&(1==this.__instance._$origin.css("opacity")&&(this.__instance._$origin.css("opacity",.99),o=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1)));if(o.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 i=o[0];e.top=Math.floor(i.left+(i.right-i.left)/2),i=o.length>2?o[Math.ceil(o.length/2)-1]:o[0],e.right=Math.floor(i.top+(i.bottom-i.top)/2),i=o[o.length-1],e.bottom=Math.floor(i.left+(i.right-i.left)/2),i=o.length>2?o[Math.ceil((o.length+1)/2)-1]:o[o.length-1],e.left=Math.floor(i.top+(i.bottom-i.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 o=["KB","MB","GB"],i=e.toUpperCase(),n=0,s=0;s<o.length;s++){var r=i.indexOf(o[s]);if(r>-1){n=parseInt(i.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 o=$.tempFile;if(!o)return!1;"function"==typeof $.upStart&&$.upStart();var i=o.name,n=i.lastIndexOf("."),s=i.length,r=i.substring(n+1,s);if($.upType&&(uptype=$.upType.split(","),-1==$.inArray(r,uptype)&&($.upError="Type error: Error-"+r)),$.upMaxSize&&($.fchunker_limitFileSize(o,$.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("#bmi").animate({opacity:1},350),jQuery("#bmi_carrousel").show(200)},100)})},50)}),jQuery(document).ready(function(t){let e=!1;t.extend({bmi:{clipboard:function(e){try{const o=document.createElement("textarea");return o.value=e,o.setAttribute("readonly",""),o.style.position="absolute",o.style.left="-9999px",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),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",o="---",i=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>${o}</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()})},i)},_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 o=t(e).parents(".bmi-notification");o.animate({"font-size":"0px"},{duration:200,queue:!1}),o.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){o.remove()})},modal:function(e=!1){let o=!1;return 0!=e&&(o=document.getElementById(e)),{clearModal:function(){o.querySelectorAll(".customselect").forEach(function(t){t.classList.remove("active")}),o.querySelectorAll('input[type="text"]').forEach(function(t){t.value="",t.setAttribute("value","")})},open:function(e=function(){}){o.classList.add("before-open"),setTimeout(function(){o.classList.add("open"),t("html")[0].style.overflowY="hidden",setTimeout(e,410)},10)},close:function(e=function(){}){o.offsetWidth>0&&o.offsetHeight>0?(o.classList.add("before-close"),setTimeout(function(){o.classList.add("closed"),setTimeout(function(){o.classList.remove("before-open"),o.classList.remove("open"),o.classList.remove("before-close"),o.classList.remove("closed"),t.bmi.modal(o.id).clearModal(),e()},410)},10)):(o.classList.remove("before-open"),o.classList.remove("open"),o.classList.remove("before-close"),o.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(o,i){try{return o(JSON.parse(e))}catch(n){if("string"!=typeof e)return i(!1);{let n=t.bmi.reverse(e).indexOf("}");n=0==n?e.length:-n,e=e.slice(e.indexOf("{"),n);try{return o(JSON.parse(e))}catch(t){return i(!1)}}}})},reverse:function(e){return"string"==typeof e?""===e?"":t.bmi.reverse(e.substr(1))+e.charAt(0):e},ajax:function(e,o={}){return new Promise(function(i,n){function s(t,o){o||(o=t),console.log("------- BACKUP MIGRATION ERROR START -------"),!1===t?(console.log("Call: ",e),console.log("Status: ",o.status),console.log("Error: ",o.responseText)):console.log(o),console.log("-------- BACKUP MIGRATION ERROR END --------\n\n"),n(t,o.responseText)}o.action="backup_migration",o.token="bmi",o.f=e,t.post(ajaxurl,o).done(e=>{t.bmi.json(e).then(function(t){i(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)}},o=t(".tooltip"),i=t(".tooltip-html"),n=t(".premium-wrapper"),s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0;for(let i=0;i<o.length;++i){let n=o[i],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<i.length;++e){let o=i[e],n=o.getAttribute("side"),r=JSON.parse(JSON.stringify(s));r.content=o.getAttribute("tooltip"),n&&n.trim().length>0&&(r.side=n),t(o).tooltipster(r)}for(let o=0;o<n.length;++o){let i=n[o],s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0,s.maxWidth=500,i.getAttribute("tooltip")?s.content=i.getAttribute("tooltip"):i.getAttribute("data-ready")?s.content=t("#premium-tooltip-pre")[0].innerHTML.trim()+" "+i.getAttribute("data-ready").trim()+" "+t("#premium-tooltip-r")[0].innerHTML.trim():s.content=t("#premium-tooltip")[0].innerHTML,i.getAttribute("side")&&(s.side=i.getAttribute("side")),t(i).tooltipster(s)}},hideAll:function(e=!1){function o(){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}e?o():setTimeout(o,10)}},collapsers:{toggle:function(o){if(!0===e)return;e=!0;let i=o.getAttribute("group");o.classList.contains("active")?t.bmi.collapsers.close(o):t.bmi.collapsers.open(o,i)},open:function(o,i){t.bmi.collapsers.closeGroup(i),t(o).addClass("active"),t(o).find(".content").show(300),setTimeout(function(){e=!1},300)},close:function(o){t(o).removeClass("active"),t(o).find(".content").hide(300),setTimeout(function(){e=!1},300)},closeGroup:function(o){t('.collapser[group="'+o+'"]').removeClass("active"),t('.collapser[group="'+o+'"]').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,o,i,n){return(e=Math,o=e.log,i=1024,n=o(t)/o(i)|0,t/e.pow(i,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(o){t("#reloading-bm-list").hide(),e(o)}).catch(function(t){console.log(t)}))},fillWithNewBackups:function(e,o=function(){}){backups={},t("#bmi_restore_tbody").html("");let i=t("#bmi-manual-locked").text().trim(),n=Object.keys(e).sort(function(t,o){return+new Date(e[t][1].replace(/\-/g,"/"))-+new Date(e[o][1].replace(/\-/g,"/"))}),s=0;for(;s<n.length;++s){let o=n[s],r="locked"===e[o][5];o=(o=o.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="+o),l.find(".bc-logs-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP_LOGS&backup-id="+o),l.find(".br_date").text(e[o][1]),l.find(".br_name").text(o),l.find(".br_size").text(t.bmi.bytesToHuman(e[o][4])+" ("+e[o][2]+")"),0!=(""+e[o][6]).trim().length&&e[o][6]+""!="false"||(l.find(".bc-locked-btn").addClass("forever"),l.find(".bc-locked-btn").attr("tooltip",i),r=!0),r?l.find(".bc-unlocked-btn").hide():l.find(".bc-locked-btn").hide(),l.prependTo("#bmi_restore_tbody"),e[o].push(o),backups[a]=e[o]}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(),o()},showMoreBackups:function(e){backups={};let o=t("#bmi_restore_tbody").find("tr:hidden");for(let e=0;e<o.length&&e<10;++e)setTimeout(function(){t(o[e]).show(300)},50*e);o.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(o){t.bmi.fillWithNewBackups(o.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 o=0;o<e.length;++o){let i=t(e[o]);i.hasClass("ignored-open")?i.removeClass("ignored-open"):(i.hide(300),i.removeClass("dropdown-open"),t(i[0].closest(".bmi-dropdown")).removeClass("active"))}},setOption:function(e,o=null,i=!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!==i&&(o=n.find('.dropdown-option[data-value="'+i+'"]')),t(o).hasClass("active-option")||(e.find(".dropdown-title").text(o.text()),e.attr("data-selected",o.data("value")),o.addClass("active-option"),!1===i&&e.change(),t.bmi.hideAllLists())},prepareFile:function(e,o){let i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(o)),i.setAttribute("download",e),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),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 o=t(this).parent(".collapser")[0];t.bmi.collapsers.toggle(o)}),t(".bmi_will_collapse").on("change",function(e){e.preventDefault();let o=!1;"radio"==this.getAttribute("type")&&"false"==this.getAttribute("value")&&(o=!0),$child=t(this).data("if-checked"),!0!==this.checked||o?t("#"+$child).hide(300):t("#"+$child).show(300)}),t(".collapser-openner").on("click",function(e){e.preventDefault();let o="configuration",i=t(this).data("el");t(this).data("group")&&(o=t(this).data("group")),t.bmi.collapsers.open(i,o),setTimeout(function(){t([document.documentElement,document.body]).animate({scrollTop:t(i).offset().top-50+"px"},300)},300)}),function(){let e=t(".bmi_will_collapse");for(let o=0;o<e.length;++o){let i=!1;$trigger=e[o],$child=t($trigger).data("if-checked"),"radio"==$trigger.getAttribute("type")&&"false"==$trigger.getAttribute("value")&&(i=!0),!0===$trigger.checked?t("#"+$child).show():t("#"+$child).hide()}}()}),jQuery(document).ready(function(t){var e=!0,o=!1;t.bmi.crons=function(){function i(){!function(e,o){t.bmi.ajax("calculate-cron",e).then(function(e){"success"==e.status?o(e):(o(!1),t.bmi._msg(e))}).catch(function(t){o(!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(o){"success"===o.status&&!1!==o?(t(".cron-time-server").tooltipster("option","interactive",!1),t(".cron-time-server").tooltipster("option","contentAsHTML",!0),!0===t("#cron-btn-toggle")[0].checked&&(o.data="---"),t(".cron-time-server").tooltipster("content","<b>"+t("#bmi-next-cron").text()+"</b>"+o.data+"<br><b>"+t("#bmi-current-time").text()+"</b>"+o.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!==o&&(o=!0,t("#bmi").on("change",'[data-id="cron-period"]',function(t){i(),n(t.target.getAttribute("data-selected"))}),t("#bmi").on("change",'[data-id="cron-day"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-week"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-hour"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-minute"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-keep-backups"]',function(t){t.target.getAttribute("data-selected");i()}),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"),i(),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"),i()}),n(t('[data-id="cron-period"]')[0].getAttribute("data-selected")),i())}}),jQuery(document).ready(function(t){t.bmi.dropdowns={init:function(){let e=t("#bmi");function o(e="null",o="---"){let i=t(".option-template").clone();return i.removeClass("option-template"),i.attr("data-value",e),i.text(o),i}function i(i){if("none"!=i.style.display){i.style.display="none";let n=t(i),s=n.find("option"),r=function(e="---"){let o=t(".dropdown-template").clone();return o.removeClass("dropdown-template"),o.find(".dropdown-title").text(e),o}(function(t){let e="";for(let o=0;o<t.length;++o){let i=t[o].innerText;e.length<i.length&&(e=i)}return e}(s));r=function(e,i){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<i.length;++t){let e=i[t];n.append(o(e.value,e.innerText))}return e}(r,s);let a=s[0].value,l=i.getAttribute("data-parent"),c=i.getAttribute("data-classes"),d="true"===i.getAttribute("data-hide");if(n.attr("data-def")&&(a=n.attr("data-def")),t(r).attr("data-id",i.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 p=u.width();u.remove(),t.bmi.setOption(t(r),null,a),t(r).find(".dropdown-title")[0].style.minWidth=p+10+"px",d&&t(r).hide()}}!function(){let t=e.find("select");for(let e=0;e<t.length;++e)i(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 o=e.find(".dropdown-options");if(e.attr("data-optioner")){(o=t(".optioner-"+e.attr("data-optioner"))).css({position:"absolute"});let i=e[0].offsetWidth,n=e[0].offsetLeft+240,s=e[0].offsetTop+e[0].offsetHeight+5;o.css({maxWidth:i+"px",minWidth:i+"px",top:s+"px",left:n+"px"})}o.hasClass("dropdown-open")?(e.removeClass("active"),o.removeClass("dropdown-open"),o.hide(300)):(e.addClass("active"),o.addClass("dropdown-open"),o.addClass("ignored-open"),o.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,o,i=!1,n=!1,s=0;let r=0,a=0,l=null,c=null,d=null,u=!1,p=!1,f=4500,_=!1,m=!1,h=null,g=!1,b=!1,w=!1,v={},y=[],k=null,x=!1,C="";function $(e){return $cb=t("#"+e).is(":checked"),!0===$cb?"true":"false"}function T(){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 I(e,o){if(a+=1,r+=parseInt(o.bytes),o.bytes<=1e4)t("#bmi-scan-"+e).find(".value").text("(0 MB)");else{let i=(parseInt(o.bytes)/1024/1024).toFixed(2);t("#bmi-scan-"+e).find(".value").text("("+i+" MB)")}t("#bmi-scan-"+e).find(".value").attr("bytes",parseInt(o.bytes)),5==a&&(t("#bmi-scan-total").find(".value").text("("+t.bmi.bytesToHuman(r)+")"),t("#bmi-scan-total").find(".value").attr("bytes",parseInt(r)),S())}function O(e){t.bmi.ajax("scan-directory",{folder:e}).then(function(t){I(e,t)}).catch(function(t){I(t,{bytes:"0",readable:"0 B"})})}function z(e=!1,o=function(){}){t.bmi.ajax("is-running-backup",{}).then(function(i){"success"==i.status?o(!1):1==e?o(!0):t.bmi._msg(i)}).catch(function(t){o(!1),console.log(t)})}function S(){let e=parseInt(t("#bmi-scan-total").find(".value").attr("bytes")),o=parseInt(T());t("#files-group-backup").is(":checked")||(e=0,o=0);let i=((e-o)/1024/1024).toFixed(2),n=(o/1024/1024).toFixed(2);"0.00"==i&&(i="0"),"0.00"==n&&(n="0"),t("#esta-exclude").text(i+" MB"),t("#esta-size-for").text(n+" MB")}function E(e){"backup-prenotice"==e?R():(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal(e).open()},300))}function A(t,e=function(){}){"is_allowed"==t?e("not-allowed"):e()}function L(){t("#prenotice-modal .prenotice").hide(),t("#prenotice-size").text(t.bmi.bytesToHuman(T())),t(".prenotic-3").show(),"true"!==$("database-group-backup")||"true"!==$("database-group-backup")||"true"===$("files-group-backup")&&("true"!==$("files-group-plugins")&&"true"!==$("files-group-themes")&&"true"!==$("files-group-uploads")&&"true"!==$("files-group-wp-install")&&$("files-group-other-contents"),1)||t(".prenotic-6").show(),"true"===$("database-group-backup")||"true"===$("database-group-backup")||"true"!==$("files-group-backup")||"true"!==$("files-group-plugins")&&"true"!==$("files-group-themes")&&"true"!==$("files-group-uploads")&&"true"!==$("files-group-wp-install")&&"true"!==$("files-group-other-contents")||t(".prenotic-5").show(),"true"===$("database-group-backup")&&"true"===$("files-group-backup")&&"true"===$("files-group-plugins")&&"true"===$("files-group-themes")&&"true"===$("files-group-uploads")&&"true"===$("files-group-other-contents")||t(".prenotic-4").show(),t("#prenotice-modal .prenotice:visible").css({background:""});let e=t("#prenotice-modal .prenotice"),o=[];for(let t=0;t<e.length;++t)"none"!==e[t].style.display&&o.push(e[t]);for(let t=0;t<o.length;t+=2)o[t].style.background="#f8f8f8"}function R(){t.bmi.modal("freeze-loading-modal").open(),L(),z(!1,function(){setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("prenotice-modal").open()},300)},300)})}function B(t,e=function(){}){let o=window.location.protocol.includes("https");t=t.includes("https")?t.slice(5):t.slice(4),t=o?"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 M(o){let r=y[s],a=document.createElement("DIV"),l="";"[INFO]"==r.substr(0,6)?l="blue":"[SUCCESS]"==r.substr(0,9)?l="green":"[WARN]"==r.substr(0,6)?l="orange":"[ERROR]"==r.substr(0,7)?l="red":"[END-CODE]"==r.substr(0,10)?l="hide_so_much":"[STEP]"==r.substr(0,6)?(a.classList.add("bold"),a.classList.add("step")):r&&r.trim().length>0&&"["!=r[0]&&s--,l.length>0&&a.classList.add(l),a.style.display="none",a.innerText=r,o.appendChild(a);let c=function(){let o=!1,s="";for(let r=0;r<y.length;++r){let a=y[r];if("[STEP]"==a.substr(0,6)&&(s=a.slice(29)),0==o&&a&&a.trim().includes("[END-CODE]")&&(!0===m||!0===w||!0===b)){o=!0;let s=a;!0===b?s.includes("205")?(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%",ot(!0)):tt():!0===w?(s.includes("001")?setTimeout(function(){et()},1e3):tt(),p=!1,w=!1):(m=!1,s.includes("001")?(i=!0,n=!0,clearTimeout(e),u=!1,U({filename:h},!0)):s.includes("002")?Q():s.includes("003")?(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3)):s.includes("100")?(t.bmi.modal("backup-progress-modal").close(),W(),t.bmi.modal("backup-progress-modal").close()):Q())}}return""!=s&&s!=C&&(C=s,t("#restore-progress-modal").hasClass("open")?t("#restore_current_step").text(s):t("#current_step").text(s)),o}();t(a).show(40),o.scrollTop=o.scrollHeight,++s<y.length&&0==c?(x=!0,k=setTimeout(function(){M(o)},40)):x=!1}function D(t,e){if(!1===t)return;let o=t.split("\n");o.length>=1&&(o=o.slice(0,-1)),y=o,0==x&&s<y.length&&M(e)}function P(e=0,s=1e3,r=null){if(c==e)return;c=e,clearInterval(o);let a=parseFloat(t(".progress-percentage")[0].style.left)-1;t("#restore-progress-modal").hasClass("open")&&(a=parseFloat(t("#restore-progress-modal .progress-percentage")[0].style.left)-1);let l=e-a,d=a,p=Math.abs(Math.floor(s/l));o=setInterval(function(){if(d+=1,t("#restore-progress-modal").hasClass("open")?(t("#restore-progress-modal .progress-active-bar")[0].style.width=d.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].style.left=d.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].innerText=d.toFixed(0)+"%"):(t(".progress-active-bar")[0].style.width=d.toFixed(2)+"%",t(".progress-percentage")[0].style.left=d.toFixed(2)+"%",t(".progress-percentage")[0].innerText=d.toFixed(0)+"%"),d>=100&&clearInterval(o),d>=100&&null!=r&&(c=null,t("#backup-progress-modal").hasClass("open"))){i=!0,n=!0,U(r,0==u)}d>e&&clearInterval(o)},p)}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 o=e.target,i=o.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("lock-backup",{filename:i}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-lock-success").text(),6e3),t(o.closest("tr").querySelector(".bc-unlocked-btn")).hide(),t(o.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",S),t(".basic-file-exlusion").on("change",'input[type="checkbox"]',S),t("#bmi_restore_tbody").on("click",".bc-locked-btn",function(e){if(e.preventDefault(),t(e.target).hasClass("forever"))return;let o=e.target,i=o.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("unlock-backup",{filename:i}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-unlock-success").text(),3e3),t(o.closest("tr").querySelector(".bc-locked-btn")).hide(),t(o.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 o=e.target.closest("tr").querySelector(".bc-download-btn").getAttribute("href");t.bmi.clipboard(o)}),t("#bmi_restore_tbody").on("click",".bc-remove-btn",function(e){let o=e.target.closest("tr").querySelector(".br_name").innerText.trim();d=[o],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:d}).then(function(e){d=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(".bmi-send-troubleshooting-logs").on("click",function(e){e.preventDefault(),t.bmi.alert("info",t("#bmi-support-send-start").text(),6e3),t(".bmi-send-troubleshooting-logs").addClass("disabled");let o=!1,i=!1;t("#backup-error-modal").is(":visible")&&(t.bmi.modal("backup-error-modal").close(),o=!0,i=!1),t("#restore-error-modal").is(":visible")&&(t.bmi.modal("restore-error-modal").close(),i=!0,o=!1),t.bmi.modal("freeze-loading-modal").open();let n=t("#after-logs-sent-modal").attr("data-error-source");t.bmi.ajax("send-troubleshooting-logs",{source:n}).then(function(e){t.bmi.modal("freeze-loading-modal").close(),"success"==e.status?(t("#bmi-support-code-generated").text(e.code),setTimeout(function(){t.bmi.alert("success",t("#bmi-support-send-success").text(),4e3),t.bmi.modal("after-logs-sent-modal").open()},300)):(t.bmi.alert("error",t("#bmi-support-send-fail").text(),6e3),i&&t.bmi.modal("restore-error-modal").open(),o&&t.bmi.modal("backup-error-modal").open()),t(".bmi-send-troubleshooting-logs").removeClass("disabled")}).catch(function(e){t.bmi.modal("freeze-loading-modal").close(),t.bmi.alert("success",t("#bmi-support-send-fail").text(),6e3),alert("Something went wrong on your browser side and we could not send your logs to support team."),t(".bmi-send-troubleshooting-logs").removeClass("disabled"),i&&t.bmi.modal("restore-error-modal").open(),o&&t.bmi.modal("backup-error-modal").open(),console.log(e)})}),t("#share-logs-allowed").on("click",function(e){e.preventDefault();let o=t("#logs-sharing-ask-modal").attr("data-destination");t.bmi.alert("success",t("#bmi-share-logs-thank-you").text(),3e3),t.bmi.modal("logs-sharing-ask-modal").close(),t.bmi.modal("freeze-loading-modal").open(),A("set_yes",function(){setTimeout(function(){E(o)},300)})}),t("#share-logs-not-allowed").on("click",function(e){e.preventDefault();let o=t("#logs-sharing-ask-modal").attr("data-destination");t.bmi.modal("logs-sharing-ask-modal").close(),t.bmi.modal("freeze-loading-modal").open(),A("set_no",function(){setTimeout(function(){E(o)},300)})}),t("#ignore-share-log-request-for-now").on("click",function(e){e.preventDefault(),t.bmi.modal("logs-sharing-ask-modal").close(),E(t("#logs-sharing-ask-modal").attr("data-destination"))}),t("#add-exclusion-rule").on("click",function(e){e.preventDefault();let o=t(".exclusion_template").clone();o[0].classList.remove("exclusion_template"),o[0].style.display="none",t("#bmi_exclusion_rules").append(o),o.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(T()))return T()/1024/1024>1e3*parseInt(t("#BMI_REV").text().trim())?W():void("true"===$("database-group-backup")||"true"===$("files-group-backup")&&("true"===$("files-group-plugins")||"true"===$("files-group-themes")||"true"===$("files-group-uploads")||"true"===$("files-group-wp-install")||"true"===$("files-group-other-contents"))?(t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","backup-prenotice"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):R()})},300)):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 o={},i=t(this.closest(".save-action")).data("save");if(i){if("save-storage"==i)o.directory=t("#bmi_path_storage_default").val(),o.access="true"===t('[name="radioAccessViaLink"]:checked').val()?"true":"false";else if("save-file-config"==i){if(o.database_group=$("database-group-backup"),o.files_group=$("files-group-backup"),t("#bmi-pro-db-tables-exclusion").length>0){o["db-exclude-tables-group"]=$("bmi-pro-db-tables-exclusion"),o["db-excluded-tables"]=["empty"];let e=t(".bmi_pro_tables_display").find("input:checked");if(e.length>0){o["db-excluded-tables"]=[];for(let t=0;t<e.length;++t)o["db-excluded-tables"].push(e[t].value)}else o["db-exclude-tables-group"]="false"}else o["db-exclude-tables-group"]="false",o["db-excluded-tables"]=["empty"];o["files-group-plugins"]=$("files-group-plugins"),o["files-group-uploads"]=$("files-group-uploads"),o["files-group-themes"]=$("files-group-themes"),o["files-group-other-contents"]=$("files-group-other-contents"),o["files-group-wp-install"]=$("files-group-wp-install"),o.files_by_filters=$("files_by_filters"),o.ex_b_fs=$("ex_b_fs"),o.BFFSIN=t("#BFFSIN").val()?t("#BFFSIN").val():"1",o.ex_b_names=$("ex_b_names"),o.ex_b_fpaths=$("ex_b_fpaths"),o.ex_b_dpaths=$("ex_b_dpaths");let e=[],i=t("#bmi_exclusion_rules").find(".exclude-row");for(let o=0;o<i.length;++o){let n=t(i[o]),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})}o["dynamic-names"]=e,o["dynamic-fpaths-names"]=t("#dynamic-fpaths-names").val().split("\n"),o["dynamic-dpaths-names"]=t("#dynamic-dpaths-names").val().split("\n")}else if("store-config"==i)o.name=t("#backup_filename").val().trim();else{if("save-other-options"!=i)return;o.email=t("#email-for-notices").val().trim(),o.email_title=t("#email-title-for-notices").val().trim(),o.schedule_issues=$("scheduled-issues"),o.experiment_timeout=$("experimental-timeout"),o.experimental_hard_timeout=$("experimental-hard-timeout"),o.php_cli_disable_others=$("cli-disable-others"),o.php_cli_manual_path=t("#cli-manual-path").val().trim(),o.download_technique=$("download-technique"),o.uninstall_config=$("uninstalling-configs"),o.uninstall_backups=$("uninstalling-backups"),o.normal_timeout=$("normal-timeout"),o.db_queries_amount=t("#db_queries_amount").val().trim(),o["bmi-restore-splitting"]=$("bmi-restore-splitting"),o["bmi-db-v3-restore-engine"]=$("bmi-db-v3-restore-engine"),o["remove-assets-before-restore"]=$("remove-assets-before-restore"),o["bmi-db-single-file-backup"]=$("bmi-db-single-file-backup")}t.bmi.ajax(i,o).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"),o=t(t(this)[0].closest(".tab2-item"));t(this).is(":checked")?(t("#"+e).show(300),o.addClass("activeList")):(t("#"+e).hide(300),o.removeClass("activeList"))});var j=0;function q(e=function(){}){let o=t("#BMI_BLOG_URL").text().trim();"/"!==o.slice(-o.length)&&(o+="/"),B(o+"?backup-migration=PROGRESS_LOGS&progress-id=latest_full.log&backup-id=current&t="+ +new Date,function(o){if(!o)return e();let i=o.split("\n").slice(0,1)[0];""===i.trim()?(i=o.split("\n").slice(0,2)[1],o=o.split("\n").slice(2).join("\n")):o=o.split("\n").slice(1).join("\n");let n=t(".log-wrapper").find("pre")[0],s=t("#bmi-making-archive").text().trim();if(i&&0!=i&&void 0!==i)if(t("#current_step").text().trim().slice(0,s.length)==s){let e=document.getElementById("bmi_counter_magic");if(e){let o=parseInt(e.innerText);j=parseInt(i.split("/")[0]),isNaN(o)||isNaN(j)||(P(parseInt(i.split("/")[0])/parseInt(i.split("/")[1])*100),async function(t,e,o,i){let n=null,s=function(r){if(j>o)return;n||(n=r);let a=Math.min((r-n)/i,1);t.innerText=Math.floor(a*(o-e)+e),a<1&&window.requestAnimationFrame(s)};window.requestAnimationFrame(s)}(e,o,j,2e3),"---"===t("#bmi_magic_max_count").text()&&100!=parseInt(i.split("/")[1])&&(t("#bmi_magic_max_count").text(parseInt(i.split("/")[1])),t("#entire_magic_counter").is(":hidden")&&t("#entire_magic_counter").show()))}else{let e=parseInt(i.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()}}else P(parseInt(i.split("/")[0])/parseInt(i.split("/")[1])*100);o&&0!=o&&void 0!==o&&D(o,n),e()})}function H(){t(".log-wrapper").find("pre")[0].innerText="",P(0),setTimeout(function(){q(function(){!function t(){q(function(){clearTimeout(e),e=setTimeout(function(){!0===u&&t()},1500)})}()})},300)}function F(o=!0){!0===o&&(t(".log-wrapper").find("pre")[0].innerText="",P(0)),V(function(){clearTimeout(e),function t(){V(function(){e=setTimeout(function(){!0!==p&&!0!==b||t()},800)})}()})}function N(t=function(){}){z(!0,function(e){t(e)})}function G(e=!1,o=function(){}){t.bmi.ajax("reset-latest",{}).then(function(i){!0===e?o():"success"==i.status?(o(),setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300)):t.bmi._msg(i)}).catch(function(t){console.log(t)})}function U(s,r=!1){(i&&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(o),clearTimeout(e);let i=t("#BMI_BLOG_URL").text().trim();"/"!==i.slice(-i.length)&&(i+="/");let n=i+"?backup-migration=BMI_BACKUP&backup-id="+s.filename+"&t="+ +new Date,r=i+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=n,t("#download-backup-url").attr("href",n),t(".download-backup-log-url").attr("href",r),t.bmi.reloadBackups(),setTimeout(function(){clearInterval(o),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 Q(o=!1){setTimeout(function(){z(!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(),t("#after-logs-sent-modal").attr("data-error-source","backup");let i=t("#BMI_BLOG_URL").text().trim();"/"!==i.slice(-i.length)&&(i+="/")})},2e3)}function W(){t.bmi.modal("bfs-modal").open()}function J(e){let o=e.status,i=parseInt(e.errors),n=parseInt(e.iteratio),s=parseInt(e.sf);if(!0===o&&-1===n)return m=!1,h=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),U({filename:h},!0);if(!isNaN(s)&&s>-1&&(g.filessofar=s),!isNaN(n)&&n>-1&&(g.iteratio+=1),isNaN(i)||i>0||0==o){if(isNaN(i)||i>0)return m=!1,h=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),Q()}else X(g,i)}function X(t,e=0){!1===g&&(t.iteratio=0,g=t),function(t,e,o=0){let i=new XMLHttpRequest;i.open("POST",t.url,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Accept","*/*"),i.setRequestHeader("Access-Control-Allow-Origin","*"),i.setRequestHeader("Content-ConfigDir",t.config_dir),i.setRequestHeader("Content-Content",t.content_dir),i.setRequestHeader("Content-Backups",t.backup_dir),i.setRequestHeader("Content-Identy",t.identy),i.setRequestHeader("Content-Url",t.url),i.setRequestHeader("Content-Abs",t.abs_dir),i.setRequestHeader("Content-Dir",t.root_dir),i.setRequestHeader("Content-Manifest",t.manifest),i.setRequestHeader("Content-Name",t.backupname),i.setRequestHeader("Content-Safelimit",t.safelimit),i.setRequestHeader("Content-Start",t.start),i.setRequestHeader("Content-Filessofar",t.filessofar),i.setRequestHeader("Content-Total",t.total_files),i.setRequestHeader("Content-Rev",t.rev),i.setRequestHeader("Content-It",t.iteratio),i.setRequestHeader("Content-Shareallowed",t.shareallowed),i.setRequestHeader("Content-Browser",!0),i.onload=function(){if(200===i.status){let t=i.getResponseHeader("Content-Finished");if(void 0!==t&&t&&"true"==t)return e({status:!0,iteratio:-1,sf:-1,errors:o=0});let n=i.getResponseHeader("Content-It"),s=i.getResponseHeader("Content-Filessofar");return e(void 0!==n&&n?{status:!0,iteratio:n,sf:s,errors:o}:{status:!1,iteratio:-1,sf:-1,errors:++o})}return e({status:!1,iteratio:-1,sf:-1,errors:++o})},i.onerror=function(){return e({status:!1,iteratio:-1,sf:-1,errors:++o})},i.send()}(g,J,e)}function K(e=function(){}){N(function(o){!0===o?t("#backup-progress-modal").hasClass("open")||(!1===u&&(i=!1,u=!0,_=!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===_?(!0===u&&(u=!1),_=!1,t.bmi.getCurrentBackups(function(e){t.bmi.fillWithNewBackups(e.backups,function(){!function(){let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/"),B(e+"?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 o="Backup process aborted",i="[ERROR]";if((e=e.split("\n"))[e.length-1].includes(o)||e[e.length-2].includes(o))t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3);else if(e[e.length-1].includes(i)||e[e.length-2].includes(i))Q();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 V(e=function(){}){let o=t("#BMI_BLOG_URL").text().trim();"/"!==o.slice(-o.length)&&(o+="/"),B(o+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration_full.log&backup-id=current&t="+ +new Date,function(o){if(!o)return e();let i=o.split("\n").slice(0,1)[0];if(o=o.split("\n").slice(1).join("\n"),!1===i||isNaN(parseFloat(i)))return e();let n=t("#restore-live-log-wrapper").find("pre")[0];o.includes("<")||o.includes(">")||o&&0!=o&&void 0!==o&&D(o,n),P(i),e()})}function Y(e=function(){}){t.bmi.ajax("htaccess-litespeed",{}).then(function(t){setTimeout(function(){e(!0)},400)}).catch(function(t){e(!1),console.log(t)})}function Z(e=function(){},o=!1,i=!0){t.bmi.ajax("migration-locked",{clearLogs:i}).then(function(i){"success"==i.status?e(!0):(o||t.bmi._msg(i),e(!1))}).catch(function(t){console.log(t)})}function tt(e=""){Z(function(e){e&&setTimeout(function(){if(!t("#restore-progress-modal").hasClass("open"))return;p=!1,b=!1,t("#restore-error-pre").text(t("#bmi-loading-translation").text().trim()),t("#after-logs-sent-modal").attr("data-error-source","migration");let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/"),t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-error-modal").open()},1e3)},!0,!1)}function et(){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 ot(i=!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(),i||(t("#restore-live-log-wrapper").find("pre")[0].innerText=""),null==n&&(s=0,p=!0,clearTimeout(e),G(!0,function(){Y(function(){V(function(){!function i(n,s,r,a=!1,l="false",c={}){null==r&&F(!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(){et(),p=!1,w=!1},1e3):tt()}}else"success"===r.status?(v={l:r.login,u:r.url},setTimeout(function(){clearInterval(o),clearTimeout(e),p=!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,i(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")),i(n,s,r.secret,r.tmp,"true",r.options)):"error"===r.status?setTimeout(function(){clearInterval(o),clearTimeout(e),tt()},1e3):(t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").close(),t.bmi._msg(r))}).catch(function(t,e){tt(e),console.log(t)})}(r,i,n)})})}))}function it(){return t("#bmi_restore_tbody").find('input[type="checkbox"]:checked')}function nt(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("site_details_troubleshooting.txt",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.bmi.modal("freeze-loading-modal").open(),t(".backup-minimize").removeClass("disabled"),clearTimeout(e),G(!1,function(){Y(function(){_=!1,i=!1,u=!0,t.bmi.ajax("create-backup",{estaminated_size:T()}).then(function(s){if("success"==s.status)i=!0,clearTimeout(e),u=!1,q(function(){setTimeout(function(){U(s,!0)},350)});else if("background"==s.status){m=!0,h=s.filename;let o=document.querySelector(".hide_so_much");if(o){let s=o.innerText;s.includes("001")&&(i=!0,n=!0,clearTimeout(e),u=!1,U({filename:h},!0)),s.includes("002")&&Q(),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?(m=!0,h=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")||setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300),window.onbeforeunload=function(){return"Backup in progress..."},X(s.settings)):(u=!1,setTimeout(function(){clearInterval(o),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.bmi.modal("backup-progress-modal").close(),void 0!==s.bfs?W():Q())}).catch(function(t){Q(),console.log(t)}),s=0,u=!0,H()})})}),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,o=this.dataset.hide,i=t(".hide-show-tr");t(this).hasClass("shown")?(i.hide(300),t(this).removeClass("shown"),this.innerText=e):(i.show(300),t(this).addClass("shown"),this.innerText=o)}),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 o=t("#"+this.getAttribute("data-copy"))[0];o.value&&o.value.length>0?t.bmi.clipboard(o.value):t.bmi.clipboard(o.innerText)}),t("#bmi_restore_tbody").on("click",".restore-btn",function(e){Z(function(o){if(o){let o=e.target.closest("tr").querySelector(".br_name").innerText;if(l=o,!o||o.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#restore-ok").prop("checked",!1),t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","pre-restore-modal"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("pre-restore-modal").open()},300))})},300)}})}),t("#quick-download-migration").on("click",function(){let e=t("#bm-d-url").val();t.bmi.isUrlValid(e)?Z(function(o){o&&(e.length>0?(l=-100,t("#restore-ok").prop("checked",!1),t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","pre-restore-modal"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("pre-restore-modal").open()},300))})},300)):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="",Z(function(i){G(!0,function(){Y(function(){if(i){let i=t("#bm-d-url").val();t("#restore_current_step").text(t("#bmi-downloading-remote").text()),t.bmi.ajax("download-backup",{url:i}).then(function(i){clearInterval(o),clearTimeout(e),"success"===i.status?(b=!0,F(!1),t.bmi.reloadBackups(),l=i.name,setTimeout(function(){clearInterval(o),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())},600)):"cli_download"==i.status?(l=".cli_download",b=!0,F(!1)):"error"===i.status?tt():(t.bmi._msg(i),tt())}).catch(function(t,e){tt(e),console.log(t)}),t("#restore-live-log-wrapper").find("pre")[0].innerText="",s=0,p=!0,b=!0,F(),t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").open()}})})})):ot():t.bmi.alert("warning",t("#bmi-restore-require-checkmark").text(),3e3)}),t(".backup-minimize").on("click",function(){N(function(e){!0===e?t("#bmi-ongoing-backup").show(300):t("#bmi-ongoing-backup").hide()})}),function t(){K(function(){setTimeout(function(){t()},f)})}(),t("#bmi-ongoing-backup").on("click",function(){N(function(e){!0===e?(s=0,H(),setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300)):(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 o=setInterval(function(){1==e&&clearInterval(o),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t("#bmi_restore_tbody").on("change",'input[type="checkbox"]',function(e){let o=it().length;o>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300),o==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),it().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=it(),o=[];for(let t=0;t<e.length;++t){let i=e[t].closest("tr");o.push(i.querySelector(".br_name").innerText)}t("#delete-confirm-modal").find(".text1").hide(),t("#delete-confirm-modal").find(".text2").show();let i=o.length;i<=0||(t("#backup-multiple-del-count").text(i),i>1?(t("#del-only-one").hide(),t("#del-more-than-one").show()):(t("#del-more-than-one").hide(),t("#del-only-one").show()),d=o,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",nt),t("#hide-format-tip").on("click",nt),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;"/"!==t.slice(-t.length)&&(t+="/");let e=t+"?backup-migration=AFTER_RESTORE&backup-id="+v.l+"&progress-id=4u70L051n&t="+ +new Date;window.location=e}),function(){!async function(){O("plugins"),O("uploads"),O("themes"),O("contents_others"),O("wordpress")}(),t.bmi.ajax("get-dynamic-names",{}).then(function(e){let o=e.data;if(t("#bmi_exclusion_rules").text(""),void 0!==o&&void 0!==o.length){for(let e=0;e<o.length;++e){let i=t(".exclusion_template").clone();i.removeClass("exclusion_template"),i.find(".exclusion_txt").val(o[e].txt);let n=i.find(".exclusion_position").find("select"),s=i.find(".exclusion_where").find("select");n&&(n[0].setAttribute("data-def",o[e].pos),s&&(s[0].setAttribute("data-def",o[e].whr),t("#bmi_exclusion_rules").append(i),i.find(".exclusion_position").find(".bmi-dropdown").length>0&&t.bmi.setOption(i.find(".exclusion_position").find(".bmi-dropdown"),null,o[e].pos),i.find(".exclusion_where").find(".bmi-dropdown").length>0&&t.bmi.setOption(i.find(".exclusion_where").find(".bmi-dropdown"),null,o[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")),o=new Date(e);t("#server-time-auto").text(o.toUTCString()),setInterval(function(){e+=1e3,o=new Date(e),t("#server-time-auto").text(o.toUTCString())},1e3),t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}();let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/");let o=e+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,i=e+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration.log&backup-id=current&t="+ +new Date;t(".download-backup-log-url").attr("href",o),t(".download-restore-log-url").attr("href",i)}()}),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,o=-1,i=!1,n="";for(let t=0;t<12;++t)n+="<div></div>";function s(i){clearInterval(e),0==i?(t(".upload-progress-bar").find("span")[0].style.width=i+"%",t(".upload-percentage").text(i+"%")):100==i?(t(".upload-progress-bar").find("span")[0].style.width=i+"%",t(".upload-percentage").text(i+"%")):function(i=0,n=1e3){if(o==i)return;o=i,clearInterval(e);let s=parseInt(t(".upload-percentage").text())-1;if(s>i&&0!=i)return;let r=i-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),o=null)},l)}(i,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 o=e.status,n=e.message;e.url,Math.random();2==o&&(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==o&&(i||(t.bmi.alert("success",t("#bmi-upload-start").text(),3e3),i=!0)),0==o&&(t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300)),5==o&&(t.bmi.modal("upload-invalid-manifest-modal").open(),t("#drop-area").show(300),t(".upload-progress").hide(300)),3==o&&(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(){i=!1,o=-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 o=t[e].closest(".container-radio");o&&void 0!=typeof o.classList&&(o.classList.remove("active"),!0===t[e].checked&&o.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(o){if(this.classList.contains("active"))return;if(!0===e)return;e=!0,t.bmi.collapsers.closeAll();let i=this.getAttribute("data-point");"manage-restore-wrapper"==i?(t("#create-backup-wrapper").hide(300),t('[data-point="create-backup-wrapper"]').removeClass("active")):"create-backup-wrapper"==i&&(t("#manage-restore-wrapper").hide(300),t('[data-point="manage-restore-wrapper"]').removeClass("active")),t("#"+i).show(300),t(this).addClass("active"),setTimeout(function(){e=!1},320)})}),jQuery(document).ready(function(t){let e=document.getElementById("drop-area");function o(t){t.preventDefault(),t.stopPropagation()}function i(t){e.classList.add("highlight")}function n(t){e.classList.remove("highlight")}e&&(["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,o,!1)}),["dragenter","dragover"].forEach(t=>{e.addEventListener(t,i,!1),document.querySelector("body").addEventListener(t,i,!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 |
+
jQuery(document).ready(function(t){var e;e=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},o="undefined"!=typeof window?window:null,i={hasTouchCapability:!(!o||!("ontouchstart"in o||o.DocumentTouch&&o.document instanceof o.DocumentTouch||o.navigator.maxTouchPoints)),hasTransitions:function(){if(!o)return!1;var t=(o.document.body||o.document.documentElement).style,e="transition",i=["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<i.length;n++)if("string"==typeof t[i[n]+e])return!0;return!1}(),IE:!1,semVer:"4.2.8",window:o},n=function(){this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__instancesLatestArr=[],this.__plugins={},this._env=i};function s(t){this.$container,this.constraints=null,this.__$tooltip,this.__init(t)}function r(e,o){var i=!0;return t.each(e,function(t,n){if(void 0===o[t]||e[t]!==o[t])return i=!1,!1}),i}function a(e){var o=e.attr("id"),n=o?i.window.document.getElementById(o):null;return n?n===e[0]:t.contains(i.window.document.body,e[0])}n.prototype={__bridge:function(e,o,i){if(!o[i]){var n=function(){};n.prototype=e;var s=new n;s.__init&&s.__init(o),t.each(e,function(t,e){0!=t.indexOf("__")&&(o[t]||(o[t]=function(){return s[t].apply(s,Array.prototype.slice.apply(arguments))},o[t].bridged=s))}),o[i]=s}return this},__setWindow:function(t){return i.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 o=e,i=null;return o.indexOf(".")>0?i=this.__plugins[o]:t.each(this.__plugins,function(t,e){if(e.name.substring(e.name.length-o.length-1)=="."+o)return i=e,!1}),i}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 o=[];return t(e||".tooltipstered").each(function(){var e=t(this),i=e.data("tooltipster-ns");i&&t.each(i,function(t,i){o.push(e.data(i))})}),o},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(o){return t.extend(e,o),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.tooltipster=new n,t.Tooltipster=function(e,o){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,o)},t.Tooltipster.prototype={__init:function(o,n){var s=this;if(s._$origin=t(o),s.__options=t.extend(!0,{},e,n),s.__optionsFormat(),!i.IE||i.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)}),i.hasTouchCapability&&t(i.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,o=this._$origin.is("area");if(o){var n=this._$origin.parent().attr("name");e=t('img[usemap="#'+n+'"]')}var s=e[0].getBoundingClientRect(),r=t(i.window.document),a=t(i.window),l=e,c={available:{document:null,window:null},document:{size:{height:r.height(),width:r.width()}},window:{scroll:{left:i.window.scrollX||i.window.document.documentElement.scrollLeft,top:i.window.scrollY||i.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:o?e[0]:null,windowOffset:{bottom:s.bottom,left:s.left,right:s.right,top:s.top}}};if(o){var d=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"!=d)switch(d){case"circle":var p=u[0],f=u[1],m=u[2],_=f-m,h=p-m;c.origin.size.height=2*m,c.origin.size.width=c.origin.size.height,c.origin.windowOffset.left+=h,c.origin.windowOffset.top+=_;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(i.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 o=(new Date).getTime();e.__touchEvents=t.grep(e.__touchEvents,function(t,e){return o-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"),i.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&&i.hasTouchCapability){var e="";t.__options.triggerOpen.click&&(e+="click."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.tap&&i.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&&i.hasTouchCapability){e="";t.__options.triggerOpen.mouseenter&&(e+="mouseenter."+t.__namespace+"-triggerOpen "),t.__options.triggerOpen.touchstart&&i.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&&i.hasTouchCapability){e="";t.__options.triggerClose.mouseleave&&(e+="mouseleave."+t.__namespace+"-triggerOpen "),t.__options.triggerClose.touchleave&&i.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,o=e.__options.interactive?"auto":"";return e._$tooltip.attr("id",e.__namespace).css({"pointer-events":o,zIndex:e.__options.zIndex}),t.each(e.__previousThemes,function(t,o){e._$tooltip.removeClass(o)}),t.each(e.__options.theme,function(t,o){e._$tooltip.addClass(o)}),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 o=null;if(e.target===i.window.document)this.__Geometry.origin.fixedLineage||this.__options.repositionOnScroll&&this.reposition(e);else{o=this.__geometry();var n=!1;if("fixed"!=this._$origin.css("position")&&this.__$originParents.each(function(e,i){var s=t(i),r=s.css("overflow-x"),a=s.css("overflow-y");if("visible"!=r||"visible"!=a){var l=i.getBoundingClientRect();if("visible"!=r&&(o.origin.windowOffset.left<l.left||o.origin.windowOffset.right>l.right))return n=!0,!1;if("visible"!=a&&(o.origin.windowOffset.top<l.top||o.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=o.origin.offset.left-this.__Geometry.origin.offset.left,r=o.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:o})}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 o=t.__geometry(),i=!1;r(o.origin.size,t.__Geometry.origin.size)&&(t.__Geometry.origin.fixedLineage?r(o.origin.windowOffset,t.__Geometry.origin.windowOffset)&&(i=!0):r(o.origin.offset,t.__Geometry.origin.offset)&&(i=!0)),i||(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,o,n){var s=this,r=!0;if(s._trigger({type:"close",event:e,stop:function(){r=!1}}),r||n){o&&s.__callbacks.close.push(o),s.__callbacks.open=[],s.__timeoutsClear();var a=function(){t.each(s.__callbacks.close,function(t,o){o.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 d=function(){clearInterval(s.__tracker),s._trigger({type:"closing",event:e}),s._$tooltip.off("."+s.__namespace+"-triggerClose").removeClass("tooltipster-dying"),t(i.window).off("."+s.__namespace+"-triggerClose"),s.__$originParents.each(function(e,o){t(o).off("scroll."+s.__namespace+"-triggerClose")}),s.__$originParents=null,t(i.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()};i.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(d)):s._$tooltip.stop().fadeOut(s.__options.animationDuration[1],d)}}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,o){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){o&&n.__callbacks.open.push(o),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"),i.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),i.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(i.window).on("resize."+n.__namespace+"-triggerClose",function(e){var o=t(document.activeElement);(o.is("input")||o.is("textarea"))&&t.contains(n._$tooltip[0],o[0])||n.reposition(e)}).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)}),n.__$originParents=n._$origin.parents(),n.__$originParents.each(function(e,o){t(o).on("scroll."+n.__namespace+"-triggerClose",function(t){n.__scrollHandler(t)})}),n.__options.triggerClose.mouseleave||n.__options.triggerClose.touchleave&&i.hasTouchCapability){n._on("dismissable",function(t){t.dismissable?t.delay?(p=setTimeout(function(){n._close(t.event)},t.delay),n.__timeouts.close.push(p)):n._close(t):clearTimeout(p)});var c=n._$origin,d="",u="",p=null;n.__options.interactive&&(c=c.add(n._$tooltip)),n.__options.triggerClose.mouseleave&&(d+="mouseenter."+n.__namespace+"-triggerClose ",u+="mouseleave."+n.__namespace+"-triggerClose "),n.__options.triggerClose.touchleave&&i.hasTouchCapability&&(d+="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(d,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&&i.hasTouchCapability)&&setTimeout(function(){if("closed"!=n.__state){var e="",o=t(i.window.document.body);n.__options.triggerClose.click&&(e+="click."+n.__namespace+"-triggerClose "),n.__options.triggerClose.tap&&i.hasTouchCapability&&(e+="touchend."+n.__namespace+"-triggerClose"),o.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&&i.hasTouchCapability&&o.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){p=setTimeout(function(){n._close()},n.__options.timer+r);n.__timeouts.close.push(p)}}}return n},_openShortly:function(t){var e=this,o=!0;if("stable"!=e.__state&&"appearing"!=e.__state&&!e.__timeouts.open&&(e._trigger({type:"start",event:t,stop:function(){o=!1}}),o)){var i=0==t.type.indexOf("touch")?e.__options.delayTouch:e.__options.delay;i[0]?e.__timeouts.open=setTimeout(function(){e.__timeouts.open=null,e.__pointerIsOverOrigin&&e._touchIsMeaningfulEvent(t)?(e._trigger("startend"),e._open(t)):e._trigger("startcancel")},i[0]):(e._trigger("startend"),e._open(t))}return e},_optionsExtract:function(e,o){var i=this,n=t.extend(!0,{},o),s=i.__options[e];return s||(s={},t.each(o,function(t,e){var o=i.__options[t];void 0!==o&&(s[t]=o)})),t.each(n,function(e,o){void 0!==s[e]&&("object"!=typeof o||o instanceof Array||null==o||"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 o=t.tooltipster._plugin(e);if(!o)throw new Error('The "'+e+'" plugin is not defined');return o.instance&&t.tooltipster.__bridge(o.instance,this,o.name),this},_touchIsEmulatedEvent:function(t){for(var e=!1,o=(new Date).getTime(),i=this.__touchEvents.length-1;i>=0;i--){var n=this.__touchEvents[i];if(!(o-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,o=this.__touchEvents.length-1;o>=0;o--){var i=this.__touchEvents[o];if("touchmove"==i.type){e=!0;break}if("touchstart"==i.type&&t===i.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 o=this;if(o[e]){var i=t.tooltipster._plugin(e);i.instance&&t.each(i.instance,function(t,i){o[t]&&o[t].bridged===o[e]&&delete o[t]}),o[e].__destroy&&o[e].__destroy(),delete o[e]}return o},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(i.hasTransitions){var o=e.__options.updateAnimation;e._$tooltip.addClass("tooltipster-update-"+o),setTimeout(function(){"closed"!=e.__state&&e._$tooltip.removeClass("tooltipster-update-"+o)},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(i.window.document.body).off("."+e.__namespace+"-triggerOpen");var o=e._$origin.data("tooltipster-ns");if(o)if(1===o.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 o=t.grep(o,function(t,o){return t!==e.__namespace}),e._$origin.data("tooltipster-ns",o);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,o){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,o){return void 0===o?this.__options[e]:(this.__destroyed?this.__destroyError():(this.__options[e]=o,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 o=Array.prototype.slice.apply(arguments);if(0===this.length)return this;if("string"==typeof o[0]){var i="#*$~&";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 \""+o[0]+'" method on an uninitialized element');if("function"!=typeof n[o[0]])throw new Error('Unknown method "'+o[0]+'"');this.length>1&&"content"==o[0]&&(o[1]instanceof t||"object"==typeof o[1]&&null!=o[1]&&o[1].tagName)&&!n.__options.contentCloning&&n.__options.debug;var s=n[o[0]](o[1],o[2]);if(s!==n||"instance"===o[0])return i=s,!1}),"#*$~&"!==i?i:this}t.tooltipster.__instancesLatestArr=[];var n=o[0]&&void 0!==o[0].multiple,s=n&&o[0].multiple||!n&&e.multiple,r=o[0]&&void 0!==o[0].content,a=r&&o[0].content||!r&&e.content,l=o[0]&&void 0!==o[0].contentCloning,c=(l&&o[0].contentCloning,o[0]&&void 0!==o[0].debug);c&&o[0].debug;return this.length>1&&(a instanceof t||"object"==typeof a&&null!=a&&a.tagName),this.each(function(){var e=!1,i=t(this),n=i.data("tooltipster-ns"),r=null;n?s&&(e=!0):e=!0,e&&(r=new t.Tooltipster(this,o[0]),n||(n=[]),n.push(r.__namespace),i.data("tooltipster-ns",n),i.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(i.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 o=this.__$tooltip.find(".tooltipster-content"),n=this.__$tooltip.outerHeight(),s=o[0].getBoundingClientRect(),r={height:n<=this.constraints.height,width:t.width<=this.constraints.width&&s.width>=o[0].scrollWidth-1};e.fits=r.height&&r.width}return i.IE&&i.IE<=11&&e.size.width!==i.window.document.documentElement.clientWidth&&(e.size.width=Math.ceil(e.size.width)+1),e}};var l=navigator.userAgent.toLowerCase();-1!=l.indexOf("msie")?i.IE=parseInt(l.split("msie")[1]):-1!==l.toLowerCase().indexOf("trident")&&-1!==l.indexOf(" rv:11")?i.IE=11:-1!=l.toLowerCase().indexOf("edge/")&&(i.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,o){var i,n=this,s=n.__targetFind(o),r=[];n.__instance._$tooltip.detach();var a=n.__instance._$tooltip.clone(),l=t.tooltipster._getRuler(a),c=!1,d=n.__instance.option("animation");switch(d&&a.removeClass("tooltipster-"+d),t.each(["window","document"],function(i,d){var u=null;if(n.__instance._trigger({container:d,helper:o,satisfied:c,takeTest:function(t){u=t},results:r,type:"positionTest"}),1==u||0!=u&&0==c&&("window"!=d||n.__options.viewportAware))for(i=0;i<n.__options.side.length;i++){var p={horizontal:0,vertical:0},f=n.__options.side[i];"top"==f||"bottom"==f?p.vertical=n.__options.distance[f]:p.horizontal=n.__options.distance[f],n.__sideChange(a,f),t.each(["natural","constrained"],function(t,i){if(u=null,n.__instance._trigger({container:d,event:e,helper:o,mode:i,results:r,satisfied:c,side:f,takeTest:function(t){u=t},type:"positionTest"}),1==u||0!=u&&0==c){var a={container:d,distance:p,fits:null,mode:i,outerSize:null,side:f,size:null,target:s[f],whole:null},m=("natural"==i?l.free():l.constrain(o.geo.available[d][f].width-p.horizontal,o.geo.available[d][f].height-p.vertical)).measure();if(a.size=m.size,a.outerSize={height:m.size.height+p.vertical,width:m.size.width+p.horizontal},"natural"==i?o.geo.available[d][f].width>=a.outerSize.width&&o.geo.available[d][f].height>=a.outerSize.height?a.fits=!0:a.fits=!1:a.fits=m.fits,"window"==d&&(a.fits?a.whole="top"==f||"bottom"==f?o.geo.origin.windowOffset.right>=n.__options.minIntersection&&o.geo.window.size.width-o.geo.origin.windowOffset.left>=n.__options.minIntersection:o.geo.origin.windowOffset.bottom>=n.__options.minIntersection&&o.geo.window.size.height-o.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<=o.geo.available[d][f].width))return!1}})}}),n.__instance._trigger({edit:function(t){r=t},event:e,helper:o,results:r,type:"positionTested"}),r.sort(function(t,e){return t.whole&&!e.whole?-1:!t.whole&&e.whole?1:t.whole&&e.whole?(o=n.__options.side.indexOf(t.side))<(i=n.__options.side.indexOf(e.side))?-1:o>i?1:"natural"==t.mode?-1:1:t.fits&&!e.fits?-1:!t.fits&&e.fits?1:t.fits&&e.fits?(o=n.__options.side.indexOf(t.side))<(i=n.__options.side.indexOf(e.side))?-1:o>i?1:"natural"==t.mode?-1:1:"document"==t.container&&"bottom"==t.side&&"natural"==t.mode?-1:1;var o,i}),(i=r[0]).coord={},i.side){case"left":case"right":i.coord.top=Math.floor(i.target-i.size.height/2);break;case"bottom":case"top":i.coord.left=Math.floor(i.target-i.size.width/2)}switch(i.side){case"left":i.coord.left=o.geo.origin.windowOffset.left-i.outerSize.width;break;case"right":i.coord.left=o.geo.origin.windowOffset.right+i.distance.horizontal;break;case"top":i.coord.top=o.geo.origin.windowOffset.top-i.outerSize.height;break;case"bottom":i.coord.top=o.geo.origin.windowOffset.bottom+i.distance.vertical}"window"==i.container?"top"==i.side||"bottom"==i.side?i.coord.left<0?o.geo.origin.windowOffset.right-this.__options.minIntersection>=0?i.coord.left=0:i.coord.left=o.geo.origin.windowOffset.right-this.__options.minIntersection-1:i.coord.left>o.geo.window.size.width-i.size.width&&(o.geo.origin.windowOffset.left+this.__options.minIntersection<=o.geo.window.size.width?i.coord.left=o.geo.window.size.width-i.size.width:i.coord.left=o.geo.origin.windowOffset.left+this.__options.minIntersection+1-i.size.width):i.coord.top<0?o.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?i.coord.top=0:i.coord.top=o.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:i.coord.top>o.geo.window.size.height-i.size.height&&(o.geo.origin.windowOffset.top+this.__options.minIntersection<=o.geo.window.size.height?i.coord.top=o.geo.window.size.height-i.size.height:i.coord.top=o.geo.origin.windowOffset.top+this.__options.minIntersection+1-i.size.height):(i.coord.left>o.geo.window.size.width-i.size.width&&(i.coord.left=o.geo.window.size.width-i.size.width),i.coord.left<0&&(i.coord.left=0)),n.__sideChange(a,i.side),o.tooltipClone=a[0],o.tooltipParent=n.__instance.option("parent").parent[0],o.mode=i.mode,o.whole=i.whole,o.origin=n.__instance._$origin[0],o.tooltip=n.__instance._$tooltip[0],delete i.container,delete i.fits,delete i.mode,delete i.outerSize,delete i.whole,i.distance=i.distance.horizontal||i.distance.vertical;var u,p,f,m=t.extend(!0,{},i);if(n.__instance._trigger({edit:function(t){i=t},event:e,helper:o,position:m,type:"position"}),n.__options.functionPosition){var _=n.__options.functionPosition.call(n,n.__instance,o,m);_&&(i=_)}l.destroy(),"top"==i.side||"bottom"==i.side?(u={prop:"left",val:i.target-i.coord.left},p=i.size.width-this.__options.minIntersection):(u={prop:"top",val:i.target-i.coord.top},p=i.size.height-this.__options.minIntersection),u.val<this.__options.minIntersection?u.val=this.__options.minIntersection:u.val>p&&(u.val=p),f=o.geo.origin.fixedLineage?o.geo.origin.windowOffset:{left:o.geo.origin.windowOffset.left+o.geo.window.scroll.left,top:o.geo.origin.windowOffset.top+o.geo.window.scroll.top},i.coord={left:f.left+(i.coord.left-o.geo.origin.windowOffset.left),top:f.top+(i.coord.top-o.geo.origin.windowOffset.top)},n.__sideChange(n.__instance._$tooltip,i.side),o.geo.origin.fixedLineage?n.__instance._$tooltip.css("position","fixed"):n.__instance._$tooltip.css("position",""),n.__instance._$tooltip.css({left:i.coord.left,top:i.coord.top,height:i.size.height,width:i.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:i})},__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={},o=this.__instance._$origin[0].getClientRects();o.length>1&&(1==this.__instance._$origin.css("opacity")&&(this.__instance._$origin.css("opacity",.99),o=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1)));if(o.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 i=o[0];e.top=Math.floor(i.left+(i.right-i.left)/2),i=o.length>2?o[Math.ceil(o.length/2)-1]:o[0],e.right=Math.floor(i.top+(i.bottom-i.top)/2),i=o[o.length-1],e.bottom=Math.floor(i.left+(i.right-i.left)/2),i=o.length>2?o[Math.ceil((o.length+1)/2)-1]:o[o.length-1],e.left=Math.floor(i.top+(i.bottom-i.top)/2)}return e}}})},"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}),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 o=["KB","MB","GB"],i=e.toUpperCase(),n=0,s=0;s<o.length;s++){var r=i.indexOf(o[s]);if(r>-1){n=parseInt(i.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 o=$.tempFile;if(!o)return!1;"function"==typeof $.upStart&&$.upStart();var i=o.name,n=i.lastIndexOf("."),s=i.length,r=i.substring(n+1,s);if($.upType&&(uptype=$.upType.split(","),-1==$.inArray(r,uptype)&&($.upError="Type error: Error-"+r)),$.upMaxSize&&($.fchunker_limitFileSize(o,$.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("#bmi").animate({opacity:1},350),jQuery("#bmi_carrousel").show(200)},100)})},50)}),jQuery(document).ready(function(t){let e=!1;t.extend({bmi:{clipboard:function(e){try{const o=document.createElement("textarea");return o.value=e,o.setAttribute("readonly",""),o.style.position="absolute",o.style.left="-9999px",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),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",o="---",i=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>${o}</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()})},i)},_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 o=t(e).parents(".bmi-notification");o.animate({"font-size":"0px"},{duration:200,queue:!1}),o.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){o.remove()})},modal:function(e=!1){let o=!1;return 0!=e&&(o=document.getElementById(e)),{clearModal:function(){o.querySelectorAll(".customselect").forEach(function(t){t.classList.remove("active")}),o.querySelectorAll('input[type="text"]').forEach(function(t){t.value="",t.setAttribute("value","")})},open:function(e=function(){}){o.classList.add("before-open"),setTimeout(function(){o.classList.add("open"),t("html")[0].style.overflowY="hidden",setTimeout(e,410)},10)},close:function(e=function(){}){o.offsetWidth>0&&o.offsetHeight>0?(o.classList.add("before-close"),setTimeout(function(){o.classList.add("closed"),setTimeout(function(){o.classList.remove("before-open"),o.classList.remove("open"),o.classList.remove("before-close"),o.classList.remove("closed"),t.bmi.modal(o.id).clearModal(),e()},410)},10)):(o.classList.remove("before-open"),o.classList.remove("open"),o.classList.remove("before-close"),o.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(o,i){try{return o(JSON.parse(e))}catch(n){if("string"!=typeof e)return i(!1);{let n=t.bmi.reverse(e).indexOf("}");n=0==n?e.length:-n,e=e.slice(e.indexOf("{"),n);try{return o(JSON.parse(e))}catch(t){return i(!1)}}}})},reverse:function(e){return"string"==typeof e?""===e?"":t.bmi.reverse(e.substr(1))+e.charAt(0):e},ajax:function(e,o={}){return new Promise(function(i,n){function s(t,o){o||(o=t),console.log("------- BACKUP MIGRATION ERROR START -------"),!1===t?(console.log("Call: ",e),console.log("Status: ",o.status),console.log("Error: ",o.responseText)):console.log(o),console.log("-------- BACKUP MIGRATION ERROR END --------\n\n"),n(t,o.responseText)}o.action="backup_migration",o.token="bmi",o.f=e,t.post(ajaxurl,o).done(e=>{t.bmi.json(e).then(function(t){i(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)}},o=t(".tooltip"),i=t(".tooltip-html"),n=t(".premium-wrapper"),s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0;for(let i=0;i<o.length;++i){let n=o[i],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<i.length;++e){let o=i[e],n=o.getAttribute("side"),r=JSON.parse(JSON.stringify(s));r.content=o.getAttribute("tooltip"),n&&n.trim().length>0&&(r.side=n),t(o).tooltipster(r)}for(let o=0;o<n.length;++o){let i=n[o],s=JSON.parse(JSON.stringify(e));s.contentAsHTML=!0,s.interactive=!0,s.maxWidth=500,i.getAttribute("tooltip")?s.content=i.getAttribute("tooltip"):i.getAttribute("data-ready")?s.content=t("#premium-tooltip-pre")[0].innerHTML.trim()+" "+i.getAttribute("data-ready").trim()+" "+t("#premium-tooltip-r")[0].innerHTML.trim():s.content=t("#premium-tooltip")[0].innerHTML,i.getAttribute("side")&&(s.side=i.getAttribute("side")),t(i).tooltipster(s)}},hideAll:function(e=!1){function o(){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}e?o():setTimeout(o,10)}},collapsers:{toggle:function(o){if(!0===e)return;e=!0;let i=o.getAttribute("group");o.classList.contains("active")?t.bmi.collapsers.close(o):t.bmi.collapsers.open(o,i)},open:function(o,i){t.bmi.collapsers.closeGroup(i),t(o).addClass("active"),t(o).find(".content").show(300),setTimeout(function(){e=!1},300)},close:function(o){t(o).removeClass("active"),t(o).find(".content").hide(300),setTimeout(function(){e=!1},300)},closeGroup:function(o){t('.collapser[group="'+o+'"]').removeClass("active"),t('.collapser[group="'+o+'"]').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,o,i,n){return(e=Math,o=e.log,i=1024,n=o(t)/o(i)|0,t/e.pow(i,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(o){t("#reloading-bm-list").hide(),e(o)}).catch(function(t){console.log(t)}))},fillWithNewBackups:function(e,o=function(){}){backups={},t("#bmi_restore_tbody").html("");let i=t("#bmi-manual-locked").text().trim(),n=Object.keys(e).sort(function(t,o){return+new Date(e[t][1].replace(/\-/g,"/"))-+new Date(e[o][1].replace(/\-/g,"/"))}),s=0;for(;s<n.length;++s){let o=n[s],r="locked"===e[o][5];o=(o=o.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="+o),l.find(".bc-logs-btn").attr("href",t("#BMI_BLOG_URL").text().trim()+"/?backup-migration=BMI_BACKUP_LOGS&backup-id="+o),l.find(".br_date").text(e[o][1]),l.find(".br_name").text(o),l.find(".br_size").text(t.bmi.bytesToHuman(e[o][4])+" ("+e[o][2]+")"),0!=(""+e[o][6]).trim().length&&e[o][6]+""!="false"||(l.find(".bc-locked-btn").addClass("forever"),l.find(".bc-locked-btn").attr("tooltip",i),r=!0),r?l.find(".bc-unlocked-btn").hide():l.find(".bc-locked-btn").hide(),l.prependTo("#bmi_restore_tbody"),e[o].push(o),backups[a]=e[o]}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(),o()},showMoreBackups:function(e){backups={};let o=t("#bmi_restore_tbody").find("tr:hidden");for(let e=0;e<o.length&&e<10;++e)setTimeout(function(){t(o[e]).show(300)},50*e);o.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(o){t.bmi.fillWithNewBackups(o.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 o=0;o<e.length;++o){let i=t(e[o]);i.hasClass("ignored-open")?i.removeClass("ignored-open"):(i.hide(300),i.removeClass("dropdown-open"),t(i[0].closest(".bmi-dropdown")).removeClass("active"))}},setOption:function(e,o=null,i=!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!==i&&(o=n.find('.dropdown-option[data-value="'+i+'"]')),t(o).hasClass("active-option")||(e.find(".dropdown-title").text(o.text()),e.attr("data-selected",o.data("value")),o.addClass("active-option"),!1===i&&e.change(),t.bmi.hideAllLists())},prepareFile:function(e,o){let i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(o)),i.setAttribute("download",e),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),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 o=t(this).parent(".collapser")[0];t.bmi.collapsers.toggle(o)}),t(".bmi_will_collapse").on("change",function(e){e.preventDefault();let o=!1;"radio"==this.getAttribute("type")&&"false"==this.getAttribute("value")&&(o=!0),$child=t(this).data("if-checked"),!0!==this.checked||o?t("#"+$child).hide(300):t("#"+$child).show(300)}),t(".collapser-openner").on("click",function(e){e.preventDefault();let o="configuration",i=t(this).data("el");t(this).data("group")&&(o=t(this).data("group")),t.bmi.collapsers.open(i,o),setTimeout(function(){t([document.documentElement,document.body]).animate({scrollTop:t(i).offset().top-50+"px"},300)},300)}),function(){let e=t(".bmi_will_collapse");for(let o=0;o<e.length;++o){let i=!1;$trigger=e[o],$child=t($trigger).data("if-checked"),"radio"==$trigger.getAttribute("type")&&"false"==$trigger.getAttribute("value")&&(i=!0),!0===$trigger.checked?t("#"+$child).show():t("#"+$child).hide()}}()}),jQuery(document).ready(function(t){var e=!0,o=!1;t.bmi.crons=function(){function i(){!function(e,o){t.bmi.ajax("calculate-cron",e).then(function(e){"success"==e.status?o(e):(o(!1),t.bmi._msg(e))}).catch(function(t){o(!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(o){"success"===o.status&&!1!==o?(t(".cron-time-server").tooltipster("option","interactive",!1),t(".cron-time-server").tooltipster("option","contentAsHTML",!0),!0===t("#cron-btn-toggle")[0].checked&&(o.data="---"),t(".cron-time-server").tooltipster("content","<b>"+t("#bmi-next-cron").text()+"</b>"+o.data+"<br><b>"+t("#bmi-current-time").text()+"</b>"+o.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!==o&&(o=!0,t("#bmi").on("change",'[data-id="cron-period"]',function(t){i(),n(t.target.getAttribute("data-selected"))}),t("#bmi").on("change",'[data-id="cron-day"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-week"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-hour"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-minute"]',function(t){t.target.getAttribute("data-selected");i()}),t("#bmi").on("change",'[data-id="cron-keep-backups"]',function(t){t.target.getAttribute("data-selected");i()}),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"),i(),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"),i()}),n(t('[data-id="cron-period"]')[0].getAttribute("data-selected")),i())}}),jQuery(document).ready(function(t){t.bmi.dropdowns={init:function(){let e=t("#bmi");function o(e="null",o="---"){let i=t(".option-template").clone();return i.removeClass("option-template"),i.attr("data-value",e),i.text(o),i}function i(i){if("none"!=i.style.display){i.style.display="none";let n=t(i),s=n.find("option"),r=function(e="---"){let o=t(".dropdown-template").clone();return o.removeClass("dropdown-template"),o.find(".dropdown-title").text(e),o}(function(t){let e="";for(let o=0;o<t.length;++o){let i=t[o].innerText;e.length<i.length&&(e=i)}return e}(s));r=function(e,i){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<i.length;++t){let e=i[t];n.append(o(e.value,e.innerText))}return e}(r,s);let a=s[0].value,l=i.getAttribute("data-parent"),c=i.getAttribute("data-classes"),d="true"===i.getAttribute("data-hide");if(n.attr("data-def")&&(a=n.attr("data-def")),t(r).attr("data-id",i.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 p=u.width();u.remove(),t.bmi.setOption(t(r),null,a),t(r).find(".dropdown-title")[0].style.minWidth=p+10+"px",d&&t(r).hide()}}!function(){let t=e.find("select");for(let e=0;e<t.length;++e)i(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 o=e.find(".dropdown-options");if(e.attr("data-optioner")){(o=t(".optioner-"+e.attr("data-optioner"))).css({position:"absolute"});let i=e[0].offsetWidth,n=e[0].offsetLeft+240,s=e[0].offsetTop+e[0].offsetHeight+5;o.css({maxWidth:i+"px",minWidth:i+"px",top:s+"px",left:n+"px"})}o.hasClass("dropdown-open")?(e.removeClass("active"),o.removeClass("dropdown-open"),o.hide(300)):(e.addClass("active"),o.addClass("dropdown-open"),o.addClass("ignored-open"),o.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,o,i=!1,n=!1,s=0;let r=0,a=0,l=null,c=null,d=null,u=!1,p=!1,f=4500,m=!1,_=!1,h=null,g=!1,b=!1,w=!1,v={},y=[],k=null,x=!1,C="";function $(e){return $cb=t("#"+e).is(":checked"),!0===$cb?"true":"false"}function T(){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 I(e,o){if(a+=1,r+=parseInt(o.bytes),o.bytes<=1e4)t("#bmi-scan-"+e).find(".value").text("(0 MB)");else{let i=(parseInt(o.bytes)/1024/1024).toFixed(2);t("#bmi-scan-"+e).find(".value").text("("+i+" MB)")}t("#bmi-scan-"+e).find(".value").attr("bytes",parseInt(o.bytes)),5==a&&(t("#bmi-scan-total").find(".value").text("("+t.bmi.bytesToHuman(r)+")"),t("#bmi-scan-total").find(".value").attr("bytes",parseInt(r)),S())}function O(e){t.bmi.ajax("scan-directory",{folder:e}).then(function(t){I(e,t)}).catch(function(t){I(t,{bytes:"0",readable:"0 B"})})}function z(e=!1,o=function(){}){t.bmi.ajax("is-running-backup",{}).then(function(i){"success"==i.status?o(!1):1==e?o(!0):(t.bmi.modal("freeze-loading-modal").close(),t.bmi._msg(i))}).catch(function(e){o(!1),t.bmi.modal("freeze-loading-modal").close(),console.log(e)})}function S(){let e=parseInt(t("#bmi-scan-total").find(".value").attr("bytes")),o=parseInt(T());t("#files-group-backup").is(":checked")||(e=0,o=0);let i=((e-o)/1024/1024).toFixed(2),n=(o/1024/1024).toFixed(2);"0.00"==i&&(i="0"),"0.00"==n&&(n="0"),t("#esta-exclude").text(i+" MB"),t("#esta-size-for").text(n+" MB")}function E(e){"backup-prenotice"==e?B():(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal(e).open()},300))}function A(t,e=function(){}){"is_allowed"==t?e("not-allowed"):e()}function R(){t("#prenotice-modal .prenotice").hide(),t("#prenotice-size").text(t.bmi.bytesToHuman(T())),t(".prenotic-3").show(),"true"!==$("database-group-backup")||"true"!==$("database-group-backup")||"true"===$("files-group-backup")&&("true"!==$("files-group-plugins")&&"true"!==$("files-group-themes")&&"true"!==$("files-group-uploads")&&"true"!==$("files-group-wp-install")&&$("files-group-other-contents"),1)||t(".prenotic-6").show(),"true"===$("database-group-backup")||"true"===$("database-group-backup")||"true"!==$("files-group-backup")||"true"!==$("files-group-plugins")&&"true"!==$("files-group-themes")&&"true"!==$("files-group-uploads")&&"true"!==$("files-group-wp-install")&&"true"!==$("files-group-other-contents")||t(".prenotic-5").show(),"true"===$("database-group-backup")&&"true"===$("files-group-backup")&&"true"===$("files-group-plugins")&&"true"===$("files-group-themes")&&"true"===$("files-group-uploads")&&"true"===$("files-group-other-contents")||t(".prenotic-4").show(),t("#prenotice-modal .prenotice:visible").css({background:""});let e=t("#prenotice-modal .prenotice"),o=[];for(let t=0;t<e.length;++t)"none"!==e[t].style.display&&o.push(e[t]);for(let t=0;t<o.length;t+=2)o[t].style.background="#f8f8f8"}function B(){t.bmi.modal("freeze-loading-modal").open(),R(),z(!1,function(){setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("prenotice-modal").open()},300)},300)})}function L(t,e=function(){}){let o=window.location.protocol.includes("https");t=t.includes("https")?t.slice(5):t.slice(4),t=o?"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 D(o){let r=y[s],a=document.createElement("DIV"),l="";if(void 0===r||!r)return;"[INFO]"==r.substr(0,6)?l="blue":"[SUCCESS]"==r.substr(0,9)?l="green":"[WARN]"==r.substr(0,6)?l="orange":"[ERROR]"==r.substr(0,7)?l="red":"[END-CODE]"==r.substr(0,10)?l="hide_so_much":"[STEP]"==r.substr(0,6)?(a.classList.add("bold"),a.classList.add("step")):r&&r.trim().length>0&&"["!=r[0]&&s--,l.length>0&&a.classList.add(l),a.style.display="none",a.innerText=r,o.appendChild(a);let c=function(){let o=!1,s="";for(let r=0;r<y.length;++r){let a=y[r];if("[STEP]"==a.substr(0,6)&&(s=a.slice(29)),0==o&&a&&a.trim().includes("[END-CODE]")&&(!0===_||!0===w||!0===b)){o=!0;let s=a;!0===b?s.includes("205")?(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%",ot(!0)):tt():!0===w?(s.includes("001")?setTimeout(function(){et()},1e3):tt(),p=!1,w=!1):(_=!1,s.includes("001")?(i=!0,n=!0,clearTimeout(e),u=!1,U({filename:h},!0)):s.includes("002")?Q():s.includes("003")?(t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3)):s.includes("100")?(t.bmi.modal("backup-progress-modal").close(),W(),t.bmi.modal("backup-progress-modal").close()):Q())}}return""!=s&&s!=C&&(C=s,t("#restore-progress-modal").hasClass("open")?t("#restore_current_step").text(s):t("#current_step").text(s)),o}();t(a).show(40),o.scrollTop=o.scrollHeight,++s<y.length&&0==c?(x=!0,k=setTimeout(function(){D(o)},40)):x=!1}function M(t,e){if(!1===t)return;let o=t.split("\n");o.length>=1&&(o=o.slice(0,-1)),y=o,0==x&&s<y.length&&D(e)}function P(e=0,s=1e3,r=null){if(c==e)return;c=e,clearInterval(o);let a=parseFloat(t(".progress-percentage")[0].style.left)-1;t("#restore-progress-modal").hasClass("open")&&(a=parseFloat(t("#restore-progress-modal .progress-percentage")[0].style.left)-1);let l=e-a,d=a,p=Math.abs(Math.floor(s/l));o=setInterval(function(){if(d+=1,t("#restore-progress-modal").hasClass("open")?(t("#restore-progress-modal .progress-active-bar")[0].style.width=d.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].style.left=d.toFixed(2)+"%",t("#restore-progress-modal .progress-percentage")[0].innerText=d.toFixed(0)+"%"):(t(".progress-active-bar")[0].style.width=d.toFixed(2)+"%",t(".progress-percentage")[0].style.left=d.toFixed(2)+"%",t(".progress-percentage")[0].innerText=d.toFixed(0)+"%"),d>=100&&clearInterval(o),d>=100&&null!=r&&(c=null,t("#backup-progress-modal").hasClass("open"))){i=!0,n=!0,U(r,0==u)}d>e&&clearInterval(o)},p)}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 o=e.target,i=o.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("lock-backup",{filename:i}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-lock-success").text(),6e3),t(o.closest("tr").querySelector(".bc-unlocked-btn")).hide(),t(o.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",S),t(".basic-file-exlusion").on("change",'input[type="checkbox"]',S),t("#bmi_restore_tbody").on("click",".bc-locked-btn",function(e){if(e.preventDefault(),t(e.target).hasClass("forever"))return;let o=e.target,i=o.closest("tr").querySelector(".br_name").innerText.trim();t.bmi.ajax("unlock-backup",{filename:i}).then(function(e){"success"==e.status?(t.bmi.alert("success",t("#bmi-unlock-success").text(),3e3),t(o.closest("tr").querySelector(".bc-locked-btn")).hide(),t(o.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 o=e.target.closest("tr").querySelector(".bc-download-btn").getAttribute("href");t.bmi.clipboard(o)}),t("#bmi_restore_tbody").on("click",".bc-remove-btn",function(e){let o=e.target.closest("tr").querySelector(".br_name").innerText.trim();d=[o],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:d}).then(function(e){d=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(".bmi-send-troubleshooting-logs").on("click",function(e){e.preventDefault(),t.bmi.alert("info",t("#bmi-support-send-start").text(),6e3),t(".bmi-send-troubleshooting-logs").addClass("disabled");let o=!1,i=!1;t("#backup-error-modal").is(":visible")&&(t.bmi.modal("backup-error-modal").close(),o=!0,i=!1),t("#restore-error-modal").is(":visible")&&(t.bmi.modal("restore-error-modal").close(),i=!0,o=!1),t.bmi.modal("freeze-loading-modal").open();let n=t("#after-logs-sent-modal").attr("data-error-source");t.bmi.ajax("send-troubleshooting-logs",{source:n}).then(function(e){t.bmi.modal("freeze-loading-modal").close(),"success"==e.status?(t("#bmi-support-code-generated").text(e.code),setTimeout(function(){t.bmi.alert("success",t("#bmi-support-send-success").text(),4e3),t.bmi.modal("after-logs-sent-modal").open()},300)):(t.bmi.alert("error",t("#bmi-support-send-fail").text(),6e3),i&&t.bmi.modal("restore-error-modal").open(),o&&t.bmi.modal("backup-error-modal").open()),t(".bmi-send-troubleshooting-logs").removeClass("disabled")}).catch(function(e){t.bmi.modal("freeze-loading-modal").close(),t.bmi.alert("success",t("#bmi-support-send-fail").text(),6e3),alert("Something went wrong on your browser side and we could not send your logs to support team."),t(".bmi-send-troubleshooting-logs").removeClass("disabled"),i&&t.bmi.modal("restore-error-modal").open(),o&&t.bmi.modal("backup-error-modal").open(),console.log(e)})}),t("#share-logs-allowed").on("click",function(e){e.preventDefault();let o=t("#logs-sharing-ask-modal").attr("data-destination");t.bmi.alert("success",t("#bmi-share-logs-thank-you").text(),3e3),t.bmi.modal("logs-sharing-ask-modal").close(),t.bmi.modal("freeze-loading-modal").open(),A("set_yes",function(){setTimeout(function(){E(o)},300)})}),t("#share-logs-not-allowed").on("click",function(e){e.preventDefault();let o=t("#logs-sharing-ask-modal").attr("data-destination");t.bmi.modal("logs-sharing-ask-modal").close(),t.bmi.modal("freeze-loading-modal").open(),A("set_no",function(){setTimeout(function(){E(o)},300)})}),t("#ignore-share-log-request-for-now").on("click",function(e){e.preventDefault(),t.bmi.modal("logs-sharing-ask-modal").close(),E(t("#logs-sharing-ask-modal").attr("data-destination"))}),t("#add-exclusion-rule").on("click",function(e){e.preventDefault();let o=t(".exclusion_template").clone();o[0].classList.remove("exclusion_template"),o[0].style.display="none",t("#bmi_exclusion_rules").append(o),o.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(T()))return T()/1024/1024>1e3*parseInt(t("#BMI_REV").text().trim())?W():void("true"===$("database-group-backup")||"true"===$("files-group-backup")&&("true"===$("files-group-plugins")||"true"===$("files-group-themes")||"true"===$("files-group-uploads")||"true"===$("files-group-wp-install")||"true"===$("files-group-other-contents"))?(t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","backup-prenotice"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):B()})},300)):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 o={},i=t(this.closest(".save-action")).data("save");if(i){if("save-storage"==i)o.directory=t("#bmi_path_storage_default").val(),o.access="true"===t('[name="radioAccessViaLink"]:checked').val()?"true":"false";else if("save-file-config"==i){if(o.database_group=$("database-group-backup"),o.files_group=$("files-group-backup"),t("#bmi-pro-db-tables-exclusion").length>0){o["db-exclude-tables-group"]=$("bmi-pro-db-tables-exclusion"),o["db-excluded-tables"]=["empty"];let e=t(".bmi_pro_tables_display").find("input:checked");if(e.length>0){o["db-excluded-tables"]=[];for(let t=0;t<e.length;++t)o["db-excluded-tables"].push(e[t].value)}else o["db-exclude-tables-group"]="false"}else o["db-exclude-tables-group"]="false",o["db-excluded-tables"]=["empty"];o["files-group-plugins"]=$("files-group-plugins"),o["files-group-uploads"]=$("files-group-uploads"),o["files-group-themes"]=$("files-group-themes"),o["files-group-other-contents"]=$("files-group-other-contents"),o["files-group-wp-install"]=$("files-group-wp-install"),o.files_by_filters=$("files_by_filters"),o.ex_b_fs=$("ex_b_fs"),o.BFFSIN=t("#BFFSIN").val()?t("#BFFSIN").val():"1",o.ex_b_names=$("ex_b_names"),o.ex_b_fpaths=$("ex_b_fpaths"),o.ex_b_dpaths=$("ex_b_dpaths");let e=[],i=t("#bmi_exclusion_rules").find(".exclude-row");for(let o=0;o<i.length;++o){let n=t(i[o]),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})}o["dynamic-names"]=e,o["dynamic-fpaths-names"]=t("#dynamic-fpaths-names").val().split("\n"),o["dynamic-dpaths-names"]=t("#dynamic-dpaths-names").val().split("\n")}else if("store-config"==i)o.name=t("#backup_filename").val().trim();else{if("save-other-options"!=i)return;o.email=t("#email-for-notices").val().trim(),o.email_title=t("#email-title-for-notices").val().trim(),o.schedule_issues=$("scheduled-issues"),o.experiment_timeout=$("experimental-timeout"),o.experimental_hard_timeout=$("experimental-hard-timeout"),o.php_cli_disable_others=$("cli-disable-others"),o.php_cli_manual_path=t("#cli-manual-path").val().trim(),o.download_technique=$("download-technique"),o.uninstall_config=$("uninstalling-configs"),o.uninstall_backups=$("uninstalling-backups"),o.normal_timeout=$("normal-timeout"),o.db_queries_amount=t("#db_queries_amount").val().trim(),o.db_search_replace_max=t("#db_search_replace_max").val().trim(),o["bmi-restore-splitting"]=$("bmi-restore-splitting"),o["bmi-db-v3-restore-engine"]=$("bmi-db-v3-restore-engine"),o["remove-assets-before-restore"]=$("remove-assets-before-restore"),o["bmi-db-single-file-backup"]=$("bmi-db-single-file-backup"),o["bmi-db-batching-backup"]=$("bmi-db-batching-backup"),o["bmi-disable-space-check-function"]=$("bmi-do-not-check-free-space-backup")}t.bmi.ajax(i,o).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"),o=t(t(this)[0].closest(".tab2-item"));t(this).is(":checked")?(t("#"+e).show(300),o.addClass("activeList")):(t("#"+e).hide(300),o.removeClass("activeList"))});var j=0;function q(e=function(){}){let o=t("#BMI_BLOG_URL").text().trim();"/"!==o.slice(-o.length)&&(o+="/"),L(o+"?backup-migration=PROGRESS_LOGS&progress-id=latest_full.log&backup-id=current&t="+ +new Date,function(o){if(!o)return e();let i=o.split("\n").slice(0,1)[0];""===i.trim()?(i=o.split("\n").slice(0,2)[1],o=o.split("\n").slice(2).join("\n")):o=o.split("\n").slice(1).join("\n");let n=t(".log-wrapper").find("pre")[0],s=t("#bmi-making-archive").text().trim();if(i&&0!=i&&void 0!==i)if(t("#current_step").text().trim().slice(0,s.length)==s){let e=document.getElementById("bmi_counter_magic");if(e){let o=parseInt(e.innerText);j=parseInt(i.split("/")[0]),isNaN(o)||isNaN(j)||(P(parseInt(i.split("/")[0])/parseInt(i.split("/")[1])*100),async function(t,e,o,i){let n=null,s=function(r){if(j>o)return;n||(n=r);let a=Math.min((r-n)/i,1);t.innerText=Math.floor(a*(o-e)+e),a<1&&window.requestAnimationFrame(s)};window.requestAnimationFrame(s)}(e,o,j,2e3),"---"===t("#bmi_magic_max_count").text()&&100!=parseInt(i.split("/")[1])&&(t("#bmi_magic_max_count").text(parseInt(i.split("/")[1])),t("#entire_magic_counter").is(":hidden")&&t("#entire_magic_counter").show()))}else{let e=parseInt(i.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()}}else P(parseInt(i.split("/")[0])/parseInt(i.split("/")[1])*100);o&&0!=o&&void 0!==o&&M(o,n),e()})}function F(){t(".log-wrapper").find("pre")[0].innerText="",P(0),setTimeout(function(){q(function(){!function t(){q(function(){clearTimeout(e),e=setTimeout(function(){!0===u&&t()},1500)})}()})},300)}function H(o=!0){!0===o&&(t(".log-wrapper").find("pre")[0].innerText="",P(0)),V(function(){clearTimeout(e),function t(){V(function(){e=setTimeout(function(){!0!==p&&!0!==b||t()},800)})}()})}function N(t=function(){}){z(!0,function(e){t(e)})}function G(e=!1,o=function(){}){t.bmi.ajax("reset-latest",{}).then(function(i){!0===e?o():"success"==i.status?(o(),setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300)):t.bmi._msg(i)}).catch(function(t){console.log(t)})}function U(s,r=!1){(i&&n||r)&&setTimeout(function(){u=!1,clearInterval(o),clearTimeout(e);let i=t("#BMI_BLOG_URL").text().trim();"/"!==i.slice(-i.length)&&(i+="/"),t.bmi.ajax("get-latest-backup",{}).then(function(e){let n=i+"?backup-migration=BMI_BACKUP&backup-id="+e+"&t="+ +new Date,s=i+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=n,t("#download-backup-url").attr("href",n),t(".download-backup-log-url").attr("href",s),t.bmi.reloadBackups(),setTimeout(function(){clearInterval(o),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("#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())}).catch(function(e){console.error("Failure during getting latest backup, error #2:",e),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());let n=i+"?backup-migration=BMI_BACKUP&backup-id="+s.filename+"&t="+ +new Date,r=i+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=n,t("#download-backup-url").attr("href",n),t(".download-backup-log-url").attr("href",r),t.bmi.reloadBackups(),setTimeout(function(){clearInterval(o),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 Q(o=!1){setTimeout(function(){z(!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(),t("#after-logs-sent-modal").attr("data-error-source","backup");let i=t("#BMI_BLOG_URL").text().trim();"/"!==i.slice(-i.length)&&(i+="/")})},2e3)}function W(){t.bmi.modal("bfs-modal").open()}function J(e){let o=e.status,i=parseInt(e.errors),n=parseInt(e.iteratio),s=parseInt(e.dbiteratio),r=parseInt(e.dblast),a=parseInt(e.sf);if(!0===o&&-1===n)return _=!1,h=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),U({filename:h},!0);if(!isNaN(a)&&a>-1&&(g.filessofar=a),g.dbiteratio=s,g.iteratio=n,g.dblast=r,isNaN(i)||i>0||0==o){if(isNaN(i)||i>0)return _=!1,h=!1,g=!1,window.onbeforeunload=null,t(".backup-minimize").removeClass("disabled"),Q()}else X(g,i)}function X(t,e=0){!1===g&&(t.iteratio=0,g=t),function(t,e,o=0){let i=new XMLHttpRequest;i.open("POST",t.url,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Accept","*/*"),i.setRequestHeader("Access-Control-Allow-Origin","*"),i.setRequestHeader("Content-ConfigDir",t.config_dir),i.setRequestHeader("Content-Content",t.content_dir),i.setRequestHeader("Content-Backups",t.backup_dir),i.setRequestHeader("Content-Identy",t.identy),i.setRequestHeader("Content-Url",t.url),i.setRequestHeader("Content-Abs",t.abs_dir),i.setRequestHeader("Content-Dir",t.root_dir),i.setRequestHeader("Content-Manifest",t.manifest),i.setRequestHeader("Content-Name",t.backupname),i.setRequestHeader("Content-Safelimit",t.safelimit),i.setRequestHeader("Content-Start",t.start),i.setRequestHeader("Content-Filessofar",t.filessofar),i.setRequestHeader("Content-Total",t.total_files),i.setRequestHeader("Content-Rev",t.rev),i.setRequestHeader("Content-It",t.iteratio),i.setRequestHeader("Content-Dbit",t.dbiteratio),i.setRequestHeader("Content-Dblast",t.dblast),i.setRequestHeader("Content-Shareallowed",t.shareallowed),i.setRequestHeader("Content-Browser",!0),i.onload=function(){if(200===i.status){let t=i.getResponseHeader("Content-Finished");if(void 0!==t&&t&&"true"==t)return e({status:!0,iteratio:-1,dbiteratio:-1,dblast:0,sf:-1,errors:o=0});let n=i.getResponseHeader("Content-It"),s=i.getResponseHeader("Content-Dbit"),r=i.getResponseHeader("Content-Dblast"),a=i.getResponseHeader("Content-Filessofar");return e(void 0!==n&&n?{status:!0,iteratio:n,dbiteratio:s,dblast:r,sf:a,errors:o}:{status:!1,iteratio:-1,dbiteratio:s,dblast:r,sf:-1,errors:++o})}return o++,e({status:!1,iteratio:-1,dbiteratio:dbiteratio,dblast:dblast,sf:-1,errors:o})},i.onerror=function(){return e({status:!1,iteratio:-1,dbiteratio:-1,dblast:0,sf:-1,errors:++o})},i.send()}(g,J,e)}function K(e=function(){}){N(function(o){!0===o?t("#backup-progress-modal").hasClass("open")||(!1===u&&(i=!1,u=!0,m=!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===m?(!0===u&&(u=!1),m=!1,t.bmi.getCurrentBackups(function(e){t.bmi.fillWithNewBackups(e.backups,function(){!function(){let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/"),L(e+"?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 o="Backup process aborted",i="[ERROR]";if((e=e.split("\n"))[e.length-1].includes(o)||e[e.length-2].includes(o))t.bmi.modal("backup-progress-modal").close(),t.bmi.alert("info",t("#bmi-aborted-al").text(),3e3);else if(e[e.length-1].includes(i)||e[e.length-2].includes(i))Q();else{let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/"),t.bmi.ajax("get-latest-backup",{}).then(function(o){let i=e+"?backup-migration=BMI_BACKUP&backup-id="+o+"&t="+ +new Date,n=e+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date;t("#text-input-copy")[0].value=i,t("#download-backup-url").attr("href",i),t(".download-backup-log-url").attr("href",n),t.bmi.modal("backup-progress-modal").close(),t.bmi.modal("backup-success-modal").open()}).catch(function(e){console.error("Failure during getting latest backup, error:",e),t.bmi.modal("backup-progress-modal").close(),t.bmi.modal("backup-success-modal").open();let o=t(t("#bmi_restore_tbody").find("tr")[0]).find(".bc-download-btn").attr("href");t("#download-backup-url").attr({href:o}),t("#text-input-copy").val(o)})}}})}()})})):!0!==u||t("#backup-progress-modal").hasClass("open")||(u=!1,t.bmi.reloadBackups())),e()})}function V(e=function(){}){let o=t("#BMI_BLOG_URL").text().trim();"/"!==o.slice(-o.length)&&(o+="/"),L(o+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration_full.log&backup-id=current&t="+ +new Date,function(o){if(!o)return e();let i=o.split("\n").slice(0,1)[0];if(o=o.split("\n").slice(1).join("\n"),!1===i||isNaN(parseFloat(i)))return e();let n=t("#restore-live-log-wrapper").find("pre")[0];o.includes("<")||o.includes(">")||o&&0!=o&&void 0!==o&&M(o,n),P(i),e()})}function Y(e=function(){}){t.bmi.ajax("htaccess-litespeed",{}).then(function(t){setTimeout(function(){e(!0)},400)}).catch(function(t){e(!1),console.log(t)})}function Z(e=function(){},o=!1,i=!0){t.bmi.ajax("migration-locked",{clearLogs:i}).then(function(i){"success"==i.status?e(!0):(o||t.bmi._msg(i),e(!1))}).catch(function(t){console.log(t)})}function tt(e=""){Z(function(e){e&&setTimeout(function(){if(!t("#restore-progress-modal").hasClass("open"))return;p=!1,b=!1,t("#restore-error-pre").text(t("#bmi-loading-translation").text().trim()),t("#after-logs-sent-modal").attr("data-error-source","migration");let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/"),t.bmi.modal("restore-progress-modal").close(),t.bmi.modal("restore-error-modal").open()},1e3)},!0,!1)}function et(){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 ot(i=!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(),i||(t("#restore-live-log-wrapper").find("pre")[0].innerText=""),null==n&&(s=0,p=!0,clearTimeout(e),G(!0,function(){Y(function(){V(function(){!function i(n,s,r,a=!1,l="false",c={}){null==r&&H(!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(){et(),p=!1,w=!1},1e3):tt()}}else"success"===r.status?(v={l:r.login,u:r.url},setTimeout(function(){clearInterval(o),clearTimeout(e),p=!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,i(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&&"1"!==r.options.dbConvertionFinished||(r.options.step=parseInt(r.options.step)+1):void 0!==r.options.replaceFinished?"true"!==r.options.replaceFinished&&!0!==r.options.replaceFinished&&"1"!==r.options.replaceFinished||(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")),i(n,s,r.secret,r.tmp,"true",r.options)):"error"===r.status?setTimeout(function(){clearInterval(o),clearTimeout(e),tt()},1e3):(t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").close(),t.bmi._msg(r))}).catch(function(t,e){tt(e),console.log(t)})}(r,i,n)})})}))}function it(){return t("#bmi_restore_tbody").find('input[type="checkbox"]:checked')}function nt(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("site_details_troubleshooting.txt",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.bmi.modal("freeze-loading-modal").open(),t(".backup-minimize").removeClass("disabled"),clearTimeout(e),G(!1,function(){Y(function(){m=!1,i=!1,u=!0,t.bmi.ajax("create-backup",{estaminated_size:T()}).then(function(s){if("success"==s.status)i=!0,clearTimeout(e),u=!1,q(function(){setTimeout(function(){U(s,!0)},350)});else if("background"==s.status){_=!0,h=s.filename;let o=document.querySelector(".hide_so_much");if(o){let s=o.innerText;s.includes("001")&&(i=!0,n=!0,clearTimeout(e),u=!1,U({filename:h},!0)),s.includes("002")&&Q(),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?(_=!0,h=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")||setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300),window.onbeforeunload=function(){return"Backup in progress..."},X(s.settings)):(u=!1,setTimeout(function(){clearInterval(o),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.bmi.modal("backup-progress-modal").close(),void 0!==s.bfs?W():Q())}).catch(function(t){Q(),console.log(t)}),s=0,u=!0,F()})})}),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,o=this.dataset.hide,i=t(".hide-show-tr");t(this).hasClass("shown")?(i.hide(300),t(this).removeClass("shown"),this.innerText=e):(i.show(300),t(this).addClass("shown"),this.innerText=o)}),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 o=t("#"+this.getAttribute("data-copy"))[0];o.value&&o.value.length>0?t.bmi.clipboard(o.value):t.bmi.clipboard(o.innerText)}),t("#bmi_restore_tbody").on("click",".restore-btn",function(e){Z(function(o){if(o){let o=e.target.closest("tr").querySelector(".br_name").innerText;if(l=o,!o||o.trim().length<=0)return t.bmi.alert("warning",t("#bmi-no-file").text(),3e3);t("#restore-ok").prop("checked",!1),t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","pre-restore-modal"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("pre-restore-modal").open()},300))})},300)}})}),t("#quick-download-migration").on("click",function(){let e=t("#bm-d-url").val();t.bmi.isUrlValid(e)?Z(function(o){o&&(e.length>0?(l=-100,t("#restore-ok").prop("checked",!1),t.bmi.modal("freeze-loading-modal").open(),setTimeout(function(){A("is_allowed",function(e){"ask"===e?(t.bmi.modal("freeze-loading-modal").close(),t("#logs-sharing-ask-modal").attr("data-destination","pre-restore-modal"),setTimeout(function(){t.bmi.modal("logs-sharing-ask-modal").open()},300)):(t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("pre-restore-modal").open()},300))})},300)):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="",Z(function(i){G(!0,function(){Y(function(){if(i){let i=t("#bm-d-url").val();t("#restore_current_step").text(t("#bmi-downloading-remote").text()),t.bmi.ajax("download-backup",{url:i}).then(function(i){clearInterval(o),clearTimeout(e),"success"===i.status?(b=!0,H(!1),t.bmi.reloadBackups(),l=i.name,setTimeout(function(){clearInterval(o),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())},600)):"cli_download"==i.status?(l=".cli_download",b=!0,H(!1)):"error"===i.status?tt():(t.bmi._msg(i),tt())}).catch(function(t,e){tt(e),console.log(t)}),t("#restore-live-log-wrapper").find("pre")[0].innerText="",s=0,p=!0,b=!0,H(),t.bmi.modal("pre-restore-modal").close(),t.bmi.modal("restore-progress-modal").open()}})})})):ot():t.bmi.alert("warning",t("#bmi-restore-require-checkmark").text(),3e3)}),t(".backup-minimize").on("click",function(){N(function(e){!0===e?t("#bmi-ongoing-backup").show(300):t("#bmi-ongoing-backup").hide()})}),function t(){K(function(){setTimeout(function(){t()},f)})}(),t("#bmi-ongoing-backup").on("click",function(){N(function(e){!0===e?(s=0,F(),setTimeout(function(){t.bmi.modal("freeze-loading-modal").close(),setTimeout(function(){t.bmi.modal("backup-progress-modal").open()},300)},300)):(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 o=setInterval(function(){1==e&&clearInterval(o),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t("#bmi_restore_tbody").on("change",'input[type="checkbox"]',function(e){let o=it().length;o>0?t(".del-all-btn-wrp").show(300):t(".del-all-btn-wrp").hide(300),o==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),it().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=it(),o=[];for(let t=0;t<e.length;++t){let i=e[t].closest("tr");o.push(i.querySelector(".br_name").innerText)}t("#delete-confirm-modal").find(".text1").hide(),t("#delete-confirm-modal").find(".text2").show();let i=o.length;i<=0||(t("#backup-multiple-del-count").text(i),i>1?(t("#del-only-one").hide(),t("#del-more-than-one").show()):(t("#del-more-than-one").hide(),t("#del-only-one").show()),d=o,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",nt),t("#hide-format-tip").on("click",nt),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;"/"!==t.slice(-t.length)&&(t+="/");let e=t+"?backup-migration=AFTER_RESTORE&backup-id="+v.l+"&progress-id=4u70L051n&t="+ +new Date;window.location=e}),function(){!async function(){O("plugins"),O("uploads"),O("themes"),O("contents_others"),O("wordpress")}(),t.bmi.ajax("get-dynamic-names",{}).then(function(e){let o=e.data;if(t("#bmi_exclusion_rules").text(""),void 0!==o&&void 0!==o.length){for(let e=0;e<o.length;++e){let i=t(".exclusion_template").clone();i.removeClass("exclusion_template"),i.find(".exclusion_txt").val(o[e].txt);let n=i.find(".exclusion_position").find("select"),s=i.find(".exclusion_where").find("select");n&&(n[0].setAttribute("data-def",o[e].pos),s&&(s[0].setAttribute("data-def",o[e].whr),t("#bmi_exclusion_rules").append(i),i.find(".exclusion_position").find(".bmi-dropdown").length>0&&t.bmi.setOption(i.find(".exclusion_position").find(".bmi-dropdown"),null,o[e].pos),i.find(".exclusion_where").find(".bmi-dropdown").length>0&&t.bmi.setOption(i.find(".exclusion_where").find(".bmi-dropdown"),null,o[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")),o=new Date(e);t("#server-time-auto").text(o.toUTCString()),setInterval(function(){e+=1e3,o=new Date(e),t("#server-time-auto").text(o.toUTCString())},1e3),t("#ex_b_fs").is(":checked")?t("#bmi__collon").show():t("#bmi__collon").hide()}();let e=t("#BMI_BLOG_URL").text().trim();"/"!==e.slice(-e.length)&&(e+="/");let o=e+"?backup-migration=PROGRESS_LOGS&progress-id=latest.log&backup-id=current&t="+ +new Date,i=e+"?backup-migration=PROGRESS_LOGS&progress-id=latest_migration.log&backup-id=current&t="+ +new Date;t(".download-backup-log-url").attr("href",o),t(".download-restore-log-url").attr("href",i)}()}),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,o=-1,i=!1,n="";for(let t=0;t<12;++t)n+="<div></div>";function s(i){clearInterval(e),0==i?(t(".upload-progress-bar").find("span")[0].style.width=i+"%",t(".upload-percentage").text(i+"%")):100==i?(t(".upload-progress-bar").find("span")[0].style.width=i+"%",t(".upload-percentage").text(i+"%")):function(i=0,n=1e3){if(o==i)return;o=i,clearInterval(e);let s=parseInt(t(".upload-percentage").text())-1;if(s>i&&0!=i)return;let r=i-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),o=null)},l)}(i,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 o=e.status,n=e.message;e.url,Math.random();2==o&&(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==o&&(i||(t.bmi.alert("success",t("#bmi-upload-start").text(),3e3),i=!0)),0==o&&(t.upErrorMsg(n),t("#drop-area").show(300),t(".upload-progress").hide(300)),5==o&&(t.bmi.modal("upload-invalid-manifest-modal").open(),t("#drop-area").show(300),t(".upload-progress").hide(300)),3==o&&(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(){i=!1,o=-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 o=t[e].closest(".container-radio");o&&void 0!=typeof o.classList&&(o.classList.remove("active"),!0===t[e].checked&&o.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(o){if(this.classList.contains("active"))return;if(!0===e)return;e=!0,t.bmi.collapsers.closeAll();let i=this.getAttribute("data-point");"manage-restore-wrapper"==i?(t("#create-backup-wrapper").hide(300),t('[data-point="create-backup-wrapper"]').removeClass("active")):"create-backup-wrapper"==i&&(t("#manage-restore-wrapper").hide(300),t('[data-point="manage-restore-wrapper"]').removeClass("active")),t("#"+i).show(300),t(this).addClass("active"),setTimeout(function(){e=!1},320)})}),jQuery(document).ready(function(t){let e=document.getElementById("drop-area");function o(t){t.preventDefault(),t.stopPropagation()}function i(t){e.classList.add("highlight")}function n(t){e.classList.remove("highlight")}e&&(["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,o,!1)}),["dragenter","dragover"].forEach(t=>{e.addEventListener(t,i,!1),document.querySelector("body").addEventListener(t,i,!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))});
|
analyst/src/helpers.php
CHANGED
@@ -71,14 +71,3 @@ if (! function_exists('analyst_require_template')) {
|
|
71 |
require analyst_templates_path($file);
|
72 |
}
|
73 |
}
|
74 |
-
|
75 |
-
if (! function_exists('dd')) {
|
76 |
-
/**
|
77 |
-
* Dump some data
|
78 |
-
*/
|
79 |
-
function dd ()
|
80 |
-
{
|
81 |
-
var_dump(func_get_args());
|
82 |
-
die();
|
83 |
-
}
|
84 |
-
}
|
71 |
require analyst_templates_path($file);
|
72 |
}
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.2.
|
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.2.
|
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.2.3
|
11 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
12 |
|
13 |
// Exit on direct access
|
21 |
define('BMI_DEBUG', false);
|
22 |
}
|
23 |
if (!defined('BMI_VERSION')) {
|
24 |
+
define('BMI_VERSION', '1.2.3');
|
25 |
}
|
26 |
if (!defined('BMI_ROOT_DIR')) {
|
27 |
define('BMI_ROOT_DIR', __DIR__);
|
includes/ajax.php
CHANGED
@@ -106,6 +106,8 @@
|
|
106 |
BMP::res($this->sendTroubleshootingDetails());
|
107 |
} elseif ($this->post['f'] == 'log-sharing-details') {
|
108 |
BMP::res($this->logSharing());
|
|
|
|
|
109 |
} elseif ($this->post['f'] == 'debugging') {
|
110 |
BMP::res($this->debugging());
|
111 |
} else {
|
@@ -654,33 +656,47 @@
|
|
654 |
return ['status' => 'error', 'bfs' => true];
|
655 |
}
|
656 |
|
657 |
-
|
658 |
|
659 |
-
|
660 |
-
$zip_progress->log(__("Aborting backup...", 'backup-backup'), 'step');
|
661 |
-
$zip_progress->log(__("There is no space for that backup, checked: ", 'backup-backup') . ($bytes) . __(" bytes", 'backup-backup'), 'error');
|
662 |
|
663 |
-
|
664 |
-
|
665 |
-
if (file_exists(BMI_BACKUPS . '/.abort')) @unlink(BMI_BACKUPS . '/.abort');
|
666 |
-
if ($isCLI === true && file_exists($cli_lock)) @unlink($cli_lock);
|
667 |
|
668 |
-
|
669 |
-
$zip_progress->log('#002', 'END-CODE');
|
670 |
-
$zip_progress->end();
|
671 |
|
672 |
-
if ($
|
673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
|
675 |
-
// Return error
|
676 |
-
return ['status' => 'error'];
|
677 |
-
} else {
|
678 |
-
$zip_progress->log(__("Confirmed, there is more than enough space, checked: ", 'backup-backup') . ($bytes) . __(" bytes", 'backup-backup'), 'success');
|
679 |
-
$zip_progress->bytes = $this->total_size_for_backup;
|
680 |
}
|
681 |
|
682 |
if (Dashboard\bmi_get_config('BACKUP:DATABASE') != 'true') {
|
683 |
-
|
|
|
|
|
|
|
684 |
}
|
685 |
|
686 |
// Log and set files length
|
@@ -999,7 +1015,6 @@
|
|
999 |
|
1000 |
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
|
1001 |
$migration->log(__('PHP CLI: Restore process initialized, restoring...', 'backup-backup'), 'success');
|
1002 |
-
error_log('running cli');
|
1003 |
touch($lock_cli);
|
1004 |
} else {
|
1005 |
$migration->log(__('Restore process initialized, restoring (non-cli mode)...', 'backup-backup'), 'success');
|
@@ -1500,6 +1515,8 @@
|
|
1500 |
$cli_no_exist = __('Path to executable that you provided for PHP CLI does not exist.', 'backup-backup');
|
1501 |
$db_query_too_low = __('The value for query amount cannot be smaller than 15.', 'backup-backup');
|
1502 |
$db_query_too_much = __('The value for query amount cannot be larger than 15000.', 'backup-backup');
|
|
|
|
|
1503 |
|
1504 |
$email = sanitize_email(trim($this->post['email'])); // OTHER:EMAIL
|
1505 |
$email_title = sanitize_text_field(trim($this->post['email_title'])); // OTHER:EMAIL:TITLE
|
@@ -1510,12 +1527,16 @@
|
|
1510 |
$php_cli_disable_others = $this->post['php_cli_disable_others'] === 'true' ? true : false; // OTHER:CLI:DISABLE
|
1511 |
$normal_timeout = $this->post['normal_timeout'] === 'true' ? true : false; // OTHER:USE:TIMEOUT:NORMAL
|
1512 |
$insecure_download = $this->post['download_technique'] === 'true' ? true : false; // OTHER:DOWNLOAD:DIRECT
|
1513 |
-
$db_query_size = isset($this->post['db_queries_amount']) ? trim($this->post['db_queries_amount']) : '
|
|
|
1514 |
$db_restore_splitting = $this->post['bmi-restore-splitting'] === 'true' ? true : false; // OTHER:RESTORE:SPLITTING
|
1515 |
$db_restore_v3_engine = $this->post['bmi-db-v3-restore-engine'] === 'true' ? true : false; // OTHER:RESTORE:DB:V3
|
1516 |
|
1517 |
$no_assets_b4_restore = $this->post['remove-assets-before-restore'] === 'true' ? true : false; // OTHER:RESTORE:BEFORE:CLEANUP
|
1518 |
$single_file_db_force = $this->post['bmi-db-single-file-backup'] === 'true' ? true : false; // OTHER:BACKUP:DB:SINGLE:FILE
|
|
|
|
|
|
|
1519 |
|
1520 |
$uninstall_config = $this->post['uninstall_config'] === 'true' ? true : false; // OTHER:UNINSTALL:CONFIGS
|
1521 |
$uninstall_backups = $this->post['uninstall_backups'] === 'true' ? true : false; // OTHER:UNINSTALL:BACKUPS
|
@@ -1530,7 +1551,11 @@
|
|
1530 |
}
|
1531 |
|
1532 |
if (!is_numeric($db_query_size) || empty($db_query_size)) {
|
1533 |
-
$db_query_size = "
|
|
|
|
|
|
|
|
|
1534 |
}
|
1535 |
|
1536 |
if (strlen($email) <= 0) {
|
@@ -1557,6 +1582,12 @@
|
|
1557 |
if (intval($db_query_size) < 15) {
|
1558 |
return ['status' => 'msg', 'why' => $db_query_too_low, 'level' => 'warning'];
|
1559 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1560 |
|
1561 |
$error = 0;
|
1562 |
if (!Dashboard\bmi_set_config('OTHER:EMAIL', $email)) {
|
@@ -1589,6 +1620,9 @@
|
|
1589 |
if (!Dashboard\bmi_set_config('OTHER:DB:QUERIES', $db_query_size)) {
|
1590 |
$error++;
|
1591 |
}
|
|
|
|
|
|
|
1592 |
if (!Dashboard\bmi_set_config('OTHER:DOWNLOAD:DIRECT', $insecure_download)) {
|
1593 |
$error++;
|
1594 |
}
|
@@ -1604,6 +1638,12 @@
|
|
1604 |
if (!Dashboard\bmi_set_config('OTHER:BACKUP:DB:SINGLE:FILE', $single_file_db_force)) {
|
1605 |
$error++;
|
1606 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1607 |
if (!Dashboard\bmi_set_config('OTHER:RESTORE:BEFORE:CLEANUP', $no_assets_b4_restore)) {
|
1608 |
$error++;
|
1609 |
}
|
@@ -1840,6 +1880,10 @@
|
|
1840 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/ai1wm-backups";
|
1841 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/uploads/wp-clone";
|
1842 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/updraft";
|
|
|
|
|
|
|
|
|
1843 |
if (defined('BMI_PRO_ROOT_DIR')) $ignored_paths_default[] = BMI_PRO_ROOT_DIR;
|
1844 |
if ($is && $dpathsis) {
|
1845 |
BMP::merge_arrays($ignored_paths_default, $dpaths);
|
@@ -1944,7 +1988,9 @@
|
|
1944 |
$acis = true;
|
1945 |
$ac = [
|
1946 |
'***ABSPATH***/wp-content/uploads/wpforms/.htaccess.cpmh3129', // Binary broken file of wpforms
|
1947 |
-
'***ABSPATH***/
|
|
|
|
|
1948 |
];
|
1949 |
} else {
|
1950 |
$ac[] = '***ABSPATH***/wp-content/uploads/wpforms/.htaccess.cpmh3129'; // Binary broken file of wpforms
|
@@ -2380,8 +2426,10 @@
|
|
2380 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'bmi_backup_manifest.json';
|
2381 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'files_latest.list';
|
2382 |
|
2383 |
-
|
2384 |
-
|
|
|
|
|
2385 |
}
|
2386 |
|
2387 |
return ['status' => 'success'];
|
@@ -2456,8 +2504,10 @@
|
|
2456 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.restore_secret';
|
2457 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.table_map';
|
2458 |
|
2459 |
-
|
2460 |
-
|
|
|
|
|
2461 |
}
|
2462 |
|
2463 |
return ['status' => 'success'];
|
@@ -2618,6 +2668,36 @@
|
|
2618 |
|
2619 |
}
|
2620 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2621 |
public function debugging() {
|
|
|
2622 |
}
|
2623 |
}
|
106 |
BMP::res($this->sendTroubleshootingDetails());
|
107 |
} elseif ($this->post['f'] == 'log-sharing-details') {
|
108 |
BMP::res($this->logSharing());
|
109 |
+
} elseif ($this->post['f'] == 'get-latest-backup') {
|
110 |
+
BMP::res($this->getLatestBackupFile());
|
111 |
} elseif ($this->post['f'] == 'debugging') {
|
112 |
BMP::res($this->debugging());
|
113 |
} else {
|
656 |
return ['status' => 'error', 'bfs' => true];
|
657 |
}
|
658 |
|
659 |
+
$isSpaceCheckDisabled = Dashboard\bmi_get_config('OTHER:BACKUP:SPACE:CHECKING');
|
660 |
|
661 |
+
if ($isSpaceCheckDisabled) {
|
|
|
|
|
662 |
|
663 |
+
$zip_progress->log(__("Free space checking is disabled by user in settings...", 'backup-backup'), 'warn');
|
664 |
+
$zip_progress->log(__("Backup will continue, trusting there is enough space...", 'backup-backup'), 'warn');
|
|
|
|
|
665 |
|
666 |
+
} else {
|
|
|
|
|
667 |
|
668 |
+
if (!$checker->check_free_space($bytes)) {
|
669 |
+
|
670 |
+
// Abort backup
|
671 |
+
$zip_progress->log(__("Aborting backup...", 'backup-backup'), 'step');
|
672 |
+
$zip_progress->log(__("There is no space for that backup, checked: ", 'backup-backup') . ($bytes) . __(" bytes", 'backup-backup'), 'error');
|
673 |
+
|
674 |
+
// Close backup
|
675 |
+
if (file_exists(BMI_BACKUPS . '/.running')) @unlink(BMI_BACKUPS . '/.running');
|
676 |
+
if (file_exists(BMI_BACKUPS . '/.abort')) @unlink(BMI_BACKUPS . '/.abort');
|
677 |
+
if ($isCLI === true && file_exists($cli_lock)) @unlink($cli_lock);
|
678 |
+
|
679 |
+
// Log and close log
|
680 |
+
$zip_progress->log('#002', 'END-CODE');
|
681 |
+
$zip_progress->end();
|
682 |
+
|
683 |
+
if ($isCLI === true) touch($cli_lock_end);
|
684 |
+
$this->actionsAfterProcess();
|
685 |
+
|
686 |
+
// Return error
|
687 |
+
return ['status' => 'error'];
|
688 |
+
} else {
|
689 |
+
$zip_progress->log(__("Confirmed, there is more than enough space, checked: ", 'backup-backup') . ($bytes) . __(" bytes", 'backup-backup'), 'success');
|
690 |
+
$zip_progress->bytes = $this->total_size_for_backup;
|
691 |
+
}
|
692 |
|
|
|
|
|
|
|
|
|
|
|
693 |
}
|
694 |
|
695 |
if (Dashboard\bmi_get_config('BACKUP:DATABASE') != 'true') {
|
696 |
+
|
697 |
+
// $zip_progress->log(__("Database won't be backed-up due to user settings, omitting...", 'backup-backup'), 'info');
|
698 |
+
// Commented as message will be shown in database backup module
|
699 |
+
|
700 |
}
|
701 |
|
702 |
// Log and set files length
|
1015 |
|
1016 |
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
|
1017 |
$migration->log(__('PHP CLI: Restore process initialized, restoring...', 'backup-backup'), 'success');
|
|
|
1018 |
touch($lock_cli);
|
1019 |
} else {
|
1020 |
$migration->log(__('Restore process initialized, restoring (non-cli mode)...', 'backup-backup'), 'success');
|
1515 |
$cli_no_exist = __('Path to executable that you provided for PHP CLI does not exist.', 'backup-backup');
|
1516 |
$db_query_too_low = __('The value for query amount cannot be smaller than 15.', 'backup-backup');
|
1517 |
$db_query_too_much = __('The value for query amount cannot be larger than 15000.', 'backup-backup');
|
1518 |
+
$db_sr_max_too_much = __('The value for search replace max page cannot be smaller than 10.', 'backup-backup');
|
1519 |
+
$db_sr_max_too_low = __('The value for search replace max page cannot be larger than 30000.', 'backup-backup');
|
1520 |
|
1521 |
$email = sanitize_email(trim($this->post['email'])); // OTHER:EMAIL
|
1522 |
$email_title = sanitize_text_field(trim($this->post['email_title'])); // OTHER:EMAIL:TITLE
|
1527 |
$php_cli_disable_others = $this->post['php_cli_disable_others'] === 'true' ? true : false; // OTHER:CLI:DISABLE
|
1528 |
$normal_timeout = $this->post['normal_timeout'] === 'true' ? true : false; // OTHER:USE:TIMEOUT:NORMAL
|
1529 |
$insecure_download = $this->post['download_technique'] === 'true' ? true : false; // OTHER:DOWNLOAD:DIRECT
|
1530 |
+
$db_query_size = isset($this->post['db_queries_amount']) ? trim($this->post['db_queries_amount']) : '2000'; // OTHER:DB:QUERIES
|
1531 |
+
$db_search_replace_max = isset($this->post['db_search_replace_max']) ? trim($this->post['db_search_replace_max']) : '300'; // OTHER:DB:SEARCHREPLACE:MAX
|
1532 |
$db_restore_splitting = $this->post['bmi-restore-splitting'] === 'true' ? true : false; // OTHER:RESTORE:SPLITTING
|
1533 |
$db_restore_v3_engine = $this->post['bmi-db-v3-restore-engine'] === 'true' ? true : false; // OTHER:RESTORE:DB:V3
|
1534 |
|
1535 |
$no_assets_b4_restore = $this->post['remove-assets-before-restore'] === 'true' ? true : false; // OTHER:RESTORE:BEFORE:CLEANUP
|
1536 |
$single_file_db_force = $this->post['bmi-db-single-file-backup'] === 'true' ? true : false; // OTHER:BACKUP:DB:SINGLE:FILE
|
1537 |
+
$db_batching_backup = $this->post['bmi-db-batching-backup'] === 'true' ? true : false; // OTHER:BACKUP:DB:BATCHING
|
1538 |
+
|
1539 |
+
$bmi_disable_space_check = $this->post['bmi-disable-space-check-function'] === 'true' ? true : false; // OTHER:BACKUP:SPACE:CHECKING
|
1540 |
|
1541 |
$uninstall_config = $this->post['uninstall_config'] === 'true' ? true : false; // OTHER:UNINSTALL:CONFIGS
|
1542 |
$uninstall_backups = $this->post['uninstall_backups'] === 'true' ? true : false; // OTHER:UNINSTALL:BACKUPS
|
1551 |
}
|
1552 |
|
1553 |
if (!is_numeric($db_query_size) || empty($db_query_size)) {
|
1554 |
+
$db_query_size = "2000";
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
if (!is_numeric($db_search_replace_max) || empty($db_search_replace_max)) {
|
1558 |
+
$db_search_replace_max = "300";
|
1559 |
}
|
1560 |
|
1561 |
if (strlen($email) <= 0) {
|
1582 |
if (intval($db_query_size) < 15) {
|
1583 |
return ['status' => 'msg', 'why' => $db_query_too_low, 'level' => 'warning'];
|
1584 |
}
|
1585 |
+
if (intval($db_search_replace_max) > 30000) {
|
1586 |
+
return ['status' => 'msg', 'why' => $db_sr_max_too_much, 'level' => 'warning'];
|
1587 |
+
}
|
1588 |
+
if (intval($db_search_replace_max) < 10) {
|
1589 |
+
return ['status' => 'msg', 'why' => $db_sr_max_too_low, 'level' => 'warning'];
|
1590 |
+
}
|
1591 |
|
1592 |
$error = 0;
|
1593 |
if (!Dashboard\bmi_set_config('OTHER:EMAIL', $email)) {
|
1620 |
if (!Dashboard\bmi_set_config('OTHER:DB:QUERIES', $db_query_size)) {
|
1621 |
$error++;
|
1622 |
}
|
1623 |
+
if (!Dashboard\bmi_set_config('OTHER:DB:SEARCHREPLACE:MAX', $db_search_replace_max)) {
|
1624 |
+
$error++;
|
1625 |
+
}
|
1626 |
if (!Dashboard\bmi_set_config('OTHER:DOWNLOAD:DIRECT', $insecure_download)) {
|
1627 |
$error++;
|
1628 |
}
|
1638 |
if (!Dashboard\bmi_set_config('OTHER:BACKUP:DB:SINGLE:FILE', $single_file_db_force)) {
|
1639 |
$error++;
|
1640 |
}
|
1641 |
+
if (!Dashboard\bmi_set_config('OTHER:BACKUP:DB:BATCHING', $db_batching_backup)) {
|
1642 |
+
$error++;
|
1643 |
+
}
|
1644 |
+
if (!Dashboard\bmi_set_config('OTHER:BACKUP:SPACE:CHECKING', $bmi_disable_space_check)) {
|
1645 |
+
$error++;
|
1646 |
+
}
|
1647 |
if (!Dashboard\bmi_set_config('OTHER:RESTORE:BEFORE:CLEANUP', $no_assets_b4_restore)) {
|
1648 |
$error++;
|
1649 |
}
|
1880 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/ai1wm-backups";
|
1881 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/uploads/wp-clone";
|
1882 |
$ignored_paths_default[] = "***ABSPATH***/wp-content/updraft";
|
1883 |
+
$ignored_paths_default[] = "***ABSPATH***/wp-content/backups-dup-pro";
|
1884 |
+
$ignored_paths_default[] = "***ABSPATH***/wp-content/wpvividbackups";
|
1885 |
+
$ignored_paths_default[] = "***ABSPATH***/wp-content/backup-guard";
|
1886 |
+
$ignored_paths_default[] = "***ABSPATH***/wp-content/backups-dup-lite";
|
1887 |
if (defined('BMI_PRO_ROOT_DIR')) $ignored_paths_default[] = BMI_PRO_ROOT_DIR;
|
1888 |
if ($is && $dpathsis) {
|
1889 |
BMP::merge_arrays($ignored_paths_default, $dpaths);
|
1988 |
$acis = true;
|
1989 |
$ac = [
|
1990 |
'***ABSPATH***/wp-content/uploads/wpforms/.htaccess.cpmh3129', // Binary broken file of wpforms
|
1991 |
+
'***ABSPATH***/wp-content/uploads/gravity_forms/.htaccess.cpmh3129', // Binary broken file of wpforms
|
1992 |
+
'***ABSPATH***/logs/traffic.html/.md5sums', // Binary broken file of wpforms
|
1993 |
+
'***ABSPATH***/wp-config.php' // Exclude wp-config.php permanently
|
1994 |
];
|
1995 |
} else {
|
1996 |
$ac[] = '***ABSPATH***/wp-content/uploads/wpforms/.htaccess.cpmh3129'; // Binary broken file of wpforms
|
2426 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'bmi_backup_manifest.json';
|
2427 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'files_latest.list';
|
2428 |
|
2429 |
+
if (is_array($filesToBeRemoved) || is_object($filesToBeRemoved)) {
|
2430 |
+
foreach ((array) $filesToBeRemoved as $file) {
|
2431 |
+
$this->rrmdir($file);
|
2432 |
+
}
|
2433 |
}
|
2434 |
|
2435 |
return ['status' => 'success'];
|
2504 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.restore_secret';
|
2505 |
$filesToBeRemoved[] = BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.table_map';
|
2506 |
|
2507 |
+
if (is_array($filesToBeRemoved) || is_object($filesToBeRemoved)) {
|
2508 |
+
foreach ((array) $filesToBeRemoved as $file) {
|
2509 |
+
$this->rrmdir($file);
|
2510 |
+
}
|
2511 |
}
|
2512 |
|
2513 |
return ['status' => 'success'];
|
2668 |
|
2669 |
}
|
2670 |
|
2671 |
+
public function getLatestBackupFile() {
|
2672 |
+
|
2673 |
+
$dir = BMI_BACKUPS;
|
2674 |
+
$backupdir = array_diff(scandir($dir), ['..', '.']);
|
2675 |
+
$backups = [];
|
2676 |
+
foreach ($backupdir as $index => $name) {
|
2677 |
+
|
2678 |
+
$ext = pathinfo($dir . DIRECTORY_SEPARATOR . $name, PATHINFO_EXTENSION);
|
2679 |
+
|
2680 |
+
if ($ext === 'zip') {
|
2681 |
+
$backups[] = [
|
2682 |
+
'cdate' => filemtime($dir . DIRECTORY_SEPARATOR . $name),
|
2683 |
+
'name' => $name
|
2684 |
+
];
|
2685 |
+
}
|
2686 |
+
|
2687 |
+
}
|
2688 |
+
|
2689 |
+
usort($backups, function ($a, $b) {
|
2690 |
+
if (intval($a['cdate']) < intval($b['cdate'])) return 1;
|
2691 |
+
else return -1;
|
2692 |
+
});
|
2693 |
+
|
2694 |
+
$backups = array_values($backups);
|
2695 |
+
|
2696 |
+
return $backups[0]['name'];
|
2697 |
+
|
2698 |
+
}
|
2699 |
+
|
2700 |
public function debugging() {
|
2701 |
+
|
2702 |
}
|
2703 |
}
|
includes/backup-cli.php
CHANGED
@@ -78,6 +78,8 @@
|
|
78 |
'total_files' => $fields->total_files,
|
79 |
'browser' => 'cli'
|
80 |
],
|
|
|
|
|
81 |
0
|
82 |
);
|
83 |
|
78 |
'total_files' => $fields->total_files,
|
79 |
'browser' => 'cli'
|
80 |
],
|
81 |
+
0,
|
82 |
+
0,
|
83 |
0
|
84 |
);
|
85 |
|
includes/backup-heart.php
CHANGED
@@ -120,7 +120,9 @@
|
|
120 |
'browser' => $fields['content-browser']
|
121 |
// 'shareallowed' => $fields['content-shareallowed']
|
122 |
],
|
123 |
-
$fields['content-it']
|
|
|
|
|
124 |
);
|
125 |
|
126 |
// Handle request
|
120 |
'browser' => $fields['content-browser']
|
121 |
// 'shareallowed' => $fields['content-shareallowed']
|
122 |
],
|
123 |
+
$fields['content-it'],
|
124 |
+
$fields['content-dbit'],
|
125 |
+
$fields['content-dblast']
|
126 |
);
|
127 |
|
128 |
// Handle request
|
includes/bypasser.php
CHANGED
@@ -7,6 +7,9 @@
|
|
7 |
use BMI\Plugin\BMI_Logger AS Logger;
|
8 |
use BMI\Plugin\Progress\BMI_ZipProgress AS Output;
|
9 |
use BMI\Plugin\Checker\System_Info as SI;
|
|
|
|
|
|
|
10 |
|
11 |
// Exit on direct access
|
12 |
if (!(defined('BMI_CURL_REQUEST') || defined('ABSPATH'))) exit;
|
@@ -20,9 +23,10 @@
|
|
20 |
class BMI_Backup_Heart {
|
21 |
|
22 |
// Prepare the request details
|
23 |
-
function __construct($curl = false, $config = false, $content = false, $backups = false, $abs = false, $dir = false, $url = false, $remote_settings = [], $it = 0) {
|
24 |
|
25 |
$this->it = intval($it);
|
|
|
26 |
$this->abs = $abs;
|
27 |
$this->dir = $dir;
|
28 |
$this->url = $url;
|
@@ -30,6 +34,7 @@
|
|
30 |
$this->config = $config;
|
31 |
$this->content = $content;
|
32 |
$this->backups = $backups;
|
|
|
33 |
|
34 |
$this->identy = $remote_settings['identy'];
|
35 |
$this->manifest = $remote_settings['manifest'];
|
@@ -57,6 +62,7 @@
|
|
57 |
$this->headersSet = false;
|
58 |
$this->final_made = false;
|
59 |
$this->final_batch = false;
|
|
|
60 |
|
61 |
$this->lock_cli = BMI_BACKUPS . '/.backup_cli_lock';
|
62 |
if ($this->it > 1) @touch($this->lock_cli);
|
@@ -65,10 +71,12 @@
|
|
65 |
|
66 |
// Human size from bytes
|
67 |
public static function humanSize($bytes) {
|
68 |
-
$
|
69 |
-
|
|
|
70 |
|
71 |
-
|
|
|
72 |
}
|
73 |
|
74 |
// Create new process
|
@@ -96,6 +104,8 @@
|
|
96 |
// 'Content-Shareallowed:' . $this->shareallowed,
|
97 |
'Content-Rev:' . $this->rev,
|
98 |
'Content-It:' . $this->it,
|
|
|
|
|
99 |
'Content-Browser:' . $this->browserSide ? 'true' : 'false'
|
100 |
);
|
101 |
|
@@ -224,6 +234,8 @@
|
|
224 |
// Content finished
|
225 |
header('Content-Finished: true');
|
226 |
header('Content-It: ' . ($this->it + 1));
|
|
|
|
|
227 |
header('Content-Filessofar: ' . $this->filessofar);
|
228 |
http_response_code(200);
|
229 |
$this->headersSet = true;
|
@@ -256,6 +268,8 @@
|
|
256 |
// Content finished
|
257 |
header('Content-Finished: false');
|
258 |
header('Content-It: ' . ($this->it + 1));
|
|
|
|
|
259 |
header('Content-Filessofar: ' . $this->filessofar);
|
260 |
http_response_code(200);
|
261 |
$this->headersSet = true;
|
@@ -287,6 +301,10 @@
|
|
287 |
// Group files for batches
|
288 |
public function make_file_groups() {
|
289 |
|
|
|
|
|
|
|
|
|
290 |
$this->output->log('Making batches for each process...', 'STEP');
|
291 |
$list_path = $this->fileList;
|
292 |
|
@@ -380,17 +398,6 @@
|
|
380 |
fclose($log_file);
|
381 |
|
382 |
$files = [$logs, $this->manifest];
|
383 |
-
if (file_exists($this->dbfile)) {
|
384 |
-
$files[] = $this->dbfile;
|
385 |
-
} elseif (file_exists($this->db_dir_v2) && is_dir($this->db_dir_v2)) {
|
386 |
-
$this->db_v2_engine = true;
|
387 |
-
$db_files = scandir($this->db_dir_v2);
|
388 |
-
foreach ($db_files as $i => $name) {
|
389 |
-
if (!($name == '.' || $name == '..')) {
|
390 |
-
$files[] = $this->db_dir_v2 . '/' . $name;
|
391 |
-
}
|
392 |
-
}
|
393 |
-
}
|
394 |
|
395 |
return $files;
|
396 |
|
@@ -402,7 +409,6 @@
|
|
402 |
$this->output->log('Finalizing backup', 'STEP');
|
403 |
$this->output->log('Closing files and archives', 'STEP');
|
404 |
$this->output->log('Archiving of ' . $this->total_files . ' files took: ' . number_format(microtime(true) - floatval($this->backupstart), 2) . 's', 'INFO');
|
405 |
-
$this->output->log('#001', 'END-CODE');
|
406 |
|
407 |
if (!BMI_CLI_REQUEST) {
|
408 |
if (!$this->browserSide) sleep(1);
|
@@ -420,8 +426,12 @@
|
|
420 |
// Load batch
|
421 |
public function load_batch() {
|
422 |
|
|
|
|
|
|
|
|
|
423 |
$allFiles = scandir($this->identyFolder);
|
424 |
-
$files = array_slice($allFiles, 2);
|
425 |
if (sizeof($files) > 0) {
|
426 |
|
427 |
$largest = $files[0]; $prev_size = 0;
|
@@ -473,7 +483,7 @@
|
|
473 |
}
|
474 |
|
475 |
// Add files to ZIP – The Backup
|
476 |
-
public function add_files($files = [], $file_list = false, $final = false) {
|
477 |
|
478 |
try {
|
479 |
|
@@ -489,6 +499,9 @@
|
|
489 |
// Show what's in use
|
490 |
if ($this->it === 1) {
|
491 |
$this->output->log('Using ZipArchive module to create the Archive.', 'INFO');
|
|
|
|
|
|
|
492 |
}
|
493 |
|
494 |
// Open / create ZIP file
|
@@ -503,15 +516,26 @@
|
|
503 |
}
|
504 |
|
505 |
// Final operation
|
506 |
-
if ($final) {
|
507 |
|
508 |
// Add files
|
509 |
for ($i = 0; $i < sizeof($files); ++$i) {
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
|
|
|
|
|
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
}
|
516 |
|
517 |
} else {
|
@@ -519,11 +543,19 @@
|
|
519 |
// Add files
|
520 |
for ($i = 0; $i < sizeof($files); ++$i) {
|
521 |
|
522 |
-
|
523 |
-
$path = 'wordpress' . DIRECTORY_SEPARATOR . substr($files[$i], strlen(ABSPATH));
|
524 |
|
525 |
-
|
526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
|
528 |
}
|
529 |
|
@@ -649,6 +681,32 @@
|
|
649 |
// ZIP one of the grouped files
|
650 |
public function zip_batch() {
|
651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
$list_file = $this->load_batch();
|
653 |
if ($list_file === false) return true;
|
654 |
$files = explode("\r\n", file_get_contents($list_file));
|
@@ -740,7 +798,9 @@
|
|
740 |
if (BMI_CLI_REQUEST) return;
|
741 |
if (file_exists($this->identyfile)) {
|
742 |
|
743 |
-
$this->
|
|
|
|
|
744 |
|
745 |
// Set header for browser
|
746 |
if ($this->browserSide && $this->headersSet === false) {
|
@@ -748,6 +808,8 @@
|
|
748 |
// Content finished
|
749 |
header('Content-Finished: false');
|
750 |
header('Content-It: ' . $this->it);
|
|
|
|
|
751 |
header('Content-Filessofar: ' . $this->filessofar);
|
752 |
http_response_code(200);
|
753 |
$this->headersSet = true;
|
@@ -800,6 +862,11 @@
|
|
800 |
// CLI case
|
801 |
if (BMI_CLI_REQUEST) {
|
802 |
|
|
|
|
|
|
|
|
|
|
|
803 |
// Log
|
804 |
$this->output->log("PHP CLI initialized - process ran successfully", 'SUCCESS');
|
805 |
$this->make_file_groups();
|
@@ -816,16 +883,143 @@
|
|
816 |
} else {
|
817 |
|
818 |
// Background
|
819 |
-
if ($this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
|
821 |
-
$this->output->log(
|
822 |
-
$this->
|
823 |
-
$this->
|
|
|
824 |
|
825 |
-
} else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
826 |
|
827 |
}
|
828 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
829 |
}
|
830 |
|
831 |
}
|
7 |
use BMI\Plugin\BMI_Logger AS Logger;
|
8 |
use BMI\Plugin\Progress\BMI_ZipProgress AS Output;
|
9 |
use BMI\Plugin\Checker\System_Info as SI;
|
10 |
+
use BMI\Plugin\Dashboard as Dashboard;
|
11 |
+
use BMI\Plugin\Database\BMI_Database as Database;
|
12 |
+
use BMI\Plugin\Database\BMI_Database_Exporter as BetterDatabaseExport;
|
13 |
|
14 |
// Exit on direct access
|
15 |
if (!(defined('BMI_CURL_REQUEST') || defined('ABSPATH'))) exit;
|
23 |
class BMI_Backup_Heart {
|
24 |
|
25 |
// Prepare the request details
|
26 |
+
function __construct($curl = false, $config = false, $content = false, $backups = false, $abs = false, $dir = false, $url = false, $remote_settings = [], $it = 0, $dbit = 0, $dblast = 0) {
|
27 |
|
28 |
$this->it = intval($it);
|
29 |
+
$this->dbit = intval($dbit);
|
30 |
$this->abs = $abs;
|
31 |
$this->dir = $dir;
|
32 |
$this->url = $url;
|
34 |
$this->config = $config;
|
35 |
$this->content = $content;
|
36 |
$this->backups = $backups;
|
37 |
+
$this->dblast = $dblast;
|
38 |
|
39 |
$this->identy = $remote_settings['identy'];
|
40 |
$this->manifest = $remote_settings['manifest'];
|
62 |
$this->headersSet = false;
|
63 |
$this->final_made = false;
|
64 |
$this->final_batch = false;
|
65 |
+
$this->dbitJustFinished = false;
|
66 |
|
67 |
$this->lock_cli = BMI_BACKUPS . '/.backup_cli_lock';
|
68 |
if ($this->it > 1) @touch($this->lock_cli);
|
71 |
|
72 |
// Human size from bytes
|
73 |
public static function humanSize($bytes) {
|
74 |
+
if (is_int($bytes)) {
|
75 |
+
$label = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
76 |
+
for ($i = 0; $bytes >= 1024 && $i < (count($label) - 1); $bytes /= 1024, $i++);
|
77 |
|
78 |
+
return (round($bytes, 2) . " " . $label[$i]);
|
79 |
+
} else return $bytes;
|
80 |
}
|
81 |
|
82 |
// Create new process
|
104 |
// 'Content-Shareallowed:' . $this->shareallowed,
|
105 |
'Content-Rev:' . $this->rev,
|
106 |
'Content-It:' . $this->it,
|
107 |
+
'Content-Dbit:' . $this->dbit,
|
108 |
+
'Content-Dblast:' . $this->dblast,
|
109 |
'Content-Browser:' . $this->browserSide ? 'true' : 'false'
|
110 |
);
|
111 |
|
234 |
// Content finished
|
235 |
header('Content-Finished: true');
|
236 |
header('Content-It: ' . ($this->it + 1));
|
237 |
+
header('Content-Dbit: ' . $this->dbit);
|
238 |
+
header('Content-Dblast: ' . $this->dblast);
|
239 |
header('Content-Filessofar: ' . $this->filessofar);
|
240 |
http_response_code(200);
|
241 |
$this->headersSet = true;
|
268 |
// Content finished
|
269 |
header('Content-Finished: false');
|
270 |
header('Content-It: ' . ($this->it + 1));
|
271 |
+
header('Content-Dbit: ' . $this->dbit);
|
272 |
+
header('Content-Dblast: ' . $this->dblast);
|
273 |
header('Content-Filessofar: ' . $this->filessofar);
|
274 |
http_response_code(200);
|
275 |
$this->headersSet = true;
|
301 |
// Group files for batches
|
302 |
public function make_file_groups() {
|
303 |
|
304 |
+
if (!(file_exists($this->fileList) && is_readable($this->fileList))) {
|
305 |
+
return $this->send_error('File list is not accessible or does not exist, try to run your backup process once again.', true);
|
306 |
+
}
|
307 |
+
|
308 |
$this->output->log('Making batches for each process...', 'STEP');
|
309 |
$list_path = $this->fileList;
|
310 |
|
398 |
fclose($log_file);
|
399 |
|
400 |
$files = [$logs, $this->manifest];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
return $files;
|
403 |
|
409 |
$this->output->log('Finalizing backup', 'STEP');
|
410 |
$this->output->log('Closing files and archives', 'STEP');
|
411 |
$this->output->log('Archiving of ' . $this->total_files . ' files took: ' . number_format(microtime(true) - floatval($this->backupstart), 2) . 's', 'INFO');
|
|
|
412 |
|
413 |
if (!BMI_CLI_REQUEST) {
|
414 |
if (!$this->browserSide) sleep(1);
|
426 |
// Load batch
|
427 |
public function load_batch() {
|
428 |
|
429 |
+
if (!(file_exists($this->identyFolder) && is_dir($this->identyFolder))) {
|
430 |
+
return $this->send_error('Temporary directory does not exist, please start the backup once again.', true);
|
431 |
+
}
|
432 |
+
|
433 |
$allFiles = scandir($this->identyFolder);
|
434 |
+
$files = array_slice((array) $allFiles, 2);
|
435 |
if (sizeof($files) > 0) {
|
436 |
|
437 |
$largest = $files[0]; $prev_size = 0;
|
483 |
}
|
484 |
|
485 |
// Add files to ZIP – The Backup
|
486 |
+
public function add_files($files = [], $file_list = false, $final = false, $dbLog = false) {
|
487 |
|
488 |
try {
|
489 |
|
499 |
// Show what's in use
|
500 |
if ($this->it === 1) {
|
501 |
$this->output->log('Using ZipArchive module to create the Archive.', 'INFO');
|
502 |
+
if ($dbLog == true) {
|
503 |
+
$this->output->log('Adding database SQL file(s) to the backup file.', 'STEP');
|
504 |
+
}
|
505 |
}
|
506 |
|
507 |
// Open / create ZIP file
|
516 |
}
|
517 |
|
518 |
// Final operation
|
519 |
+
if ($final || $dbLog) {
|
520 |
|
521 |
// Add files
|
522 |
for ($i = 0; $i < sizeof($files); ++$i) {
|
523 |
|
524 |
+
if (file_exists($files[$i]) && is_readable($files[$i]) && !is_link($files[$i])) {
|
525 |
+
|
526 |
+
// Add the file
|
527 |
+
$this->_zip->addFile($files[$i], $this->cutDir($files[$i]));
|
528 |
+
|
529 |
+
} else {
|
530 |
|
531 |
+
$this->output->log('This file is not readable, it will not be included in the backup: ' . $files[$i], 'WARN');
|
532 |
+
|
533 |
+
}
|
534 |
+
|
535 |
+
}
|
536 |
+
|
537 |
+
if ($dbLog === false) {
|
538 |
+
$this->final_made = true;
|
539 |
}
|
540 |
|
541 |
} else {
|
543 |
// Add files
|
544 |
for ($i = 0; $i < sizeof($files); ++$i) {
|
545 |
|
546 |
+
if (file_exists($files[$i]) && is_readable($files[$i]) && !is_link($files[$i])) {
|
|
|
547 |
|
548 |
+
// Calculate Path in ZIP
|
549 |
+
$path = 'wordpress' . DIRECTORY_SEPARATOR . substr($files[$i], strlen(ABSPATH));
|
550 |
+
|
551 |
+
// Add the file
|
552 |
+
$this->_zip->addFile($files[$i], $path);
|
553 |
+
|
554 |
+
} else {
|
555 |
+
|
556 |
+
$this->output->log('This file is not readable, it will not be included in the backup: ' . $files[$i], 'WARN');
|
557 |
+
|
558 |
+
}
|
559 |
|
560 |
}
|
561 |
|
681 |
// ZIP one of the grouped files
|
682 |
public function zip_batch() {
|
683 |
|
684 |
+
if ($this->it === 1) {
|
685 |
+
|
686 |
+
$files = [];
|
687 |
+
if (file_exists($this->dbfile)) {
|
688 |
+
$files[] = $this->dbfile;
|
689 |
+
} elseif (file_exists($this->db_dir_v2) && is_dir($this->db_dir_v2)) {
|
690 |
+
$this->db_v2_engine = true;
|
691 |
+
$db_files = scandir($this->db_dir_v2);
|
692 |
+
foreach ($db_files as $i => $name) {
|
693 |
+
if (!($name == '.' || $name == '..')) {
|
694 |
+
$files[] = $this->db_dir_v2 . '/' . $name;
|
695 |
+
}
|
696 |
+
}
|
697 |
+
}
|
698 |
+
|
699 |
+
if (sizeof($files) > 0) {
|
700 |
+
$this->add_files($files, false, false, true);
|
701 |
+
$this->output->log('Database added to the backup file.', 'SUCCESS');
|
702 |
+
$this->output->log('Performing site files backup...', 'STEP');
|
703 |
+
return true;
|
704 |
+
}
|
705 |
+
|
706 |
+
$this->output->log('Performing site files backup...', 'STEP');
|
707 |
+
|
708 |
+
}
|
709 |
+
|
710 |
$list_file = $this->load_batch();
|
711 |
if ($list_file === false) return true;
|
712 |
$files = explode("\r\n", file_get_contents($list_file));
|
798 |
if (BMI_CLI_REQUEST) return;
|
799 |
if (file_exists($this->identyfile)) {
|
800 |
|
801 |
+
if ($this->dbit === -1 && $this->dbitJustFinished == false) {
|
802 |
+
$this->it += 1;
|
803 |
+
}
|
804 |
|
805 |
// Set header for browser
|
806 |
if ($this->browserSide && $this->headersSet === false) {
|
808 |
// Content finished
|
809 |
header('Content-Finished: false');
|
810 |
header('Content-It: ' . $this->it);
|
811 |
+
header('Content-Dbit: ' . $this->dbit);
|
812 |
+
header('Content-Dblast: ' . $this->dblast);
|
813 |
header('Content-Filessofar: ' . $this->filessofar);
|
814 |
http_response_code(200);
|
815 |
$this->headersSet = true;
|
862 |
// CLI case
|
863 |
if (BMI_CLI_REQUEST) {
|
864 |
|
865 |
+
$this->output->log('Starting database backup exporter', 'STEP');
|
866 |
+
while ($this->dbit !== -1) {
|
867 |
+
$this->databaseBackupMaker();
|
868 |
+
}
|
869 |
+
|
870 |
// Log
|
871 |
$this->output->log("PHP CLI initialized - process ran successfully", 'SUCCESS');
|
872 |
$this->make_file_groups();
|
883 |
} else {
|
884 |
|
885 |
// Background
|
886 |
+
if ($this->dbit !== -1) {
|
887 |
+
|
888 |
+
if ($this->dbit === 0) {
|
889 |
+
$this->output->log('Background process initialized', 'SUCCESS');
|
890 |
+
$this->output->log('Starting database backup exporter', 'STEP');
|
891 |
+
}
|
892 |
+
|
893 |
+
$this->databaseBackupMaker();
|
894 |
+
|
895 |
+
} else {
|
896 |
+
|
897 |
+
if ($this->it === 0) {
|
898 |
+
|
899 |
+
$this->make_file_groups();
|
900 |
+
$this->output->log('Making archive...', 'STEP');
|
901 |
+
|
902 |
+
} else $this->zip_batch();
|
903 |
+
|
904 |
+
}
|
905 |
+
|
906 |
+
}
|
907 |
+
|
908 |
+
}
|
909 |
+
|
910 |
+
}
|
911 |
+
|
912 |
+
public function fixSlashes($str) {
|
913 |
+
$str = str_replace('\\\\', DIRECTORY_SEPARATOR, $str);
|
914 |
+
$str = str_replace('\\', DIRECTORY_SEPARATOR, $str);
|
915 |
+
$str = str_replace('\/', DIRECTORY_SEPARATOR, $str);
|
916 |
+
$str = str_replace('/', DIRECTORY_SEPARATOR, $str);
|
917 |
+
|
918 |
+
if ($str[strlen($str) - 1] == DIRECTORY_SEPARATOR) {
|
919 |
+
$str = substr($str, 0, -1);
|
920 |
+
}
|
921 |
+
|
922 |
+
return $str;
|
923 |
+
}
|
924 |
+
|
925 |
+
// Database batch maker and dumper
|
926 |
+
// We need WP instance for that to get access to wpdb
|
927 |
+
public function databaseBackupMaker() {
|
928 |
+
|
929 |
+
if ($this->dbit === -1) return;
|
930 |
+
|
931 |
+
define('WP_USE_THEMES', false);
|
932 |
+
|
933 |
+
// Use WP Globals and load WordPress
|
934 |
+
global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header;
|
935 |
+
require_once $this->bmi_find_wordpress_base_path() . DIRECTORY_SEPARATOR . 'wp-load.php';
|
936 |
+
|
937 |
+
// DB File Name for that type of backup
|
938 |
+
$dbbackupname = 'bmi_database_backup.sql';
|
939 |
+
$database_file = $this->fixSlashes(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . $dbbackupname);
|
940 |
+
|
941 |
+
if (Dashboard\bmi_get_config('BACKUP:DATABASE') == 'true') {
|
942 |
+
|
943 |
+
if (Dashboard\bmi_get_config('OTHER:BACKUP:DB:SINGLE:FILE') == 'true') {
|
944 |
+
|
945 |
+
// Require Database Manager
|
946 |
+
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'manager.php';
|
947 |
+
|
948 |
+
// Log what's going on
|
949 |
+
$this->output->log('Making single-file database backup (using deprecated engine, due to used settings)', 'STEP');
|
950 |
+
|
951 |
+
// Get database dump
|
952 |
+
$databaser = new Database(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
|
953 |
+
$databaser->exportDatabase($dbbackupname);
|
954 |
+
$this->output->log("Database size: " . $this->humanSize(filesize($database_file)), 'INFO');
|
955 |
+
$this->output->log('Database (single-file) backup finished.', 'SUCCESS');
|
956 |
+
|
957 |
+
$this->dbitJustFinished = true;
|
958 |
+
$this->dbit = -1;
|
959 |
+
return true;
|
960 |
+
|
961 |
+
} else {
|
962 |
+
|
963 |
+
// Log what's going on
|
964 |
+
if ($this->dbit === 0) {
|
965 |
+
$this->output->log("Making database backup (using v3 engine, requires at least v1.2.2 to restore)", 'STEP');
|
966 |
+
$this->output->log("Iterating database...", 'INFO');
|
967 |
+
}
|
968 |
+
|
969 |
+
// Require Database Manager
|
970 |
+
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'better-backup-v3.php';
|
971 |
+
|
972 |
+
$database_file_dir = $this->fixSlashes((dirname($database_file))) . DIRECTORY_SEPARATOR;
|
973 |
+
$better_database_files_dir = $database_file_dir . 'db_tables';
|
974 |
+
|
975 |
+
if (!is_dir($better_database_files_dir)) @mkdir($better_database_files_dir, 0755, true);
|
976 |
+
$db_exporter = new BetterDatabaseExport($better_database_files_dir, $this->output, $this->dbit, intval($this->backupstart));
|
977 |
+
|
978 |
+
$dbBatchingEnabled = false;
|
979 |
+
if (Dashboard\bmi_get_config('OTHER:BACKUP:DB:BATCHING') == 'true') {
|
980 |
+
$dbBatchingEnabled = true;
|
981 |
+
} else {
|
982 |
+
if ($this->dbit === 0) {
|
983 |
+
$this->output->log("Database batching is disabled in options, consider to use this option if your database backup fails.", 'WARN');
|
984 |
+
}
|
985 |
+
}
|
986 |
+
|
987 |
+
if (BMI_CLI_REQUEST === true || $dbBatchingEnabled === false) {
|
988 |
+
|
989 |
+
$results = $db_exporter->export();
|
990 |
|
991 |
+
$this->output->log("Database backup finished", 'SUCCESS');
|
992 |
+
$this->dbitJustFinished = true;
|
993 |
+
$this->dbit = -1;
|
994 |
+
$this->dblast = 0;
|
995 |
|
996 |
+
} else {
|
997 |
+
|
998 |
+
$results = $db_exporter->export($this->dbit, $this->dblast);
|
999 |
+
|
1000 |
+
$this->dbit = intval($results['batchingStep']);
|
1001 |
+
$this->dblast = intval($results['finishedQuery']);
|
1002 |
+
$dbFinished = $results['dumpCompleted'];
|
1003 |
+
|
1004 |
+
if ($dbFinished == true) {
|
1005 |
+
$this->output->log("Database backup finished", 'SUCCESS');
|
1006 |
+
$this->dbitJustFinished = true;
|
1007 |
+
$this->dbit = -1;
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
return true;
|
1013 |
|
1014 |
}
|
1015 |
|
1016 |
+
} else {
|
1017 |
+
|
1018 |
+
$this->output->log('Database will not be dumped due to user settings.', 'INFO');
|
1019 |
+
$this->dbitJustFinished = true;
|
1020 |
+
$this->dbit = -1;
|
1021 |
+
return true;
|
1022 |
+
|
1023 |
}
|
1024 |
|
1025 |
}
|
includes/check/checker.php
CHANGED
@@ -32,9 +32,11 @@ class BMI_Checker {
|
|
32 |
}
|
33 |
|
34 |
public function is_enabled($func) {
|
35 |
-
|
36 |
$disabled = explode(',', ini_get('disable_functions'));
|
37 |
-
|
|
|
|
|
38 |
|
39 |
}
|
40 |
|
32 |
}
|
33 |
|
34 |
public function is_enabled($func) {
|
35 |
+
|
36 |
$disabled = explode(',', ini_get('disable_functions'));
|
37 |
+
$isDisabled = in_array($func, $disabled);
|
38 |
+
if (!$isDisabled && function_exists($func)) return true;
|
39 |
+
else return false;
|
40 |
|
41 |
}
|
42 |
|
includes/check/system_info.php
CHANGED
@@ -53,9 +53,12 @@ class System_Info {
|
|
53 |
protected $free_space_after_backup;
|
54 |
|
55 |
public function is_enabled($func) {
|
|
|
56 |
$disabled = explode(',', ini_get('disable_functions'));
|
|
|
|
|
|
|
57 |
|
58 |
-
return !in_array($func, $disabled);
|
59 |
}
|
60 |
|
61 |
/**
|
@@ -223,8 +226,8 @@ class System_Info {
|
|
223 |
*/
|
224 |
public function get_disk_free_space() {
|
225 |
if ($this->is_enabled('disk_free_space')) {
|
226 |
-
if (!
|
227 |
-
$this->disk_free_space = disk_free_space(
|
228 |
}
|
229 |
|
230 |
return $this->disk_free_space;
|
53 |
protected $free_space_after_backup;
|
54 |
|
55 |
public function is_enabled($func) {
|
56 |
+
|
57 |
$disabled = explode(',', ini_get('disable_functions'));
|
58 |
+
$isDisabled = in_array($func, $disabled);
|
59 |
+
if (!$isDisabled && function_exists($func)) return true;
|
60 |
+
else return false;
|
61 |
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
226 |
*/
|
227 |
public function get_disk_free_space() {
|
228 |
if ($this->is_enabled('disk_free_space')) {
|
229 |
+
if (!isset($this->disk_free_space)) {
|
230 |
+
$this->disk_free_space = \disk_free_space(ABSPATH);
|
231 |
}
|
232 |
|
233 |
return $this->disk_free_space;
|
includes/constants.php
CHANGED
@@ -41,18 +41,34 @@
|
|
41 |
$db_queries = intval($db_queries);
|
42 |
|
43 |
if ($db_queries > 15000 || $db_queries < 15) {
|
44 |
-
$db_queries =
|
45 |
}
|
46 |
}
|
47 |
|
48 |
if (!isset($db_queries) || is_null($db_queries) || !is_numeric($db_queries)) {
|
49 |
-
$db_queries =
|
50 |
}
|
51 |
|
52 |
define('BMI_DB_MAX_ROWS_PER_QUERY', $db_queries);
|
53 |
}
|
54 |
|
55 |
// Default constants
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
if (!defined('BMI_CLI_EXECUTABLE')) {
|
57 |
$php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
|
58 |
if (strlen(trim($php_cli_path)) > 0) {
|
41 |
$db_queries = intval($db_queries);
|
42 |
|
43 |
if ($db_queries > 15000 || $db_queries < 15) {
|
44 |
+
$db_queries = 2000;
|
45 |
}
|
46 |
}
|
47 |
|
48 |
if (!isset($db_queries) || is_null($db_queries) || !is_numeric($db_queries)) {
|
49 |
+
$db_queries = 2000;
|
50 |
}
|
51 |
|
52 |
define('BMI_DB_MAX_ROWS_PER_QUERY', $db_queries);
|
53 |
}
|
54 |
|
55 |
// Default constants
|
56 |
+
if (!defined('BMI_MAX_SEARCH_REPLACE_PAGE')) {
|
57 |
+
$db_sr_max_page = Dashboard\bmi_get_config('OTHER:DB:SEARCHREPLACE:MAX');
|
58 |
+
if (is_numeric($db_sr_max_page)) {
|
59 |
+
$db_sr_max_page = intval($db_sr_max_page);
|
60 |
+
|
61 |
+
if ($db_sr_max_page > 30000 || $db_sr_max_page < 10) {
|
62 |
+
$db_sr_max_page = 300;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
if (!isset($db_sr_max_page) || is_null($db_sr_max_page) || !is_numeric($db_sr_max_page)) {
|
67 |
+
$db_sr_max_page = 300;
|
68 |
+
}
|
69 |
+
|
70 |
+
define('BMI_MAX_SEARCH_REPLACE_PAGE', $db_sr_max_page);
|
71 |
+
}
|
72 |
if (!defined('BMI_CLI_EXECUTABLE')) {
|
73 |
$php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
|
74 |
if (strlen(trim($php_cli_path)) > 0) {
|
includes/dashboard/chapter/other_config.php
CHANGED
@@ -18,6 +18,8 @@
|
|
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 |
$deprecatedsinglefile = __('It will force to use V1 engine (first export function of this plugin), it is usually much quicker but search & replace may not work well for recursively santisized data - but may be recommended for not complex sites.', 'backup-backup');
|
20 |
$cleanupbeforerestore = __('Advanced details: It will remove all plugins (excluding backup migration) and themes before performing migration. These files during migration will be kept in directory wp-content/backup-migration/clean-ups. If you want to keep them after migration you can use wp-config.php constant BMI_KEEP_CLEANUPS set to TRUE.', 'backup-backup');
|
|
|
|
|
21 |
|
22 |
?>
|
23 |
|
@@ -387,7 +389,19 @@
|
|
387 |
<div class="left">
|
388 |
<?php $query_amount = sanitize_text_field(bmi_get_config('OTHER:DB:QUERIES')); ?>
|
389 |
<label for="db_queries_amount">
|
390 |
-
<input type="number" id="db_queries_amount" class="bmi-text-input small" value="<?php echo $query_amount; ?>" placeholder="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
</label>
|
392 |
</div>
|
393 |
</div>
|
@@ -406,15 +420,44 @@
|
|
406 |
</label>
|
407 |
</div>
|
408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
<div class="lh40">
|
410 |
<label for="bmi-db-single-file-backup">
|
411 |
<input type="checkbox" id="bmi-db-single-file-backup"<?php bmi_try_checked('OTHER:BACKUP:DB:SINGLE:FILE'); ?> />
|
412 |
-
<span class="relative"
|
|
|
|
|
|
|
413 |
</label>
|
414 |
</div>
|
415 |
|
416 |
</div>
|
417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
<!-- -->
|
419 |
<div class="mm mbl">
|
420 |
<div class="f20 bold">
|
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 |
$deprecatedsinglefile = __('It will force to use V1 engine (first export function of this plugin), it is usually much quicker but search & replace may not work well for recursively santisized data - but may be recommended for not complex sites.', 'backup-backup');
|
20 |
$cleanupbeforerestore = __('Advanced details: It will remove all plugins (excluding backup migration) and themes before performing migration. These files during migration will be kept in directory wp-content/backup-migration/clean-ups. If you want to keep them after migration you can use wp-config.php constant BMI_KEEP_CLEANUPS set to TRUE.', 'backup-backup');
|
21 |
+
$disabledspacechecking = __('This option will disable validation of free space on your server i.e. if there is enough space to make the backup. Use it only when you are 100% sure that you have enough space, otherwise backup process may fail with fatal error. In corner cases, if there will not be enough space it may make your site slow or even limit functionality.', 'backup-backup');
|
22 |
+
$dbbatching = __('This option will enable batching for database table export (backup). It will affect only non-default methods of the backup. It will significantly slow down the backup process, but it will make it much more stable.', 'backup-backup');
|
23 |
|
24 |
?>
|
25 |
|
389 |
<div class="left">
|
390 |
<?php $query_amount = sanitize_text_field(bmi_get_config('OTHER:DB:QUERIES')); ?>
|
391 |
<label for="db_queries_amount">
|
392 |
+
<input type="number" id="db_queries_amount" class="bmi-text-input small" value="<?php echo $query_amount; ?>" placeholder="2000" min="15" max="15000" />
|
393 |
+
</label>
|
394 |
+
</div>
|
395 |
+
</div>
|
396 |
+
|
397 |
+
<div class="lh40 cf">
|
398 |
+
<div class="left mw250 lh65">
|
399 |
+
<?php _e("Search & Replace max Page Size: ", 'backup-backup'); ?>
|
400 |
+
</div>
|
401 |
+
<div class="left">
|
402 |
+
<?php $sr_max_amount = sanitize_text_field(bmi_get_config('OTHER:DB:SEARCHREPLACE:MAX')); ?>
|
403 |
+
<label for="db_search_replace_max">
|
404 |
+
<input type="number" id="db_search_replace_max" class="bmi-text-input small" value="<?php echo $sr_max_amount; ?>" placeholder="300" min="10" max="30000" />
|
405 |
</label>
|
406 |
</div>
|
407 |
</div>
|
420 |
</label>
|
421 |
</div>
|
422 |
|
423 |
+
<div class="lh40">
|
424 |
+
<label for="bmi-db-batching-backup">
|
425 |
+
<input type="checkbox" id="bmi-db-batching-backup"<?php bmi_try_checked('OTHER:BACKUP:DB:BATCHING'); ?> />
|
426 |
+
<span class="relative">
|
427 |
+
<?php _e("Use batching technique for database export (backup).", 'backup-backup'); ?>
|
428 |
+
<span class="bmi-info-icon tooltip" tooltip="<?php echo $dbbatching; ?>"></span>
|
429 |
+
</span>
|
430 |
+
</label>
|
431 |
+
</div>
|
432 |
+
|
433 |
<div class="lh40">
|
434 |
<label for="bmi-db-single-file-backup">
|
435 |
<input type="checkbox" id="bmi-db-single-file-backup"<?php bmi_try_checked('OTHER:BACKUP:DB:SINGLE:FILE'); ?> />
|
436 |
+
<span class="relative">
|
437 |
+
<?php _e("Deprecated: Force the plugin to backup all tables into one file.", 'backup-backup'); ?>
|
438 |
+
<span class="bmi-info-icon tooltip" tooltip="<?php echo $deprecatedsinglefile; ?>"></span>
|
439 |
+
</span>
|
440 |
</label>
|
441 |
</div>
|
442 |
|
443 |
</div>
|
444 |
|
445 |
+
<!-- -->
|
446 |
+
<div class="mm mbl">
|
447 |
+
<div class="f20 bold">
|
448 |
+
<?php _e("Trust settings", 'backup-backup'); ?>
|
449 |
+
</div>
|
450 |
+
<div class="mtlll lh40">
|
451 |
+
<label for="bmi-do-not-check-free-space-backup">
|
452 |
+
<input type="checkbox" id="bmi-do-not-check-free-space-backup"<?php bmi_try_checked('OTHER:BACKUP:SPACE:CHECKING'); ?> />
|
453 |
+
<span class="relative">
|
454 |
+
<?php _e("Disable space checking during backup process - please read additional info.", 'backup-backup'); ?>
|
455 |
+
<span class="bmi-info-icon tooltip" tooltip="<?php echo $disabledspacechecking; ?>"></span>
|
456 |
+
</span>
|
457 |
+
</label>
|
458 |
+
</div>
|
459 |
+
</div>
|
460 |
+
|
461 |
<!-- -->
|
462 |
<div class="mm mbl">
|
463 |
<div class="f20 bold">
|
includes/dashboard/chapter/troubleshooting.php
CHANGED
@@ -168,7 +168,7 @@
|
|
168 |
} elseif (is_bool($value)) {
|
169 |
echo $value === true ? 'true' : 'false';
|
170 |
} else {
|
171 |
-
if (strlen($value) == '0') {
|
172 |
echo '---';
|
173 |
} else {
|
174 |
echo $value;
|
168 |
} elseif (is_bool($value)) {
|
169 |
echo $value === true ? 'true' : 'false';
|
170 |
} else {
|
171 |
+
if (!$value || is_null($value) || strlen($value) == '0') {
|
172 |
echo '---';
|
173 |
} else {
|
174 |
echo $value;
|
includes/dashboard/modals/after-logs-sent.php
CHANGED
@@ -10,13 +10,15 @@
|
|
10 |
|
11 |
$bmiSupportForumUrl = "https://wordpress.org/support/plugin/backup-backup/";
|
12 |
$bmiSupportEmail = "support" . "@" . "backupbliss" . "." . "com";
|
13 |
-
$bmiSupportMessage = __('Now open a new thread in the %s1support forum%s2, and share there your debug code.');
|
14 |
$bmiSupportMessage = str_replace('%s1', '<a href="' . $bmiSupportForumUrl . '" class="secondary hoverable" target="_blank">', $bmiSupportMessage);
|
15 |
$bmiSupportMessage = str_replace('%s2', '</a>', $bmiSupportMessage);
|
16 |
|
17 |
$bmiSupportMessage2 = __('Please email us the code to %s1, so that we can start investigating. Thank you!', 'backup-backup');
|
18 |
$bmiSupportMessage2 = str_replace('%s1', '<a href="mailto:' . $bmiSupportEmail . '" class="secondary hoverable" target="_blank">' . $bmiSupportEmail . '</a>', $bmiSupportMessage2);
|
19 |
|
|
|
|
|
20 |
?>
|
21 |
|
22 |
<div class="modal modal-no-close" id="after-logs-sent-modal" data-error-source="manual">
|
@@ -49,7 +51,9 @@
|
|
49 |
|
50 |
<?php if (!defined('BMI_BACKUP_PRO')): ?>
|
51 |
<div class="mm60 f18 mbl">
|
52 |
-
<?php echo $bmiSupportMessage;
|
|
|
|
|
53 |
|
54 |
<div class="center mbll mtl">
|
55 |
<a class="btn inline semibold mm60 f16" href="https://wordpress.org/support/plugin/backup-backup/" target="_blank">
|
10 |
|
11 |
$bmiSupportForumUrl = "https://wordpress.org/support/plugin/backup-backup/";
|
12 |
$bmiSupportEmail = "support" . "@" . "backupbliss" . "." . "com";
|
13 |
+
$bmiSupportMessage = __('Now open a new thread in the %s1support forum%s2, and share there your debug code.', 'backup-backup');
|
14 |
$bmiSupportMessage = str_replace('%s1', '<a href="' . $bmiSupportForumUrl . '" class="secondary hoverable" target="_blank">', $bmiSupportMessage);
|
15 |
$bmiSupportMessage = str_replace('%s2', '</a>', $bmiSupportMessage);
|
16 |
|
17 |
$bmiSupportMessage2 = __('Please email us the code to %s1, so that we can start investigating. Thank you!', 'backup-backup');
|
18 |
$bmiSupportMessage2 = str_replace('%s1', '<a href="mailto:' . $bmiSupportEmail . '" class="secondary hoverable" target="_blank">' . $bmiSupportEmail . '</a>', $bmiSupportMessage2);
|
19 |
|
20 |
+
$bmiSupportMessage3 = __('Please also provide some details like, my migration/backup failed at x%.', 'backup-backup');
|
21 |
+
$bmiSupportMessage4 = __('Otherwise forum moderators may remove the topic.', 'backup-backup');
|
22 |
?>
|
23 |
|
24 |
<div class="modal modal-no-close" id="after-logs-sent-modal" data-error-source="manual">
|
51 |
|
52 |
<?php if (!defined('BMI_BACKUP_PRO')): ?>
|
53 |
<div class="mm60 f18 mbl">
|
54 |
+
<?php echo $bmiSupportMessage; ?><br /><br />
|
55 |
+
<?php echo $bmiSupportMessage3; ?><br />
|
56 |
+
<?php echo $bmiSupportMessage4; ?>
|
57 |
|
58 |
<div class="center mbll mtl">
|
59 |
<a class="btn inline semibold mm60 f16" href="https://wordpress.org/support/plugin/backup-backup/" target="_blank">
|
includes/dashboard/modals/restore-error-modal.php
CHANGED
@@ -51,7 +51,7 @@
|
|
51 |
</div>
|
52 |
|
53 |
<div class="mm60 f18 center mb mtl">
|
54 |
-
<a href="#" class="modal-closer text-muted" data-close="
|
55 |
</div>
|
56 |
|
57 |
</div>
|
51 |
</div>
|
52 |
|
53 |
<div class="mm60 f18 center mb mtl">
|
54 |
+
<a href="#" class="modal-closer text-muted" data-close="restore-error-modal"><?php _e('Close window', 'backup-backup') ?></a>
|
55 |
</div>
|
56 |
|
57 |
</div>
|
includes/database/better-backup-v3.php
CHANGED
@@ -66,7 +66,7 @@ class BMI_Database_Exporter {
|
|
66 |
*
|
67 |
* @return self
|
68 |
*/
|
69 |
-
function __construct($storage, &$logger) {
|
70 |
|
71 |
/**
|
72 |
* WP Global Database variable
|
@@ -102,8 +102,13 @@ class BMI_Database_Exporter {
|
|
102 |
$this->max_query_size = 1 * 1024 * 1024;
|
103 |
|
104 |
$this->table_prefix = time();
|
|
|
|
|
|
|
105 |
$this->init_start = microtime(true);
|
106 |
-
$
|
|
|
|
|
107 |
|
108 |
}
|
109 |
|
@@ -112,33 +117,47 @@ class BMI_Database_Exporter {
|
|
112 |
*
|
113 |
* @return filename/filenames
|
114 |
*/
|
115 |
-
public function export() {
|
116 |
|
117 |
// Table names
|
118 |
-
$this->get_table_names_and_sizes();
|
119 |
-
|
120 |
-
|
|
|
|
|
121 |
|
122 |
// Recipes
|
123 |
-
$
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
127 |
|
128 |
// Save Recipes
|
129 |
-
$
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
|
134 |
// Tables data
|
135 |
-
$
|
136 |
-
|
137 |
-
|
138 |
-
$this->
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
$
|
141 |
-
|
|
|
|
|
|
|
|
|
142 |
|
143 |
}
|
144 |
|
@@ -147,24 +166,24 @@ class BMI_Database_Exporter {
|
|
147 |
*
|
148 |
* @return {array} associative array table_name => [size => its size in MB, rows => rows count]
|
149 |
*/
|
150 |
-
private function get_table_names_and_sizes() {
|
151 |
|
152 |
$tables = $this->wpdb->get_results('SHOW TABLES');
|
153 |
$shouldExcludeTables = Dashboard\bmi_get_config('BACKUP:DATABASE:EXCLUDE');
|
154 |
|
155 |
$excludedTables = [];
|
156 |
-
|
157 |
-
|
158 |
-
if (!is_array($excludedTables) || empty($excludedTables)) $excludedTables = [];
|
159 |
-
}
|
160 |
|
161 |
foreach ($tables as $table_index => $table_object) {
|
162 |
foreach ($table_object as $database_name => $table_name) {
|
163 |
|
164 |
-
if (in_array($table_name, $excludedTables) && $shouldExcludeTables) {
|
165 |
$str = __('Excluding %s table from backup (due to exclusion rules).', 'backup-backup');
|
166 |
$str = str_replace('%s', $table_name, $str);
|
167 |
-
$
|
|
|
|
|
168 |
|
169 |
continue;
|
170 |
}
|
@@ -176,13 +195,17 @@ class BMI_Database_Exporter {
|
|
176 |
$results = $this->wpdb->get_results($this->wpdb->prepare($query, DB_NAME, $table_name));
|
177 |
|
178 |
if (!is_object($results[0])) {
|
179 |
-
$
|
|
|
|
|
180 |
continue;
|
181 |
}
|
182 |
|
183 |
$table_name_returned = trim($results[0]->table);
|
184 |
if ($table_name != $table_name_returned || strlen(trim($table_name)) <= 0) {
|
185 |
-
$
|
|
|
|
|
186 |
continue;
|
187 |
}
|
188 |
|
@@ -310,12 +333,29 @@ class BMI_Database_Exporter {
|
|
310 |
*
|
311 |
* @return {int} Total rows count
|
312 |
*/
|
313 |
-
private function get_tables_data() {
|
|
|
|
|
|
|
|
|
314 |
|
315 |
foreach ($this->tables_by_size as $table_name => $table_object) {
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
$start_time = microtime(true);
|
318 |
-
|
|
|
|
|
319 |
$rows = intval($table_object['rows']);
|
320 |
|
321 |
$this->wpdb->query("SET foreign_key_checks = 0;");
|
@@ -323,44 +363,99 @@ class BMI_Database_Exporter {
|
|
323 |
$currentBufferSize = 0;
|
324 |
$bufferResult = [];
|
325 |
|
326 |
-
|
|
|
327 |
|
328 |
-
|
329 |
-
|
330 |
|
331 |
-
|
332 |
-
|
333 |
-
$valuesBytesSize = $valuesSize['size'] - $currentBufferSize;
|
334 |
-
$valuesMaxRow = $valuesSize['index'];
|
335 |
-
$valuesLimit = $valuesSize['limit'];
|
336 |
|
337 |
-
|
|
|
|
|
|
|
|
|
338 |
|
339 |
-
|
340 |
-
$currentBufferSize += $valuesBytesSize;
|
341 |
|
342 |
-
|
|
|
|
|
343 |
|
344 |
-
|
345 |
|
346 |
-
$currentBufferSize
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
|
351 |
}
|
352 |
|
353 |
-
|
|
|
354 |
|
355 |
-
|
356 |
|
357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
-
|
360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
}
|
365 |
|
366 |
/**
|
66 |
*
|
67 |
* @return self
|
68 |
*/
|
69 |
+
function __construct($storage, &$logger, $batcher = false, $backupStart = false) {
|
70 |
|
71 |
/**
|
72 |
* WP Global Database variable
|
102 |
$this->max_query_size = 1 * 1024 * 1024;
|
103 |
|
104 |
$this->table_prefix = time();
|
105 |
+
if ($backupStart && $backupStart !== false && is_numeric($backupStart)) {
|
106 |
+
$this->table_prefix = $backupStart;
|
107 |
+
}
|
108 |
$this->init_start = microtime(true);
|
109 |
+
if ($batcher === false || $batcher === 0) {
|
110 |
+
$this->logger->log("Memory usage after initialization: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
111 |
+
}
|
112 |
|
113 |
}
|
114 |
|
117 |
*
|
118 |
* @return filename/filenames
|
119 |
*/
|
120 |
+
public function export($batchingStep = false, $indexEnded = 0) {
|
121 |
|
122 |
// Table names
|
123 |
+
$this->get_table_names_and_sizes($batchingStep);
|
124 |
+
if ($batchingStep === false || $batchingStep === 0) {
|
125 |
+
$this->logger->log("Scan found $this->total_tables tables ($this->total_rows rows), estimated total size: $this->total_size MB.", 'INFO');
|
126 |
+
$this->logger->log("Memory usage after getting table names: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB ", 'INFO');
|
127 |
+
}
|
128 |
|
129 |
// Recipes
|
130 |
+
if ($batchingStep === false || $batchingStep === 0) {
|
131 |
+
$this->logger->log("Getting table recipes...", 'INFO');
|
132 |
+
$this->table_recipes();
|
133 |
+
$this->logger->log("Table recipes have been exported.", 'INFO');
|
134 |
+
$this->logger->log("Memory usage after loading recipes: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB ", 'INFO');
|
135 |
+
}
|
136 |
|
137 |
// Save Recipes
|
138 |
+
if ($batchingStep === false || $batchingStep === 0) {
|
139 |
+
$this->logger->log("Saving recipes...", 'INFO');
|
140 |
+
$this->save_recipes();
|
141 |
+
$this->logger->log("Recipes saved.", 'INFO');
|
142 |
+
$this->logger->log("Memory usage after recipe off-load: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
143 |
+
}
|
144 |
|
145 |
// Tables data
|
146 |
+
if ($batchingStep === false || $batchingStep === 0) {
|
147 |
+
$this->logger->log("Exporting table data...", 'INFO');
|
148 |
+
}
|
149 |
+
$finishedAt = $this->get_tables_data($batchingStep, $indexEnded);
|
150 |
+
if ($batchingStep === false || $finishedAt['dumpCompleted'] === true) {
|
151 |
+
$this->logger->log("Table data exported.", 'INFO');
|
152 |
+
$this->logger->log("Memory usage after data export: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB", 'INFO');
|
153 |
+
}
|
154 |
|
155 |
+
if ($batchingStep === false) {
|
156 |
+
$end = number_format(microtime(true) - $this->init_start, 4);
|
157 |
+
$this->logger->log("Entire process took: $end s", 'INFO');
|
158 |
+
}
|
159 |
+
|
160 |
+
return $finishedAt;
|
161 |
|
162 |
}
|
163 |
|
166 |
*
|
167 |
* @return {array} associative array table_name => [size => its size in MB, rows => rows count]
|
168 |
*/
|
169 |
+
private function get_table_names_and_sizes($batchingStep) {
|
170 |
|
171 |
$tables = $this->wpdb->get_results('SHOW TABLES');
|
172 |
$shouldExcludeTables = Dashboard\bmi_get_config('BACKUP:DATABASE:EXCLUDE');
|
173 |
|
174 |
$excludedTables = [];
|
175 |
+
$excludedTables = Dashboard\bmi_get_config('BACKUP:DATABASE:EXCLUDE:LIST');
|
176 |
+
if (!is_array($excludedTables) || empty($excludedTables)) $excludedTables = [];
|
|
|
|
|
177 |
|
178 |
foreach ($tables as $table_index => $table_object) {
|
179 |
foreach ($table_object as $database_name => $table_name) {
|
180 |
|
181 |
+
if (in_array($table_name, $excludedTables) && $shouldExcludeTables == 'true') {
|
182 |
$str = __('Excluding %s table from backup (due to exclusion rules).', 'backup-backup');
|
183 |
$str = str_replace('%s', $table_name, $str);
|
184 |
+
if ($batchingStep === false || intval($batchingStep) === 0) {
|
185 |
+
$this->logger->log($str, 'INFO');
|
186 |
+
}
|
187 |
|
188 |
continue;
|
189 |
}
|
195 |
$results = $this->wpdb->get_results($this->wpdb->prepare($query, DB_NAME, $table_name));
|
196 |
|
197 |
if (!is_object($results[0])) {
|
198 |
+
if ($batchingStep === false || intval($batchingStep) === 0) {
|
199 |
+
$this->logger->log("Could not get info about: $table_name (#01)", 'WARN');
|
200 |
+
}
|
201 |
continue;
|
202 |
}
|
203 |
|
204 |
$table_name_returned = trim($results[0]->table);
|
205 |
if ($table_name != $table_name_returned || strlen(trim($table_name)) <= 0) {
|
206 |
+
if ($batchingStep === false || intval($batchingStep) === 0) {
|
207 |
+
$this->logger->log("Could not get info about: $table_name (#02)", 'WARN');
|
208 |
+
}
|
209 |
continue;
|
210 |
}
|
211 |
|
333 |
*
|
334 |
* @return {int} Total rows count
|
335 |
*/
|
336 |
+
private function get_tables_data($batchingStep = false, $indexEnded = 0) {
|
337 |
+
|
338 |
+
$finishedAt = 0;
|
339 |
+
$currentTableIndex = 0;
|
340 |
+
$dumpCompleted = true;
|
341 |
|
342 |
foreach ($this->tables_by_size as $table_name => $table_object) {
|
343 |
|
344 |
+
$emptyTable = false;
|
345 |
+
$currentTableIndex = $currentTableIndex + 1;
|
346 |
+
|
347 |
+
if ($batchingStep !== false) {
|
348 |
+
if (intval($currentTableIndex - 1) !== intval($batchingStep)) {
|
349 |
+
continue;
|
350 |
+
} else {
|
351 |
+
$dumpCompleted = false;
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
$start_time = microtime(true);
|
356 |
+
if ($batchingStep === false || intval($indexEnded) === 0) {
|
357 |
+
$this->logger->log("Getting data of table: " . $table_name . " (" . $currentTableIndex . "/" . $this->total_tables . ", " . number_format($table_object['size'], 2) . " MB)", 'STEP');
|
358 |
+
}
|
359 |
$rows = intval($table_object['rows']);
|
360 |
|
361 |
$this->wpdb->query("SET foreign_key_checks = 0;");
|
363 |
$currentBufferSize = 0;
|
364 |
$bufferResult = [];
|
365 |
|
366 |
+
$i = 0;
|
367 |
+
if ($batchingStep !== false) $i = $indexEnded;
|
368 |
|
369 |
+
if (intval($table_object['rows']) > 0) {
|
370 |
+
for (;$i < $rows;) {
|
371 |
|
372 |
+
$query = $this->wpdb->prepare("SELECT * FROM `$table_name` LIMIT %d, $this->max_rows", $i);
|
373 |
+
$result = $this->wpdb->get_results($query);
|
|
|
|
|
|
|
374 |
|
375 |
+
$valuesSize = $this->getArraySize($result, $currentBufferSize);
|
376 |
+
$rowsAmount = sizeof($result);
|
377 |
+
$valuesBytesSize = $valuesSize['size'] - $currentBufferSize;
|
378 |
+
$valuesMaxRow = $valuesSize['index'];
|
379 |
+
$valuesLimit = $valuesSize['limit'];
|
380 |
|
381 |
+
if ($valuesMaxRow < $rowsAmount && $valuesMaxRow != 0) $result = array_slice($result, 0, $valuesMaxRow);
|
|
|
382 |
|
383 |
+
$i += $valuesMaxRow;
|
384 |
+
$currentBufferSize += $valuesBytesSize;
|
385 |
+
$finishedAt = $i;
|
386 |
|
387 |
+
if ($valuesMaxRow != 0) $bufferResult = array_merge($bufferResult, $result);
|
388 |
|
389 |
+
if ($currentBufferSize >= $this->max_query_size || $i >= $rows || $valuesLimit == true) {
|
390 |
+
|
391 |
+
$currentBufferSize = 0;
|
392 |
+
$this->save_data($bufferResult, $table_name);
|
393 |
+
unset($bufferResult);
|
394 |
+
$bufferResult = [];
|
395 |
+
|
396 |
+
if ($batchingStep !== false) break;
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
unset($result);
|
401 |
|
402 |
}
|
403 |
|
404 |
+
$percentg = 100;
|
405 |
+
if (intval($table_object['rows']) !== 0 && is_numeric(intval($table_object['rows']))) {
|
406 |
|
407 |
+
$percentg = number_format(($i / intval($table_object['rows']) * 100), 2);
|
408 |
|
409 |
+
}
|
410 |
+
|
411 |
+
if ($i >= $rows && $batchingStep !== false) {
|
412 |
+
|
413 |
+
$batchingStep = $batchingStep + 1;
|
414 |
+
$finishedAt = 0;
|
415 |
+
|
416 |
+
$this->logger->log("Milestone of table " . $table_name . ": " . $i . "/" . $table_object['rows'] . " rows (" . $percentg . "%, " . number_format((microtime(true) - $start_time), 5) . "s)", 'INFO');
|
417 |
+
$this->logger->log("Table export for: " . $table_name . " finished", 'SUCCESS');
|
418 |
+
|
419 |
+
} else if ($batchingStep !== false) {
|
420 |
+
|
421 |
+
$this->logger->log("Milestone of table " . $table_name . ": " . $i . "/" . $table_object['rows'] . " rows (" . $percentg . "%, " . number_format((microtime(true) - $start_time), 5) . "s)", 'INFO');
|
422 |
+
|
423 |
+
}
|
424 |
+
|
425 |
+
$this->wpdb->query("SET foreign_key_checks = 1;");
|
426 |
+
|
427 |
+
if ($batchingStep === false) {
|
428 |
+
|
429 |
+
$this->logger->log("Table export for: " . $table_name . " finished (" . number_format((microtime(true) - $start_time), 5) . "s)", 'SUCCESS');
|
430 |
+
|
431 |
+
}
|
432 |
|
433 |
+
unset($start_time);
|
434 |
+
|
435 |
+
} else {
|
436 |
+
|
437 |
+
$this->logger->log("Table " . $table_name . " is empty, saving only recipe.", 'INFO');
|
438 |
+
$emptyTable = true;
|
439 |
+
|
440 |
+
if ($batchingStep !== false) {
|
441 |
+
|
442 |
+
$batchingStep = $batchingStep + 1;
|
443 |
+
$finishedAt = 0;
|
444 |
+
|
445 |
+
}
|
446 |
+
|
447 |
+
}
|
448 |
+
|
449 |
+
if ($batchingStep !== false && $emptyTable === false) break;
|
450 |
|
451 |
}
|
452 |
|
453 |
+
return [
|
454 |
+
'finishedQuery' => $finishedAt,
|
455 |
+
'batchingStep' => $batchingStep,
|
456 |
+
'dumpCompleted' => $dumpCompleted
|
457 |
+
];
|
458 |
+
|
459 |
}
|
460 |
|
461 |
/**
|
includes/database/better-backup.php
CHANGED
@@ -295,7 +295,7 @@ class BMI_Database_Exporter {
|
|
295 |
foreach ($this->tables_by_size as $table_name => $table_object) {
|
296 |
|
297 |
$start_time = microtime(true);
|
298 |
-
$this->logger->log("Getting data of table: " . $table_name . " (" . number_format ($table_object['size'], 2) . " MB)", '
|
299 |
$rows = intval($table_object['rows']);
|
300 |
|
301 |
$this->wpdb->query("SET foreign_key_checks = 0;");
|
295 |
foreach ($this->tables_by_size as $table_name => $table_object) {
|
296 |
|
297 |
$start_time = microtime(true);
|
298 |
+
$this->logger->log("Getting data of table: " . $table_name . " (" . number_format ($table_object['size'], 2) . " MB)", 'STEP');
|
299 |
$rows = intval($table_object['rows']);
|
300 |
|
301 |
$this->wpdb->query("SET foreign_key_checks = 0;");
|
includes/database/even-better-restore-v3.php
CHANGED
@@ -170,7 +170,7 @@ class BMI_Even_Better_Database_Restore {
|
|
170 |
$str = __("Started restoration of %table_name% %total_tables% table", 'backup-backup');
|
171 |
$str = str_replace('%table_name%', $realTableName, $str);
|
172 |
$str = str_replace('%total_tables%', $this->getTableProgress(), $str);
|
173 |
-
$this->logger->log($str, '
|
174 |
|
175 |
// Check if file can be cleaned
|
176 |
$this->filterFile($filePath, basename($filePath));
|
@@ -320,7 +320,16 @@ class BMI_Even_Better_Database_Restore {
|
|
320 |
|
321 |
}
|
322 |
|
323 |
-
private function performReplace() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'search-replace.php';
|
326 |
|
@@ -330,100 +339,200 @@ class BMI_Even_Better_Database_Restore {
|
|
330 |
$backupDomain = $this->parseDomain($this->manifest->dbdomain);
|
331 |
$currentDomain = $this->parseDomain(get_option('siteurl'), false);
|
332 |
|
333 |
-
$
|
|
|
334 |
|
335 |
-
$
|
|
|
|
|
336 |
|
337 |
-
if ($
|
338 |
-
$this->
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
$
|
|
|
343 |
}
|
344 |
|
345 |
-
|
346 |
|
347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
|
349 |
-
|
350 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
-
$
|
353 |
-
$
|
354 |
-
$info = str_replace('%rows%', $drows, $info);
|
355 |
-
$info = str_replace('%changes%', $dchange, $info);
|
356 |
-
$info = str_replace('%updates%', $dupdates, $info);
|
357 |
|
358 |
-
|
359 |
|
360 |
-
|
361 |
|
362 |
-
|
363 |
-
|
364 |
|
365 |
-
|
|
|
366 |
|
367 |
-
|
368 |
-
$ssl = is_ssl() == true ? 'https://' : 'http://';
|
369 |
|
370 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
-
|
373 |
-
"https://www." . $backupDomain,
|
374 |
-
"http://www." . $backupDomain,
|
375 |
-
"https://" . $backupDomain,
|
376 |
-
"http://" . $backupDomain,
|
377 |
-
$backupDomain
|
378 |
-
];
|
379 |
|
380 |
-
|
381 |
-
$ssl . $currentDomain,
|
382 |
-
$ssl . $currentDomain,
|
383 |
-
$ssl . $currentDomain,
|
384 |
-
$ssl . $currentDomain,
|
385 |
-
$currentDomain
|
386 |
-
];
|
387 |
|
388 |
-
|
389 |
-
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
390 |
-
$progress++; $this->logger->progress(90 + $progress);
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
395 |
|
396 |
-
|
397 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
398 |
-
$progress++; $this->logger->progress(90 + $progress);
|
399 |
|
400 |
-
|
401 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
402 |
-
$progress++; $this->logger->progress(90 + $progress);
|
403 |
|
404 |
-
if (!(substr($currentDomain, -strlen($backupDomain)) === $backupDomain)) {
|
405 |
-
$r = $replaceEngine->perform($possibleDomainsBackup[4], $possibleDomainsCurrent[4]);
|
406 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
407 |
}
|
408 |
-
|
409 |
|
410 |
-
|
411 |
-
$
|
412 |
-
|
413 |
-
|
414 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
-
|
417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
|
419 |
-
|
420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
}
|
422 |
|
423 |
-
|
424 |
-
|
|
|
|
|
425 |
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
}
|
429 |
|
@@ -437,7 +546,9 @@ class BMI_Even_Better_Database_Restore {
|
|
437 |
'bluehost-wordpress-plugin/bluehost-wordpress-plugin.php',
|
438 |
'sg-cachepress/sg-cachepress.php',
|
439 |
'wordpress-starter/siteground-wizard.php',
|
440 |
-
'revslider/revslider.php'
|
|
|
|
|
441 |
];
|
442 |
|
443 |
for ($i = 0; $i < sizeof($plugins_copy); ++$i) {
|
@@ -580,11 +691,18 @@ class BMI_Even_Better_Database_Restore {
|
|
580 |
|
581 |
}
|
582 |
|
583 |
-
public function
|
584 |
|
585 |
$this->logger->progress(90);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
$this->prepareFinalDatabase();
|
587 |
-
$this->
|
588 |
$this->enablePlugins();
|
589 |
|
590 |
}
|
@@ -617,7 +735,11 @@ class BMI_Even_Better_Database_Restore {
|
|
617 |
$wpdb->query($sql);
|
618 |
|
619 |
$active_plugins = $wpdb->get_results('SELECT option_value FROM `' . $options_table . '` WHERE option_name = "active_plugins"');
|
620 |
-
$active_plugins
|
|
|
|
|
|
|
|
|
621 |
|
622 |
$this->seek['active_plugins'] = $active_plugins;
|
623 |
|
170 |
$str = __("Started restoration of %table_name% %total_tables% table", 'backup-backup');
|
171 |
$str = str_replace('%table_name%', $realTableName, $str);
|
172 |
$str = str_replace('%total_tables%', $this->getTableProgress(), $str);
|
173 |
+
$this->logger->log($str, 'STEP');
|
174 |
|
175 |
// Check if file can be cleaned
|
176 |
$this->filterFile($filePath, basename($filePath));
|
320 |
|
321 |
}
|
322 |
|
323 |
+
private function performReplace($step = 0, $tableIndex = 0, $currentPage = 0, $totalPages = 0, $fieldAdjustments = 0) {
|
324 |
+
|
325 |
+
$status = [
|
326 |
+
'step' => $step,
|
327 |
+
'tableIndex' => $tableIndex,
|
328 |
+
'finished' => false,
|
329 |
+
'currentPage' => $currentPage,
|
330 |
+
'totalPages' => $totalPages,
|
331 |
+
'fieldAdjustments' => $fieldAdjustments
|
332 |
+
];
|
333 |
|
334 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'search-replace.php';
|
335 |
|
339 |
$backupDomain = $this->parseDomain($this->manifest->dbdomain);
|
340 |
$currentDomain = $this->parseDomain(get_option('siteurl'), false);
|
341 |
|
342 |
+
$currentTable = false;
|
343 |
+
$allTables = array_keys($this->map['tables']);
|
344 |
|
345 |
+
if ($tableIndex < sizeof($allTables) && array_key_exists($tableIndex, $allTables)) {
|
346 |
+
$currentTable = $allTables[$tableIndex];
|
347 |
+
}
|
348 |
|
349 |
+
if ($currentTable == false && !$currentTable) {
|
350 |
+
if ($backupRootDir != $currentRootDir || $currentDomain != $this->parseDomain($backupDomain, false)) {
|
351 |
+
$this->logger->log(__('Search & Replace finished successfully.', 'backup-backup'), 'SUCCESS');
|
352 |
+
}
|
353 |
+
|
354 |
+
$status['finished'] = true;
|
355 |
+
return $status;
|
356 |
}
|
357 |
|
358 |
+
$replaceEngine = new BMISearchReplace([$currentTable], $currentPage, $totalPages);
|
359 |
|
360 |
+
if ($step == 0) {
|
361 |
+
if ($backupRootDir != $currentRootDir || $currentDomain != $this->parseDomain($backupDomain, false)) {
|
362 |
+
$this->logger->log(__('Performing Search & Replace', 'backup-backup'), 'STEP');
|
363 |
+
$pagesize = '?';
|
364 |
+
if (defined('BMI_MAX_SEARCH_REPLACE_PAGE')) $pagesize = BMI_MAX_SEARCH_REPLACE_PAGE;
|
365 |
+
$this->logger->log(__('Page size for that restoration: ', 'backup-backup') . $pagesize, 'INFO');
|
366 |
+
$status['step'] = $step + 1; $step++;
|
367 |
+
} else {
|
368 |
+
$this->logger->log(__('This backup was made on the same site, ommiting search & replace.', 'backup-backup'), 'INFO');
|
369 |
+
$status['finished'] = true;
|
370 |
+
return $status;
|
371 |
+
}
|
372 |
+
}
|
373 |
|
374 |
+
if ($step == 1) {
|
375 |
+
$replaceProgress = ($tableIndex + 1) . "/" . sizeof($allTables);
|
376 |
+
$replaceProgressPercentage = number_format((($tableIndex + 1) / sizeof($allTables) * 100), 2);
|
377 |
+
$progressLogT = __('Performing database adjustments for table %progress%: %table_name% (%progress_percentage%)', 'backup-backup');
|
378 |
+
$progressLogT = str_replace('%progress%', $replaceProgress, $progressLogT);
|
379 |
+
$progressLogT = str_replace('%table_name%', $currentTable, $progressLogT);
|
380 |
+
$progressLogT = str_replace('%progress_percentage%', $replaceProgressPercentage . '%', $progressLogT);
|
381 |
+
$this->logger->log($progressLogT, 'STEP');
|
382 |
|
383 |
+
$percentageProgress = number_format($replaceProgressPercentage, 0);
|
384 |
+
$this->logger->progress(number_format(90 + ($percentageProgress / 100) * 8, 0));
|
|
|
|
|
|
|
385 |
|
386 |
+
if ($backupRootDir != $currentRootDir) {
|
387 |
|
388 |
+
$dtables = 0; $drows = 0; $dchange = 0; $dupdates = 0;
|
389 |
|
390 |
+
$r = $replaceEngine->perform($backupRootDir, $currentRootDir);
|
391 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
392 |
|
393 |
+
$status['currentPage'] = $r['currentPage'];
|
394 |
+
$status['totalPages'] = $r['totalPages'];
|
395 |
|
396 |
+
if ($status['totalPages'] > 0) {
|
|
|
397 |
|
398 |
+
$info = __("Batch for path adjustment (%page%/%allPages%) updated: %updates% fields.", 'backup-backup');
|
399 |
+
$updates = $dupdates;
|
400 |
+
if ($updates == 0) $updates = 1;
|
401 |
+
$info = str_replace('%page%', $status['currentPage'], $info);
|
402 |
+
$info = str_replace('%allPages%', $status['totalPages'], $info);
|
403 |
+
$info = str_replace('%updates%', $updates, $info);
|
404 |
+
$this->logger->log($info, 'INFO');
|
405 |
+
$status['fieldAdjustments']++;
|
406 |
|
407 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
+
// $this->logger->log(__('Path adjustments are not required for this table.', 'backup-backup'), 'INFO');
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
+
}
|
|
|
|
|
412 |
|
413 |
+
if ($status['currentPage'] >= $status['totalPages']) {
|
414 |
+
$status['currentPage'] = 0;
|
415 |
+
$status['totalPages'] = 0;
|
416 |
+
$status['step'] = $step + 1;
|
417 |
+
}
|
418 |
+
return $status;
|
419 |
|
420 |
+
} else {
|
|
|
|
|
421 |
|
422 |
+
$status['step'] = $step + 1; $step++;
|
|
|
|
|
423 |
|
|
|
|
|
|
|
424 |
}
|
425 |
+
}
|
426 |
|
427 |
+
if ($step == 2 || $step == 3 || $step == 4 || $step == 5 || $step == 6 || $step == 7) {
|
428 |
+
if ($currentDomain != $this->parseDomain($backupDomain, false)) {
|
429 |
+
$ssl = is_ssl() == true ? 'https://' : 'http://';
|
430 |
+
|
431 |
+
$dtables = 0; $drows = 0; $dchange = 0; $dupdates = 0;
|
432 |
+
|
433 |
+
$possibleDomainsBackup = [
|
434 |
+
"https://www." . $backupDomain,
|
435 |
+
"http://www." . $backupDomain,
|
436 |
+
"https://" . $backupDomain,
|
437 |
+
"http://" . $backupDomain,
|
438 |
+
'www.' . $backupDomain,
|
439 |
+
$backupDomain
|
440 |
+
];
|
441 |
+
|
442 |
+
$possibleDomainsCurrent = [
|
443 |
+
$ssl . $currentDomain,
|
444 |
+
$ssl . $currentDomain,
|
445 |
+
$ssl . $currentDomain,
|
446 |
+
$ssl . $currentDomain,
|
447 |
+
$currentDomain,
|
448 |
+
$currentDomain
|
449 |
+
];
|
450 |
+
|
451 |
+
if ($step == 2) {
|
452 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[0], $possibleDomainsCurrent[0]);
|
453 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
454 |
+
}
|
455 |
|
456 |
+
if ($step == 3) {
|
457 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[1], $possibleDomainsCurrent[1]);
|
458 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
459 |
+
}
|
460 |
+
|
461 |
+
if ($step == 4) {
|
462 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[2], $possibleDomainsCurrent[2]);
|
463 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
464 |
+
}
|
465 |
+
|
466 |
+
if ($step == 5) {
|
467 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[3], $possibleDomainsCurrent[3]);
|
468 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
469 |
+
}
|
470 |
|
471 |
+
if ($step == 6) {
|
472 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[4], $possibleDomainsCurrent[4]);
|
473 |
+
$dchange += $r['change']; $dupdates += $r['updates'];
|
474 |
+
}
|
475 |
+
|
476 |
+
if ($step == 7) {
|
477 |
+
if (!(substr($currentDomain, -strlen($backupDomain)) === $backupDomain)) {
|
478 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[5], $possibleDomainsCurrent[5]);
|
479 |
+
$dchange += $r['change']; $dupdates += $r['updates'];
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
$status['currentPage'] = $r['currentPage'];
|
484 |
+
$status['totalPages'] = $r['totalPages'];
|
485 |
+
|
486 |
+
$variants = [
|
487 |
+
__('variant A', 'backup-backup'),
|
488 |
+
__('variant B', 'backup-backup'),
|
489 |
+
__('variant C', 'backup-backup'),
|
490 |
+
__('variant D', 'backup-backup'),
|
491 |
+
__('variant E', 'backup-backup'),
|
492 |
+
__('variant F', 'backup-backup')
|
493 |
+
];
|
494 |
+
|
495 |
+
if ($status['totalPages'] > 0) {
|
496 |
+
|
497 |
+
$info = __("Batch for domain (%variant%) adjustments (%page%/%allPages%) updated: %updates% fields.", 'backup-backup');
|
498 |
+
$updates = $dupdates;
|
499 |
+
if ($updates == 0) $updates = 1;
|
500 |
+
$info = str_replace('%variant%', $variants[$step - 2], $info);
|
501 |
+
$info = str_replace('%page%', $status['currentPage'], $info);
|
502 |
+
$info = str_replace('%allPages%', $status['totalPages'], $info);
|
503 |
+
$info = str_replace('%updates%', $updates, $info);
|
504 |
+
$this->logger->log($info, 'INFO');
|
505 |
+
$status['fieldAdjustments']++;
|
506 |
+
|
507 |
+
} else {
|
508 |
+
|
509 |
+
// $info = __('Domain (%variant%) adjustments are not required for this table.', 'backup-backup');
|
510 |
+
// $info = str_replace('%variant%', $variants[$step - 2], $info);
|
511 |
+
// $this->logger->log($info, 'INFO');
|
512 |
+
|
513 |
+
}
|
514 |
+
|
515 |
+
if ($status['currentPage'] >= $status['totalPages']) {
|
516 |
+
$status['currentPage'] = 0;
|
517 |
+
$status['totalPages'] = 0;
|
518 |
+
$status['step'] = $step + 1;
|
519 |
+
}
|
520 |
+
return $status;
|
521 |
+
}
|
522 |
}
|
523 |
|
524 |
+
if ($step == 8) {
|
525 |
+
if ($fieldAdjustments === 0) {
|
526 |
+
$this->logger->log(__('Adjustments are not required for this table.', 'backup-backup'), 'INFO');
|
527 |
+
}
|
528 |
|
529 |
+
$status['step'] = 1;
|
530 |
+
$status['fieldAdjustments'] = 0;
|
531 |
+
$status['tableIndex'] = $tableIndex + 1;
|
532 |
+
return $status;
|
533 |
+
}
|
534 |
+
|
535 |
+
return $status;
|
536 |
|
537 |
}
|
538 |
|
546 |
'bluehost-wordpress-plugin/bluehost-wordpress-plugin.php',
|
547 |
'sg-cachepress/sg-cachepress.php',
|
548 |
'wordpress-starter/siteground-wizard.php',
|
549 |
+
'revslider/revslider.php',
|
550 |
+
'easy-soundcloud-shortcode/easy-soundcloud-shortcode.php',
|
551 |
+
'easy-soundcloud-shortcode/EasySoundcloudShortcode.php'
|
552 |
];
|
553 |
|
554 |
for ($i = 0; $i < sizeof($plugins_copy); ++$i) {
|
691 |
|
692 |
}
|
693 |
|
694 |
+
public function searchReplace($step = 0, $tableIndex = 0, $currentPage = 0, $totalPages = 0, $fieldAdjustments = 0) {
|
695 |
|
696 |
$this->logger->progress(90);
|
697 |
+
return $this->performReplace($step, $tableIndex, $currentPage, $totalPages, $fieldAdjustments);
|
698 |
+
|
699 |
+
}
|
700 |
+
|
701 |
+
public function alter_tables() {
|
702 |
+
|
703 |
+
$this->logger->progress(98);
|
704 |
$this->prepareFinalDatabase();
|
705 |
+
$this->replaceTableNames($this->map['tables']);
|
706 |
$this->enablePlugins();
|
707 |
|
708 |
}
|
735 |
$wpdb->query($sql);
|
736 |
|
737 |
$active_plugins = $wpdb->get_results('SELECT option_value FROM `' . $options_table . '` WHERE option_name = "active_plugins"');
|
738 |
+
if ($active_plugins && sizeof($active_plugins) > 0) {
|
739 |
+
$active_plugins = $active_plugins[0]->option_value;
|
740 |
+
} else {
|
741 |
+
$active_plugins = '';
|
742 |
+
}
|
743 |
|
744 |
$this->seek['active_plugins'] = $active_plugins;
|
745 |
|
includes/database/even-better-restore-v4.php
CHANGED
@@ -19,7 +19,7 @@ use BMI\Plugin\Database\BMI_Search_Replace_Engine as BMISearchReplace;
|
|
19 |
if (!defined('ABSPATH')) exit;
|
20 |
|
21 |
/**
|
22 |
-
* Database Restore Enginge
|
23 |
*/
|
24 |
class BMI_Even_Better_Database_Restore {
|
25 |
|
@@ -170,7 +170,7 @@ class BMI_Even_Better_Database_Restore {
|
|
170 |
$str = __("Started restoration of %table_name% %total_tables% table", 'backup-backup');
|
171 |
$str = str_replace('%table_name%', $realTableName, $str);
|
172 |
$str = str_replace('%total_tables%', $this->getTableProgress(), $str);
|
173 |
-
$this->logger->log($str, '
|
174 |
|
175 |
// Check if file can be cleaned
|
176 |
$this->filterFile($filePath, basename($filePath));
|
@@ -209,6 +209,7 @@ class BMI_Even_Better_Database_Restore {
|
|
209 |
|
210 |
if ($total_size <= 0) $total_size = 1;
|
211 |
if (($seek - 5) <= 0) $seek = 6;
|
|
|
212 |
|
213 |
$progress = ($seek - 5) . '/' . $total_size . " (" . number_format(($seek - 5) / $total_size * 100, 2) . "%)";
|
214 |
$str = str_replace('%progress%', $progress, $str);
|
@@ -312,7 +313,16 @@ class BMI_Even_Better_Database_Restore {
|
|
312 |
|
313 |
}
|
314 |
|
315 |
-
private function performReplace() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
|
317 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'search-replace.php';
|
318 |
|
@@ -322,100 +332,200 @@ class BMI_Even_Better_Database_Restore {
|
|
322 |
$backupDomain = $this->parseDomain($this->manifest->dbdomain);
|
323 |
$currentDomain = $this->parseDomain(get_option('siteurl'), false);
|
324 |
|
325 |
-
$
|
|
|
326 |
|
327 |
-
$
|
|
|
|
|
328 |
|
329 |
-
if ($
|
330 |
-
$this->
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
$
|
|
|
335 |
}
|
336 |
|
337 |
-
|
338 |
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
-
|
342 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
-
$
|
345 |
-
$
|
346 |
-
$info = str_replace('%rows%', $drows, $info);
|
347 |
-
$info = str_replace('%changes%', $dchange, $info);
|
348 |
-
$info = str_replace('%updates%', $dupdates, $info);
|
349 |
|
350 |
-
|
351 |
|
352 |
-
|
353 |
|
354 |
-
|
355 |
-
|
356 |
|
357 |
-
|
|
|
358 |
|
359 |
-
|
360 |
-
$ssl = is_ssl() == true ? 'https://' : 'http://';
|
361 |
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
-
|
365 |
-
"https://www." . $backupDomain,
|
366 |
-
"http://www." . $backupDomain,
|
367 |
-
"https://" . $backupDomain,
|
368 |
-
"http://" . $backupDomain,
|
369 |
-
$backupDomain
|
370 |
-
];
|
371 |
|
372 |
-
|
373 |
-
$ssl . $currentDomain,
|
374 |
-
$ssl . $currentDomain,
|
375 |
-
$ssl . $currentDomain,
|
376 |
-
$ssl . $currentDomain,
|
377 |
-
$currentDomain
|
378 |
-
];
|
379 |
|
380 |
-
|
381 |
-
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
382 |
-
$progress++; $this->logger->progress(90 + $progress);
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
|
|
387 |
|
388 |
-
|
389 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
390 |
-
$progress++; $this->logger->progress(90 + $progress);
|
391 |
|
392 |
-
|
393 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
394 |
-
$progress++; $this->logger->progress(90 + $progress);
|
395 |
|
396 |
-
if (!(substr($currentDomain, -strlen($backupDomain)) === $backupDomain)) {
|
397 |
-
$r = $replaceEngine->perform($possibleDomainsBackup[4], $possibleDomainsCurrent[4]);
|
398 |
-
$dchange += $r['change']; $dupdates += $r['updates'];
|
399 |
}
|
400 |
-
|
401 |
|
402 |
-
|
403 |
-
$
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
|
415 |
-
|
416 |
-
|
|
|
|
|
417 |
|
418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
}
|
421 |
|
@@ -574,11 +684,18 @@ class BMI_Even_Better_Database_Restore {
|
|
574 |
|
575 |
}
|
576 |
|
577 |
-
public function
|
578 |
|
579 |
$this->logger->progress(90);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
$this->prepareFinalDatabase();
|
581 |
-
$this->
|
582 |
$this->enablePlugins();
|
583 |
|
584 |
}
|
19 |
if (!defined('ABSPATH')) exit;
|
20 |
|
21 |
/**
|
22 |
+
* Database Restore Enginge v4
|
23 |
*/
|
24 |
class BMI_Even_Better_Database_Restore {
|
25 |
|
170 |
$str = __("Started restoration of %table_name% %total_tables% table", 'backup-backup');
|
171 |
$str = str_replace('%table_name%', $realTableName, $str);
|
172 |
$str = str_replace('%total_tables%', $this->getTableProgress(), $str);
|
173 |
+
$this->logger->log($str, 'STEP');
|
174 |
|
175 |
// Check if file can be cleaned
|
176 |
$this->filterFile($filePath, basename($filePath));
|
209 |
|
210 |
if ($total_size <= 0) $total_size = 1;
|
211 |
if (($seek - 5) <= 0) $seek = 6;
|
212 |
+
if ($total_size > 0) $total_size += 1;
|
213 |
|
214 |
$progress = ($seek - 5) . '/' . $total_size . " (" . number_format(($seek - 5) / $total_size * 100, 2) . "%)";
|
215 |
$str = str_replace('%progress%', $progress, $str);
|
313 |
|
314 |
}
|
315 |
|
316 |
+
private function performReplace($step = 0, $tableIndex = 0, $currentPage = 0, $totalPages = 0, $fieldAdjustments = 0) {
|
317 |
+
|
318 |
+
$status = [
|
319 |
+
'step' => $step,
|
320 |
+
'tableIndex' => $tableIndex,
|
321 |
+
'finished' => false,
|
322 |
+
'currentPage' => $currentPage,
|
323 |
+
'totalPages' => $totalPages,
|
324 |
+
'fieldAdjustments' => $fieldAdjustments
|
325 |
+
];
|
326 |
|
327 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'search-replace.php';
|
328 |
|
332 |
$backupDomain = $this->parseDomain($this->manifest->dbdomain);
|
333 |
$currentDomain = $this->parseDomain(get_option('siteurl'), false);
|
334 |
|
335 |
+
$currentTable = false;
|
336 |
+
$allTables = array_keys($this->map['tables']);
|
337 |
|
338 |
+
if ($tableIndex < sizeof($allTables) && array_key_exists($tableIndex, $allTables)) {
|
339 |
+
$currentTable = $allTables[$tableIndex];
|
340 |
+
}
|
341 |
|
342 |
+
if ($currentTable == false && !$currentTable) {
|
343 |
+
if ($backupRootDir != $currentRootDir || $currentDomain != $this->parseDomain($backupDomain, false)) {
|
344 |
+
$this->logger->log(__('Search & Replace finished successfully.', 'backup-backup'), 'SUCCESS');
|
345 |
+
}
|
346 |
+
|
347 |
+
$status['finished'] = true;
|
348 |
+
return $status;
|
349 |
}
|
350 |
|
351 |
+
$replaceEngine = new BMISearchReplace([$currentTable], $currentPage, $totalPages);
|
352 |
|
353 |
+
if ($step == 0) {
|
354 |
+
if ($backupRootDir != $currentRootDir || $currentDomain != $this->parseDomain($backupDomain, false)) {
|
355 |
+
$this->logger->log(__('Performing Search & Replace', 'backup-backup'), 'STEP');
|
356 |
+
$pagesize = '?';
|
357 |
+
if (defined('BMI_MAX_SEARCH_REPLACE_PAGE')) $pagesize = BMI_MAX_SEARCH_REPLACE_PAGE;
|
358 |
+
$this->logger->log(__('Page size for that restoration: ', 'backup-backup') . $pagesize, 'INFO');
|
359 |
+
$status['step'] = $step + 1; $step++;
|
360 |
+
} else {
|
361 |
+
$this->logger->log(__('This backup was made on the same site, ommiting search & replace.', 'backup-backup'), 'INFO');
|
362 |
+
$status['finished'] = true;
|
363 |
+
return $status;
|
364 |
+
}
|
365 |
+
}
|
366 |
|
367 |
+
if ($step == 1) {
|
368 |
+
$replaceProgress = ($tableIndex + 1) . "/" . sizeof($allTables);
|
369 |
+
$replaceProgressPercentage = number_format((($tableIndex + 1) / sizeof($allTables) * 100), 2);
|
370 |
+
$progressLogT = __('Performing database adjustments for table %progress%: %table_name% (%progress_percentage%)', 'backup-backup');
|
371 |
+
$progressLogT = str_replace('%progress%', $replaceProgress, $progressLogT);
|
372 |
+
$progressLogT = str_replace('%table_name%', $currentTable, $progressLogT);
|
373 |
+
$progressLogT = str_replace('%progress_percentage%', $replaceProgressPercentage . '%', $progressLogT);
|
374 |
+
$this->logger->log($progressLogT, 'STEP');
|
375 |
|
376 |
+
$percentageProgress = number_format($replaceProgressPercentage, 0);
|
377 |
+
$this->logger->progress(number_format(90 + ($percentageProgress / 100) * 8, 0));
|
|
|
|
|
|
|
378 |
|
379 |
+
if ($backupRootDir != $currentRootDir) {
|
380 |
|
381 |
+
$dtables = 0; $drows = 0; $dchange = 0; $dupdates = 0;
|
382 |
|
383 |
+
$r = $replaceEngine->perform($backupRootDir, $currentRootDir);
|
384 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
385 |
|
386 |
+
$status['currentPage'] = $r['currentPage'];
|
387 |
+
$status['totalPages'] = $r['totalPages'];
|
388 |
|
389 |
+
if ($status['totalPages'] > 0) {
|
|
|
390 |
|
391 |
+
$info = __("Batch for path adjustment (%page%/%allPages%) updated: %updates% fields.", 'backup-backup');
|
392 |
+
$updates = $dupdates;
|
393 |
+
if ($updates == 0) $updates = 1;
|
394 |
+
$info = str_replace('%page%', $status['currentPage'], $info);
|
395 |
+
$info = str_replace('%allPages%', $status['totalPages'], $info);
|
396 |
+
$info = str_replace('%updates%', $updates, $info);
|
397 |
+
$this->logger->log($info, 'INFO');
|
398 |
+
$status['fieldAdjustments']++;
|
399 |
|
400 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
+
// $this->logger->log(__('Path adjustments are not required for this table.', 'backup-backup'), 'INFO');
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
+
}
|
|
|
|
|
405 |
|
406 |
+
if ($status['currentPage'] >= $status['totalPages']) {
|
407 |
+
$status['currentPage'] = 0;
|
408 |
+
$status['totalPages'] = 0;
|
409 |
+
$status['step'] = $step + 1;
|
410 |
+
}
|
411 |
+
return $status;
|
412 |
|
413 |
+
} else {
|
|
|
|
|
414 |
|
415 |
+
$status['step'] = $step + 1; $step++;
|
|
|
|
|
416 |
|
|
|
|
|
|
|
417 |
}
|
418 |
+
}
|
419 |
|
420 |
+
if ($step == 2 || $step == 3 || $step == 4 || $step == 5 || $step == 6 || $step == 7) {
|
421 |
+
if ($currentDomain != $this->parseDomain($backupDomain, false)) {
|
422 |
+
$ssl = is_ssl() == true ? 'https://' : 'http://';
|
423 |
+
|
424 |
+
$dtables = 0; $drows = 0; $dchange = 0; $dupdates = 0;
|
425 |
+
|
426 |
+
$possibleDomainsBackup = [
|
427 |
+
"https://www." . $backupDomain,
|
428 |
+
"http://www." . $backupDomain,
|
429 |
+
"https://" . $backupDomain,
|
430 |
+
"http://" . $backupDomain,
|
431 |
+
'www.' . $backupDomain,
|
432 |
+
$backupDomain
|
433 |
+
];
|
434 |
+
|
435 |
+
$possibleDomainsCurrent = [
|
436 |
+
$ssl . $currentDomain,
|
437 |
+
$ssl . $currentDomain,
|
438 |
+
$ssl . $currentDomain,
|
439 |
+
$ssl . $currentDomain,
|
440 |
+
$currentDomain,
|
441 |
+
$currentDomain
|
442 |
+
];
|
443 |
+
|
444 |
+
if ($step == 2) {
|
445 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[0], $possibleDomainsCurrent[0]);
|
446 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
447 |
+
}
|
448 |
|
449 |
+
if ($step == 3) {
|
450 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[1], $possibleDomainsCurrent[1]);
|
451 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
452 |
+
}
|
453 |
+
|
454 |
+
if ($step == 4) {
|
455 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[2], $possibleDomainsCurrent[2]);
|
456 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
457 |
+
}
|
458 |
|
459 |
+
if ($step == 5) {
|
460 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[3], $possibleDomainsCurrent[3]);
|
461 |
+
$dtables += $r['tables']; $drows += $r['rows']; $dchange += $r['change']; $dupdates += $r['updates'];
|
462 |
+
}
|
463 |
+
|
464 |
+
if ($step == 6) {
|
465 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[4], $possibleDomainsCurrent[4]);
|
466 |
+
$dchange += $r['change']; $dupdates += $r['updates'];
|
467 |
+
}
|
468 |
+
|
469 |
+
if ($step == 7) {
|
470 |
+
if (!(substr($currentDomain, -strlen($backupDomain)) === $backupDomain)) {
|
471 |
+
$r = $replaceEngine->perform($possibleDomainsBackup[5], $possibleDomainsCurrent[5]);
|
472 |
+
$dchange += $r['change']; $dupdates += $r['updates'];
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
$status['currentPage'] = $r['currentPage'];
|
477 |
+
$status['totalPages'] = $r['totalPages'];
|
478 |
+
|
479 |
+
$variants = [
|
480 |
+
__('variant A', 'backup-backup'),
|
481 |
+
__('variant B', 'backup-backup'),
|
482 |
+
__('variant C', 'backup-backup'),
|
483 |
+
__('variant D', 'backup-backup'),
|
484 |
+
__('variant E', 'backup-backup'),
|
485 |
+
__('variant F', 'backup-backup'),
|
486 |
+
];
|
487 |
+
|
488 |
+
if ($status['totalPages'] > 0) {
|
489 |
+
|
490 |
+
$info = __("Batch for domain (%variant%) adjustments (%page%/%allPages%) updated: %updates% fields.", 'backup-backup');
|
491 |
+
$updates = $dupdates;
|
492 |
+
if ($updates == 0) $updates = 1;
|
493 |
+
$info = str_replace('%variant%', $variants[$step - 2], $info);
|
494 |
+
$info = str_replace('%page%', $status['currentPage'], $info);
|
495 |
+
$info = str_replace('%allPages%', $status['totalPages'], $info);
|
496 |
+
$info = str_replace('%updates%', $updates, $info);
|
497 |
+
$this->logger->log($info, 'INFO');
|
498 |
+
$status['fieldAdjustments']++;
|
499 |
+
|
500 |
+
} else {
|
501 |
+
|
502 |
+
// $info = __('Domain (%variant%) adjustments are not required for this table.', 'backup-backup');
|
503 |
+
// $info = str_replace('%variant%', $variants[$step - 2], $info);
|
504 |
+
// $this->logger->log($info, 'INFO');
|
505 |
+
|
506 |
+
}
|
507 |
+
|
508 |
+
if ($status['currentPage'] >= $status['totalPages']) {
|
509 |
+
$status['currentPage'] = 0;
|
510 |
+
$status['totalPages'] = 0;
|
511 |
+
$status['step'] = $step + 1;
|
512 |
+
}
|
513 |
+
return $status;
|
514 |
+
}
|
515 |
}
|
516 |
|
517 |
+
if ($step == 8) {
|
518 |
+
if ($fieldAdjustments === 0) {
|
519 |
+
$this->logger->log(__('Adjustments are not required for this table.', 'backup-backup'), 'INFO');
|
520 |
+
}
|
521 |
|
522 |
+
$status['step'] = 1;
|
523 |
+
$status['fieldAdjustments'] = 0;
|
524 |
+
$status['tableIndex'] = $tableIndex + 1;
|
525 |
+
return $status;
|
526 |
+
}
|
527 |
+
|
528 |
+
return $status;
|
529 |
|
530 |
}
|
531 |
|
684 |
|
685 |
}
|
686 |
|
687 |
+
public function searchReplace($step = 0, $tableIndex = 0, $currentPage = 0, $totalPages = 0, $fieldAdjustments = 0) {
|
688 |
|
689 |
$this->logger->progress(90);
|
690 |
+
return $this->performReplace($step, $tableIndex, $currentPage, $totalPages, $fieldAdjustments);
|
691 |
+
|
692 |
+
}
|
693 |
+
|
694 |
+
public function alter_tables() {
|
695 |
+
|
696 |
+
$this->logger->progress(98);
|
697 |
$this->prepareFinalDatabase();
|
698 |
+
$this->replaceTableNames($this->map['tables']);
|
699 |
$this->enablePlugins();
|
700 |
|
701 |
}
|
includes/database/search-replace.php
CHANGED
@@ -24,8 +24,10 @@ if (!defined('ABSPATH')) exit;
|
|
24 |
*/
|
25 |
class BMI_Search_Replace_Engine {
|
26 |
|
27 |
-
function __construct($tables) {
|
28 |
|
|
|
|
|
29 |
$this->all_tables = $tables;
|
30 |
|
31 |
}
|
@@ -44,7 +46,7 @@ class BMI_Search_Replace_Engine {
|
|
44 |
|
45 |
$data = $this->recursive_unserialize_replace($from, $to, $unserialized, true);
|
46 |
|
47 |
-
}
|
48 |
|
49 |
$_tmp = [];
|
50 |
foreach ($data as $key => $value) {
|
@@ -70,8 +72,16 @@ class BMI_Search_Replace_Engine {
|
|
70 |
|
71 |
global $wpdb;
|
72 |
|
73 |
-
$excluded_columns = ['
|
74 |
-
$report = ['tables' => 0, 'rows' => 0, 'change' => 0, 'updates' => 0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
if (is_array($tables) && !empty($tables)) {
|
77 |
|
@@ -87,20 +97,52 @@ class BMI_Search_Replace_Engine {
|
|
87 |
$columns[$object->Field] = $object->Key == 'PRI' ? true : false;
|
88 |
}
|
89 |
|
90 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$row_count = $row_count[0]->num;
|
92 |
-
if ($row_count == 0)
|
|
|
|
|
|
|
93 |
|
94 |
-
$page_size =
|
95 |
$pages = ceil($row_count / $page_size);
|
|
|
96 |
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
$current_row = 0;
|
100 |
$start = $page * $page_size;
|
101 |
$end = $start + $page_size;
|
102 |
|
103 |
-
$data = $wpdb->get_results(sprintf('SELECT * FROM %s LIMIT %d, %d', $table, $start, $end));
|
104 |
for ($i = 0; $i < sizeof($data); ++$i) {
|
105 |
|
106 |
$row = $data[$i];
|
@@ -114,22 +156,24 @@ class BMI_Search_Replace_Engine {
|
|
114 |
foreach ($columns as $column => $primary_key) {
|
115 |
|
116 |
if (in_array($column, $excluded_columns)) continue;
|
|
|
117 |
|
118 |
$edited_data = $data_to_fix = $row->$column;
|
119 |
$edited_data = $this->recursive_unserialize_replace($search, $replace, $data_to_fix);
|
120 |
|
121 |
if ($edited_data != $data_to_fix) {
|
122 |
$report['change']++;
|
123 |
-
$update_sql[] = $column . ' = "' . mysqli_real_escape_string($wpdb->dbh, $edited_data) . '"';
|
124 |
$upd = true;
|
125 |
-
$where_sql[] = $column . ' = "' . mysqli_real_escape_string($wpdb->dbh, $data_to_fix) . '"';
|
126 |
}
|
127 |
|
128 |
}
|
129 |
|
130 |
if ($upd && !empty($where_sql)) {
|
131 |
$sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $update_sql) . ' WHERE ' . implode(' AND ', array_filter($where_sql));
|
132 |
-
$wpdb->
|
|
|
133 |
unset($sql);
|
134 |
|
135 |
$report['updates']++;
|
@@ -146,6 +190,7 @@ class BMI_Search_Replace_Engine {
|
|
146 |
}
|
147 |
|
148 |
unset($data);
|
|
|
149 |
|
150 |
}
|
151 |
|
24 |
*/
|
25 |
class BMI_Search_Replace_Engine {
|
26 |
|
27 |
+
function __construct($tables, $currentPage = 0, $totalPages = 0) {
|
28 |
|
29 |
+
$this->totalPages = $totalPages;
|
30 |
+
$this->currentPage = $currentPage;
|
31 |
$this->all_tables = $tables;
|
32 |
|
33 |
}
|
46 |
|
47 |
$data = $this->recursive_unserialize_replace($from, $to, $unserialized, true);
|
48 |
|
49 |
+
} else if (is_array($data)) {
|
50 |
|
51 |
$_tmp = [];
|
52 |
foreach ($data as $key => $value) {
|
72 |
|
73 |
global $wpdb;
|
74 |
|
75 |
+
$excluded_columns = ['id', 'ID'];
|
76 |
+
$report = ['tables' => 0, 'rows' => 0, 'change' => 0, 'updates' => 0, 'currentPage' => 0, 'totalPages' => 0];
|
77 |
+
|
78 |
+
if ($this->currentPage !== 0 && is_numeric($this->currentPage)) {
|
79 |
+
$report['currentPage'] = $this->currentPage;
|
80 |
+
}
|
81 |
+
|
82 |
+
if ($this->totalPages !== 0 && is_numeric($this->totalPages)) {
|
83 |
+
$report['totalPages'] = $this->totalPages;
|
84 |
+
}
|
85 |
|
86 |
if (is_array($tables) && !empty($tables)) {
|
87 |
|
97 |
$columns[$object->Field] = $object->Key == 'PRI' ? true : false;
|
98 |
}
|
99 |
|
100 |
+
$fieldsForWhereStmt = [];
|
101 |
+
|
102 |
+
foreach ($fields as $index => $columnInfo) {
|
103 |
+
$type = strtolower($columnInfo->Type);
|
104 |
+
if (strpos($type, 'char') !== false || strpos($type, 'text') !== false) {
|
105 |
+
$column = mysqli_real_escape_string($wpdb->dbh, $columnInfo->Field);
|
106 |
+
if (!in_array($column, $fieldsForWhereStmt)) {
|
107 |
+
$fieldsForWhereStmt[] = $column;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
$whereStmt = '';
|
113 |
+
$totalColumns = sizeof($fieldsForWhereStmt);
|
114 |
+
for ($i = 0; $i < $totalColumns; ++$i) {
|
115 |
+
$column = $fieldsForWhereStmt[$i];
|
116 |
+
if ($i == 0) $whereStmt .= ' WHERE ';
|
117 |
+
$whereStmt .= '`' . $column . '`' . ' LIKE ' . '"%' . mysqli_real_escape_string($wpdb->dbh, $search) . '%"';
|
118 |
+
if ($i != $totalColumns - 1) $whereStmt .= ' OR ';
|
119 |
+
}
|
120 |
+
|
121 |
+
if ($whereStmt === '') continue;
|
122 |
+
$row_count = $wpdb->get_results('SELECT COUNT(*) AS num FROM `' . $table . '`' . $whereStmt);
|
123 |
$row_count = $row_count[0]->num;
|
124 |
+
if ($row_count == 0) {
|
125 |
+
$report['currentPage'] = $report['currentPage'] + 1;
|
126 |
+
continue;
|
127 |
+
}
|
128 |
|
129 |
+
$page_size = BMI_MAX_SEARCH_REPLACE_PAGE;
|
130 |
$pages = ceil($row_count / $page_size);
|
131 |
+
$page = 0;
|
132 |
|
133 |
+
if ($report['totalPages'] === 0) {
|
134 |
+
$report['totalPages'] = $pages;
|
135 |
+
}
|
136 |
+
|
137 |
+
for ($page; $page < $pages; $page++) {
|
138 |
+
|
139 |
+
$report['currentPage'] = $report['currentPage'] + 1;
|
140 |
|
141 |
$current_row = 0;
|
142 |
$start = $page * $page_size;
|
143 |
$end = $start + $page_size;
|
144 |
|
145 |
+
$data = $wpdb->get_results(sprintf('SELECT * FROM %s%s LIMIT %d, %d', $table, $whereStmt, $start, $end));
|
146 |
for ($i = 0; $i < sizeof($data); ++$i) {
|
147 |
|
148 |
$row = $data[$i];
|
156 |
foreach ($columns as $column => $primary_key) {
|
157 |
|
158 |
if (in_array($column, $excluded_columns)) continue;
|
159 |
+
if (!in_array($column, $fieldsForWhereStmt)) continue;
|
160 |
|
161 |
$edited_data = $data_to_fix = $row->$column;
|
162 |
$edited_data = $this->recursive_unserialize_replace($search, $replace, $data_to_fix);
|
163 |
|
164 |
if ($edited_data != $data_to_fix) {
|
165 |
$report['change']++;
|
166 |
+
$update_sql[] = '`' . $column . '`' . ' = "' . mysqli_real_escape_string($wpdb->dbh, $edited_data) . '"';
|
167 |
$upd = true;
|
168 |
+
$where_sql[] = '`' . $column . '`' . ' = "' . mysqli_real_escape_string($wpdb->dbh, $data_to_fix) . '"';
|
169 |
}
|
170 |
|
171 |
}
|
172 |
|
173 |
if ($upd && !empty($where_sql)) {
|
174 |
$sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $update_sql) . ' WHERE ' . implode(' AND ', array_filter($where_sql));
|
175 |
+
$results = $wpdb->get_results($sql);
|
176 |
+
|
177 |
unset($sql);
|
178 |
|
179 |
$report['updates']++;
|
190 |
}
|
191 |
|
192 |
unset($data);
|
193 |
+
return $report;
|
194 |
|
195 |
}
|
196 |
|
includes/extracter/extract.php
CHANGED
@@ -123,6 +123,27 @@
|
|
123 |
$this->conversionStats = $options['conversionStats'];
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
// Name
|
127 |
$this->tmp = untrailingslashit(ABSPATH) . DIRECTORY_SEPARATOR . 'backup-migration_' . $this->tmptime;
|
128 |
$GLOBALS['bmi_current_tmp_restore'] = $this->tmp;
|
@@ -201,7 +222,7 @@
|
|
201 |
}
|
202 |
|
203 |
$dest = untrailingslashit($dest);
|
204 |
-
if (!file_exists($dest)
|
205 |
@mkdir($dest, 0755, true);
|
206 |
}
|
207 |
}
|
@@ -228,7 +249,17 @@
|
|
228 |
$dest = $this->ABSPATH . $sub . $files[$i];
|
229 |
}
|
230 |
|
231 |
-
if (file_exists($src))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
if ($i % 100 === 0) {
|
234 |
$this->migration->progress(25 + intval((($i / $max) * 100) / 4));
|
@@ -237,13 +268,34 @@
|
|
237 |
}
|
238 |
|
239 |
public function replaceAll($content) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
$this->replacePath($this->tmp, DIRECTORY_SEPARATOR, $content);
|
|
|
241 |
}
|
242 |
|
243 |
public function cleanup() {
|
244 |
|
|
|
245 |
$dir = $this->tmp;
|
246 |
|
|
|
|
|
|
|
|
|
247 |
if (is_dir($dir) && file_exists($dir)) {
|
248 |
|
249 |
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
|
@@ -321,8 +373,10 @@
|
|
321 |
|
322 |
}
|
323 |
|
324 |
-
|
325 |
-
|
|
|
|
|
326 |
}
|
327 |
|
328 |
}
|
@@ -513,10 +567,14 @@
|
|
513 |
|
514 |
public function makeWPConfigCopy() {
|
515 |
|
516 |
-
$abs = untrailingslashit(ABSPATH);
|
517 |
$this->migration->log(__('Saving wp-config file...', 'backup-backup'), 'STEP');
|
518 |
-
|
519 |
-
$
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
}
|
522 |
|
@@ -603,9 +661,29 @@
|
|
603 |
|
604 |
}
|
605 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
606 |
public function alter_tables_v3(&$manifest) {
|
607 |
|
608 |
if (!$this->isCLI || $this->v3Importer == null) {
|
|
|
609 |
$importer = new EvenBetterDatabaseImport($storage, false, $manifest, $this->migration, $this->splitting, $this->isCLI);
|
610 |
$importer->alter_tables();
|
611 |
} else {
|
@@ -716,7 +794,18 @@
|
|
716 |
|
717 |
if (is_dir($this->tmp . DIRECTORY_SEPARATOR . 'db_tables')) {
|
718 |
|
719 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
720 |
|
721 |
if (!$this->isCLI) {
|
722 |
|
@@ -885,30 +974,39 @@
|
|
885 |
$curr_prefix = $this->table_prefix;
|
886 |
$new_prefix = $manifest->config->table_prefix;
|
887 |
$this->migration->log(__('Restoring wp-config file...', 'backup-backup'), 'STEP');
|
888 |
-
$
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
$wpconfig =
|
893 |
-
|
894 |
-
|
895 |
-
|
|
|
|
|
896 |
|
897 |
-
|
898 |
-
$this->migration->log(__('WP-Config restored', 'backup-backup'), 'SUCCESS');
|
899 |
|
900 |
-
|
901 |
|
902 |
-
|
|
|
|
|
903 |
|
904 |
-
$abs = untrailingslashit(ABSPATH);
|
905 |
-
$tmp_file_f = $abs . DIRECTORY_SEPARATOR . 'wp-config.' . $this->tmptime . '.php';
|
906 |
-
if (file_exists($tmp_file_f)) {
|
907 |
-
copy($tmp_file_f, $abs . DIRECTORY_SEPARATOR . 'wp-config.php');
|
908 |
-
if ($remove === true) @unlink($tmp_file_f);
|
909 |
}
|
910 |
|
911 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
912 |
|
913 |
}
|
914 |
|
@@ -971,7 +1069,14 @@
|
|
971 |
public function finalCleanUP() {
|
972 |
|
973 |
$this->migration->log(__('Cleaning temporary files...', 'backup-backup'), 'STEP');
|
|
|
974 |
update_option('tastewp_auto_activated', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
975 |
$this->cleanup();
|
976 |
$this->removeCleanedThemesAndPlugins();
|
977 |
$this->migration->log(__('Temporary files cleaned', 'backup-backup'), 'SUCCESS');
|
@@ -1262,7 +1367,17 @@
|
|
1262 |
}
|
1263 |
|
1264 |
$wasDisabled = 0;
|
1265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1266 |
|
1267 |
if ($this->usingDbEngineV4) {
|
1268 |
$this->migration->log(__('Splitting process is disabled because v4 restore engine is enabled.', 'backup-backup'), 'INFO');
|
@@ -1279,8 +1394,6 @@
|
|
1279 |
|
1280 |
} else {
|
1281 |
|
1282 |
-
$newDataProcess = $this->processData;
|
1283 |
-
$dbFinishedConv = 'false';
|
1284 |
$db_tables = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
1285 |
|
1286 |
if (is_dir($db_tables)) {
|
@@ -1453,9 +1566,10 @@
|
|
1453 |
// STEP: 9
|
1454 |
if ($this->isCLI || $this->batchStep == 9) {
|
1455 |
|
1456 |
-
//
|
1457 |
-
|
1458 |
-
|
|
|
1459 |
|
1460 |
if (isset($manifest->db_backup_engine) && $manifest->db_backup_engine === 'v4') {
|
1461 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'even-better-restore-v4.php';
|
@@ -1465,11 +1579,114 @@
|
|
1465 |
$this->usingDbEngineV4 = false;
|
1466 |
}
|
1467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1468 |
// Get manifest
|
1469 |
if (!isset($manifest)) {
|
1470 |
$manifest = $this->getCurrentManifest();
|
1471 |
}
|
1472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
$database_exist = $this->databaseExist;
|
1474 |
|
1475 |
// Restore WP Config ** It allows to recover session after restore no matter what
|
@@ -1485,6 +1702,12 @@
|
|
1485 |
// Update TasteWP option
|
1486 |
delete_option('tastewp_auto_activated', true);
|
1487 |
update_option('tastewp_auto_activated', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
1488 |
|
1489 |
// Modify the WP Config and replace
|
1490 |
$this->replaceDbPrefixInWPConfig($manifest);
|
123 |
$this->conversionStats = $options['conversionStats'];
|
124 |
}
|
125 |
|
126 |
+
$this->tableIndex = 0;
|
127 |
+
$this->replaceStep = 0;
|
128 |
+
$this->totalReplacePage = 0;
|
129 |
+
$this->currentReplacePage = 0;
|
130 |
+
$this->fieldAdjustments = 0;
|
131 |
+
if (isset($options['replaceStep'])) {
|
132 |
+
$this->replaceStep = intval($options['replaceStep']);
|
133 |
+
}
|
134 |
+
if (isset($options['tableIndex'])) {
|
135 |
+
$this->tableIndex = intval($options['tableIndex']);
|
136 |
+
}
|
137 |
+
if (isset($options['currentReplacePage'])) {
|
138 |
+
$this->currentReplacePage = intval($options['currentReplacePage']);
|
139 |
+
}
|
140 |
+
if (isset($options['totalReplacePage'])) {
|
141 |
+
$this->totalReplacePage = intval($options['totalReplacePage']);
|
142 |
+
}
|
143 |
+
if (isset($options['fieldAdjustments'])) {
|
144 |
+
$this->fieldAdjustments = intval($options['fieldAdjustments']);
|
145 |
+
}
|
146 |
+
|
147 |
// Name
|
148 |
$this->tmp = untrailingslashit(ABSPATH) . DIRECTORY_SEPARATOR . 'backup-migration_' . $this->tmptime;
|
149 |
$GLOBALS['bmi_current_tmp_restore'] = $this->tmp;
|
222 |
}
|
223 |
|
224 |
$dest = untrailingslashit($dest);
|
225 |
+
if (!file_exists($dest) && !is_dir($dest)) {
|
226 |
@mkdir($dest, 0755, true);
|
227 |
}
|
228 |
}
|
249 |
$dest = $this->ABSPATH . $sub . $files[$i];
|
250 |
}
|
251 |
|
252 |
+
if (file_exists($src)) {
|
253 |
+
$fileDest = BMP::fixSlashes($dest);
|
254 |
+
$dirDest = pathinfo($fileDest);
|
255 |
+
if ($dirDest['dirname']) {
|
256 |
+
$dirDest = $dirDest['dirname'];
|
257 |
+
if (!(is_dir($dirDest) && file_exists($dirDest))) {
|
258 |
+
@mkdir($dirDest, 0755, true);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
rename($src, $fileDest);
|
262 |
+
}
|
263 |
|
264 |
if ($i % 100 === 0) {
|
265 |
$this->migration->progress(25 + intval((($i / $max) * 100) / 4));
|
268 |
}
|
269 |
|
270 |
public function replaceAll($content) {
|
271 |
+
|
272 |
+
update_option('active_plugins', ['backup-backup/backup-backup.php']);
|
273 |
+
|
274 |
+
$themedir = get_theme_root();
|
275 |
+
$tempTheme = $themedir . DIRECTORY_SEPARATOR . 'backup_migration_restoration_in_progress';
|
276 |
+
@mkdir($tempTheme, 0755, true);
|
277 |
+
|
278 |
+
$visitLaterText = __('Site restoration in progress, please visit that website a bit later, thank you! :)', 'backup-backup');
|
279 |
+
file_put_contents($tempTheme . DIRECTORY_SEPARATOR . 'header.php', '<?php wp_head(); show_admin_bar(true);');
|
280 |
+
file_put_contents($tempTheme . DIRECTORY_SEPARATOR . 'footer.php', '<?php wp_footer(); get_footer();');
|
281 |
+
file_put_contents($tempTheme . DIRECTORY_SEPARATOR . 'index.php', '<?php get_header(); wp_body_open(); ?>' . $visitLaterText);
|
282 |
+
|
283 |
+
update_option('template', 'backup_migration_restoration_in_progress');
|
284 |
+
update_option('stylesheet', 'backup_migration_restoration_in_progress');
|
285 |
+
|
286 |
$this->replacePath($this->tmp, DIRECTORY_SEPARATOR, $content);
|
287 |
+
|
288 |
}
|
289 |
|
290 |
public function cleanup() {
|
291 |
|
292 |
+
$filesToBeRemoved = [];
|
293 |
$dir = $this->tmp;
|
294 |
|
295 |
+
$themedir = get_theme_root();
|
296 |
+
$tempTheme = $themedir . DIRECTORY_SEPARATOR . 'backup_migration_restoration_in_progress';
|
297 |
+
$filesToBeRemoved[] = $tempTheme;
|
298 |
+
|
299 |
if (is_dir($dir) && file_exists($dir)) {
|
300 |
|
301 |
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
|
373 |
|
374 |
}
|
375 |
|
376 |
+
if (is_array($filesToBeRemoved) || is_object($filesToBeRemoved)) {
|
377 |
+
foreach ((array) $filesToBeRemoved as $file) {
|
378 |
+
$this->rrmdir($file);
|
379 |
+
}
|
380 |
}
|
381 |
|
382 |
}
|
567 |
|
568 |
public function makeWPConfigCopy() {
|
569 |
|
|
|
570 |
$this->migration->log(__('Saving wp-config file...', 'backup-backup'), 'STEP');
|
571 |
+
$configData = file_get_contents(ABSPATH . 'wp-config.php');
|
572 |
+
if ($configData && strlen($configData) > 0) {
|
573 |
+
file_put_contents(ABSPATH . 'wp-config.' . $this->tmptime . '.php', $configData);
|
574 |
+
$this->migration->log(__('File wp-config saved', 'backup-backup'), 'SUCCESS');
|
575 |
+
} else {
|
576 |
+
$this->migration->log(__('Could not backup/read wp-config file.', 'backup-backup'), 'WARN');
|
577 |
+
}
|
578 |
|
579 |
}
|
580 |
|
661 |
|
662 |
}
|
663 |
|
664 |
+
public function search_replace_v3(&$manifest) {
|
665 |
+
|
666 |
+
$res = false;
|
667 |
+
if (!$this->isCLI || $this->v3Importer == null) {
|
668 |
+
$storage = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
669 |
+
$importer = new EvenBetterDatabaseImport($storage, false, $manifest, $this->migration, $this->splitting, $this->isCLI);
|
670 |
+
$res = $importer->searchReplace($this->replaceStep, $this->tableIndex, $this->currentReplacePage, $this->totalReplacePage, $this->fieldAdjustments);
|
671 |
+
} else {
|
672 |
+
$res = $this->v3Importer->searchReplace($this->replaceStep, $this->tableIndex, $this->currentReplacePage, $this->totalReplacePage, $this->fieldAdjustments);
|
673 |
+
}
|
674 |
+
|
675 |
+
if ($res && is_array($res) && $res['finished'] == true) {
|
676 |
+
$this->migration->log(__('Database restored', 'backup-backup'), 'SUCCESS');
|
677 |
+
}
|
678 |
+
|
679 |
+
return $res;
|
680 |
+
|
681 |
+
}
|
682 |
+
|
683 |
public function alter_tables_v3(&$manifest) {
|
684 |
|
685 |
if (!$this->isCLI || $this->v3Importer == null) {
|
686 |
+
$storage = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
687 |
$importer = new EvenBetterDatabaseImport($storage, false, $manifest, $this->migration, $this->splitting, $this->isCLI);
|
688 |
$importer->alter_tables();
|
689 |
} else {
|
794 |
|
795 |
if (is_dir($this->tmp . DIRECTORY_SEPARATOR . 'db_tables')) {
|
796 |
|
797 |
+
$forcev3Engine = false;
|
798 |
+
if (isset($manifest->db_backup_engine) && $manifest->db_backup_engine === 'v4') {
|
799 |
+
if ($this->v3engine == false) {
|
800 |
+
$forcev3Engine = true;
|
801 |
+
|
802 |
+
if ($this->firstDB == true) {
|
803 |
+
$this->migration->log(__('New search replace is disabled, nevertheless your backup does not support it, forcing to use new S&R engine.', 'backup-backup'), 'WARN');
|
804 |
+
}
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
if ($this->v3engine || $forcev3Engine) {
|
809 |
|
810 |
if (!$this->isCLI) {
|
811 |
|
974 |
$curr_prefix = $this->table_prefix;
|
975 |
$new_prefix = $manifest->config->table_prefix;
|
976 |
$this->migration->log(__('Restoring wp-config file...', 'backup-backup'), 'STEP');
|
977 |
+
$wpconfigDir = $abs . DIRECTORY_SEPARATOR . 'wp-config.' . $this->tmptime . '.php';
|
978 |
+
if (file_exists($wpconfigDir) && is_readable($wpconfigDir) && is_writable($wpconfigDir)) {
|
979 |
+
|
980 |
+
// rename($abs . DIRECTORY_SEPARATOR . 'wp-config.' . $this->tmptime . '.php', $abs . DIRECTORY_SEPARATOR . 'wp-config.php');
|
981 |
+
$wpconfig = file_get_contents($abs . DIRECTORY_SEPARATOR . 'wp-config.php');
|
982 |
+
if (strpos($wpconfig, '"' . $curr_prefix . '";') !== false) {
|
983 |
+
$wpconfig = str_replace('"' . $curr_prefix . '";', '"' . $new_prefix . '";', $wpconfig);
|
984 |
+
} elseif (strpos($wpconfig, "'" . $curr_prefix . "';") !== false) {
|
985 |
+
$wpconfig = str_replace("'" . $curr_prefix . "';", "'" . $new_prefix . "';", $wpconfig);
|
986 |
+
}
|
987 |
|
988 |
+
file_put_contents($abs . DIRECTORY_SEPARATOR . 'wp-config.php', $wpconfig);
|
|
|
989 |
|
990 |
+
$this->migration->log(__('WP-Config restored', 'backup-backup'), 'SUCCESS');
|
991 |
|
992 |
+
} else {
|
993 |
+
|
994 |
+
$this->migration->log(__('Cannot write to WP-Config, if you need to change database prefix, please do it manually.', 'backup-backup'), 'WARN');
|
995 |
|
|
|
|
|
|
|
|
|
|
|
996 |
}
|
997 |
|
998 |
+
}
|
999 |
+
|
1000 |
+
public function restoreOriginalWPConfig($remove = true) {
|
1001 |
+
|
1002 |
+
// $abs = untrailingslashit(ABSPATH);
|
1003 |
+
// $tmp_file_f = $abs . DIRECTORY_SEPARATOR . 'wp-config.' . $this->tmptime . '.php';
|
1004 |
+
// if (file_exists($tmp_file_f)) {
|
1005 |
+
// copy($tmp_file_f, $abs . DIRECTORY_SEPARATOR . 'wp-config.php');
|
1006 |
+
// if ($remove === true) @unlink($tmp_file_f);
|
1007 |
+
// }
|
1008 |
+
//
|
1009 |
+
// wp_load_alloptions(true);
|
1010 |
|
1011 |
}
|
1012 |
|
1069 |
public function finalCleanUP() {
|
1070 |
|
1071 |
$this->migration->log(__('Cleaning temporary files...', 'backup-backup'), 'STEP');
|
1072 |
+
delete_option('tastewp_auto_activated', true);
|
1073 |
update_option('tastewp_auto_activated', true);
|
1074 |
+
delete_option('__tastewp_sub_requested', true);
|
1075 |
+
update_option('__tastewp_sub_requested', true);
|
1076 |
+
delete_option('__tastewp_redirection_performed', true);
|
1077 |
+
update_option('auto_smart_tastewp_redirect_performed', 1);
|
1078 |
+
delete_option('__tastewp_redirection_performed', true);
|
1079 |
+
update_option('auto_smart_tastewp_redirect_performed', 1);
|
1080 |
$this->cleanup();
|
1081 |
$this->removeCleanedThemesAndPlugins();
|
1082 |
$this->migration->log(__('Temporary files cleaned', 'backup-backup'), 'SUCCESS');
|
1367 |
}
|
1368 |
|
1369 |
$wasDisabled = 0;
|
1370 |
+
$dbFinishedConv = 'false';
|
1371 |
+
$newDataProcess = $this->processData;
|
1372 |
+
|
1373 |
+
$forcev3Engine = false;
|
1374 |
+
if (isset($manifest->db_backup_engine) && $manifest->db_backup_engine === 'v4') {
|
1375 |
+
if ($this->v3engine == false) {
|
1376 |
+
$forcev3Engine = true;
|
1377 |
+
}
|
1378 |
+
}
|
1379 |
+
|
1380 |
+
if ($this->v3engine || $forcev3Engine) {
|
1381 |
|
1382 |
if ($this->usingDbEngineV4) {
|
1383 |
$this->migration->log(__('Splitting process is disabled because v4 restore engine is enabled.', 'backup-backup'), 'INFO');
|
1394 |
|
1395 |
} else {
|
1396 |
|
|
|
|
|
1397 |
$db_tables = $this->tmp . DIRECTORY_SEPARATOR . 'db_tables';
|
1398 |
|
1399 |
if (is_dir($db_tables)) {
|
1566 |
// STEP: 9
|
1567 |
if ($this->isCLI || $this->batchStep == 9) {
|
1568 |
|
1569 |
+
// Get manifest
|
1570 |
+
if (!isset($manifest)) {
|
1571 |
+
$manifest = $this->getCurrentManifest();
|
1572 |
+
}
|
1573 |
|
1574 |
if (isset($manifest->db_backup_engine) && $manifest->db_backup_engine === 'v4') {
|
1575 |
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'even-better-restore-v4.php';
|
1579 |
$this->usingDbEngineV4 = false;
|
1580 |
}
|
1581 |
|
1582 |
+
$database_exist = $this->databaseExist;
|
1583 |
+
|
1584 |
+
// Alter all tables
|
1585 |
+
$status = false;
|
1586 |
+
$tableIndex = $this->tableIndex;
|
1587 |
+
$replaceStep = $this->replaceStep;
|
1588 |
+
$replaceFinished = false;
|
1589 |
+
$currentReplacePage = 0;
|
1590 |
+
$totalReplacePage = 0;
|
1591 |
+
$fieldAdjustments = 0;
|
1592 |
+
|
1593 |
+
if ($this->isCLI) {
|
1594 |
+
|
1595 |
+
$srFinished = false;
|
1596 |
+
if ($database_exist && $this->v3RestoreUsed == true) {
|
1597 |
+
while (!$srFinished) {
|
1598 |
+
|
1599 |
+
$status = $this->search_replace_v3($manifest);
|
1600 |
+
|
1601 |
+
if ($status != false && is_array($status)) {
|
1602 |
+
$this->replaceStep = $status['step'];
|
1603 |
+
$this->tableIndex = $status['tableIndex'];
|
1604 |
+
$this->replaceFinished = $status['finished'];
|
1605 |
+
$this->currentReplacePage = $status['currentPage'];
|
1606 |
+
$this->totalReplacePage = $status['totalPages'];
|
1607 |
+
$this->fieldAdjustments = $status['fieldAdjustments'];
|
1608 |
+
|
1609 |
+
if ($this->replaceFinished == true) $srFinished = true;
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
}
|
1613 |
+
} else {
|
1614 |
+
$this->replaceFinished = true;
|
1615 |
+
$this->migration->progress(98);
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
} else {
|
1619 |
+
|
1620 |
+
if ($database_exist && $this->v3RestoreUsed == true) {
|
1621 |
+
$status = $this->search_replace_v3($manifest);
|
1622 |
+
} else {
|
1623 |
+
$this->replaceFinished = true;
|
1624 |
+
$this->migration->progress(98);
|
1625 |
+
}
|
1626 |
+
|
1627 |
+
if ($status != false && is_array($status)) {
|
1628 |
+
$this->replaceStep = $status['step'];
|
1629 |
+
$this->tableIndex = $status['tableIndex'];
|
1630 |
+
$this->replaceFinished = $status['finished'];
|
1631 |
+
$this->currentReplacePage = $status['currentPage'];
|
1632 |
+
$this->totalReplacePage = $status['totalPages'];
|
1633 |
+
$this->fieldAdjustments = $status['fieldAdjustments'];
|
1634 |
+
}
|
1635 |
+
|
1636 |
+
}
|
1637 |
+
|
1638 |
+
if (!$this->isCLI) {
|
1639 |
+
|
1640 |
+
BMP::res([
|
1641 |
+
'status' => 'restore_ongoing',
|
1642 |
+
'tmp' => $this->tmptime,
|
1643 |
+
'secret' => $secret,
|
1644 |
+
'options' => [
|
1645 |
+
'code' => $this->code,
|
1646 |
+
'start' => $this->start,
|
1647 |
+
'amount' => $this->fileAmount,
|
1648 |
+
'databaseExist' => $database_exist === true ? 'true' : 'false',
|
1649 |
+
'firstDB' => $this->firstDB,
|
1650 |
+
'db_xi' => $this->db_xi,
|
1651 |
+
'ini_start' => $this->ini_start,
|
1652 |
+
'table_names_alter' => $this->table_names_alter,
|
1653 |
+
'conversionStats' => $this->conversionStats,
|
1654 |
+
'v3RestoreUsed' => $this->v3RestoreUsed,
|
1655 |
+
'replaceStep' => $this->replaceStep,
|
1656 |
+
'tableIndex' => $this->tableIndex,
|
1657 |
+
'replaceFinished' => $this->replaceFinished,
|
1658 |
+
'currentReplacePage' => $this->currentReplacePage,
|
1659 |
+
'totalReplacePage' => $this->totalReplacePage,
|
1660 |
+
'fieldAdjustments' => $this->fieldAdjustments,
|
1661 |
+
'step' => 9
|
1662 |
+
]
|
1663 |
+
]);
|
1664 |
+
|
1665 |
+
return;
|
1666 |
+
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
// STEP: 10
|
1672 |
+
if ($this->isCLI || $this->batchStep == 10) {
|
1673 |
+
|
1674 |
+
// Rename database from temporary to destination
|
1675 |
+
// And do the rest
|
1676 |
+
// Step 10 runs only at the end of database import
|
1677 |
// Get manifest
|
1678 |
if (!isset($manifest)) {
|
1679 |
$manifest = $this->getCurrentManifest();
|
1680 |
}
|
1681 |
|
1682 |
+
if (isset($manifest->db_backup_engine) && $manifest->db_backup_engine === 'v4') {
|
1683 |
+
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'even-better-restore-v4.php';
|
1684 |
+
$this->usingDbEngineV4 = true;
|
1685 |
+
} else {
|
1686 |
+
require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'even-better-restore-v3.php';
|
1687 |
+
$this->usingDbEngineV4 = false;
|
1688 |
+
}
|
1689 |
+
|
1690 |
$database_exist = $this->databaseExist;
|
1691 |
|
1692 |
// Restore WP Config ** It allows to recover session after restore no matter what
|
1702 |
// Update TasteWP option
|
1703 |
delete_option('tastewp_auto_activated', true);
|
1704 |
update_option('tastewp_auto_activated', true);
|
1705 |
+
delete_option('__tastewp_sub_requested', true);
|
1706 |
+
update_option('__tastewp_sub_requested', true);
|
1707 |
+
delete_option('__tastewp_redirection_performed', true);
|
1708 |
+
update_option('auto_smart_tastewp_redirect_performed', 1);
|
1709 |
+
delete_option('__tastewp_redirection_performed', true);
|
1710 |
+
update_option('auto_smart_tastewp_redirect_performed', 1);
|
1711 |
|
1712 |
// Modify the WP Config and replace
|
1713 |
$this->replaceDbPrefixInWPConfig($manifest);
|
includes/htaccess/default.json
CHANGED
@@ -18,6 +18,8 @@
|
|
18 |
{"txt": "wp-clone", "pos": "1", "whr": "1" },
|
19 |
{"txt": "wp-clone", "pos": "1", "whr": "2" },
|
20 |
{"txt": ".git", "pos": "2", "whr": "2" },
|
|
|
|
|
21 |
{"txt": "node_modules", "pos": "2", "whr": "2" },
|
22 |
{"txt": "mysql.sql", "pos": "3", "whr": "1" },
|
23 |
{"txt": "debug.log", "pos": "3", "whr": "1" }
|
@@ -33,11 +35,14 @@
|
|
33 |
"OTHER:UNINSTALL:CONFIGS": false,
|
34 |
"OTHER:UNINSTALL:BACKUPS": false,
|
35 |
"OTHER:DOWNLOAD:DIRECT": false,
|
|
|
36 |
"OTHER:BACKUP:DB:SINGLE:FILE": false,
|
37 |
"OTHER:RESTORE:BEFORE:CLEANUP": false,
|
38 |
"OTHER:CLI:DISABLE": false,
|
39 |
"OTHER:CLI:PATH": "",
|
40 |
-
"OTHER:DB:QUERIES": "
|
|
|
|
|
41 |
"OTHER:RESTORE:SPLITTING": true,
|
42 |
"OTHER:RESTORE:DB:V3": true,
|
43 |
"CRON:ENABLED": false,
|
18 |
{"txt": "wp-clone", "pos": "1", "whr": "1" },
|
19 |
{"txt": "wp-clone", "pos": "1", "whr": "2" },
|
20 |
{"txt": ".git", "pos": "2", "whr": "2" },
|
21 |
+
{"txt": ".cpmh3129", "pos": "2", "whr": "2" },
|
22 |
+
{"txt": "error_log", "pos": "2", "whr": "2" },
|
23 |
{"txt": "node_modules", "pos": "2", "whr": "2" },
|
24 |
{"txt": "mysql.sql", "pos": "3", "whr": "1" },
|
25 |
{"txt": "debug.log", "pos": "3", "whr": "1" }
|
35 |
"OTHER:UNINSTALL:CONFIGS": false,
|
36 |
"OTHER:UNINSTALL:BACKUPS": false,
|
37 |
"OTHER:DOWNLOAD:DIRECT": false,
|
38 |
+
"OTHER:BACKUP:DB:BATCHING": false,
|
39 |
"OTHER:BACKUP:DB:SINGLE:FILE": false,
|
40 |
"OTHER:RESTORE:BEFORE:CLEANUP": false,
|
41 |
"OTHER:CLI:DISABLE": false,
|
42 |
"OTHER:CLI:PATH": "",
|
43 |
+
"OTHER:DB:QUERIES": "2000",
|
44 |
+
"OTHER:DB:SEARCHREPLACE:MAX": "300",
|
45 |
+
"OTHER:BACKUP:SPACE:CHECKING": false,
|
46 |
"OTHER:RESTORE:SPLITTING": true,
|
47 |
"OTHER:RESTORE:DB:V3": true,
|
48 |
"CRON:ENABLED": false,
|
includes/initializer.php
CHANGED
@@ -153,8 +153,8 @@
|
|
153 |
}
|
154 |
|
155 |
// Styles & scripts
|
156 |
-
add_action('
|
157 |
-
add_action('
|
158 |
|
159 |
}
|
160 |
|
@@ -227,7 +227,7 @@
|
|
227 |
if ($current_splitting_value === false || $current_query_size != 300) {
|
228 |
|
229 |
$b_db_restore_splitting = true;
|
230 |
-
$b_db_query_size = '
|
231 |
|
232 |
$error_b = 0;
|
233 |
if (!Dashboard\bmi_set_config('OTHER:RESTORE:SPLITTING', $b_db_restore_splitting)) {
|
@@ -345,7 +345,7 @@
|
|
345 |
return;
|
346 |
}
|
347 |
|
348 |
-
if ($GLOBALS['bmi_error_handled']) return;
|
349 |
if ($_POST['f'] == 'create-backup') {
|
350 |
Logger::error(__('There was an error during backup', 'backup-backup'));
|
351 |
Logger::error(__('Error message: ', 'backup-backup') . $msg);
|
@@ -795,8 +795,10 @@
|
|
795 |
<script type="text/javascript">
|
796 |
let stars = '<?php echo plugin_dir_url(BMI_ROOT_FILE); ?>' + 'admin/images/stars.gif';
|
797 |
let css_star = "background:url('" + stars + "')";
|
798 |
-
|
799 |
-
|
|
|
|
|
800 |
</script>
|
801 |
<?php }
|
802 |
|
@@ -805,6 +807,7 @@
|
|
805 |
return;
|
806 |
}
|
807 |
wp_enqueue_script('backup-migration-script', $this->get_asset('js', 'backup-migration.min.js'), ['jquery'], BMI_VERSION, true);
|
|
|
808 |
}
|
809 |
|
810 |
public function enqueue_styles() {
|
@@ -867,21 +870,26 @@
|
|
867 |
if ($aID6 === intval($get_bid)) $timeIsProper = true;
|
868 |
|
869 |
if ($timeIsProper && $aIP === $ip && trim($aIZ) === $get_pid) {
|
870 |
-
$query = new \WP_User_Query(['role' => 'Administrator', 'count_total' => false]);
|
871 |
$sqlres = $wpdb->get_results($query->request);
|
872 |
-
|
873 |
-
$
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
|
|
|
|
|
|
|
|
|
|
885 |
|
886 |
$url = admin_url('admin.php?page=backup-migration');
|
887 |
header('Location: ' . $url);
|
@@ -1200,10 +1208,12 @@
|
|
1200 |
}
|
1201 |
|
1202 |
public static function humanSize($bytes) {
|
1203 |
-
$
|
1204 |
-
|
|
|
1205 |
|
1206 |
-
|
|
|
1207 |
}
|
1208 |
|
1209 |
public static function fixSlashes($str) {
|
153 |
}
|
154 |
|
155 |
// Styles & scripts
|
156 |
+
add_action('admin_enqueue_scripts', [&$this, 'enqueue_styles']);
|
157 |
+
add_action('admin_enqueue_scripts', [&$this, 'enqueue_scripts']);
|
158 |
|
159 |
}
|
160 |
|
227 |
if ($current_splitting_value === false || $current_query_size != 300) {
|
228 |
|
229 |
$b_db_restore_splitting = true;
|
230 |
+
$b_db_query_size = '2000';
|
231 |
|
232 |
$error_b = 0;
|
233 |
if (!Dashboard\bmi_set_config('OTHER:RESTORE:SPLITTING', $b_db_restore_splitting)) {
|
345 |
return;
|
346 |
}
|
347 |
|
348 |
+
if (isset($GLOBALS['bmi_error_handled']) && $GLOBALS['bmi_error_handled']) return;
|
349 |
if ($_POST['f'] == 'create-backup') {
|
350 |
Logger::error(__('There was an error during backup', 'backup-backup'));
|
351 |
Logger::error(__('Error message: ', 'backup-backup') . $msg);
|
795 |
<script type="text/javascript">
|
796 |
let stars = '<?php echo plugin_dir_url(BMI_ROOT_FILE); ?>' + 'admin/images/stars.gif';
|
797 |
let css_star = "background:url('" + stars + "')";
|
798 |
+
document.addEventListener("DOMContentLoaded", function(event) {
|
799 |
+
jQuery('[data-slug="backup-migration-pro"]').find('strong').html('<span>Backup Migration <b style="color: orange; ' + css_star + '">Pro</b></span>');
|
800 |
+
jQuery('[data-slug="backup-backup-pro"]').find('strong').html('<span>Backup Migration <b style="color: orange; ' + css_star + '">Pro</b></span>');
|
801 |
+
});
|
802 |
</script>
|
803 |
<?php }
|
804 |
|
807 |
return;
|
808 |
}
|
809 |
wp_enqueue_script('backup-migration-script', $this->get_asset('js', 'backup-migration.min.js'), ['jquery'], BMI_VERSION, true);
|
810 |
+
|
811 |
}
|
812 |
|
813 |
public function enqueue_styles() {
|
870 |
if ($aID6 === intval($get_bid)) $timeIsProper = true;
|
871 |
|
872 |
if ($timeIsProper && $aIP === $ip && trim($aIZ) === $get_pid) {
|
873 |
+
$query = new \WP_User_Query(['role' => 'Administrator', 'count_total' => false, 'fields' => ['ID', 'user_login']]);
|
874 |
$sqlres = $wpdb->get_results($query->request);
|
875 |
+
|
876 |
+
if (sizeof($sqlres) > 0 && isset($sqlres[0]->ID) && isset($sqlres[0]->user_login)) {
|
877 |
+
|
878 |
+
$user = $sqlres[0];
|
879 |
+
$adminID = $sqlres[0]->ID;
|
880 |
+
$adminLogin = $sqlres[0]->user_login;
|
881 |
+
|
882 |
+
remove_all_actions('wp_login', -1000);
|
883 |
+
wp_load_alloptions(true);
|
884 |
+
clean_user_cache(get_current_user_id());
|
885 |
+
clean_user_cache($adminID);
|
886 |
+
wp_clear_auth_cookie();
|
887 |
+
wp_set_current_user($adminID, $adminLogin);
|
888 |
+
wp_set_auth_cookie($adminID, 1, is_ssl());
|
889 |
+
do_action('wp_login', $adminLogin, $user);
|
890 |
+
update_user_caches($user);
|
891 |
+
|
892 |
+
}
|
893 |
|
894 |
$url = admin_url('admin.php?page=backup-migration');
|
895 |
header('Location: ' . $url);
|
1208 |
}
|
1209 |
|
1210 |
public static function humanSize($bytes) {
|
1211 |
+
if (is_int($bytes)) {
|
1212 |
+
$label = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
1213 |
+
for ($i = 0; $bytes >= 1024 && $i < (count($label) - 1); $bytes /= 1024, $i++);
|
1214 |
|
1215 |
+
return (round($bytes, 2) . " " . $label[$i]);
|
1216 |
+
} else return $bytes;
|
1217 |
}
|
1218 |
|
1219 |
public static function fixSlashes($str) {
|
includes/scanner/files.php
CHANGED
@@ -86,8 +86,10 @@
|
|
86 |
public static function scanDirectory($path) {
|
87 |
|
88 |
$files = [];
|
|
|
89 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
90 |
|
|
|
91 |
if ($fileInfo->isDot()) continue;
|
92 |
if (!$fileInfo->isDir()) {
|
93 |
|
@@ -117,8 +119,10 @@
|
|
117 |
public static function scanDirectorySizeOnly($path, $bm) {
|
118 |
|
119 |
$files = [];
|
|
|
120 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
121 |
|
|
|
122 |
if ($fileInfo->isDot()) continue;
|
123 |
if (!$fileInfo->isDir()) {
|
124 |
|
@@ -149,8 +153,10 @@
|
|
149 |
public static function scanDirectorySizeOnlyAndIgnore($path, $ignored = [], $bm = '') {
|
150 |
|
151 |
$files = [];
|
|
|
152 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
153 |
|
|
|
154 |
if ($fileInfo->isDot()) continue;
|
155 |
if (!$fileInfo->isDir()) {
|
156 |
|
@@ -189,8 +195,10 @@
|
|
189 |
$files = [];
|
190 |
try {
|
191 |
|
|
|
192 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
193 |
|
|
|
194 |
if ($fileInfo->isDot()) continue;
|
195 |
if (!$fileInfo->isDir()) {
|
196 |
|
@@ -235,8 +243,11 @@
|
|
235 |
public static function scanDirectoryNameOnly($path) {
|
236 |
|
237 |
$files = [];
|
|
|
|
|
238 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
239 |
|
|
|
240 |
if ($fileInfo->isDot()) continue;
|
241 |
if (!$fileInfo->isDir()) {
|
242 |
|
@@ -264,8 +275,11 @@
|
|
264 |
public static function scanDirectoryNameOnlyAndIgnore($path, $ignored = []) {
|
265 |
|
266 |
$files = [];
|
|
|
|
|
267 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
268 |
|
|
|
269 |
if ($fileInfo->isDot()) continue;
|
270 |
if (!$fileInfo->isDir()) {
|
271 |
|
@@ -298,8 +312,11 @@
|
|
298 |
public static function scanDirectoryNameOnlyAndIgnoreFBC($path, $ignored_folders = [], $ignored_paths = []) {
|
299 |
|
300 |
$files = [];
|
|
|
|
|
301 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
302 |
|
|
|
303 |
if ($fileInfo->isDot()) continue;
|
304 |
if (!$fileInfo->isDir()) {
|
305 |
|
86 |
public static function scanDirectory($path) {
|
87 |
|
88 |
$files = [];
|
89 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
90 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
91 |
|
92 |
+
if ($fileInfo->isLink()) continue;
|
93 |
if ($fileInfo->isDot()) continue;
|
94 |
if (!$fileInfo->isDir()) {
|
95 |
|
119 |
public static function scanDirectorySizeOnly($path, $bm) {
|
120 |
|
121 |
$files = [];
|
122 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
123 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
124 |
|
125 |
+
if ($fileInfo->isLink()) continue;
|
126 |
if ($fileInfo->isDot()) continue;
|
127 |
if (!$fileInfo->isDir()) {
|
128 |
|
153 |
public static function scanDirectorySizeOnlyAndIgnore($path, $ignored = [], $bm = '') {
|
154 |
|
155 |
$files = [];
|
156 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
157 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
158 |
|
159 |
+
if ($fileInfo->isLink()) continue;
|
160 |
if ($fileInfo->isDot()) continue;
|
161 |
if (!$fileInfo->isDir()) {
|
162 |
|
195 |
$files = [];
|
196 |
try {
|
197 |
|
198 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
199 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
200 |
|
201 |
+
if ($fileInfo->isLink()) continue;
|
202 |
if ($fileInfo->isDot()) continue;
|
203 |
if (!$fileInfo->isDir()) {
|
204 |
|
243 |
public static function scanDirectoryNameOnly($path) {
|
244 |
|
245 |
$files = [];
|
246 |
+
|
247 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
248 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
249 |
|
250 |
+
if ($fileInfo->isLink()) continue;
|
251 |
if ($fileInfo->isDot()) continue;
|
252 |
if (!$fileInfo->isDir()) {
|
253 |
|
275 |
public static function scanDirectoryNameOnlyAndIgnore($path, $ignored = []) {
|
276 |
|
277 |
$files = [];
|
278 |
+
|
279 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
280 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
281 |
|
282 |
+
if ($fileInfo->isLink()) continue;
|
283 |
if ($fileInfo->isDot()) continue;
|
284 |
if (!$fileInfo->isDir()) {
|
285 |
|
312 |
public static function scanDirectoryNameOnlyAndIgnoreFBC($path, $ignored_folders = [], $ignored_paths = []) {
|
313 |
|
314 |
$files = [];
|
315 |
+
|
316 |
+
if (!is_readable($path) || is_link($path)) return $files;
|
317 |
foreach (new \DirectoryIterator($path) as $fileInfo) {
|
318 |
|
319 |
+
if ($fileInfo->isLink()) continue;
|
320 |
if ($fileInfo->isDot()) continue;
|
321 |
if (!$fileInfo->isDir()) {
|
322 |
|
includes/zipper/src/zip.php
CHANGED
@@ -107,38 +107,7 @@ class Zip {
|
|
107 |
return true;
|
108 |
}
|
109 |
|
110 |
-
public function
|
111 |
-
|
112 |
-
// Try to set limit
|
113 |
-
$this->zip_progress->log(__("Smart memory calculation...", 'backup-backup'), 'STEP');
|
114 |
-
if ((intval($this->return_bytes(ini_get('memory_limit'))) / 1024 / 1024) < 384) @ini_set('memory_limit', '384M');
|
115 |
-
if (defined('WP_MAX_MEMORY_LIMIT')) $maxwp = WP_MAX_MEMORY_LIMIT;
|
116 |
-
else $maxwp = '1M';
|
117 |
-
|
118 |
-
$memory_limit = (intval($this->return_bytes(ini_get('memory_limit'))) / 1024 / 1024);
|
119 |
-
$maxwp = (intval($this->return_bytes($maxwp)) / 1024 / 1024);
|
120 |
-
|
121 |
-
if ($maxwp > $memory_limit) $memory_limit = $maxwp;
|
122 |
-
$this->zip_progress->log(str_replace('%s', $memory_limit, __("There is %s MBs of memory to use", 'backup-backup')), 'INFO');
|
123 |
-
$this->zip_progress->log(str_replace('%s', $maxwp, __("WordPress memory limit: %s MBs", 'backup-backup')), 'INFO');
|
124 |
-
$safe_limit = intval($memory_limit / 4);
|
125 |
-
if ($safe_limit > 64) $safe_limit = 64;
|
126 |
-
if ($memory_limit === 384) $safe_limit = 96;
|
127 |
-
if ($memory_limit >= 512) $safe_limit = 128;
|
128 |
-
if ($memory_limit >= 1024) $safe_limit = 256;
|
129 |
-
|
130 |
-
// $real_memory = intval(memory_get_usage() * 0.9 / 1024 / 1024);
|
131 |
-
// if ($real_memory < $safe_limit) $safe_limit = $real_memory;
|
132 |
-
$safe_limit = intval($safe_limit * 0.9);
|
133 |
-
|
134 |
-
$this->zip_progress->log(str_replace('%s', $safe_limit, __("Setting the safe limit to %s MB", 'backup-backup')), 'SUCCESS');
|
135 |
-
|
136 |
-
$abs = BMP::fixSlashes(ABSPATH) . DIRECTORY_SEPARATOR;
|
137 |
-
|
138 |
-
$dbbackupname = 'bmi_database_backup.sql';
|
139 |
-
$database_file = BMP::fixSlashes(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . $dbbackupname);
|
140 |
-
$database_file_dir = BMP::fixSlashes((dirname($database_file))) . DIRECTORY_SEPARATOR;
|
141 |
-
$better_database_files_dir = $database_file_dir . 'db_tables';
|
142 |
|
143 |
if (Dashboard\bmi_get_config('BACKUP:DATABASE') == 'true') {
|
144 |
|
@@ -155,16 +124,15 @@ class Zip {
|
|
155 |
$databaser->exportDatabase($dbbackupname);
|
156 |
|
157 |
// Fix for newer version
|
158 |
-
$db_exporter_queries = 0;
|
159 |
$this->zip_progress->total_queries = 0;
|
160 |
-
$db_exporter_files = [];
|
161 |
|
|
|
162 |
$this->zip_progress->log(__("Database size: ", 'backup-backup') . BMP::humanSize(filesize($database_file)), 'INFO');
|
163 |
|
164 |
} else {
|
165 |
|
166 |
-
$dbBackupEngine = 'v4';
|
167 |
-
|
168 |
if ($dbBackupEngine == 'v4') {
|
169 |
|
170 |
// Require Database Manager
|
@@ -188,121 +156,174 @@ class Zip {
|
|
188 |
if (!is_dir($better_database_files_dir)) @mkdir($better_database_files_dir, 0755, true);
|
189 |
$db_exporter = new BetterDatabaseExport($better_database_files_dir, $this->zip_progress);
|
190 |
$db_exporter->export();
|
191 |
-
$db_exporter_files = $db_exporter->files;
|
192 |
-
$db_exporter_queries = $db_exporter->total_queries;
|
193 |
|
194 |
-
$this->zip_progress->total_queries = $db_exporter_queries;
|
195 |
|
|
|
196 |
$this->zip_progress->log(__("Database backup finished", 'backup-backup'), 'SUCCESS');
|
197 |
|
198 |
}
|
199 |
|
200 |
} else {
|
201 |
|
|
|
202 |
$this->zip_progress->log(__("Omitting database backup (due to settings)...", 'backup-backup'), 'WARN');
|
203 |
$database_file = false;
|
204 |
-
$db_exporter_files =
|
|
|
|
|
205 |
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
if ($force_lib === 2) {
|
210 |
-
|
211 |
-
$this->lib = 2;
|
212 |
-
|
213 |
-
} elseif ($force_lib === 1) {
|
214 |
-
|
215 |
-
$this->lib = 1;
|
216 |
-
|
217 |
-
}
|
218 |
|
219 |
-
|
220 |
-
if ($this->lib === 0 || $this->new_file_path === 0) {
|
221 |
-
throw new \Exception('PHP-ZIP: zip_start and zip_add haven\'t been called yet');
|
222 |
-
}
|
223 |
|
224 |
-
//
|
225 |
-
$
|
226 |
-
$this->zip_progress->log(__("Making archive", 'backup-backup'), 'STEP');
|
227 |
-
$this->zip_progress->log(__("Compressing...", 'backup-backup'), 'INFO');
|
228 |
|
229 |
-
//
|
230 |
-
|
|
|
|
|
|
|
231 |
|
232 |
-
|
233 |
-
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
$zippath = substr($file, strlen($abs));
|
244 |
-
$lib->addFile($file, 'wordpress' . DIRECTORY_SEPARATOR . $zippath);
|
245 |
|
246 |
-
|
247 |
-
if (file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.abort')) {
|
248 |
-
break;
|
249 |
-
}
|
250 |
-
$this->zip_progress->progress($i + 1 . '/' . $max);
|
251 |
-
}
|
252 |
|
253 |
-
|
254 |
-
if (($i + 1) < $max) {
|
255 |
-
$this->zip_progress->log((__("Milestone: ", 'backup-backup') . ($i + 1) . '/' . $max), 'info');
|
256 |
-
}
|
257 |
-
}
|
258 |
-
}
|
259 |
|
260 |
-
|
|
|
|
|
|
|
261 |
|
262 |
-
|
263 |
-
|
264 |
-
} else {
|
265 |
-
$this->zip_progress->log((__("Milestone: ", 'backup-backup') . $max . '/' . $max), 'info');
|
266 |
-
$this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
267 |
|
268 |
-
|
269 |
-
$this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . number_format(microtime(true) - $this->start_zip, 2) . 's');
|
270 |
|
271 |
-
|
272 |
-
$this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
273 |
-
$this->zip_progress->log(__("Closing files and archives", 'backup-backup'), 'STEP');
|
274 |
-
$this->zip_progress->log('#001', 'END-CODE');
|
275 |
|
276 |
-
|
277 |
-
$logs = file_get_contents(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'latest.log');
|
278 |
-
$this->zip_progress->start(true);
|
279 |
|
280 |
-
|
281 |
-
if (Dashboard\bmi_get_config('OTHER:BACKUP:DB:SINGLE:FILE') == 'true') {
|
282 |
-
if (file_exists($database_file)) {
|
283 |
-
$lib->addFile($database_file, 'bmi_database_backup.sql');
|
284 |
-
}
|
285 |
-
} else {
|
286 |
-
if ($db_exporter_files && sizeof($db_exporter_files) > 0) {
|
287 |
-
for ($i = 0; $i < sizeof($db_exporter_files); ++$i) {
|
288 |
-
$lib->addFile($db_exporter_files[$i], 'db_tables' . DIRECTORY_SEPARATOR . basename($db_exporter_files[$i]));
|
289 |
-
}
|
290 |
-
}
|
291 |
-
}
|
292 |
-
}
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
|
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
}
|
302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
// using PclZip
|
304 |
if ($this->lib === 2) {
|
305 |
|
|
|
|
|
|
|
306 |
// Verbose
|
307 |
$legacy = BMI_LEGACY_VERSION;
|
308 |
if ($legacy) $legacy = BMI_LEGACY_HARD_VERSION;
|
@@ -312,7 +333,15 @@ class Zip {
|
|
312 |
} elseif (!BMI_LEGACY_HARD_VERSION) {
|
313 |
$this->zip_progress->log(__("Legacy setting: Using user browser as middleware for full capabilities", 'backup-backup'), 'INFO');
|
314 |
} else {
|
|
|
315 |
$this->zip_progress->log(__("Legacy setting: Using default modules depending on user server", 'backup-backup'), 'INFO');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
}
|
317 |
|
318 |
// Run the backup in background
|
@@ -336,6 +365,8 @@ class Zip {
|
|
336 |
'root_dir' => plugin_dir_path(BMI_ROOT_FILE),
|
337 |
'browser' => false,
|
338 |
'shareallowed' => BMP::canShareLogsOrShouldAsk(),
|
|
|
|
|
339 |
'url' => $url
|
340 |
];
|
341 |
|
@@ -344,32 +375,6 @@ class Zip {
|
|
344 |
foreach ($Xfiles as $xfile) if (is_file($xfile)) unlink($xfile);
|
345 |
touch(BMI_INCLUDES . '/htaccess' . '/.' . $identy);
|
346 |
|
347 |
-
// if (BMI_CLI_ENABLED === true && BMI_FUNCTION_NORMAL === true) {
|
348 |
-
// file_put_contents($database_file_dir . 'bmi_cli_data.json', json_encode($remote_settings));
|
349 |
-
// $this->zip_progress->log(__("Running PHP CLI process - it should be confirmed with next messages", 'backup-backup'), 'STEP');
|
350 |
-
// $fix = false;
|
351 |
-
//
|
352 |
-
// // ignore_user_abort(true);
|
353 |
-
// // ob_start();
|
354 |
-
// // session_write_close();
|
355 |
-
// // header('Content-Length: ' . ob_get_length());
|
356 |
-
// // header('Connection: close');
|
357 |
-
// // ob_end_flush();
|
358 |
-
// // flush();
|
359 |
-
// // ob_start();
|
360 |
-
//
|
361 |
-
// $output = @shell_exec(BMI_CLI_EXECUTABLE . ' -f ' . realpath(BMI_INCLUDES . '/cli-handler.php') . ' bmi_backup');
|
362 |
-
//
|
363 |
-
// if ($output === '010011010101' || $output === '010011010111') {
|
364 |
-
// $this->zip_progress->log(__('CLI Failed, trying to save the backup using alternative approaches.', 'backup-backup'), 'WARN');
|
365 |
-
// $fix = true;
|
366 |
-
// }
|
367 |
-
//
|
368 |
-
// if ($output === '100101011101') {
|
369 |
-
// $this->zip_progress->log(__('PHP CLI response is correct, awaiting lock file.', 'backup-backup'), 'INFO');
|
370 |
-
// }
|
371 |
-
// }
|
372 |
-
|
373 |
if ($fix === true) {
|
374 |
if (BMI_LEGACY_HARD_VERSION === false && $cron === false) {
|
375 |
$remote_settings['browser'] = true;
|
@@ -414,6 +419,9 @@ class Zip {
|
|
414 |
} else {
|
415 |
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
|
416 |
$this->zip_progress->log(__("Backup is running under PHP CLI environment.", 'backup-backup'), 'INFO');
|
|
|
|
|
|
|
417 |
} else {
|
418 |
$this->zip_progress->log(__("Backup will run as single-request, may be unstable...", 'backup-backup'), 'WARN');
|
419 |
}
|
@@ -441,6 +449,45 @@ class Zip {
|
|
441 |
throw new \Exception('PHP-ZIP: Permission Denied or zlib can\'t be found');
|
442 |
}
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
try {
|
445 |
$splitby = 200; $milestoneby = 500;
|
446 |
$filestotal = sizeof($this->org_files);
|
@@ -529,20 +576,35 @@ class Zip {
|
|
529 |
|
530 |
$this->zip_progress->start(true);
|
531 |
|
532 |
-
$files = [
|
533 |
-
|
534 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
}
|
536 |
|
537 |
-
|
538 |
-
|
539 |
-
|
|
|
|
|
|
|
|
|
540 |
}
|
541 |
-
}
|
542 |
|
543 |
-
|
544 |
-
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
|
547 |
if (file_exists($database_file_dir . 'bmi_backup_manifest.json')) {
|
548 |
@unlink($database_file_dir . 'bmi_backup_manifest.json');
|
@@ -557,14 +619,14 @@ class Zip {
|
|
557 |
}
|
558 |
|
559 |
// Remove Better DB SQL Files
|
560 |
-
if ($db_exporter_files && sizeof($db_exporter_files) > 0) {
|
561 |
-
for ($i = 0; $i < sizeof($db_exporter_files); ++$i) {
|
562 |
-
if (file_exists($db_exporter_files[$i])) @unlink($db_exporter_files[$i]);
|
563 |
}
|
564 |
@rmdir($better_database_files_dir);
|
565 |
}
|
566 |
|
567 |
-
if (file_exists($database_file)) @unlink($database_file);
|
568 |
if (!file_exists($this->new_file_path)) {
|
569 |
throw new \Exception('PHP-ZIP: After doing the zipping file can not be found');
|
570 |
}
|
107 |
return true;
|
108 |
}
|
109 |
|
110 |
+
public function createDatabaseDump($dbbackupname, $better_database_files_dir, &$database_file, $database_file_dir, $dbBackupEngine = 'v4') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
if (Dashboard\bmi_get_config('BACKUP:DATABASE') == 'true') {
|
113 |
|
124 |
$databaser->exportDatabase($dbbackupname);
|
125 |
|
126 |
// Fix for newer version
|
127 |
+
$this->db_exporter_queries = 0;
|
128 |
$this->zip_progress->total_queries = 0;
|
129 |
+
$this->db_exporter_files = [];
|
130 |
|
131 |
+
$this->dbDumped = true;
|
132 |
$this->zip_progress->log(__("Database size: ", 'backup-backup') . BMP::humanSize(filesize($database_file)), 'INFO');
|
133 |
|
134 |
} else {
|
135 |
|
|
|
|
|
136 |
if ($dbBackupEngine == 'v4') {
|
137 |
|
138 |
// Require Database Manager
|
156 |
if (!is_dir($better_database_files_dir)) @mkdir($better_database_files_dir, 0755, true);
|
157 |
$db_exporter = new BetterDatabaseExport($better_database_files_dir, $this->zip_progress);
|
158 |
$db_exporter->export();
|
159 |
+
$this->db_exporter_files = $db_exporter->files;
|
160 |
+
$this->db_exporter_queries = $db_exporter->total_queries;
|
161 |
|
162 |
+
$this->zip_progress->total_queries = $this->db_exporter_queries;
|
163 |
|
164 |
+
$this->dbDumped = true;
|
165 |
$this->zip_progress->log(__("Database backup finished", 'backup-backup'), 'SUCCESS');
|
166 |
|
167 |
}
|
168 |
|
169 |
} else {
|
170 |
|
171 |
+
$this->dbDumped = false;
|
172 |
$this->zip_progress->log(__("Omitting database backup (due to settings)...", 'backup-backup'), 'WARN');
|
173 |
$database_file = false;
|
174 |
+
$this->db_exporter_files = [];
|
175 |
+
$this->db_exporter_queries = 0;
|
176 |
+
$this->zip_progress->total_queries = 0;
|
177 |
|
178 |
}
|
179 |
|
180 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
public function zip_end($force_lib = false, $cron = false) {
|
|
|
|
|
|
|
183 |
|
184 |
+
// v4 for new one, v3 for old one
|
185 |
+
$dbBackupEngine = 'v4';
|
|
|
|
|
186 |
|
187 |
+
// Try to set limit
|
188 |
+
$this->zip_progress->log(__("Smart memory calculation...", 'backup-backup'), 'STEP');
|
189 |
+
if ((intval($this->return_bytes(ini_get('memory_limit'))) / 1024 / 1024) < 384) @ini_set('memory_limit', '384M');
|
190 |
+
if (defined('WP_MAX_MEMORY_LIMIT')) $maxwp = WP_MAX_MEMORY_LIMIT;
|
191 |
+
else $maxwp = '1M';
|
192 |
|
193 |
+
$memory_limit = (intval($this->return_bytes(ini_get('memory_limit'))) / 1024 / 1024);
|
194 |
+
$maxwp = (intval($this->return_bytes($maxwp)) / 1024 / 1024);
|
195 |
|
196 |
+
if ($maxwp > $memory_limit) $memory_limit = $maxwp;
|
197 |
+
$this->zip_progress->log(str_replace('%s', $memory_limit, __("There is %s MBs of memory to use", 'backup-backup')), 'INFO');
|
198 |
+
$this->zip_progress->log(str_replace('%s', $maxwp, __("WordPress memory limit: %s MBs", 'backup-backup')), 'INFO');
|
199 |
+
$safe_limit = intval($memory_limit / 4);
|
200 |
+
if ($safe_limit > 64) $safe_limit = 64;
|
201 |
+
if ($memory_limit === 384) $safe_limit = 96;
|
202 |
+
if ($memory_limit >= 512) $safe_limit = 128;
|
203 |
+
if ($memory_limit >= 1024) $safe_limit = 256;
|
204 |
|
205 |
+
// $real_memory = intval(memory_get_usage() * 0.9 / 1024 / 1024);
|
206 |
+
// if ($real_memory < $safe_limit) $safe_limit = $real_memory;
|
207 |
+
$safe_limit = intval($safe_limit * 0.9);
|
|
|
|
|
208 |
|
209 |
+
$this->zip_progress->log(str_replace('%s', $safe_limit, __("Setting the safe limit to %s MB", 'backup-backup')), 'SUCCESS');
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
+
$abs = BMP::fixSlashes(ABSPATH) . DIRECTORY_SEPARATOR;
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
+
$dbbackupname = 'bmi_database_backup.sql';
|
214 |
+
$database_file = BMP::fixSlashes(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . $dbbackupname);
|
215 |
+
$database_file_dir = BMP::fixSlashes((dirname($database_file))) . DIRECTORY_SEPARATOR;
|
216 |
+
$better_database_files_dir = $database_file_dir . 'db_tables';
|
217 |
|
218 |
+
// force usage of specific lib (for testing purposes)
|
219 |
+
if ($force_lib === 2) {
|
|
|
|
|
|
|
220 |
|
221 |
+
$this->lib = 2;
|
|
|
222 |
|
223 |
+
} elseif ($force_lib === 1) {
|
|
|
|
|
|
|
224 |
|
225 |
+
$this->lib = 1;
|
|
|
|
|
226 |
|
227 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
+
$this->dbDumped = false;
|
230 |
+
$this->db_exporter_queries = 0;
|
231 |
+
$this->zip_progress->total_queries = 0;
|
232 |
+
$this->db_exporter_files = [];
|
233 |
|
234 |
+
// just to make sure.. if the user haven't called the earlier method
|
235 |
+
if ($this->lib === 0 || $this->new_file_path === 0) {
|
236 |
+
throw new \Exception('PHP-ZIP: zip_start and zip_add haven\'t been called yet');
|
237 |
}
|
238 |
|
239 |
+
// using zipArchive class
|
240 |
+
// if ($this->lib === 1) {
|
241 |
+
//
|
242 |
+
// // Create DB Dump
|
243 |
+
// $this->createDatabaseDump($dbbackupname, $better_database_files_dir, $database_file, $database_file_dir);
|
244 |
+
//
|
245 |
+
// // All files
|
246 |
+
// $max = sizeof($this->org_files);
|
247 |
+
// $this->zip_progress->log(__("Making archive", 'backup-backup'), 'STEP');
|
248 |
+
// $this->zip_progress->log(__("Compressing...", 'backup-backup'), 'INFO');
|
249 |
+
//
|
250 |
+
// // Verbose
|
251 |
+
// $this->zip_progress->log(__("Using Zlib to create Backup", 'backup-backup'));
|
252 |
+
//
|
253 |
+
// $lib = new \ZipArchive();
|
254 |
+
// if (!$lib->open($this->new_file_path, \ZipArchive::CREATE)) {
|
255 |
+
// throw new \Exception('PHP-ZIP: Permission Denied or zlib can\'t be found');
|
256 |
+
// }
|
257 |
+
//
|
258 |
+
// // Add each file
|
259 |
+
// for ($i = 0; $i < $max; $i++) {
|
260 |
+
// $file = $this->org_files[$i];
|
261 |
+
// $zippath = substr($file, strlen($abs));
|
262 |
+
// $lib->addFile($file, 'wordpress' . DIRECTORY_SEPARATOR . $zippath);
|
263 |
+
//
|
264 |
+
// if ($i % 100 === 0) {
|
265 |
+
// if (file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.abort')) {
|
266 |
+
// break;
|
267 |
+
// }
|
268 |
+
// $this->zip_progress->progress($i + 1 . '/' . $max);
|
269 |
+
// }
|
270 |
+
//
|
271 |
+
// if (($i + 1) % 500 === 0 || $i == 0) {
|
272 |
+
// if (($i + 1) < $max) {
|
273 |
+
// $this->zip_progress->log((__("Milestone: ", 'backup-backup') . ($i + 1) . '/' . $max), 'info');
|
274 |
+
// }
|
275 |
+
// }
|
276 |
+
// }
|
277 |
+
//
|
278 |
+
// if (file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.abort')) {
|
279 |
+
//
|
280 |
+
// // close the archive
|
281 |
+
// $lib->close();
|
282 |
+
// } else {
|
283 |
+
// $this->zip_progress->log((__("Milestone: ", 'backup-backup') . $max . '/' . $max), 'info');
|
284 |
+
// $this->zip_progress->log(__("Compressed ", 'backup-backup') . $max . __(" files", 'backup-backup'), 'SUCCESS');
|
285 |
+
//
|
286 |
+
// // Log time of ZIP Process
|
287 |
+
// $this->zip_progress->log(__("Archiving of ", 'backup-backup') . $max . __(" files took: ", 'backup-backup') . number_format(microtime(true) - $this->start_zip, 2) . 's');
|
288 |
+
//
|
289 |
+
// $this->zip_progress->log(__("Finalizing backup", 'backup-backup'), 'STEP');
|
290 |
+
// $this->zip_progress->log(__("Adding manifest...", 'backup-backup'), 'INFO');
|
291 |
+
// $this->zip_progress->log(__("Closing files and archives", 'backup-backup'), 'STEP');
|
292 |
+
// $this->zip_progress->log('#001', 'END-CODE');
|
293 |
+
//
|
294 |
+
// $this->zip_progress->end();
|
295 |
+
// $logs = file_get_contents(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'latest.log');
|
296 |
+
// $this->zip_progress->start(true);
|
297 |
+
//
|
298 |
+
// if ($database_file !== false) {
|
299 |
+
// if (Dashboard\bmi_get_config('OTHER:BACKUP:DB:SINGLE:FILE') == 'true') {
|
300 |
+
// if (file_exists($database_file)) {
|
301 |
+
// $lib->addFile($database_file, 'bmi_database_backup.sql');
|
302 |
+
// }
|
303 |
+
// } else {
|
304 |
+
// if ($db_exporter_files && sizeof($db_exporter_files) > 0) {
|
305 |
+
// for ($i = 0; $i < sizeof($db_exporter_files); ++$i) {
|
306 |
+
// $lib->addFile($db_exporter_files[$i], 'db_tables' . DIRECTORY_SEPARATOR . basename($db_exporter_files[$i]));
|
307 |
+
// }
|
308 |
+
// }
|
309 |
+
// }
|
310 |
+
// }
|
311 |
+
//
|
312 |
+
// $lib->addFromString('bmi_backup_manifest.json', $this->zip_progress->createManifest($dbBackupEngine));
|
313 |
+
// $lib->addFromString('bmi_logs_this_backup.log', $logs);
|
314 |
+
// $this->zip_progress->progress($max . '/' . $max);
|
315 |
+
//
|
316 |
+
// // close the archive
|
317 |
+
// $lib->close();
|
318 |
+
// }
|
319 |
+
// }
|
320 |
+
|
321 |
// using PclZip
|
322 |
if ($this->lib === 2) {
|
323 |
|
324 |
+
// All files
|
325 |
+
$max = sizeof($this->org_files);
|
326 |
+
|
327 |
// Verbose
|
328 |
$legacy = BMI_LEGACY_VERSION;
|
329 |
if ($legacy) $legacy = BMI_LEGACY_HARD_VERSION;
|
333 |
} elseif (!BMI_LEGACY_HARD_VERSION) {
|
334 |
$this->zip_progress->log(__("Legacy setting: Using user browser as middleware for full capabilities", 'backup-backup'), 'INFO');
|
335 |
} else {
|
336 |
+
|
337 |
$this->zip_progress->log(__("Legacy setting: Using default modules depending on user server", 'backup-backup'), 'INFO');
|
338 |
+
|
339 |
+
// Create DB Dump
|
340 |
+
$this->createDatabaseDump($dbbackupname, $better_database_files_dir, $database_file, $database_file_dir, $dbBackupEngine);
|
341 |
+
|
342 |
+
$this->zip_progress->log(__("Making archive", 'backup-backup'), 'STEP');
|
343 |
+
$this->zip_progress->log(__("Compressing...", 'backup-backup'), 'INFO');
|
344 |
+
|
345 |
}
|
346 |
|
347 |
// Run the backup in background
|
365 |
'root_dir' => plugin_dir_path(BMI_ROOT_FILE),
|
366 |
'browser' => false,
|
367 |
'shareallowed' => BMP::canShareLogsOrShouldAsk(),
|
368 |
+
'dbiteratio' => 0,
|
369 |
+
'dblast' => 0,
|
370 |
'url' => $url
|
371 |
];
|
372 |
|
375 |
foreach ($Xfiles as $xfile) if (is_file($xfile)) unlink($xfile);
|
376 |
touch(BMI_INCLUDES . '/htaccess' . '/.' . $identy);
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
if ($fix === true) {
|
379 |
if (BMI_LEGACY_HARD_VERSION === false && $cron === false) {
|
380 |
$remote_settings['browser'] = true;
|
419 |
} else {
|
420 |
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
|
421 |
$this->zip_progress->log(__("Backup is running under PHP CLI environment.", 'backup-backup'), 'INFO');
|
422 |
+
if ($this->dbDumped === false) {
|
423 |
+
$this->createDatabaseDump($dbbackupname, $better_database_files_dir, $database_file, $database_file_dir);
|
424 |
+
}
|
425 |
} else {
|
426 |
$this->zip_progress->log(__("Backup will run as single-request, may be unstable...", 'backup-backup'), 'WARN');
|
427 |
}
|
449 |
throw new \Exception('PHP-ZIP: Permission Denied or zlib can\'t be found');
|
450 |
}
|
451 |
|
452 |
+
if ($this->dbDumped === true) {
|
453 |
+
try {
|
454 |
+
|
455 |
+
$this->zip_progress->log(__('Adding database SQL file(s) to the backup file.', 'backup-backup'), 'STEP');
|
456 |
+
|
457 |
+
$files = [];
|
458 |
+
|
459 |
+
if ($database_file !== false && !($this->db_exporter_files && sizeof($this->db_exporter_files) > 0)) {
|
460 |
+
$files[] = $database_file;
|
461 |
+
}
|
462 |
+
|
463 |
+
if ($this->db_exporter_files && sizeof($this->db_exporter_files) > 0) {
|
464 |
+
for ($i = 0; $i < sizeof($this->db_exporter_files); ++$i) {
|
465 |
+
$files[] = $this->db_exporter_files[$i];
|
466 |
+
}
|
467 |
+
}
|
468 |
+
|
469 |
+
$dbback = $lib->add($files, PCLZIP_OPT_REMOVE_PATH, $database_file_dir);
|
470 |
+
|
471 |
+
if ($dbback == 0) {
|
472 |
+
$this->zip_failed($lib->errorInfo(true));
|
473 |
+
return false;
|
474 |
+
}
|
475 |
+
|
476 |
+
} catch (\Exception $e) {
|
477 |
+
$this->zip_failed($e->getMessage());
|
478 |
+
|
479 |
+
return false;
|
480 |
+
} catch (\Throwable $e) {
|
481 |
+
$this->zip_failed($e->getMessage());
|
482 |
+
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
|
486 |
+
$this->zip_progress->log(__('Database added to the backup successfully.', 'backup-backup'), 'SUCCESS');
|
487 |
+
}
|
488 |
+
|
489 |
+
$this->zip_progress->log(__('Performing site files backup...', 'backup-backup'), 'STEP');
|
490 |
+
|
491 |
try {
|
492 |
$splitby = 200; $milestoneby = 500;
|
493 |
$filestotal = sizeof($this->org_files);
|
576 |
|
577 |
$this->zip_progress->start(true);
|
578 |
|
579 |
+
$files = [];
|
580 |
+
|
581 |
+
if (file_exists($database_file_dir . 'bmi_logs_this_backup.log')) $files[] = $database_file_dir . 'bmi_logs_this_backup.log';
|
582 |
+
if (file_exists($database_file_dir . 'bmi_backup_manifest.json')) $files[] = $database_file_dir . 'bmi_backup_manifest.json';
|
583 |
+
else {
|
584 |
+
|
585 |
+
$this->zip_failed('Manifest file could not be added, manifest does not exist.');
|
586 |
+
return false;
|
587 |
+
|
588 |
}
|
589 |
|
590 |
+
try {
|
591 |
+
|
592 |
+
$maback = $lib->add($files, PCLZIP_OPT_REMOVE_PATH, $database_file_dir);
|
593 |
+
|
594 |
+
if ($maback == 0) {
|
595 |
+
$this->zip_failed($lib->errorInfo(true));
|
596 |
+
return false;
|
597 |
}
|
|
|
598 |
|
599 |
+
} catch (\Exception $e) {
|
600 |
+
$this->zip_failed($e->getMessage());
|
601 |
+
|
602 |
+
return false;
|
603 |
+
} catch (\Throwable $e) {
|
604 |
+
$this->zip_failed($e->getMessage());
|
605 |
+
|
606 |
+
return false;
|
607 |
+
}
|
608 |
|
609 |
if (file_exists($database_file_dir . 'bmi_backup_manifest.json')) {
|
610 |
@unlink($database_file_dir . 'bmi_backup_manifest.json');
|
619 |
}
|
620 |
|
621 |
// Remove Better DB SQL Files
|
622 |
+
if ($this->db_exporter_files && sizeof($this->db_exporter_files) > 0) {
|
623 |
+
for ($i = 0; $i < sizeof($this->db_exporter_files); ++$i) {
|
624 |
+
if (file_exists($this->db_exporter_files[$i])) @unlink($this->db_exporter_files[$i]);
|
625 |
}
|
626 |
@rmdir($better_database_files_dir);
|
627 |
}
|
628 |
|
629 |
+
if ($database_file && file_exists($database_file)) @unlink($database_file);
|
630 |
if (!file_exists($this->new_file_path)) {
|
631 |
throw new \Exception('PHP-ZIP: After doing the zipping file can not be found');
|
632 |
}
|
modules/deactivation/assets/script.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
// Always close the code, cause you can make conflicts (same for css use prefixes)
|
2 |
-
(function ($) {
|
3 |
-
|
4 |
-
let deactivation_urls = {};
|
5 |
-
|
6 |
-
function getUrl(plugin_dir) {
|
7 |
-
|
8 |
-
let plugin_slug = plugin_dir.split('/')[0];
|
9 |
-
return 'https://wordpress.org/support/plugin/' + plugin_slug + '/#wporg-footer';
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
function closeModal() {
|
14 |
-
|
15 |
-
setTimeout(function () {
|
16 |
-
$('#iiev-modal-leave').animate({'opacity': 0}, 400);
|
17 |
-
}, 200);
|
18 |
-
|
19 |
-
$('.iiev-modal-leave__body').animate({'opacity': 0, 'top': '-50px'}, 300, function () {
|
20 |
-
setTimeout(function () {
|
21 |
-
$('#iiev-modal-leave').hide();
|
22 |
-
}, 100);
|
23 |
-
});
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
function openModal(e) {
|
28 |
-
|
29 |
-
e.preventDefault();
|
30 |
-
|
31 |
-
let plugin_dist = $(e.target).attr('data-plugin-dist');
|
32 |
-
|
33 |
-
$('.iiev-modal-leave__away-link').attr('href', getUrl(plugin_dist));
|
34 |
-
$('.iiev-modal-leave__deactivated-link').attr('href', deactivation_urls[plugin_dist]);
|
35 |
-
|
36 |
-
$('#iiev-modal-leave').show();
|
37 |
-
$('#iiev-modal-leave').animate({'opacity': 1}, 300);
|
38 |
-
$('.iiev-modal-leave__body').animate({'opacity': 1, 'top': '0px'}, 300);
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
function addHook($tr) {
|
43 |
-
|
44 |
-
$tr.find('.deactivate').find('a').on('click', openModal);
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
function tryToFindItAndAddEvent(plugin) {
|
49 |
-
|
50 |
-
let $tr = $('#the-list').find('tr[data-plugin="' + plugin + '"]');
|
51 |
-
let deactivate_btn = $tr.find('.deactivate')
|
52 |
-
if (typeof deactivate_btn != 'undefined' && deactivate_btn.length > 0) {
|
53 |
-
deactivate_url = deactivate_btn.find('a')[0].getAttribute('href');
|
54 |
-
if (typeof deactivate_url != 'undefined' && deactivate_url.length > 0) {
|
55 |
-
deactivation_urls[plugin] = deactivate_url;
|
56 |
-
deactivate_btn.find('a').attr('href', '#');
|
57 |
-
deactivate_btn.find('a').attr('data-plugin-dist', plugin);
|
58 |
-
addHook($tr);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
$('.iiev-modal-leave__btn-close').on('click', closeModal);
|
65 |
-
|
66 |
-
for (let i = 0; i < IIEV_DEACTIV_PLUG_LIST.length; ++i) {
|
67 |
-
|
68 |
-
let plugin = IIEV_DEACTIV_PLUG_LIST[i];
|
69 |
-
tryToFindItAndAddEvent(plugin);
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/deactivation/assets/style.css
DELETED
@@ -1,316 +0,0 @@
|
|
1 |
-
/* Version 1.0.1 */
|
2 |
-
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
|
3 |
-
|
4 |
-
.iiev-modal-leave {
|
5 |
-
font-family: "Montserrat", "Arial", sans-serif;
|
6 |
-
color: #393939; }
|
7 |
-
|
8 |
-
.iiev-modal-leave__body {
|
9 |
-
opacity: 0;
|
10 |
-
top: -50px;
|
11 |
-
max-width: 600px;
|
12 |
-
position: relative;
|
13 |
-
background: #f0fbfe;
|
14 |
-
border-radius: 20px;
|
15 |
-
display: grid;
|
16 |
-
grid-template-columns: 1fr;
|
17 |
-
-webkit-box-align: start;
|
18 |
-
-ms-flex-align: start;
|
19 |
-
align-items: start;
|
20 |
-
justify-items: center;
|
21 |
-
-webkit-transform: translateY(50px);
|
22 |
-
transform: translateY(50px);
|
23 |
-
-webkit-transition: 0.5s all;
|
24 |
-
transition: 0.5s all;
|
25 |
-
margin: 115px auto 0; }
|
26 |
-
|
27 |
-
.iiev-modal-leave__btn-close {
|
28 |
-
display: -webkit-box;
|
29 |
-
display: -ms-flexbox;
|
30 |
-
display: flex;
|
31 |
-
-webkit-box-align: center;
|
32 |
-
-ms-flex-align: center;
|
33 |
-
align-items: center;
|
34 |
-
-webkit-box-pack: center;
|
35 |
-
-ms-flex-pack: center;
|
36 |
-
justify-content: center;
|
37 |
-
width: 26px;
|
38 |
-
height: 26px;
|
39 |
-
border: 0;
|
40 |
-
padding: 0;
|
41 |
-
background: transparent;
|
42 |
-
position: absolute;
|
43 |
-
z-index: 10;
|
44 |
-
right: 15px;
|
45 |
-
top: 15px;
|
46 |
-
cursor: pointer;
|
47 |
-
fill: #adadad;
|
48 |
-
-webkit-transition: fill 0.3s ease 0s;
|
49 |
-
transition: fill 0.3s ease 0s; }
|
50 |
-
@media (hover: hover), screen and (min-width: 0\0) {
|
51 |
-
.iiev-modal-leave__btn-close:hover {
|
52 |
-
fill: #000; } }
|
53 |
-
|
54 |
-
.iiev-modal-leave__content {
|
55 |
-
padding: 0 27px;
|
56 |
-
display: grid;
|
57 |
-
padding-bottom: 12px; }
|
58 |
-
@media (min-width: 600px) {
|
59 |
-
.iiev-modal-leave__content {
|
60 |
-
grid-template-columns: 247px 1fr;
|
61 |
-
gap: 42px 22px; } }
|
62 |
-
|
63 |
-
.iiev-modal-leave__title-wrap {
|
64 |
-
position: relative;
|
65 |
-
z-index: 3;
|
66 |
-
margin-top: -21px;
|
67 |
-
margin-bottom: 40px;
|
68 |
-
grid-column: 1/-1; }
|
69 |
-
@media (min-width: 600px) {
|
70 |
-
.iiev-modal-leave__title-wrap {
|
71 |
-
margin-bottom: 0; } }
|
72 |
-
|
73 |
-
.iiev-modal-leave__title {
|
74 |
-
font-weight: 500;
|
75 |
-
font-size: 28px;
|
76 |
-
line-height: 34px;
|
77 |
-
max-width: 255px;
|
78 |
-
text-align: center;
|
79 |
-
margin: 0 auto;
|
80 |
-
position: relative; }
|
81 |
-
.iiev-modal-leave__title::after {
|
82 |
-
pointer-events: none;
|
83 |
-
content: "";
|
84 |
-
position: absolute;
|
85 |
-
top: 50%;
|
86 |
-
left: 50%;
|
87 |
-
-webkit-transform: translate(-50%, -50%);
|
88 |
-
transform: translate(-50%, -50%);
|
89 |
-
width: 230px;
|
90 |
-
height: 221px;
|
91 |
-
z-index: -1;
|
92 |
-
background: url("../img/message.svg") no-repeat;
|
93 |
-
background-size: cover; }
|
94 |
-
@media (min-width: 600px) {
|
95 |
-
.iiev-modal-leave__title::after {
|
96 |
-
width: 273px;
|
97 |
-
height: 268px; } }
|
98 |
-
|
99 |
-
.iiev-modal-leave-text-primary {
|
100 |
-
color: #2885c0; }
|
101 |
-
|
102 |
-
.iiev-modal-leave__img-wrap {
|
103 |
-
position: relative;
|
104 |
-
z-index: 1; }
|
105 |
-
|
106 |
-
@media (min-width: 600px) {
|
107 |
-
.iiev-modal-leave__text-content {
|
108 |
-
padding-top: 47px;
|
109 |
-
padding-right: 20px; } }
|
110 |
-
|
111 |
-
.iiev-modal-leave__text-content-title {
|
112 |
-
font-weight: normal;
|
113 |
-
font-size: 18px;
|
114 |
-
line-height: 27px;
|
115 |
-
margin: 0 0 19px; }
|
116 |
-
|
117 |
-
.iiev-modal-leave__away-link {
|
118 |
-
padding: 15px 26px 13px 27px;
|
119 |
-
text-decoration: none;
|
120 |
-
background: #2885c0;
|
121 |
-
border-radius: 10px;
|
122 |
-
display: -webkit-inline-box;
|
123 |
-
display: -ms-inline-flexbox;
|
124 |
-
display: inline-flex;
|
125 |
-
-webkit-box-align: center;
|
126 |
-
-ms-flex-align: center;
|
127 |
-
align-items: center;
|
128 |
-
-webkit-box-pack: center;
|
129 |
-
-ms-flex-pack: center;
|
130 |
-
justify-content: center;
|
131 |
-
font-weight: 600;
|
132 |
-
font-size: 18px;
|
133 |
-
line-height: 22px;
|
134 |
-
color: #ffffff;
|
135 |
-
opacity: 1;
|
136 |
-
transition: .3s all;
|
137 |
-
margin: 0 auto 15px; }
|
138 |
-
.iiev-modal-leave__away-link svg {
|
139 |
-
-webkit-transition: -webkit-transform 0.3s ease 0s;
|
140 |
-
transition: -webkit-transform 0.3s ease 0s;
|
141 |
-
transition: transform 0.3s ease 0s;
|
142 |
-
transition: transform 0.3s ease 0s, -webkit-transform 0.3s ease 0s; }
|
143 |
-
@media (hover: hover), screen and (min-width: 0\0) {
|
144 |
-
.iiev-modal-leave__away-link:hover svg {
|
145 |
-
-webkit-transform: translateX(5px);
|
146 |
-
transform: translateX(5px); } }
|
147 |
-
|
148 |
-
.iiev-modal-leave__away-link-text {
|
149 |
-
margin-right: 10px; }
|
150 |
-
|
151 |
-
.iiev-modal-leave__away-link:hover, .iiev-modal-leave__away-link:active {
|
152 |
-
color: white !important;
|
153 |
-
opacity: 0.9;
|
154 |
-
}
|
155 |
-
|
156 |
-
.iiev-modal-leave__loggin-trouble {
|
157 |
-
display: -webkit-inline-box;
|
158 |
-
display: -ms-inline-flexbox;
|
159 |
-
display: inline-flex;
|
160 |
-
-webkit-box-align: center;
|
161 |
-
-ms-flex-align: center;
|
162 |
-
align-items: center;
|
163 |
-
margin: 0 0 8px 38px; }
|
164 |
-
.iiev-modal-leave__loggin-trouble span {
|
165 |
-
font-weight: normal;
|
166 |
-
font-size: 15px;
|
167 |
-
line-height: 18px;
|
168 |
-
color: #808080; }
|
169 |
-
|
170 |
-
.iiev-modal-leave__info {
|
171 |
-
display: -webkit-box;
|
172 |
-
display: -ms-flexbox;
|
173 |
-
display: flex;
|
174 |
-
-webkit-box-align: center;
|
175 |
-
-ms-flex-align: center;
|
176 |
-
align-items: center;
|
177 |
-
position: relative;
|
178 |
-
margin-left: 5px;
|
179 |
-
cursor: pointer; }
|
180 |
-
.iiev-modal-leave__info::after {
|
181 |
-
display: none;
|
182 |
-
content: "";
|
183 |
-
position: absolute;
|
184 |
-
z-index: 6;
|
185 |
-
bottom: calc(100% + 4px);
|
186 |
-
left: calc(50% + 75px);
|
187 |
-
-webkit-transform: translateX(-50%);
|
188 |
-
transform: translateX(-50%);
|
189 |
-
width: 0;
|
190 |
-
height: 0;
|
191 |
-
border-width: 21px 17.5px 0 17.5px;
|
192 |
-
border-color: #2885c0 transparent transparent transparent;
|
193 |
-
border-style: solid; }
|
194 |
-
.iiev-modal-leave__info::before {
|
195 |
-
content: "";
|
196 |
-
position: absolute;
|
197 |
-
width: 100px;
|
198 |
-
height: 40px;
|
199 |
-
background: transparent;
|
200 |
-
top: -30px;
|
201 |
-
left: 50%;
|
202 |
-
-webkit-transform: translateX(-50%);
|
203 |
-
transform: translateX(-50%);
|
204 |
-
pointer-events: none; }
|
205 |
-
@media (hover: hover), screen and (min-width: 0\0) {
|
206 |
-
.iiev-modal-leave__info:hover::before {
|
207 |
-
pointer-events: all; }
|
208 |
-
.iiev-modal-leave__info:hover::after {
|
209 |
-
-webkit-animation: 0.45s ease 0s normal forwards 1 iiev_fadein;
|
210 |
-
animation: 0.45s ease 0s normal forwards 1 iiev_fadein;
|
211 |
-
display: block }
|
212 |
-
.iiev-modal-leave__info:hover .iiev-modal-leave__info-popup {
|
213 |
-
-webkit-animation: 0.45s ease 0s normal forwards 1 iiev_fadein;
|
214 |
-
animation: 0.45s ease 0s normal forwards 1 iiev_fadein;
|
215 |
-
display: block;
|
216 |
-
z-index: 6; } }
|
217 |
-
|
218 |
-
@keyframes iiev_fadein {
|
219 |
-
0% { opacity:0; }
|
220 |
-
66% { opacity:0; }
|
221 |
-
100% { opacity:1; }
|
222 |
-
}
|
223 |
-
|
224 |
-
@-webkit-keyframes iiev_fadein {
|
225 |
-
0% { opacity:0; }
|
226 |
-
66% { opacity:0; }
|
227 |
-
100% { opacity:1; }
|
228 |
-
}
|
229 |
-
|
230 |
-
@keyframes iiev_fadeout {
|
231 |
-
0% { opacity:0; }
|
232 |
-
66% { opacity:0; }
|
233 |
-
100% { opacity:1; display: none; }
|
234 |
-
}
|
235 |
-
|
236 |
-
@-webkit-keyframes iiev_fadeout {
|
237 |
-
0% { opacity:0; }
|
238 |
-
66% { opacity:0; }
|
239 |
-
100% { opacity:1; display: none; }
|
240 |
-
}
|
241 |
-
|
242 |
-
.iiev-modal-leave__info-icon {
|
243 |
-
position: relative; }
|
244 |
-
|
245 |
-
.iiev-modal-leave__info-popup {
|
246 |
-
display: none;
|
247 |
-
position: absolute;
|
248 |
-
bottom: calc(100% + 4px);
|
249 |
-
left: -70px;
|
250 |
-
width: 200px;
|
251 |
-
padding: 20px 28px 19px;
|
252 |
-
background: #2885c0;
|
253 |
-
-webkit-box-shadow: 0px 0px 17px rgba(0, 0, 0, 0.3);
|
254 |
-
box-shadow: 0px 0px 17px rgba(0, 0, 0, 0.3);
|
255 |
-
border-radius: 5px;
|
256 |
-
font-weight: 500;
|
257 |
-
font-size: 15px;
|
258 |
-
line-height: 18px;
|
259 |
-
text-align: center;
|
260 |
-
color: #ffffff;
|
261 |
-
opacity: 0;
|
262 |
-
transition: .3s all;
|
263 |
-
margin-bottom: 11px; }
|
264 |
-
@media (min-width: 600px) {
|
265 |
-
.iiev-modal-leave__info-popup {
|
266 |
-
left: -267px;
|
267 |
-
width: 400px; } }
|
268 |
-
|
269 |
-
.iiev-modal-leave__text-hint {
|
270 |
-
font-weight: normal;
|
271 |
-
font-size: 13px;
|
272 |
-
line-height: 19px;
|
273 |
-
color: #2885c0;
|
274 |
-
position: relative;
|
275 |
-
padding-left: 12px; }
|
276 |
-
.iiev-modal-leave__text-hint::before {
|
277 |
-
content: "";
|
278 |
-
position: absolute;
|
279 |
-
left: 0;
|
280 |
-
top: 0;
|
281 |
-
width: 2px;
|
282 |
-
height: 100%;
|
283 |
-
border-radius: 2px;
|
284 |
-
background: currentColor; }
|
285 |
-
|
286 |
-
.iiev-modal-leave__footer {
|
287 |
-
width: 100%;
|
288 |
-
background: #d7f0f7;
|
289 |
-
text-align: center;
|
290 |
-
border-radius: 0px 0px 20px 20px; }
|
291 |
-
|
292 |
-
.iiev-modal-leave__deactivated-link {
|
293 |
-
text-decoration: none;
|
294 |
-
display: -webkit-inline-box;
|
295 |
-
display: -ms-inline-flexbox;
|
296 |
-
display: inline-flex;
|
297 |
-
font-weight: 500;
|
298 |
-
font-size: 14px;
|
299 |
-
line-height: 17px;
|
300 |
-
color: #9fb9bf;
|
301 |
-
padding: 16px 5px 17px; }
|
302 |
-
@media (hover: hover), screen and (min-width: 0\0) {
|
303 |
-
.iiev-modal-leave__deactivated-link:hover {
|
304 |
-
color: #3b7887; } }
|
305 |
-
|
306 |
-
#iiev-modal-leave {
|
307 |
-
position: fixed;
|
308 |
-
top: 0;
|
309 |
-
left: 0;
|
310 |
-
width: 100%;
|
311 |
-
height: 100%;
|
312 |
-
z-index: 99999;
|
313 |
-
background: rgba(2, 113, 245, 0.21);
|
314 |
-
display: none;
|
315 |
-
opacity: 0;
|
316 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/deactivation/deactivation.php
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Deactivation free help offer module
|
5 |
-
*
|
6 |
-
* @category Child Plugin
|
7 |
-
* @version v0.1.0
|
8 |
-
* @since v0.1.0
|
9 |
-
* @author iClyde <kontakt@iclyde.pl>
|
10 |
-
* @author Artem K
|
11 |
-
*/
|
12 |
-
|
13 |
-
// Namespace
|
14 |
-
namespace Inisev\Subs;
|
15 |
-
|
16 |
-
// Disallow direct access
|
17 |
-
if (!defined('ABSPATH')) exit;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Main class for handling the Deactivation
|
21 |
-
*/
|
22 |
-
if (!class_exists('Inisev\Subs\Inisev_Deactivation')) {
|
23 |
-
class Inisev_Deactivation {
|
24 |
-
|
25 |
-
// Variables
|
26 |
-
private $assets_url;
|
27 |
-
private $plugin_dir;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* __construct - Initialization of the module
|
31 |
-
* @param string $plugin Name with path to the plugin source file e.g. "backup-backup/backup-backup.php"
|
32 |
-
*
|
33 |
-
* @return void
|
34 |
-
*/
|
35 |
-
function __construct($plugin, $plugin_dir, $plugin_file) {
|
36 |
-
|
37 |
-
global $pagenow;
|
38 |
-
if ($pagenow != 'plugins.php') return;
|
39 |
-
|
40 |
-
$this->plugin_file = $plugin_file;
|
41 |
-
$this->plugin_dir = $plugin_dir;
|
42 |
-
$this->assets_url = plugin_dir_url($this->plugin_dir) . basename($plugin_dir);
|
43 |
-
|
44 |
-
if (file_exists(trailingslashit(WP_PLUGIN_DIR) . $plugin)) {
|
45 |
-
if (!isset($GLOBALS['IIEV_PLUGINS_DEACTIVATION'])) {
|
46 |
-
$GLOBALS['IIEV_PLUGINS_DEACTIVATION'] = [];
|
47 |
-
}
|
48 |
-
if (!in_array($plugin, $GLOBALS['IIEV_PLUGINS_DEACTIVATION'])) {
|
49 |
-
$GLOBALS['IIEV_PLUGINS_DEACTIVATION'][] = $plugin;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
$this->enableDeactivation();
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* add_assets - Will add assets for that module
|
59 |
-
*
|
60 |
-
* @return void
|
61 |
-
*/
|
62 |
-
public function add_assets() {
|
63 |
-
|
64 |
-
wp_enqueue_script('inisev-deactivation-script', $this->__asset('assets/script.js'), [], filemtime($this->__asset('assets/script.js', true)), true);
|
65 |
-
wp_enqueue_style('inisev-deactivation-style', $this->__asset('assets/style.css'), [], filemtime($this->__asset('assets/style.css', true)));
|
66 |
-
|
67 |
-
add_action('wp_after_admin_bar_render', [&$this, 'render_content']);
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* render_content - Will render content of our deactivation modal
|
73 |
-
*
|
74 |
-
* @return void
|
75 |
-
*/
|
76 |
-
public function render_content() {
|
77 |
-
|
78 |
-
require_once trailingslashit(__DIR__) . 'modal.php';
|
79 |
-
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* __asset - Asset handler will return path
|
84 |
-
*
|
85 |
-
* @param string $name Relative path to the file
|
86 |
-
* @return string Absolute path to that file
|
87 |
-
*/
|
88 |
-
private function __asset($name, $dir = false) {
|
89 |
-
|
90 |
-
if ($dir == false) {
|
91 |
-
return trailingslashit($this->assets_url) . 'modules' . DIRECTORY_SEPARATOR . 'deactivation' . DIRECTORY_SEPARATOR . $name;
|
92 |
-
} else {
|
93 |
-
return trailingslashit(__DIR__) . $name;
|
94 |
-
}
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* add_plugin_list - Will print out script with plugin array
|
100 |
-
*
|
101 |
-
* @return void
|
102 |
-
*/
|
103 |
-
public function add_plugin_list() {
|
104 |
-
|
105 |
-
$plugin_list = $GLOBALS['IIEV_PLUGINS_DEACTIVATION'];
|
106 |
-
if (is_array($plugin_list) && sizeof($plugin_list) >= 1) {
|
107 |
-
echo '<script type="text/javascript"> const IIEV_DEACTIV_PLUG_LIST = ' . json_encode($plugin_list) . ';</script>';
|
108 |
-
}
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* enableDeactivation - It will enable deactivation script & style
|
114 |
-
*
|
115 |
-
* @return void
|
116 |
-
*/
|
117 |
-
private function enableDeactivation() {
|
118 |
-
|
119 |
-
if (!defined('IIEV_ASSETS_LOADED_DEACTIV')) {
|
120 |
-
define('IIEV_ASSETS_LOADED_DEACTIV', true);
|
121 |
-
add_action('admin_enqueue_scripts', [&$this, 'add_assets']);
|
122 |
-
}
|
123 |
-
|
124 |
-
if (!defined('IIEV_LIST_MODULE_DEACTIV')) {
|
125 |
-
define('IIEV_LIST_MODULE_DEACTIV', true);
|
126 |
-
add_action('wp_print_scripts', [&$this, 'add_plugin_list']);
|
127 |
-
}
|
128 |
-
|
129 |
-
}
|
130 |
-
|
131 |
-
}
|
132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/deactivation/img/dog.webp
DELETED
Binary file
|
modules/deactivation/img/message.svg
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<svg width="275" height="260" viewBox="0 0 275 260" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2 |
-
<path d="M152.549 17.9273C85.7088 12.3375 27.6767 54.5999 22.8443 112.385C19.2289 155.615 46.4303 195.126 88.2189 214.688C80.8529 241.755 65.0762 243.476 65.0762 243.476C93.7247 250.105 109.631 235.151 117.046 224.373C122.912 225.623 128.914 226.559 135.059 227.073C201.899 232.663 259.931 190.401 264.764 132.616C269.596 74.8313 219.282 23.5081 152.549 17.9273Z" fill="#DBF6FE"/>
|
3 |
-
<path d="M142.552 10.2519C121.314 8.4758 99.6793 11.4432 79.795 19.4422C61.8156 26.7321 45.3353 38.1641 33.0046 53.1999C20.9166 67.9304 13.1221 85.8425 11.2119 104.789C9.1845 125.138 14.0838 145.74 24.5632 163.226C35.4106 181.503 51.6406 196.431 70.3337 206.57C72.7231 207.856 75.1215 209.033 77.6277 210.22C77.3584 209.546 76.9813 208.863 76.7119 208.189C74.4547 215.708 71.6584 223.182 66.1764 229.02C64.6216 230.736 62.6356 232.415 60.8025 233.565C60.0028 234.041 59.2031 234.517 58.4124 234.885C58.0709 235.073 57.7385 235.154 57.397 235.343C57.1724 235.433 56.2739 235.792 56.7231 235.612C56.0583 235.774 55.3844 236.043 54.7285 236.097C53.1922 236.294 52.868 238.872 54.4671 239.223C63.9447 241.427 73.908 241.717 83.2794 238.701C90.3056 236.466 96.6137 232.434 101.826 227.225C104.199 224.818 106.364 222.285 108.225 219.51C107.776 219.689 107.21 219.968 106.76 220.147C121.269 223.206 136.173 224.127 150.953 222.649C163.657 221.323 176.181 218.245 188.087 213.487C199.22 208.881 209.823 202.82 219.15 195.132C228.119 187.849 236.018 179.065 242.157 169.265C248.297 159.465 252.567 148.64 254.817 137.321C257.084 125.786 257.213 113.855 255.132 102.39C253.033 91.1417 248.949 80.2697 243.157 70.3405C237.167 60.1777 229.569 51.0745 220.785 43.1748C211.597 34.9157 201.195 28.1835 190.011 23.0144C178.1 17.4587 165.496 13.6906 152.524 11.7372C149.119 10.9097 145.786 10.5224 142.552 10.2519C140.504 10.0806 140.233 13.3148 142.282 13.4861C167.401 15.5868 191.844 24.4703 211.838 39.8211C229.793 53.5901 243.929 72.7934 250.023 94.6895C256.107 116.694 253.594 140.258 243.103 160.55C232.613 180.842 214.775 196.829 194.396 206.849C171.186 218.261 144.709 222.018 119.24 218.911C115.161 218.353 110.984 217.678 106.932 216.796C106.402 216.643 105.719 217.02 105.467 217.433C102.133 222.257 98.0798 226.586 93.2454 229.873C87.0181 234.237 79.6504 236.661 72.1035 237.333C66.5332 237.735 60.8284 237.15 55.3934 235.935C55.3032 237.013 55.2221 237.983 55.1319 239.062C57.3241 238.811 59.5795 237.805 61.4126 236.656C66.5524 233.612 70.6326 228.959 73.5539 223.884C76.2235 219.222 77.932 214.371 79.4428 209.286C79.7305 208.442 79.3624 207.651 78.527 207.256C59.7258 198.41 42.9384 184.955 31.0304 167.675C19.8051 151.321 13.4141 131.68 13.8781 111.852C14.3418 93.3266 20.627 75.2883 31.4393 60.2341C42.4853 44.9822 57.5912 33.1096 74.6454 25.1996C93.2901 16.4455 113.811 12.5165 134.178 13.0256C136.882 13.1431 139.586 13.2607 142.282 13.4861C144.33 13.6574 144.6 10.4232 142.552 10.2519Z" fill="#523823"/>
|
4 |
-
</svg>
|
|
|
|
|
|
|
|
modules/deactivation/modal.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Deactivation free help offer module
|
5 |
-
*
|
6 |
-
* @category Child Plugin
|
7 |
-
* @version v0.1.0
|
8 |
-
* @since v0.1.0
|
9 |
-
* @author iClyde <kontakt@iclyde.pl>
|
10 |
-
* @author Artem K
|
11 |
-
*/
|
12 |
-
|
13 |
-
// Namespace
|
14 |
-
namespace Inisev\Subs;
|
15 |
-
|
16 |
-
// Disallow direct access
|
17 |
-
if (!defined('ABSPATH')) exit;
|
18 |
-
|
19 |
-
?>
|
20 |
-
<div id="iiev-modal-leave" class="iiev-modal-leave">
|
21 |
-
|
22 |
-
<div class="iiev-modal-leave__body">
|
23 |
-
<button type="button" class="iiev-modal-leave__btn-close" id="iiev-modal-leave__closebtn" aria-label="close modal">
|
24 |
-
<svg width="10" height="10" viewBox="0 0 11 10">
|
25 |
-
<path d="M9.70384 1.96966L6.66078 4.99993L9.70384 8.03006C10.1565 8.48093 10.1565 9.21127 9.70384 9.66213C9.47768 9.88732 9.18117 10 8.8848 10C8.58794 10 8.2914 9.88749 8.06541 9.66213L5.02168 6.63165L1.97818 9.6621C1.75204 9.88729 1.4555 9.99997 1.15887 9.99997C0.86233 9.99997 0.565989 9.88746 0.339654 9.6621C-0.112987 9.21144 -0.112987 8.48107 0.339654 8.03004L3.38264 4.9999L0.339481 1.96966C-0.11316 1.51896 -0.11316 0.788452 0.339481 0.33776C0.792036 -0.112587 1.52528 -0.112587 1.978 0.33776L5.02165 3.36804L8.06506 0.33776C8.51788 -0.112587 9.2512 -0.112587 9.70367 0.33776C10.1565 0.788452 10.1565 1.51896 9.70384 1.96966Z"></path>
|
26 |
-
</svg>
|
27 |
-
</button>
|
28 |
-
<div class="iiev-modal-leave__content">
|
29 |
-
|
30 |
-
<div class="iiev-modal-leave__title-wrap">
|
31 |
-
<h1 class="iiev-modal-leave__title">
|
32 |
-
<b><span class="iiev-modal-leave-text-primary">Please</span></b> don’t leave us!
|
33 |
-
</h1>
|
34 |
-
</div>
|
35 |
-
<div class="iiev-modal-leave__img-wrap">
|
36 |
-
<img src="<?php echo $this->__asset('img/dog.webp') ?>" width="247" height="290" alt="dog with sad eyes">
|
37 |
-
</div>
|
38 |
-
|
39 |
-
<div class="iiev-modal-leave__text-content">
|
40 |
-
<h2 class="iiev-modal-leave__text-content-title">
|
41 |
-
We’re happy to fix the issue, whatever it is! Quickly, and <b><span class="iiev-modal-leave-text-primary">100%
|
42 |
-
for free</span></b> :)
|
43 |
-
</h2>
|
44 |
-
<a href="#" target="_blank" class="iiev-modal-leave__away-link">
|
45 |
-
<span class="iiev-modal-leave__away-link-text">Ok, let me ask you</span>
|
46 |
-
<svg width="7" height="12" viewBox="0 0 7 12">
|
47 |
-
<path d="M6.53033 6.53033C6.82322 6.23744 6.82322 5.76256 6.53033 5.46967L1.75736 0.696699C1.46447 0.403806 0.989592 0.403806 0.696699 0.696699C0.403806 0.989592 0.403806 1.46447 0.696699 1.75736L4.93934 6L0.696699 10.2426C0.403806 10.5355 0.403806 11.0104 0.696699 11.3033C0.989592 11.5962 1.46447 11.5962 1.75736 11.3033L6.53033 6.53033ZM5 6.75H6V5.25H5V6.75Z" fill="white"></path>
|
48 |
-
</svg>
|
49 |
-
</a>
|
50 |
-
<div class="iiev-modal-leave__loggin-trouble">
|
51 |
-
|
52 |
-
<div class="iiev-modal-leave__info">
|
53 |
-
<span>Trouble logging in?</span>
|
54 |
-
<svg class="iiev-modal-leave__info-icon" width="16" height="16" viewBox="0 0 16 16">
|
55 |
-
<circle cx="8" cy="8" r="8" fill="#2885C0"></circle>
|
56 |
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.44813 5.96124C9.43327 5.95864 9.41823 5.95732 9.40314 5.95735H9.35043C9.19253 5.95266 9.03454 5.96281 8.87853 5.98761C8.70752 6.01975 8.53137 6.04738 8.361 6.07374L8.12249 6.11102L7.22241 6.25761L7.08805 6.2801L7.02376 6.29105L6.92733 6.3071L6.75503 6.84456H7.03598H7.12084C7.17623 6.84374 7.23162 6.84633 7.2867 6.85229C7.33498 6.85765 7.37929 6.88156 7.41025 6.919C7.4412 6.95643 7.45637 7.00445 7.45257 7.05288C7.43727 7.20794 7.40736 7.36118 7.36322 7.51061C7.23464 7.96064 7.10155 8.41068 6.97426 8.85299L6.79682 9.46246C6.77175 9.55054 6.74604 9.6386 6.72032 9.72732C6.63996 10.0044 6.55638 10.2905 6.47602 10.5734C6.4227 10.7466 6.39709 10.9271 6.40015 11.1083C6.40419 11.3387 6.49837 11.5585 6.66246 11.7203C6.82256 11.8768 7.03213 11.9728 7.25521 11.9916C7.3071 11.9973 7.35924 12.0001 7.41143 12C7.61553 11.9994 7.8174 11.9574 8.00483 11.8765C8.2435 11.7715 8.46128 11.6243 8.64772 11.4419C8.8778 11.2198 9.08106 10.9714 9.25335 10.702C9.30542 10.6222 9.35556 10.5399 9.40442 10.4609L9.47321 10.3503L9.56065 10.2108L9.08232 9.92921L8.99811 10.0578C8.99297 10.0649 8.9891 10.0713 8.98524 10.0777L8.96596 10.1054L8.87661 10.2339C8.80718 10.3323 8.73516 10.4339 8.66187 10.5309C8.58028 10.6427 8.4848 10.7436 8.37772 10.8312C8.35185 10.8519 8.32301 10.8686 8.2922 10.8807H8.289C8.28474 10.8775 8.28105 10.8736 8.27807 10.8691C8.27469 10.8652 8.27247 10.8604 8.27167 10.8553C8.27088 10.8502 8.27152 10.845 8.27356 10.8402L8.29477 10.7444C8.31855 10.6325 8.34171 10.5271 8.37128 10.423C8.67537 9.36346 8.9859 8.28661 9.28613 7.24511L9.57929 6.22932C9.58379 6.21389 9.58701 6.19909 9.59086 6.18494C9.59472 6.1708 9.59086 6.17275 9.59536 6.16568L9.64037 5.98824L9.45843 5.96701L9.44813 5.96124ZM9.47385 3.28162C9.34609 3.22768 9.2088 3.19994 9.07012 3.2C8.93297 3.20061 8.79733 3.22879 8.67131 3.28291C8.54528 3.33703 8.43144 3.41598 8.33656 3.51501C8.23998 3.61221 8.16371 3.72764 8.11217 3.85459C8.06062 3.98154 8.03486 4.11747 8.03635 4.25448C8.03785 4.39149 8.06658 4.52684 8.12088 4.65264C8.17518 4.77844 8.25397 4.89217 8.35264 4.98724C8.44609 5.08127 8.55715 5.15598 8.67949 5.20706C8.80183 5.25813 8.93303 5.28458 9.06561 5.28491H9.07526C9.31563 5.28393 9.54827 5.1999 9.73377 5.04704C9.91928 4.89418 10.0462 4.68187 10.0931 4.44612C10.1401 4.21038 10.104 3.96566 9.99117 3.75343C9.8783 3.5412 9.69554 3.37452 9.47385 3.28162Z" fill="white"></path>
|
57 |
-
<div class="iiev-modal-leave__info-popup">
|
58 |
-
Your account on Wordpress.org (where you open a new support thread) is different to the one you
|
59 |
-
login to your WordPress
|
60 |
-
dashboard (where you are now). If you don't have a WordPress.org account yet, please sign up at the
|
61 |
-
top right on the
|
62 |
-
Support Forum page, and then scroll down on that page . It only takes a minute:)
|
63 |
-
Thank you!
|
64 |
-
</div>
|
65 |
-
</svg></div>
|
66 |
-
|
67 |
-
</div>
|
68 |
-
<p class="iiev-modal-leave__text-hint">
|
69 |
-
Just open a new ticket, you don't have to browse through existing ones
|
70 |
-
</p>
|
71 |
-
</div>
|
72 |
-
|
73 |
-
</div>
|
74 |
-
<footer class="iiev-modal-leave__footer">
|
75 |
-
<a href="#" class="iiev-modal-leave__deactivated-link">
|
76 |
-
I already asked – de-activate it for now
|
77 |
-
</a>
|
78 |
-
</footer>
|
79 |
-
</div>
|
80 |
-
|
81 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: Migrate
|
3 |
Tags: Backup, Migration, Migrate, Backups, Restore, All In One, Duplicate, Clone, Import, Export, Transfer
|
4 |
Requires at least: 4.6
|
5 |
-
Tested up to: 6.
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
@@ -11,12 +11,13 @@ Backup Migrate Restore
|
|
11 |
|
12 |
== Description ==
|
13 |
|
|
|
|
|
|
|
14 |
Creating a backup of your site has never been easier!
|
15 |
|
16 |
Simply install the plugin, click on "Create backup now" - done.
|
17 |
|
18 |
-
**Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/backup-backup](https://tastewp.com/plugins/backup-backup?redirect-menu=backup-migration)**.
|
19 |
-
|
20 |
You can also schedule backups, e.g. define that a backup should be taken automatically every week (or every day/month).
|
21 |
|
22 |
Use a wide choice of configuration options:
|
@@ -143,6 +144,47 @@ Vietnamese: [Tạo sao lưu, khôi phục các bản sao lưu và di chuyển c
|
|
143 |
|
144 |
== Changelog ==
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
= 1.2.2 =
|
147 |
* Fixed some plugin conflicts causing styling issues in our plugin
|
148 |
* Removed unnecessary error logging
|
@@ -403,24 +445,45 @@ Vietnamese: [Tạo sao lưu, khôi phục các bản sao lưu và di chuyển c
|
|
403 |
* Initial release
|
404 |
|
405 |
== Upgrade Notice ==
|
406 |
-
= 1.2.
|
407 |
-
What's new in 1.2.
|
408 |
-
*
|
409 |
-
*
|
410 |
-
*
|
411 |
-
*
|
412 |
-
*
|
413 |
-
*
|
414 |
-
*
|
415 |
-
*
|
416 |
-
*
|
417 |
-
*
|
418 |
-
*
|
419 |
-
*
|
420 |
-
*
|
421 |
-
*
|
422 |
-
*
|
423 |
-
*
|
424 |
-
* Fixed
|
425 |
-
*
|
426 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
Contributors: Migrate
|
3 |
Tags: Backup, Migration, Migrate, Backups, Restore, All In One, Duplicate, Clone, Import, Export, Transfer
|
4 |
Requires at least: 4.6
|
5 |
+
Tested up to: 6.1
|
6 |
+
Stable tag: 1.2.3
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
**Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/backup-backup](https://demo.tastewp.com/bmi).**
|
15 |
+
(this trick works for all plugins in the WP repo - just replace "wordpress" with "tastewp" in the URL)
|
16 |
+
|
17 |
Creating a backup of your site has never been easier!
|
18 |
|
19 |
Simply install the plugin, click on "Create backup now" - done.
|
20 |
|
|
|
|
|
21 |
You can also schedule backups, e.g. define that a backup should be taken automatically every week (or every day/month).
|
22 |
|
23 |
Use a wide choice of configuration options:
|
144 |
|
145 |
== Changelog ==
|
146 |
|
147 |
+
= 1.2.3 =
|
148 |
+
* Permanently excluded link files from the backup (directories and files)
|
149 |
+
* Permanently excluded non-readable files from the backup to prevent errors.
|
150 |
+
* Applied above exclusion rules to file size calculator in plugin settings
|
151 |
+
* Removed unused debug dd() function to prevent conflicts
|
152 |
+
* Adjusted bytes to read converter to display proper size value on string data
|
153 |
+
* Changed action hook of plugin's settings – script and style
|
154 |
+
* Fixed issues with notices/warnings of unaccessible variables (backup)
|
155 |
+
* Set new database export engine as default (v4, requires at least v1.2.2 to restore)
|
156 |
+
* Added possibility to disable space check step, not recommend but may help in some cases
|
157 |
+
* Updated out of the box backup paths of other plugins - exclusion rules (5 new)
|
158 |
+
* Fixed temporary files clean-up after restoration (fail and successful)
|
159 |
+
* Modified default size of query output – new value: 2000
|
160 |
+
* Added support for batching to search & replace step (restoration/migration)
|
161 |
+
* Added new option for search & replace, allows to set page size – default 300
|
162 |
+
* Removed unused deactivation module from source code
|
163 |
+
* Added hints of how to properly create support topic
|
164 |
+
* Fixed close button for restoration/migration process error window
|
165 |
+
* Adjusted style of logs for database (now current table will be displayed as step)
|
166 |
+
* Fixed percentages above 100% for database table progress in logs
|
167 |
+
* Adjusted old v3 database engine to support new search replace method
|
168 |
+
* Added automatic temporary theme for the time of restoration/migration
|
169 |
+
* All other plugins will be now automatically disabled during db migration/restoration
|
170 |
+
* Fixed rare issue when wp-config.php was empty after restoration
|
171 |
+
* Fixed issues with database restoration of tables with columns using reserved names (like "key")
|
172 |
+
* Fixed issues with search & replace of tables with columns using reserved names (like "key")
|
173 |
+
* Added improvements for restoration at TasteWP.com
|
174 |
+
* Updated v3 restoration engine (old backups) to not activate problematic plugins
|
175 |
+
* Added batching for database export during backup process (only alternate backup methods)
|
176 |
+
* Added option which allows to toggle batching technique of database export (disabled by default)
|
177 |
+
* Fully tested on WordPress 6.1 with PHP 7.4, 8.0 and 8.1
|
178 |
+
* Fixed Super-Quick Migration automatic restoration continuation
|
179 |
+
* Fixed download URL and Super-Quick Migration URL displayed after backup process
|
180 |
+
* Premium: Fixed database table exclusion rules in different backup methods
|
181 |
+
* Added additional check for non-readable files in legacy backup methods
|
182 |
+
* Minimized possibility of damaged backup with success window
|
183 |
+
* Resolved issues with freezing live-log in/with PHP CLI mode
|
184 |
+
* Fixed multisite restoration while blog domain used www. while new website don't
|
185 |
+
* Adjusted engine selector for compatibility with older restoration methods
|
186 |
+
* Adjusted auto-login after restoration to work with forum-like plugins and new version of WP
|
187 |
+
|
188 |
= 1.2.2 =
|
189 |
* Fixed some plugin conflicts causing styling issues in our plugin
|
190 |
* Removed unnecessary error logging
|
445 |
* Initial release
|
446 |
|
447 |
== Upgrade Notice ==
|
448 |
+
= 1.2.3 =
|
449 |
+
What's new in 1.2.3?
|
450 |
+
* Permanently excluded link files from the backup (directories and files)
|
451 |
+
* Permanently excluded non-readable files from the backup to prevent errors.
|
452 |
+
* Applied above exclusion rules to file size calculator in plugin settings
|
453 |
+
* Removed unused debug dd() function to prevent conflicts
|
454 |
+
* Adjusted bytes to read converter to display proper size value on string data
|
455 |
+
* Changed action hook of plugin's settings – script and style
|
456 |
+
* Fixed issues with notices/warnings of unaccessible variables (backup)
|
457 |
+
* Set new database export engine as default (v4, requires at least v1.2.2 to restore)
|
458 |
+
* Added possibility to disable space check step, not recommend but may help in some cases
|
459 |
+
* Updated out of the box backup paths of other plugins - exclusion rules (5 new)
|
460 |
+
* Fixed temporary files clean-up after restoration (fail and successful)
|
461 |
+
* Modified default size of query output – new value: 2000
|
462 |
+
* Added support for batching to search & replace step (restoration/migration)
|
463 |
+
* Added new option for search & replace, allows to set page size – default 300
|
464 |
+
* Removed unused deactivation module from source code
|
465 |
+
* Added hints of how to properly create support topic
|
466 |
+
* Fixed close button for restoration/migration process error window
|
467 |
+
* Adjusted style of logs for database (now current table will be displayed as step)
|
468 |
+
* Fixed percentages above 100% for database table progress in logs
|
469 |
+
* Adjusted old v3 database engine to support new search replace method
|
470 |
+
* Added automatic temporary theme for the time of restoration/migration
|
471 |
+
* All other plugins will be now automatically disabled during db migration/restoration
|
472 |
+
* Fixed rare issue when wp-config.php was empty after restoration
|
473 |
+
* Fixed issues with database restoration of tables with columns using reserved names (like "key")
|
474 |
+
* Fixed issues with search & replace of tables with columns using reserved names (like "key")
|
475 |
+
* Added improvements for restoration at TasteWP.com
|
476 |
+
* Updated v3 restoration engine (old backups) to not activate problematic plugins
|
477 |
+
* Added batching for database export during backup process (only alternate backup methods)
|
478 |
+
* Added option which allows to toggle batching technique of database export (disabled by default)
|
479 |
+
* Fully tested on WordPress 6.1 with PHP 7.4, 8.0 and 8.1
|
480 |
+
* Fixed Super-Quick Migration automatic restoration continuation
|
481 |
+
* Fixed download URL and Super-Quick Migration URL displayed after backup process
|
482 |
+
* Premium: Fixed database table exclusion rules in different backup methods
|
483 |
+
* Added additional check for non-readable files in legacy backup methods
|
484 |
+
* Minimized possibility of damaged backup with success window
|
485 |
+
* Resolved issues with freezing live-log in/with PHP CLI mode
|
486 |
+
* Resolved issues with freezing live-log in/with PHP CLI mode
|
487 |
+
* Fixed multisite restoration while blog domain used www. while new website don't
|
488 |
+
* Adjusted engine selector for compatibility with older restoration methods
|
489 |
+
* Adjusted auto-login after restoration to work with forum-like plugins and new version of WP
|