Plugin Directory

Changeset 3485735


Ignore:
Timestamp:
03/18/2026 01:44:41 PM (2 weeks ago)
Author:
seraphinitesoft
Message:

seraphinite-accelerator: 2.28.16.

Location:
seraphinite-accelerator
Files:
145 added
20 edited

Legend:

Unmodified
Added
Removed
  • seraphinite-accelerator/trunk/Admin.js

    r3450747 r3485735  
    11function asyncGeneratorStep(B,y,K,J,H,F,C){try{var I=B[F](C),D=I.value}catch(L){K(L);return}I.done?y(D):Promise.resolve(D).then(J,H)}function _asyncToGenerator(B){return function(){var y=this,K=arguments;return new Promise(function(J,H){function F(D){asyncGeneratorStep(I,J,H,F,C,"next",D)}function C(D){asyncGeneratorStep(I,J,H,F,C,"throw",D)}var I=B.apply(y,K);F(void 0)})}}
    22function _typeof(B){_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(y){return typeof y}:function(y){return y&&"function"===typeof Symbol&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y};return _typeof(B)}var _regenerator;
    3 (function(){var B=function(y){function K(a,b,c,m){b=Object.create((b&&b.prototype instanceof H?b:H).prototype);m=new M(m||[]);b._invoke=L(a,c,m);return b}function J(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(m){return{type:"throw",arg:m}}}function H(){}function F(){}function C(){}function I(a){["next","throw","return"].forEach(function(b){a[b]=function(c){return this._invoke(b,c)}})}function D(a,b){function c(d,n,t,w){d=J(a[d],a,n);if("throw"===d.type)w(d.arg);else{var u=d.arg;return(d=
    4 u.value)&&"object"===_typeof(d)&&E.call(d,"__await")?b.resolve(d.__await).then(function(A){c("next",A,t,w)},function(A){c("throw",A,t,w)}):b.resolve(d).then(function(A){u.value=A;t(u)},function(A){return c("throw",A,t,w)})}}var m;this._invoke=function(d,n){function t(){return new b(function(w,u){c(d,n,w,u)})}return m=m?m.then(t,t):t()}}function L(a,b,c){var m=l;return function(d,n){if(m===v)throw Error("Generator is already running");if(m===e){if("throw"===d)throw n;return P()}c.method=d;for(c.arg=
    5 n;;){if(d=c.delegate)if(d=Q(d,c)){if(d===h)continue;return d}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(m===l)throw m=e,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);m=v;d=J(a,b,c);if("normal"===d.type){m=c.done?e:g;if(d.arg===h)continue;return{value:d.arg,done:c.done}}"throw"===d.type&&(m=e,c.method="throw",c.arg=d.arg)}}}function Q(a,b){var c=a.iterator[b.method];if(c===G){b.delegate=null;if("throw"===b.method){if(a.iterator["return"]&&
     3(function(){var B=function(y){function K(a,b,c,m){b=Object.create((b&&b.prototype instanceof H?b:H).prototype);m=new M(m||[]);b._invoke=L(a,c,m);return b}function J(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(m){return{type:"throw",arg:m}}}function H(){}function F(){}function C(){}function I(a){["next","throw","return"].forEach(function(b){a[b]=function(c){return this._invoke(b,c)}})}function D(a,b){function c(d,n,u,w){d=J(a[d],a,n);if("throw"===d.type)w(d.arg);else{var v=d.arg;return(d=
     4v.value)&&"object"===_typeof(d)&&E.call(d,"__await")?b.resolve(d.__await).then(function(A){c("next",A,u,w)},function(A){c("throw",A,u,w)}):b.resolve(d).then(function(A){v.value=A;u(v)},function(A){return c("throw",A,u,w)})}}var m;this._invoke=function(d,n){function u(){return new b(function(w,v){c(d,n,w,v)})}return m=m?m.then(u,u):u()}}function L(a,b,c){var m=l;return function(d,n){if(m===r)throw Error("Generator is already running");if(m===e){if("throw"===d)throw n;return P()}c.method=d;for(c.arg=
     5n;;){if(d=c.delegate)if(d=Q(d,c)){if(d===h)continue;return d}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(m===l)throw m=e,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);m=r;d=J(a,b,c);if("normal"===d.type){m=c.done?e:g;if(d.arg===h)continue;return{value:d.arg,done:c.done}}"throw"===d.type&&(m=e,c.method="throw",c.arg=d.arg)}}}function Q(a,b){var c=a.iterator[b.method];if(c===G){b.delegate=null;if("throw"===b.method){if(a.iterator["return"]&&
    66(b.method="return",b.arg=G,Q(a,b),"throw"===b.method))return h;b.method="throw";b.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}c=J(c,a.iterator,b.arg);if("throw"===c.type)return b.method="throw",b.arg=c.arg,b.delegate=null,h;c=c.arg;if(!c)return b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,h;if(c.done)b[a.resultName]=c.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=G);else return c;b.delegate=null;return h}
    77function R(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]);2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]);this.tryEntries.push(b)}function N(a){var b=a.completion||{};b.type="normal";delete b.arg;a.completion=b}function M(a){this.tryEntries=[{tryLoc:"root"}];a.forEach(R,this);this.reset(!0)}function O(a){if(a){var b=a[p];if(b)return b.call(a);if("function"===typeof a.next)return a;if(!isNaN(a.length)){var c=-1;b=function d(){for(;++c<a.length;)if(E.call(a,c))return d.value=a[c],d.done=!1,d;d.value=
    8 G;d.done=!0;return d};return b.next=b}}return{next:P}}function P(){return{value:G,done:!0}}var S=Object.prototype,E=S.hasOwnProperty,G,x="function"===typeof Symbol?Symbol:{},p=x.iterator||"@@iterator",r=x.asyncIterator||"@@asyncIterator",k=x.toStringTag||"@@toStringTag";y.wrap=K;var l="suspendedStart",g="suspendedYield",v="executing",e="completed",h={};x={};x[p]=function(){return this};var f=Object.getPrototypeOf;(f=f&&f(f(O([]))))&&f!==S&&E.call(f,p)&&(x=f);var q=C.prototype=H.prototype=Object.create(x);
    9 F.prototype=q.constructor=C;C.constructor=F;C[k]=F.displayName="GeneratorFunction";y.isGeneratorFunction=function(a){return(a="function"===typeof a&&a.constructor)?a===F||"GeneratorFunction"===(a.displayName||a.name):!1};y.mark=function(a){Object.setPrototypeOf?Object.setPrototypeOf(a,C):(a.__proto__=C,k in a||(a[k]="GeneratorFunction"));a.prototype=Object.create(q);return a};y.awrap=function(a){return{__await:a}};I(D.prototype);D.prototype[r]=function(){return this};y.AsyncIterator=D;y.async=function(a,
    10 b,c,m,d){void 0===d&&(d=Promise);var n=new D(K(a,b,c,m),d);return y.isGeneratorFunction(b)?n:n.next().then(function(t){return t.done?t.value:n.next()})};I(q);q[k]="Generator";q[p]=function(){return this};q.toString=function(){return"[object Generator]"};y.keys=function(a){var b=[],c;for(c in a)b.push(c);b.reverse();return function d(){for(;b.length;){var n=b.pop();if(n in a)return d.value=n,d.done=!1,d}d.done=!0;return d}};y.values=O;M.prototype={constructor:M,reset:function(a){this.next=this.prev=
    11 0;this.sent=this._sent=G;this.done=!1;this.delegate=null;this.method="next";this.arg=G;this.tryEntries.forEach(N);if(!a)for(var b in this)"t"===b.charAt(0)&&E.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=G)},stop:function(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(a){function b(u,A){n.type="throw";n.arg=a;c.next=u;A&&(c.method="next",c.arg=G);return!!A}if(this.done)throw a;for(var c=this,m=this.tryEntries.length-1;0<=
    12 m;--m){var d=this.tryEntries[m],n=d.completion;if("root"===d.tryLoc)return b("end");if(d.tryLoc<=this.prev){var t=E.call(d,"catchLoc"),w=E.call(d,"finallyLoc");if(t&&w){if(this.prev<d.catchLoc)return b(d.catchLoc,!0);if(this.prev<d.finallyLoc)return b(d.finallyLoc)}else if(t){if(this.prev<d.catchLoc)return b(d.catchLoc,!0)}else if(w){if(this.prev<d.finallyLoc)return b(d.finallyLoc)}else throw Error("try statement without catch or finally");}}},abrupt:function(a,b){for(var c=this.tryEntries.length-
     8G;d.done=!0;return d};return b.next=b}}return{next:P}}function P(){return{value:G,done:!0}}var S=Object.prototype,E=S.hasOwnProperty,G,x="function"===typeof Symbol?Symbol:{},p=x.iterator||"@@iterator",t=x.asyncIterator||"@@asyncIterator",k=x.toStringTag||"@@toStringTag";y.wrap=K;var l="suspendedStart",g="suspendedYield",r="executing",e="completed",h={};x={};x[p]=function(){return this};var f=Object.getPrototypeOf;(f=f&&f(f(O([]))))&&f!==S&&E.call(f,p)&&(x=f);var q=C.prototype=H.prototype=Object.create(x);
     9F.prototype=q.constructor=C;C.constructor=F;C[k]=F.displayName="GeneratorFunction";y.isGeneratorFunction=function(a){return(a="function"===typeof a&&a.constructor)?a===F||"GeneratorFunction"===(a.displayName||a.name):!1};y.mark=function(a){Object.setPrototypeOf?Object.setPrototypeOf(a,C):(a.__proto__=C,k in a||(a[k]="GeneratorFunction"));a.prototype=Object.create(q);return a};y.awrap=function(a){return{__await:a}};I(D.prototype);D.prototype[t]=function(){return this};y.AsyncIterator=D;y.async=function(a,
     10b,c,m,d){void 0===d&&(d=Promise);var n=new D(K(a,b,c,m),d);return y.isGeneratorFunction(b)?n:n.next().then(function(u){return u.done?u.value:n.next()})};I(q);q[k]="Generator";q[p]=function(){return this};q.toString=function(){return"[object Generator]"};y.keys=function(a){var b=[],c;for(c in a)b.push(c);b.reverse();return function d(){for(;b.length;){var n=b.pop();if(n in a)return d.value=n,d.done=!1,d}d.done=!0;return d}};y.values=O;M.prototype={constructor:M,reset:function(a){this.next=this.prev=
     110;this.sent=this._sent=G;this.done=!1;this.delegate=null;this.method="next";this.arg=G;this.tryEntries.forEach(N);if(!a)for(var b in this)"t"===b.charAt(0)&&E.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=G)},stop:function(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(a){function b(v,A){n.type="throw";n.arg=a;c.next=v;A&&(c.method="next",c.arg=G);return!!A}if(this.done)throw a;for(var c=this,m=this.tryEntries.length-1;0<=
     12m;--m){var d=this.tryEntries[m],n=d.completion;if("root"===d.tryLoc)return b("end");if(d.tryLoc<=this.prev){var u=E.call(d,"catchLoc"),w=E.call(d,"finallyLoc");if(u&&w){if(this.prev<d.catchLoc)return b(d.catchLoc,!0);if(this.prev<d.finallyLoc)return b(d.finallyLoc)}else if(u){if(this.prev<d.catchLoc)return b(d.catchLoc,!0)}else if(w){if(this.prev<d.finallyLoc)return b(d.finallyLoc)}else throw Error("try statement without catch or finally");}}},abrupt:function(a,b){for(var c=this.tryEntries.length-
    13131;0<=c;--c){var m=this.tryEntries[c];if(m.tryLoc<=this.prev&&E.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var d=m;break}}d&&("break"===a||"continue"===a)&&d.tryLoc<=b&&b<=d.finallyLoc&&(d=null);c=d?d.completion:{};c.type=a;c.arg=b;return d?(this.method="next",this.next=d.finallyLoc,h):this.complete(c)},complete:function(a,b){if("throw"===a.type)throw a.arg;"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===
    1414a.type&&b&&(this.next=b);return h},finish:function(a){for(var b=this.tryEntries.length-1;0<=b;--b){var c=this.tryEntries[b];if(c.finallyLoc===a)return this.complete(c.completion,c.afterLoc),N(c),h}},"catch":function(a){for(var b=this.tryEntries.length-1;0<=b;--b){var c=this.tryEntries[b];if(c.tryLoc===a){a=c.completion;if("throw"===a.type){var m=a.arg;N(c)}return m}}throw Error("illegal catch attempt");},delegateYield:function(a,b,c){this.delegate={iterator:O(a),resultName:b,nextLoc:c};"next"===this.method&&
    1515(this.arg=G);return h}};return y}("object"===("undefined"===typeof module?"undefined":_typeof(module))?module.exports:{});try{_regenerator=B}catch(y){Function("r","_regenerator = r")(B)}})();
    16 (function(){function B(x){var p=null;x==seraph_accel.Gen.hr.E_CONTEXT_EXPIRED?p=E("OpSrvCtxExpired","admin.Manage","seraphinite-accelerator"):seraph_accel.Gen.hr.Fail(x)&&(p=G(E("OpSrvErr_%1$08X","admin.Manage","seraphinite-accelerator"),x));return p}function y(){y=_asyncToGenerator(_regenerator.mark(function r(p){return _regenerator.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return jQuery(p).attr("disabled",!0),k.prev=1,k.next=4,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
    17 "LogClear",{}),type:"POST",data:"",dataType:"json",cache:!1});case 4:k.next=8;break;case 6:k.prev=6,k.t0=k["catch"](1);case 8:jQuery(p).attr("disabled",!1);case 9:case "end":return k.stop()}},r,this,[[1,6]])}));return y.apply(this,arguments)}function K(){K=_asyncToGenerator(_regenerator.mark(function k(p,r){var l,g,v,e,h,f;return _regenerator.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:l=jQuery(p.parentNode).closest(".blck").first();g=l.find(".seraph_accel_spinner");l.find(".content");v=
    18 l.find('input[type="button"]:not(.cancel)');e=l.find('input[type="button"].cancel');if(!r){q.next=23;break}v.prop("disabled",!0);g.show();seraph_accel.Manager._int.notRefreshStat=!0;h=null;q.prev=10;q.next=13;return jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"UpdateStatBegin",{}),cache:!1,dataType:"json"});case 13:f=q.sent;seraph_accel.Gen.hr.Fail(f)&&(h=G(E("OpSrvErr_%1$08X","admin.Manage","seraphinite-accelerator"),f));q.next=20;break;case 17:q.prev=17,
    19 q.t0=q["catch"](10),h="HTTP "+q.t0.status;case 20:return h&&(alert(h),v.prop("disabled",!1),g.hide()),delete seraph_accel.Manager._int.notRefreshStat,q.abrupt("return");case 23:return e.prop("disabled",!0),seraph_accel.Manager._int.notRefreshStat=!0,h=null,q.prev=26,q.next=29,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"UpdateStatCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 29:f=q.sent;h=B(f);q.next=37;break;case 33:q.prev=33,q.t1=q["catch"](26),
     16(function(){function B(x){var p=null;x==seraph_accel.Gen.hr.E_CONTEXT_EXPIRED?p=E("OpSrvCtxExpired","admin.Manage","seraphinite-accelerator"):seraph_accel.Gen.hr.Fail(x)&&(p=G(E("OpSrvErr_%1$08X","admin.Manage","seraphinite-accelerator"),x));return p}function y(){y=_asyncToGenerator(_regenerator.mark(function t(p){return _regenerator.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return jQuery(p).attr("disabled",!0),k.prev=1,k.next=4,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
     17"LogClear",{}),type:"POST",data:"",dataType:"json",cache:!1});case 4:k.next=8;break;case 6:k.prev=6,k.t0=k["catch"](1);case 8:jQuery(p).attr("disabled",!1);case 9:case "end":return k.stop()}},t,this,[[1,6]])}));return y.apply(this,arguments)}function K(){K=_asyncToGenerator(_regenerator.mark(function k(p,t){var l,g,r,e,h,f;return _regenerator.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:l=jQuery(p.parentNode).closest(".blck").first();g=l.find(".seraph_accel_spinner");l.find(".content");r=
     18l.find('input[type="button"]:not(.cancel)');e=l.find('input[type="button"].cancel');if(!t){q.next=23;break}r.prop("disabled",!0);g.show();seraph_accel.Manager._int.notRefreshStat=!0;h=null;q.prev=10;q.next=13;return jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"UpdateStatBegin",{}),cache:!1,dataType:"json"});case 13:f=q.sent;seraph_accel.Gen.hr.Fail(f)&&(h=G(E("OpSrvErr_%1$08X","admin.Manage","seraphinite-accelerator"),f));q.next=20;break;case 17:q.prev=17,
     19q.t0=q["catch"](10),h="HTTP "+q.t0.status;case 20:return h&&(alert(h),r.prop("disabled",!1),g.hide()),delete seraph_accel.Manager._int.notRefreshStat,q.abrupt("return");case 23:return e.prop("disabled",!0),seraph_accel.Manager._int.notRefreshStat=!0,h=null,q.prev=26,q.next=29,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"UpdateStatCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 29:f=q.sent;h=B(f);q.next=37;break;case 33:q.prev=33,q.t1=q["catch"](26),
    2020h="HTTP "+q.t1.status,e.prop("disabled",!1);case 37:h&&alert(h),delete seraph_accel.Manager._int.notRefreshStat;case 39:case "end":return q.stop()}},k,this,[[10,17],[26,33]])}));return K.apply(this,arguments)}function J(x){switch(x){case 0:return E("OpDescr_Invalidate","admin.Manage","seraphinite-accelerator");case 3:return E("OpDescr_CheckInvalidate","admin.Manage","seraphinite-accelerator");case 2:return E("OpDescr_Delete","admin.Manage","seraphinite-accelerator");case 10:return E("OpDescr_SrvDel",
    21 "admin.Manage","seraphinite-accelerator")}return""+x}function H(){H=_asyncToGenerator(_regenerator.mark(function r(p){var k,l,g,v;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"PostUpdCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:v=
    22 e.sent;g=B(v);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},r,this,[[4,11]])}));return H.apply(this,arguments)}function F(){F=_asyncToGenerator(_regenerator.mark(function r(p){var k,l,g,v;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
    23 "ScheUpdCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:v=e.sent;g=B(v);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},r,this,[[4,11]])}));return F.apply(this,arguments)}function C(){C=_asyncToGenerator(_regenerator.mark(function r(p){var k,l,g,v,e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find(".seraph_accel_spinner"),
    24 g=k.find('input[type="button"]:not(.cancel)'),v=k.find('input[type="button"].cancel'),l.show(),g.prop("disabled",!0),v.prop("disabled",!1),seraph_accel.Manager._int.notRefreshExtDp=!0,e=null,f.prev=9,f.next=12,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"ExtDbUpdBegin",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 12:h=f.sent;e=B(h);f.next=19;break;case 16:f.prev=16,f.t0=f["catch"](9),e="HTTP "+f.t0.status;case 19:e&&alert(e),delete seraph_accel.Manager._int.notRefreshExtDp;
    25 case 21:case "end":return f.stop()}},r,this,[[9,16]])}));return C.apply(this,arguments)}function I(){I=_asyncToGenerator(_regenerator.mark(function r(p){var k,l,g,v;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"ExtDbUpdCancel",{}),type:"POST",data:"",
    26 cache:!1,dataType:"json"});case 7:v=e.sent;g=B(v);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},r,this,[[4,11]])}));return I.apply(this,arguments)}function D(){D=_asyncToGenerator(_regenerator.mark(function l(p,r,k){var g,v,e,h,f,q,a,b,c,m,d,n,t,w,u,A;return _regenerator.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return g=jQuery(p.parentNode).closest(".blck").first(),v=g.find(".seraph_accel_spinner"),e=
     21"admin.Manage","seraphinite-accelerator")}return""+x}function H(){H=_asyncToGenerator(_regenerator.mark(function t(p){var k,l,g,r;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"PostUpdCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:r=
     22e.sent;g=B(r);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},t,this,[[4,11]])}));return H.apply(this,arguments)}function F(){F=_asyncToGenerator(_regenerator.mark(function t(p){var k,l,g,r;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
     23"ScheUpdCancel",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:r=e.sent;g=B(r);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},t,this,[[4,11]])}));return F.apply(this,arguments)}function C(){C=_asyncToGenerator(_regenerator.mark(function t(p){var k,l,g,r,e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find(".seraph_accel_spinner"),
     24g=k.find('input[type="button"]:not(.cancel)'),r=k.find('input[type="button"].cancel'),l.show(),g.prop("disabled",!0),r.prop("disabled",!1),seraph_accel.Manager._int.notRefreshExtDp=!0,e=null,f.prev=9,f.next=12,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"ExtDbUpdBegin",{}),type:"POST",data:"",cache:!1,dataType:"json"});case 12:h=f.sent;e=B(h);f.next=19;break;case 16:f.prev=16,f.t0=f["catch"](9),e="HTTP "+f.t0.status;case 19:e&&alert(e),delete seraph_accel.Manager._int.notRefreshExtDp;
     25case 21:case "end":return f.stop()}},t,this,[[9,16]])}));return C.apply(this,arguments)}function I(){I=_asyncToGenerator(_regenerator.mark(function t(p){var k,l,g,r;return _regenerator.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find('input[type="button"].cancel'),l.prop("disabled",!0),g=null,e.prev=4,e.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"ExtDbUpdCancel",{}),type:"POST",data:"",
     26cache:!1,dataType:"json"});case 7:r=e.sent;g=B(r);e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),g="HTTP "+e.t0.status;case 14:g&&alert(g);case 15:case "end":return e.stop()}},t,this,[[4,11]])}));return I.apply(this,arguments)}function D(){D=_asyncToGenerator(_regenerator.mark(function l(p,t,k){var g,r,e,h,f,q,a,b,c,m,d,n,u,w,v,A;return _regenerator.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return g=jQuery(p.parentNode).closest(".blck").first(),r=g.find(".seraph_accel_spinner"),e=
    2727g.find(".descr"),h=g.find('input[type="button"]:not(.cancel)'),f=g.find('input[type="button"].cancel'),q=g.find("#seraph_accel_views"),a=g.find("#seraph_accel_geos"),b=g.find("#seraph_accel_langs"),c=[],q.get()&&(seraph_accel.Ui.TokensMetaTree.Apply(q.get()),c=seraph_accel.Ui.TokensList.GetVal(q.get())),m=[],a.get()&&(seraph_accel.Ui.TokensMetaTree.Apply(a.get()),m=seraph_accel.Ui.TokensList.GetVal(a.get()).filter(function(T){return"_"!==T})),d=[],b.get()&&(seraph_accel.Ui.TokensMetaTree.Apply(b.get()),
    28 d=seraph_accel.Ui.TokensList.GetVal(b.get())),t=String(g.find(".type").val()),"uri"===t?n=g.find(".uri").val():0===t.indexOf("uri:")&&(n=t.substr(4),t="uri"),n="string"==typeof n?seraph_accel.Gen.StrReplaceAll(n,["\r","\n","*"],["",";","{ASTRSK}"]):"",v.show(),e.show(),e.text(J(r)),h.prop("disabled",!0),f.prop("disabled",!1),seraph_accel.Manager._int.notRefreshOp=!0,w={cache:!1,dataType:"json"},512>n.length?w.url=seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"CacheOpBegin",
    29 {type:t,op:r,uri:n,v:c.join(),g:m.length?m.join():void 0,l:d.length?d.join():void 0,_wpnonce:k}):(w.url=seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"CacheOpBegin",{type:t,op:r,v:c.join(),g:m.length?m.join():void 0,l:d.length?d.join():void 0,_wpnonce:k}),w.type="POST",w.contentType="application/x-www-form-urlencoded",w.data="uri="+encodeURIComponent(n)),u=null,z.prev=26,z.next=29,jQuery.ajax(w);case 29:A=z.sent;u=B(A);z.next=36;break;case 33:z.prev=33,z.t0=z["catch"](26),
    30 u="HTTP "+z.t0.status;case 36:u&&alert(u),delete seraph_accel.Manager._int.notRefreshOp;case 38:case "end":return z.stop()}},l,this,[[26,33]])}));return D.apply(this,arguments)}function L(){L=_asyncToGenerator(_regenerator.mark(function l(p,r,k){var g,v,e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return g=jQuery(p.parentNode).closest(".blck").first(),v=g.find('input[type="button"].cancel'),v.prop("disabled",!0),e=null,f.prev=4,f.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
    31 "CacheOpCancel",{op:r,_wpnonce:k}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:h=f.sent;e=B(h);f.next=14;break;case 11:f.prev=11,f.t0=f["catch"](4),e="HTTP "+f.t0.status;case 14:e&&alert(e);case 15:case "end":return f.stop()}},l,this,[[4,11]])}));return L.apply(this,arguments)}function Q(){Q=_asyncToGenerator(_regenerator.mark(function l(p,r,k){return _regenerator.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:case "end":return g.stop()}},l,this)}));return Q.apply(this,arguments)}
    32 function R(){R=_asyncToGenerator(_regenerator.mark(function l(p,r,k){return _regenerator.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:case "end":return g.stop()}},l,this)}));return R.apply(this,arguments)}function N(){N=_asyncToGenerator(_regenerator.mark(function l(p,r,k){return _regenerator.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:case "end":return g.stop()}},l,this)}));return N.apply(this,arguments)}function M(){M=_asyncToGenerator(_regenerator.mark(function k(p,r){var l,g,
    33 v,e;return _regenerator.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:e=function(){e=_asyncToGenerator(_regenerator.mark(function q(){return _regenerator.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,seraph_accel.Manager._int.OnDataRefresh(p,r);case 2:g();case 3:case "end":return a.stop()}},q,this)}));return e.apply(this,arguments)},v=function(){return e.apply(this,arguments)},g=function(){var f=1E3*parseInt(l.val(),10);100>f&&(f=100);clearTimeout(seraph_accel.Manager._int.refreshTimer);
    34 seraph_accel.Manager._int.refreshTimer=setTimeout(v,f)},l=jQuery("#seraph_accel_manage .tmDataRefresh"),l.on("change",g),v();case 6:case "end":return h.stop()}},k,this)}));return M.apply(this,arguments)}function O(){O=_asyncToGenerator(_regenerator.mark(function k(p,r){var l,g,v,e,h,f,q,a,b,c,m,d,n,t,w,u,A;return _regenerator.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return l=jQuery(p).find("#status").first(),g=jQuery(p).find("#stat").first(),v=g.find(".seraph_accel_spinner"),e=g.find('input[type="button"]:not(.cancel)'),
     28d=seraph_accel.Ui.TokensList.GetVal(b.get())),u=String(g.find(".type").val()),"uri"===u?n=g.find(".uri").val():0===u.indexOf("uri:")&&(n=u.substr(4),u="uri"),n="string"==typeof n?seraph_accel.Gen.StrReplaceAll(n,["\r","\n","*"],["",";","{ASTRSK}"]):"",r.show(),e.show(),e.text(J(t)),h.prop("disabled",!0),f.prop("disabled",!1),seraph_accel.Manager._int.notRefreshOp=!0,w={cache:!1,dataType:"json"},512>n.length?w.url=seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"CacheOpBegin",
     29{type:u,op:t,uri:n,v:c.join(),g:m.length?m.join():void 0,l:d.length?d.join():void 0,_wpnonce:k}):(w.url=seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"CacheOpBegin",{type:u,op:t,v:c.join(),g:m.length?m.join():void 0,l:d.length?d.join():void 0,_wpnonce:k}),w.type="POST",w.contentType="application/x-www-form-urlencoded",w.data="uri="+encodeURIComponent(n)),v=null,z.prev=26,z.next=29,jQuery.ajax(w);case 29:A=z.sent;v=B(A);z.next=36;break;case 33:z.prev=33,z.t0=z["catch"](26),
     30v="HTTP "+z.t0.status;case 36:v&&alert(v),delete seraph_accel.Manager._int.notRefreshOp;case 38:case "end":return z.stop()}},l,this,[[26,33]])}));return D.apply(this,arguments)}function L(){L=_asyncToGenerator(_regenerator.mark(function l(p,t,k){var g,r,e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return g=jQuery(p.parentNode).closest(".blck").first(),r=g.find('input[type="button"].cancel'),r.prop("disabled",!0),e=null,f.prev=4,f.next=7,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
     31"CacheOpCancel",{op:t,_wpnonce:k}),type:"POST",data:"",cache:!1,dataType:"json"});case 7:h=f.sent;e=B(h);f.next=14;break;case 11:f.prev=11,f.t0=f["catch"](4),e="HTTP "+f.t0.status;case 14:e&&alert(e);case 15:case "end":return f.stop()}},l,this,[[4,11]])}));return L.apply(this,arguments)}function Q(){Q=_asyncToGenerator(_regenerator.mark(function l(p,t,k){return _regenerator.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:case "end":return g.stop()}},l,this)}));return Q.apply(this,arguments)}
     32function R(){R=_asyncToGenerator(_regenerator.mark(function l(p,t,k){return _regenerator.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:case "end":return g.stop()}},l,this)}));return R.apply(this,arguments)}function N(){N=_asyncToGenerator(_regenerator.mark(function g(p,t,k,l){return _regenerator.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:case "end":return r.stop()}},g,this)}));return N.apply(this,arguments)}function M(){M=_asyncToGenerator(_regenerator.mark(function k(p,t){var l,
     33g,r,e;return _regenerator.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:e=function(){e=_asyncToGenerator(_regenerator.mark(function q(){return _regenerator.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,seraph_accel.Manager._int.OnDataRefresh(p,t);case 2:g();case 3:case "end":return a.stop()}},q,this)}));return e.apply(this,arguments)},r=function(){return e.apply(this,arguments)},g=function(){var f=1E3*parseInt(l.val(),10);100>f&&(f=100);clearTimeout(seraph_accel.Manager._int.refreshTimer);
     34seraph_accel.Manager._int.refreshTimer=setTimeout(r,f)},l=jQuery("#seraph_accel_manage .tmDataRefresh"),l.on("change",g),r();case 6:case "end":return h.stop()}},k,this)}));return M.apply(this,arguments)}function O(){O=_asyncToGenerator(_regenerator.mark(function k(p,t){var l,g,r,e,h,f,q,a,b,c,m,d,n,u,w,v,A;return _regenerator.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return l=jQuery(p).find("#status").first(),g=jQuery(p).find("#stat").first(),r=g.find(".seraph_accel_spinner"),e=g.find('input[type="button"]:not(.cancel)'),
    3535h=g.find('input[type="button"].cancel'),f=jQuery(p).find("#operate").first(),q=f.find(".seraph_accel_spinner"),a=f.find(".descr"),b=f.find('input[type="button"]:not(.cancel)'),c=f.find('input[type="button"].cancel'),m=jQuery(p).find("#queue").first(),m.find(".content"),d=m.find(".maxItems"),m.find(".seraph_accel_spinner"),m.find('input[type="button"]'),m.find(".descrNums"),z.prev=16,z.next=19,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"GetData",{nMaxQueueItems:d.val(),
    36 allSites:r?!0:void 0}),type:"GET",cache:!1,dataType:"json"});case 19:u=z.sent;z.next=24;break;case 22:z.prev=22,z.t0=z["catch"](16);case 24:if(u){z.next=26;break}return z.abrupt("return");case 26:if(!r){for(A in u.status.cont)l.find('[data-id-cont="'+A+'"]').html(u.status.cont[A]);seraph_accel.Manager._int.notRefreshPostUpd||(n=l.find(".blck.postupd .seraph_accel_spinner"),t=l.find('.blck.postupd input[type="button"]:not(.cancel)'),w=l.find('.blck.postupd input[type="button"].cancel'),u.status.postUpd?
    37 (n.show(),t.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),t.prop("disabled",!1),w.prop("disabled",!0)));seraph_accel.Manager._int.notRefreshScheUpd||(n=l.find(".blck.scheupd .seraph_accel_spinner"),t=l.find('.blck.scheupd input[type="button"]:not(.cancel)'),w=l.find('.blck.scheupd input[type="button"].cancel'),u.status.scheUpd?(n.show(),t.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),t.prop("disabled",!1),w.prop("disabled",!0)));seraph_accel.Manager._int.notRefreshCleanup||(n=l.find(".blck.cleanup .seraph_accel_spinner"),
    38 t=l.find('.blck.cleanup input[type="button"]:not(.cancel)'),w=l.find('.blck.cleanup input[type="button"].cancel'),u.status.cleanUp?(n.show(),t.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),t.prop("disabled",!1),w.prop("disabled",!0)))}r||seraph_accel.Manager._int.notRefreshExtDp||(n=l.find(".blck.extdb .seraph_accel_spinner"),t=l.find('.blck.extdb input[type="button"]:not(.cancel)'),w=l.find('.blck.extdb input[type="button"].cancel'),u.extDb.isUpdating?(n.show(),t.prop("disabled",!0),w.prop("disabled",
    39 !1)):(n.hide(),t.prop("disabled",!1),w.prop("disabled",!0)));r||seraph_accel.Manager._int.notRefreshStat||(u.stat.isUpdating?(v.show(),e.prop("disabled",!0),h.prop("disabled",!1)):(v.hide(),e.prop("disabled",!1),h.prop("disabled",!0)),g.find('[data-id-cont="stat"]').html(u.stat.cont));r||seraph_accel.Manager._int.notRefreshOp||(null===u.curOp&&(u.curOp=void 0),void 0!==u.curOp?(q.show(),a.show(),a.text(J(u.curOp)),b.prop("disabled",!0),c.prop("disabled",!1)):(q.hide(),a.hide(),b.prop("disabled",!1),
    40 c.prop("disabled",!0),a.text("")));case 30:case "end":return z.stop()}},k,this,[[16,22]])}));return O.apply(this,arguments)}function P(){P=_asyncToGenerator(_regenerator.mark(function r(p){var k,l,g,v,e,h,f,q;return _regenerator.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find(".url"),g=k.find(".messages"),v=k.find(".seraph_accel_spinner"),e=k.find('input[type="button"]'),h=0,k.find(".liteChk").prop("checked")&&(h|=1),k.find(".medChk").prop("checked")&&
    41 (h|=2),k.find(".tidyChk").prop("checked")&&(h|=524288),g.empty(),v.show(),e.prop("disabled",!0),a.prev=12,a.next=15,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"HtmlCheck",{url:l.val(),norm:h}),type:"POST",data:"",dataType:"json",cache:!1});case 15:f=a.sent;a.next=21;break;case 18:a.prev=18,a.t0=a["catch"](12),f={err:a.t0.statusText};case 21:v.hide();e.prop("disabled",!1);if(!f.err){a.next=26;break}g.append(seraph_accel.Ui.LogItem("error",f.err));return a.abrupt("return");
    42 case 26:for(q in f.list)q=f.list[q],g.append(seraph_accel.Ui.LogItem(q.severity,q.text));case 27:case "end":return a.stop()}},r,this,[[12,18]])}));return P.apply(this,arguments)}var S=seraph_accel.Wp.Loc.GetApi(),E=S._x,G=S.sprintf;seraph_accel.Settings={_int:{OnUpdateCssAuto:function(x){seraph_accel.Ui.ComboShowDependedItems(x,jQuery(x.parentNode).closest(".blck").first().get(0))},OnLogClear:function(x){return y.apply(this,arguments)}}};seraph_accel.Manager={_int:{OnStatOp:function(x,p){return K.apply(this,
    43 arguments)},OnCacheOp:function(x,p,r){return D.apply(this,arguments)},OnCacheOpCancel:function(x,p,r){return L.apply(this,arguments)},OnPostUpdCancel:function(x){return H.apply(this,arguments)},OnScheUpdCancel:function(x){return F.apply(this,arguments)},OnExtDbUpdBegin:function(x){return C.apply(this,arguments)},OnExtDbUpdCancel:function(x){return I.apply(this,arguments)},OnQueueDel:function(x,p,r){return Q.apply(this,arguments)},OnQueuePause:function(x,p,r){return R.apply(this,arguments)},OnQueueItemCancel:function(x,
    44 p,r){return N.apply(this,arguments)},OnDataRefreshInit:function(x,p){return M.apply(this,arguments)},OnDataRefresh:function(x,p){return O.apply(this,arguments)},OnHtmlCheck:function(x){return P.apply(this,arguments)}}};(function(){function x(l){return p.apply(this,arguments)}function p(){p=_asyncToGenerator(_regenerator.mark(function v(g){var e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return e={},f.prev=1,seraph_accel.SelfDiag._int.curAjax=jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
     36allSites:t?!0:void 0}),type:"GET",cache:!1,dataType:"json"});case 19:v=z.sent;z.next=24;break;case 22:z.prev=22,z.t0=z["catch"](16);case 24:if(v){z.next=26;break}return z.abrupt("return");case 26:if(!t){for(A in v.status.cont)l.find('[data-id-cont="'+A+'"]').html(v.status.cont[A]);seraph_accel.Manager._int.notRefreshPostUpd||(n=l.find(".blck.postupd .seraph_accel_spinner"),u=l.find('.blck.postupd input[type="button"]:not(.cancel)'),w=l.find('.blck.postupd input[type="button"].cancel'),v.status.postUpd?
     37(n.show(),u.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),u.prop("disabled",!1),w.prop("disabled",!0)));seraph_accel.Manager._int.notRefreshScheUpd||(n=l.find(".blck.scheupd .seraph_accel_spinner"),u=l.find('.blck.scheupd input[type="button"]:not(.cancel)'),w=l.find('.blck.scheupd input[type="button"].cancel'),v.status.scheUpd?(n.show(),u.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),u.prop("disabled",!1),w.prop("disabled",!0)));seraph_accel.Manager._int.notRefreshCleanup||(n=l.find(".blck.cleanup .seraph_accel_spinner"),
     38u=l.find('.blck.cleanup input[type="button"]:not(.cancel)'),w=l.find('.blck.cleanup input[type="button"].cancel'),v.status.cleanUp?(n.show(),u.prop("disabled",!0),w.prop("disabled",!1)):(n.hide(),u.prop("disabled",!1),w.prop("disabled",!0)))}t||seraph_accel.Manager._int.notRefreshExtDp||(n=l.find(".blck.extdb .seraph_accel_spinner"),u=l.find('.blck.extdb input[type="button"]:not(.cancel)'),w=l.find('.blck.extdb input[type="button"].cancel'),v.extDb.isUpdating?(n.show(),u.prop("disabled",!0),w.prop("disabled",
     39!1)):(n.hide(),u.prop("disabled",!1),w.prop("disabled",!0)));t||seraph_accel.Manager._int.notRefreshStat||(v.stat.isUpdating?(r.show(),e.prop("disabled",!0),h.prop("disabled",!1)):(r.hide(),e.prop("disabled",!1),h.prop("disabled",!0)),g.find('[data-id-cont="stat"]').html(v.stat.cont));t||seraph_accel.Manager._int.notRefreshOp||(null===v.curOp&&(v.curOp=void 0),void 0!==v.curOp?(q.show(),a.show(),a.text(J(v.curOp)),b.prop("disabled",!0),c.prop("disabled",!1)):(q.hide(),a.hide(),b.prop("disabled",!1),
     40c.prop("disabled",!0),a.text("")));case 30:case "end":return z.stop()}},k,this,[[16,22]])}));return O.apply(this,arguments)}function P(){P=_asyncToGenerator(_regenerator.mark(function t(p){var k,l,g,r,e,h,f,q;return _regenerator.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return k=jQuery(p.parentNode).closest(".blck").first(),l=k.find(".url"),g=k.find(".messages"),r=k.find(".seraph_accel_spinner"),e=k.find('input[type="button"]'),h=0,k.find(".liteChk").prop("checked")&&(h|=1),k.find(".medChk").prop("checked")&&
     41(h|=2),k.find(".tidyChk").prop("checked")&&(h|=524288),g.empty(),r.show(),e.prop("disabled",!0),a.prev=12,a.next=15,jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+"HtmlCheck",{url:l.val(),norm:h}),type:"POST",data:"",dataType:"json",cache:!1});case 15:f=a.sent;a.next=21;break;case 18:a.prev=18,a.t0=a["catch"](12),f={err:a.t0.statusText};case 21:r.hide();e.prop("disabled",!1);if(!f.err){a.next=26;break}g.append(seraph_accel.Ui.LogItem("error",f.err));return a.abrupt("return");
     42case 26:for(q in f.list)q=f.list[q],g.append(seraph_accel.Ui.LogItem(q.severity,q.text));case 27:case "end":return a.stop()}},t,this,[[12,18]])}));return P.apply(this,arguments)}var S=seraph_accel.Wp.Loc.GetApi(),E=S._x,G=S.sprintf;seraph_accel.Settings={_int:{OnUpdateCssAuto:function(x){seraph_accel.Ui.ComboShowDependedItems(x,jQuery(x.parentNode).closest(".blck").first().get(0))},OnLogClear:function(x){return y.apply(this,arguments)}}};seraph_accel.Manager={_int:{OnStatOp:function(x,p){return K.apply(this,
     43arguments)},OnCacheOp:function(x,p,t){return D.apply(this,arguments)},OnCacheOpCancel:function(x,p,t){return L.apply(this,arguments)},OnPostUpdCancel:function(x){return H.apply(this,arguments)},OnScheUpdCancel:function(x){return F.apply(this,arguments)},OnExtDbUpdBegin:function(x){return C.apply(this,arguments)},OnExtDbUpdCancel:function(x){return I.apply(this,arguments)},OnQueueDel:function(x,p,t){return Q.apply(this,arguments)},OnQueuePause:function(x,p,t){return R.apply(this,arguments)},OnQueueItemCancel:function(x,
     44p,t,k){return N.apply(this,arguments)},OnDataRefreshInit:function(x,p){return M.apply(this,arguments)},OnDataRefresh:function(x,p){return O.apply(this,arguments)},OnHtmlCheck:function(x){return P.apply(this,arguments)}}};(function(){function x(l){return p.apply(this,arguments)}function p(){p=_asyncToGenerator(_regenerator.mark(function r(g){var e,h;return _regenerator.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return e={},f.prev=1,seraph_accel.SelfDiag._int.curAjax=jQuery.ajax({url:seraph_accel.Net.UpdateQueryArgs(seraph_accel.Plugin.GetAdminApiUrl()+
    4545"SelfDiag_"+g,{}),cache:!1,dataType:"json"}),f.next=5,seraph_accel.SelfDiag._int.curAjax;case 5:e=f.sent;delete seraph_accel.SelfDiag._int.curAjax;f.next=14;break;case 9:f.prev=9,f.t0=f["catch"](1),delete seraph_accel.SelfDiag._int.curAjax,0===f.t0.status?e.hr=seraph_accel.Gen.hr.S_ABORTED:(e.hr=seraph_accel.Gen.hr.E_FAIL,e.descr="HTTP "+f.t0.status),500==f.t0.status&&(h=document.implementation.createHTMLDocument(""),h.documentElement.innerHTML=f.t0.responseText,h=h.body.textContent,h=seraph_accel.Gen.StrReplaceAll(h,
    46 "\r",""),h=seraph_accel.Gen.StrReplaceAll(h,["\t","\v"]," "),h=seraph_accel.Gen.StrReplaceAll(h,"\n",". "),(h=seraph_accel.Gen.StrReplaceAllWhileChanging(h,["  ",". . "],[" ",". "]).trim())&&"."!=h&&(e.descr+="<br>"+h));case 14:return f.abrupt("return",e);case 15:case "end":return f.stop()}},v,this,[[1,9]])}));return p.apply(this,arguments)}function r(){r=_asyncToGenerator(_regenerator.mark(function v(g){var e,h,f,q,a,b,c,m,d,n,t,w=arguments;return _regenerator.wrap(function(u){for(;;)switch(u.prev=
    47 u.next){case 0:e=1<w.length&&void 0!==w[1]?w[1]:!1;h=jQuery(g.parentNode).closest(".blck").first();f=h.find(".seraph_accel_spinner");q=h.find('input[type="button"]:not(.cancel)');a=h.find('input[type="button"].cancel');b=h.find(".log");c=[{id:"3rdPartySettCompat",name:k("TestName_3rdPartySettCompat","admin.SelfDiag","seraphinite-accelerator")},{id:"AsyncRequest",name:k("TestName_AsyncRequest","admin.SelfDiag","seraphinite-accelerator")},{id:"SetMaxExecTime",name:k("TestName_SetMaxExecTime","admin.SelfDiag",
    48 "seraphinite-accelerator")},{id:"PageOptimize",name:k("TestName_PageOptimize","admin.SelfDiag","seraphinite-accelerator")},{id:"VendorSrv",name:k("TestName_VendorSrv","admin.SelfDiag","seraphinite-accelerator")},{id:"ExtCache",name:k("TestName_ExtCache","admin.SelfDiag","seraphinite-accelerator")}];b.empty();for(m=0;m<c.length;m++)d=c[m],b.append(seraph_accel.Ui.LogItem("none",seraph_accel.Ui.Tag("strong",d.name?d.name:d.id),!1));if(!e){u.next=11;break}return u.abrupt("return");case 11:f.show(),q.prop("disabled",
    49 !0),a.prop("disabled",!1),seraph_accel.SelfDiag._int.inProgress=!0,m=0;case 16:if(!(m<c.length)){u.next=31;break}d=c[m];jQuery(b.children().get(m)).replaceWith(seraph_accel.Ui.LogItem("info",seraph_accel.Ui.Tag("strong",d.name?d.name:d.id)+k("TestRunning","admin.SelfDiag","seraphinite-accelerator"),!1));u.next=21;return x(d.id);case 21:n=u.sent;t=k("TestSucc","admin.SelfDiag","seraphinite-accelerator");n.hr!=seraph_accel.Gen.hr.S_OK&&(t=seraph_accel.Gen.hr.Succ(n.hr)?n.hr==seraph_accel.Gen.hr.S_ABORTED?
    50 k("TestAbort","admin.SelfDiag","seraphinite-accelerator"):n.hr==seraph_accel.Gen.hr.S_FALSE?k("TestNotice","admin.SelfDiag","seraphinite-accelerator"):k("TestWarn","admin.SelfDiag","seraphinite-accelerator"):k("TestError","admin.SelfDiag","seraphinite-accelerator"));n.descr&&(t+="<br>"+n.descr);jQuery(b.children().get(m)).replaceWith(seraph_accel.Ui.LogItem(n.hr==seraph_accel.Gen.hr.S_OK?"success":seraph_accel.Gen.hr.Succ(n.hr)?n.hr==seraph_accel.Gen.hr.S_FALSE?"normal":"warning":"error",seraph_accel.Ui.Tag("strong",
    51 d.name?d.name:d.id)+t,!1));if(seraph_accel.SelfDiag._int.inProgress){u.next=28;break}return u.abrupt("break",31);case 28:m++;u.next=16;break;case 31:f.hide(),q.prop("disabled",!1),a.prop("disabled",!0);case 34:case "end":return u.stop()}},v,this)}));return r.apply(this,arguments)}var k=seraph_accel.Wp.Loc.GetApi()._x;seraph_accel.SelfDiag={_int:{OnStart:function(l){return r.apply(this,arguments)},OnCancel:function(l){l=jQuery(l.parentNode).closest(".blck").first();l.find(".seraph_accel_spinner");
     46"\r",""),h=seraph_accel.Gen.StrReplaceAll(h,["\t","\v"]," "),h=seraph_accel.Gen.StrReplaceAll(h,"\n",". "),(h=seraph_accel.Gen.StrReplaceAllWhileChanging(h,["  ",". . "],[" ",". "]).trim())&&"."!=h&&(e.descr+="<br>"+h));case 14:return f.abrupt("return",e);case 15:case "end":return f.stop()}},r,this,[[1,9]])}));return p.apply(this,arguments)}function t(){t=_asyncToGenerator(_regenerator.mark(function r(g){var e,h,f,q,a,b,c,m,d,n,u,w=arguments;return _regenerator.wrap(function(v){for(;;)switch(v.prev=
     47v.next){case 0:e=1<w.length&&void 0!==w[1]?w[1]:!1;h=jQuery(g.parentNode).closest(".blck").first();f=h.find(".seraph_accel_spinner");q=h.find('input[type="button"]:not(.cancel)');a=h.find('input[type="button"].cancel');b=h.find(".log");c=[{id:"3rdPartySettCompat",name:k("TestName_3rdPartySettCompat","admin.SelfDiag","seraphinite-accelerator")},{id:"AsyncRequest",name:k("TestName_AsyncRequest","admin.SelfDiag","seraphinite-accelerator")},{id:"SetMaxExecTime",name:k("TestName_SetMaxExecTime","admin.SelfDiag",
     48"seraphinite-accelerator")},{id:"PageOptimize",name:k("TestName_PageOptimize","admin.SelfDiag","seraphinite-accelerator")},{id:"VendorSrv",name:k("TestName_VendorSrv","admin.SelfDiag","seraphinite-accelerator")},{id:"ExtCache",name:k("TestName_ExtCache","admin.SelfDiag","seraphinite-accelerator")}];b.empty();for(m=0;m<c.length;m++)d=c[m],b.append(seraph_accel.Ui.LogItem("none",seraph_accel.Ui.Tag("strong",d.name?d.name:d.id),!1));if(!e){v.next=11;break}return v.abrupt("return");case 11:f.show(),q.prop("disabled",
     49!0),a.prop("disabled",!1),seraph_accel.SelfDiag._int.inProgress=!0,m=0;case 16:if(!(m<c.length)){v.next=31;break}d=c[m];jQuery(b.children().get(m)).replaceWith(seraph_accel.Ui.LogItem("info",seraph_accel.Ui.Tag("strong",d.name?d.name:d.id)+k("TestRunning","admin.SelfDiag","seraphinite-accelerator"),!1));v.next=21;return x(d.id);case 21:n=v.sent;u=k("TestSucc","admin.SelfDiag","seraphinite-accelerator");n.hr!=seraph_accel.Gen.hr.S_OK&&(u=seraph_accel.Gen.hr.Succ(n.hr)?n.hr==seraph_accel.Gen.hr.S_ABORTED?
     50k("TestAbort","admin.SelfDiag","seraphinite-accelerator"):n.hr==seraph_accel.Gen.hr.S_FALSE?k("TestNotice","admin.SelfDiag","seraphinite-accelerator"):k("TestWarn","admin.SelfDiag","seraphinite-accelerator"):k("TestError","admin.SelfDiag","seraphinite-accelerator"));n.descr&&(u+="<br>"+n.descr);jQuery(b.children().get(m)).replaceWith(seraph_accel.Ui.LogItem(n.hr==seraph_accel.Gen.hr.S_OK?"success":seraph_accel.Gen.hr.Succ(n.hr)?n.hr==seraph_accel.Gen.hr.S_FALSE?"normal":"warning":"error",seraph_accel.Ui.Tag("strong",
     51d.name?d.name:d.id)+u,!1));if(seraph_accel.SelfDiag._int.inProgress){v.next=28;break}return v.abrupt("break",31);case 28:m++;v.next=16;break;case 31:f.hide(),q.prop("disabled",!1),a.prop("disabled",!0);case 34:case "end":return v.stop()}},r,this)}));return t.apply(this,arguments)}var k=seraph_accel.Wp.Loc.GetApi()._x;seraph_accel.SelfDiag={_int:{OnStart:function(l){return t.apply(this,arguments)},OnCancel:function(l){l=jQuery(l.parentNode).closest(".blck").first();l.find(".seraph_accel_spinner");
    5252l.find('input[type="button"]:not(.cancel)');l.find('input[type="button"].cancel').prop("disabled",!0);seraph_accel.SelfDiag._int.inProgress=!1;seraph_accel.SelfDiag._int.curAjax&&seraph_accel.SelfDiag._int.curAjax.abort()},inProgress:!1}}})()})();
  • seraphinite-accelerator/trunk/Cmn/Gen.php

    r3468084 r3485735  
    2222    const S_TIMEOUT                                 = 0x000705B4;
    2323    const S_ABORTED                                 = 0x000704C7;
     24    const S_ACCESS_DENIED                           = 0x00070005;
    2425
    2526    const E_DISPATCH_9                              = 0x80020009;
     
    699700                break;
    700701
    701             if( $filePathRoot && strlen( $filePathRoot ) >= strlen( $filePath ) )
     702            if( $filePathRoot && strlen( $filePathRoot ) > strlen( $filePath ) )
    702703                break;
    703704
     
    768769    }
    769770
    770     static function CopyDir( $path, $pathNew )
     771    static function CopyDir( $path, $pathNew, $bMove = false )
    771772    {
    772773        if( Gen::HrFail( Gen::MakeDir( $pathNew, true ) ) )
    773774            return( false );
    774775
    775         $ctx = array( 'pathNew' => $pathNew );
     776        $ctx = array( 'pathNew' => $pathNew, 'bMove' => $bMove );
    776777        if( Gen::DirEnum( $path, $ctx,
    777778            function( $path, $file, &$ctx )
     
    781782                if( @is_dir( $path ) )
    782783                {
    783                     if( !Gen::CopyDir( $path, $pathNew ) )
     784                    if( !Gen::CopyDir( $path, $pathNew, $ctx[ 'bMove' ] ) )
    784785                        $ctx[ 'notAll' ] = true;
    785786                }
    786                 else if( !@copy( $path, $pathNew ) )
    787                     $ctx[ 'notAll' ] = true;
     787                else
     788                {
     789                    if( $ctx[ 'bMove' ] )
     790                    {
     791                        if( !@rename( $path, $pathNew ) )
     792                            $ctx[ 'notAll' ] = true;
     793                    }
     794                    else if( !@copy( $path, $pathNew ) )
     795                        $ctx[ 'notAll' ] = true;
     796                }
    788797
    789798                return( true );
     
    791800        ) === null )
    792801            return( false );
     802
     803        if( $bMove && !Gen::DelDir( $path ) )
     804            $ctx[ 'notAll' ] = true;
    793805
    794806        return( !( isset( $ctx[ 'notAll' ] ) ? $ctx[ 'notAll' ] : false ) );
     
    804816                if( @is_dir( $path ) )
    805817                {
    806                     if( !Gen::DelDir( $path ) )
     818                    if( Gen::DelDir( $path ) === false )
    807819                        $notAll = true;
    808820                }
     
    817829            return( false );
    818830
    819         return( $selfToo ? @rmdir( $path ) : true );
     831        return( $selfToo ? ( file_exists( $path ) ? @rmdir( $path ) : null ) : true );
    820832    }
    821833
     
    924936    static function FileContentExclusive_Close( $h )
    925937    {
     938        if( !$h )
     939            return;
     940
    926941        @flock( $h, LOCK_UN );
    927942        @fclose( $h );
     
    10231038    }
    10241039
     1040    static function Unlink( $file )
     1041    {
     1042        return( @file_exists( $file ) ? @unlink( $file ) : false );
     1043    }
     1044
     1045    static function Touch( $file, $mtime = null )
     1046    {
     1047        return( @file_exists( $file ) ? @touch( $file, $mtime ) : false );
     1048    }
     1049
    10251050    static function FileGetContents( $file )
    10261051    {
     
    10331058            Gen::DelDir( $file );
    10341059        return( @file_put_contents( $file, $data ) );
     1060    }
     1061
     1062    static function FileWriteTmpAndReplace( $lock, $file, $data, $fileTime = null, $delIfFail = false, $overwrite = true, $makeDir = null )
     1063    {
     1064        if( !$overwrite && @file_exists( $file ) )
     1065            return( null );
     1066
     1067        $dir = Gen::GetFileDir( $file );
     1068
     1069        if( $makeDir !== null && Gen::HrFail( Gen::MakeDir( $dir, $makeDir ) ) )
     1070        {
     1071            Gen::LastErrDsc_Set( LocId::Pack( 'DirWriteErr_%1$s', 'Common', array( $dir ) ) );
     1072            return( false );
     1073        }
     1074
     1075        if( $lock )
     1076            $fileTmp = $file . '.tmp';
     1077        else
     1078        {
     1079            $fileTmp = tempnam( $dir, '' );
     1080            if( !$fileTmp )
     1081            {
     1082                Gen::LastErrDsc_Set( LocId::Pack( 'DirWriteErr_%1$s', 'Common', array( $dir ) ) );
     1083                return( false );
     1084            }
     1085        }
     1086
     1087        if( ( $lr = $lock ? $lock -> Acquire() : null ) !== false )
     1088        {
     1089            if( @file_put_contents( $fileTmp, $data ) )
     1090            {
     1091                if( $fileTime === null || @touch( $fileTmp, $fileTime ) )
     1092                {
     1093                    if( @file_exists( $file ) )
     1094                        @unlink( $file );
     1095
     1096                    if( @rename( $fileTmp, $file ) )
     1097                    {
     1098                        if( $lr )
     1099                            $lock -> Release();
     1100                        return( true );
     1101                    }
     1102                    else
     1103                        Gen::LastErrDsc_Set( LocId::Pack( 'FileRenameErr_%1$s%2$s', 'Common', array( $fileTmp, $file ) ) );
     1104                }
     1105                else
     1106                    Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );
     1107            }
     1108            else
     1109                Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );
     1110        }
     1111        else
     1112            Gen::LastErrDsc_Set( $lock -> GetErrDescr() );
     1113
     1114        @unlink( $fileTmp );
     1115        if( $delIfFail )
     1116            @unlink( $file );
     1117
     1118        if( $lr )
     1119            $lock -> Release();
     1120
     1121        return( false );
    10351122    }
    10361123
     
    11601247
    11611248        return( $subject );
     1249    }
     1250
     1251    static function StrReplaceKeyed( $searchReplace, $subject )
     1252    {
     1253        return( Gen::StrReplace( array_keys( $searchReplace ), array_values( $searchReplace ), $subject ) );
    11621254    }
    11631255
     
    14061498        if( gettype( $data ) != 'string' )
    14071499            return( '' );
    1408         return( preg_replace( '@[^A-Za-z0-9_\\-:+=|/,\\.\\ ]@', '', $data ) );
     1500        return( preg_replace( '@[^A-Za-z0-9_\\-:+=|/,\\.\\ \\\\]@', '', $data ) );
    14091501    }
    14101502
     
    16331725
    16341726        return( str_replace( '^', '%', $v ) );
     1727    }
     1728
     1729    static function GetCpuLoad()
     1730    {
     1731        if( function_exists( 'sys_getloadavg' ) )
     1732        {
     1733            $loadavg = sys_getloadavg();
     1734            if( is_array( $loadavg ) )
     1735            {
     1736                $loadavg = ($loadavg[ 0 ]??null);
     1737                if( is_float( $loadavg ) )
     1738                {
     1739                    if( $loadavg > 1.0 )
     1740                        $loadavg = 1.0;
     1741                    return( $loadavg );
     1742                }
     1743            }
     1744        }
     1745
     1746        if( stristr( PHP_OS, 'win' ) )
     1747        {
     1748            $output = null;
     1749            if( function_exists( 'exec' ) )
     1750                @exec( 'wmic cpu get loadpercentage /all', $output );
     1751
     1752            if( $output )
     1753                foreach( $output as $line )
     1754                    if( $line && preg_match( '@^[0-9]+\$@', $line ) )
     1755                        return( ( float )( ( int )$line / 100 ) );
     1756        }
     1757
     1758        return( false );
     1759    }
     1760
     1761    static function GetCpuCount()
     1762    {
     1763        static $g_nCpu;
     1764
     1765        if( $g_nCpu !== null )
     1766            return( $g_nCpu );
     1767
     1768        if( stristr( PHP_OS, 'win' ) )
     1769        {
     1770            if( $n = getenv( 'NUMBER_OF_PROCESSORS' ) )
     1771                return( $g_nCpu = $n );
     1772
     1773            if( function_exists( 'shell_exec' ) )
     1774                return( $g_nCpu = ( int )shell_exec( 'echo %NUMBER_OF_PROCESSORS%' ) );
     1775
     1776            return( $g_nCpu = false );
     1777        }
     1778        else
     1779        {
     1780            if( $cpuinfo = Gen::FileGetContents( '/proc/cpuinfo' ) )
     1781                if( preg_match_all( '@^processor@m', $cpuinfo, $m ) )
     1782                    return( $g_nCpu = count( $m[ 0 ] ) );
     1783
     1784            if( function_exists( 'shell_exec' ) )
     1785                if( $n = ( int )shell_exec( 'cat /proc/cpuinfo | grep processor | wc -l' ) )
     1786                    return( $g_nCpu = $n );
     1787        }
     1788
     1789        return( $g_nCpu = false );
    16351790    }
    16361791
     
    19002055    }
    19012056
    1902     static function GetNonce( $data, $key )
    1903     {
    1904         return( str_replace( array( '/', '+' ), '', rtrim( base64_encode( hash_hmac( 'md5', $data, $key, true ) ), '=' ) ) );
     2057    static function GetNonce( $data, $key, $ttl = null, $time = null )
     2058    {
     2059        if( $ttl )
     2060        {
     2061            if( $time === null )
     2062                $time = time();
     2063            $time = Gen::AlignNLow( $time, ( int )( $ttl / 2 ) );
     2064        }
     2065
     2066        return( str_replace( array( '/', '+' ), '', rtrim( base64_encode( hash_hmac( 'md5', $data . ( $time ? ( string )$time : '' ), $key, true ) ), '=' ) ) );
     2067    }
     2068
     2069    static function CheckNonce( $nonce, $data, $key, $ttl = null, $time = null )
     2070    {
     2071        if( $ttl )
     2072        {
     2073            if( $time === null )
     2074                $time = time();
     2075            $time = array( $time, $time - ( int )( $ttl / 2 ) );
     2076        }
     2077        else
     2078            $time = array( null );
     2079
     2080        foreach( $time as $timeCheck )
     2081            if( $nonce == Gen::GetNonce( $data, $key, $ttl, $timeCheck ) )
     2082                return( true );
     2083
     2084        return( false );
    19052085    }
    19062086
     
    19902170    }
    19912171
     2172    static function GetScriptCpuTime()
     2173    {
     2174
     2175        $v = getrusage();
     2176        if( !is_array( $v ) )
     2177            return( 0.0 );
     2178        return( ( float )$v[ 'ru_utime.tv_sec' ] + $v[ 'ru_utime.tv_usec' ] / ( 1000 * 1000 ) );
     2179    }
     2180
    19922181    static private $_lastErrDsc = null;
    19932182    static private $_fnGetTmpDir = null;
     
    24052594        usort( $this -> aChunk, function( $chunk1, $chunk2 ) { return( Gen::VarCmp( $chunk1 -> idx, $chunk2 -> idx ) ); } );
    24062595    }
     2596
     2597    function GetDir()
     2598    {
     2599        return( implode( '*', $this -> dir ) );
     2600    }
    24072601
    24082602    #[\ReturnTypeWillChange]
     
    32483442    const E_HTTP_STATUS_END                         = 0x400;
    32493443
     3444    const E_HTTP_STATUS_400                         = 0x80190290;
     3445    const E_HTTP_STATUS_403                         = 0x80190293;
     3446
     3447    const E_HTTP_STATUS_500                         = 0x801902F4;
     3448
    32503449    static function GetHrFromResponseCode( $code, $soft = false )
    32513450    {
    3252         return( Gen::HrMake( $code < ( $soft ? 500 : 400 ) ? Gen::SEVERITY_SUCCESS : Gen::SEVERITY_ERROR, Gen::FACILITY_HTTP, Net::E_HTTP_STATUS_BEGIN + $code ) );
    3253     }
    3254 
    3255     static function GetResponseCodeFromHr( $hr )
    3256     {
     3451        return( Gen::HrMake( $code < ( $soft ? 500 : 400 ) ? Gen::SEVERITY_SUCCESS : Gen::SEVERITY_ERROR, Gen::FACILITY_HTTP, Net::E_HTTP_STATUS_BEGIN + ( int )$code ) );
     3452    }
     3453
     3454    static function GetResponseCodeFromHr( $hr, $smart = false )
     3455    {
     3456        if( $smart )
     3457        {
     3458            if( $hr == Gen::S_OK )
     3459                return( 200 );
     3460            if( $hr == Gen::S_FALSE )
     3461                return( 204 );
     3462            if( $hr == Gen::S_ABORTED )
     3463                return( 205 );
     3464            if( $hr == Gen::E_ACCESS_DENIED )
     3465                return( 403 );
     3466            if( $hr == Gen::E_INVALIDARG )
     3467                return( 400 );
     3468            if( $hr == Gen::E_NOT_FOUND )
     3469                return( 404 );
     3470            if( $hr == Gen::E_BUSY )
     3471                return( 503 );
     3472        }
     3473
    32573474        if( Gen::HrFacility( $hr ) != Gen::FACILITY_HTTP )
    32583475            return( null );
     
    32683485            return( Gen::E_FAIL );
    32693486
    3270         if( !is_wp_error( $requestRes ) )
    3271         {
    3272             $httpStatus = wp_remote_retrieve_response_code( $requestRes );
     3487        if( is_a( $requestRes, '\\WP_Error' ) )
     3488        {
     3489            $errCode = $requestRes -> get_error_code();
     3490            $errMsg = $requestRes -> get_error_message( $errCode );
     3491        }
     3492        else if( is_a( $requestRes, '\\seraph_accel\\AnyObj' ) )
     3493        {
     3494            $errCode = $requestRes -> code;
     3495            $errMsg = $requestRes -> message;
     3496        }
     3497        else
     3498        {
     3499            $httpStatus = ($requestRes[ 'response' ][ 'code' ]??'');
    32733500            if( $httpStatus == 200 || $httpStatus === false )
    32743501                return( Gen::S_OK );
     
    32773504            if( $smart )
    32783505            {
    3279                 if( $httpStatus == 404 )
     3506                if( $httpStatus == 204 )
     3507                    $hr = Gen::S_FALSE;
     3508                else if( $httpStatus == 205 )
     3509                    $hr = Gen::S_ABORTED;
     3510                else if( $httpStatus == 400 )
     3511                    $hr = Gen::E_INVALIDARG;
     3512                else if( $httpStatus == 403 )
     3513                    $hr = Gen::E_ACCESS_DENIED;
     3514                else if( $httpStatus == 404 )
    32803515                    $hr = Gen::E_NOT_FOUND;
     3516                else if( $httpStatus == 503 )
     3517                    $hr = Gen::E_BUSY;
    32813518            }
    32823519
    32833520            return( $hr );
    32843521        }
    3285 
    3286         $errCode = $requestRes -> get_error_code();
    3287         $errMsg = $requestRes -> get_error_message( $errCode );
    32883522
    32893523        if( $errCode == 'http_request_failed' && strpos( $errMsg, 'cURL error 28:' ) !== false )
     
    34793713    }
    34803714
    3481     static function UrlAddArgs( $url, $args )
    3482     {
    3483         $args = array_merge( Net::UrlExtractArgs( $url ), $args );
     3715    static function UrlAddArgs( $url, $args, $merge = true )
     3716    {
     3717        $argsPrev = Net::UrlExtractArgs( $url );
     3718        if( $merge )
     3719            $args = array_merge( $argsPrev, $args );
    34843720        return( Net::UrlAddArgsEx( $url, $args ) );
    34853721    }
     
    36553891            $args[ 'provider' ] = 'CURL';
    36563892        if( !isset( $args[ 'user-agent' ] ) )
    3657             $args[ 'user-agent' ] = 'seraph-accel-Agent/2.28.15';
     3893            $args[ 'user-agent' ] = 'seraph-accel-Agent/2.28.16';
    36583894        if( !isset( $args[ 'timeout' ] ) )
    36593895            $args[ 'timeout' ] = 5;
     
    51645400        $obj = new AnyObj();
    51655401        $obj -> method = $method;
     5402        $obj -> transport = ($args[ 'transport' ]??null);
    51665403
    51675404        $obj -> _cbRequestBefore =
     
    51705407                if( $options && isset( $options[ 'timeout' ] ) && $options[ 'timeout' ] )
    51715408                    $options[ 'connect_timeout' ] = $options[ 'timeout' ] - 1;
     5409                if( $obj -> transport )
     5410                    $options[ 'transport' ] = $obj -> transport;
    51725411            };
    51735412
     
    52715510
    52725511        return( $obj -> adjustRes( $url, $res ) );
     5512    }
     5513
     5514    static function GetRemoteTransport()
     5515    {
     5516        $p = null;
     5517        foreach( array(
     5518            '\\WpOrg\\Requests\\Transport\\Curl',
     5519            '\\WpOrg\\Requests\\Transport\\Fsockopen',
     5520        ) as $transport )
     5521        {
     5522            if( !class_exists( $transport ) )
     5523                continue;
     5524
     5525            $p = new $transport();
     5526            break;
     5527        }
     5528
     5529        return( $p );
    52735530    }
    52745531
     
    65126769    {
    65136770        $res = array( 'global' => true, 'local' => true );
    6514         if( !is_multisite() )
     6771        if( !Wp::IsMultisite() )
    65156772            return( $res );
    65166773
     
    65206777    }
    65216778
     6779    static function IsMultisite()
     6780    {
     6781        return( Gen::CallFunc( 'is_multisite' ) && defined( 'BLOG_ID_CURRENT_SITE' ) );
     6782    }
     6783
    65226784    static function IsMultisiteMain()
    65236785    {
    6524         if( !is_multisite() || !defined( 'BLOG_ID_CURRENT_SITE' ) )
     6786        if( !Wp::IsMultisite() )
    65256787            return( true );
    65266788        return( get_current_blog_id() == BLOG_ID_CURRENT_SITE );
     
    65296791    static function IsMultisiteGlobalAdmin()
    65306792    {
    6531         if( !is_multisite() )
     6793        if( !Wp::IsMultisite() )
    65326794            return( false );
    65336795        return( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN == true );
  • seraphinite-accelerator/trunk/Cmn/Plugin.php

    r3468084 r3485735  
    6464                {
    6565                    update_option( 'seraph_accel_' . $name . 'V' . $verFrom, $dataRaw );
    66                     for( $verFromDel = ( int )$verFrom - 5; $verFromDel; $verFromDel-- )
     66                    for( $verFromDel = ( int )$verFrom - 5; $verFromDel > 0; $verFromDel-- )
    6767                        delete_option( 'seraph_accel_' . $name . 'V' . $verFromDel );
    6868                }
     
    122122    static function GetMultiSitePrefix()
    123123    {
    124         return( is_multisite() ? PluginOptions::GetBlogId() : '' );
     124        $blogId = 0;
     125        if( self::$_blogId !== null )
     126            $blogId = self::$_blogId;
     127        else if( Wp::IsMultisite() && Plugin::IsInited() )
     128        {
     129            $blogId = get_current_blog_id();
     130            if( $blogId == BLOG_ID_CURRENT_SITE )
     131                $blogId = 0;
     132        }
     133
     134        return( $blogId );
    125135    }
    126136
     
    128138    {
    129139        $idPrev = self::$_blogId;
    130         self::$_blogId = $id;
     140        self::$_blogId = ( int )$id;
    131141        return( $idPrev );
    132142    }
    133143
    134     static function GetBlogId()
    135     {
    136         if( self::$_blogId !== null )
    137             return( self::$_blogId );
    138         return( Plugin::IsInited() ? get_current_blog_id() : Gen::Constant( 'BLOG_ID_CURRENT_SITE', 0 ) );
     144    static function UnsetBlogId()
     145    {
     146        $idPrev = self::$_blogId;
     147        self::$_blogId = null;
     148        return( $idPrev );
    139149    }
    140150}
     
    307317            $args[ 'id' ] = 'wordpress-accelerator';
    308318            $args[ 'name' ] = 'Accelerator';
    309             $args[ 'v' ] = '2.28.15';
     319            $args[ 'v' ] = '2.28.16';
    310320            $args[ 'pk' ] = 'Base';
    311321            $args[ 'cfg' ] = '';
     
    329339            $lastCheckPackage = 'Base';
    330340
    331         if( $lastCheckVer !== '2.28.15' || $lastCheckPackage !== 'Base' )
     341        if( $lastCheckVer !== '2.28.16' || $lastCheckPackage !== 'Base' )
    332342        {
    333343            $state = Plugin::StateGet();
    334344
    335             if( $lastCheckVer !== '2.28.15' && !isset( $state[ 'changeVerCheck' ] ) )
     345            if( $lastCheckVer !== '2.28.16' && !isset( $state[ 'changeVerCheck' ] ) )
    336346            {
    337347                $state[ 'changeVerCheck' ] = $lastCheckVer !== null ? $lastCheckVer : '';
     
    350360        if( !$bForce )
    351361        {
    352             if( $bFirstTimeOnly && $lastCheckVer == '2.28.15' )
     362            if( $bFirstTimeOnly && $lastCheckVer == '2.28.16' )
    353363                return( Gen::S_FALSE );
    354364
     
    369379            $args[ 'id' ] = 'wordpress-accelerator';
    370380            $args[ 'name' ] = 'Accelerator';
    371             $args[ 'v' ] = '2.28.15';
     381            $args[ 'v' ] = '2.28.16';
    372382            $args[ 'pk' ] = 'Base';
    373383            $args[ 'cfg' ] = '';
     
    386396            {
    387397                $data[ 'updTime' ] = $curUpdTime;
    388                 $data[ 'plgVer' ] = '2.28.15';
     398                $data[ 'plgVer' ] = '2.28.16';
    389399                $data[ 'plgPk' ] = 'Base';
    390400
     
    403413        $data[ 'mdfTime' ] = $timeMdf;
    404414        $data[ 'updTime' ] = $curUpdTime;
    405         $data[ 'plgVer' ] = '2.28.15';
     415        $data[ 'plgVer' ] = '2.28.16';
    406416        $data[ 'plgPk' ] = 'Base';
    407417
     
    737747    const ASYNCTASK_PUSH_AUTO       = 'A';
    738748
     749    private static function _AsyncTask_GetCurBlogId()
     750    {
     751        if( !Wp::IsMultisite() )
     752            return( null );
     753
     754        $blogIdCur = get_current_blog_id();
     755        if( $blogIdCur == BLOG_ID_CURRENT_SITE )
     756            $blogIdCur = null;
     757
     758        return( $blogIdCur );
     759    }
     760
    739761    static private function _AsyncTasksProcess()
    740762    {
     
    914936    {
    915937
    916         if( is_multisite() )
    917             switch_to_blog( $dataItem[ 'b' ] );
     938        if( Wp::IsMultisite() )
     939            switch_to_blog( ($dataItem[ 'b' ]??BLOG_ID_CURRENT_SITE) );
    918940        Gen::CallFunc( 'seraph_accel\\OnAsyncTask_' . $dataItem[ 'n' ], array( Gen::CallFunc( 'seraph_accel\\OnAsyncTask_' . $dataItem[ 'n' ] . '_AU', array( $dataItem[ 'a' ] ), $dataItem[ 'a' ] ) ) );
    919941
     
    10301052        }
    10311053
    1032         if( is_multisite() )
    1033             $dataItemNew[ 'b' ] = get_current_blog_id();
     1054        if( $blogIdCur = self::_AsyncTask_GetCurBlogId() )
     1055            $dataItemNew[ 'b' ] = $blogIdCur;
    10341056
    10351057        if( $fast )
     
    11031125            return( $hr );
    11041126
    1105         $curBlogId = null;
    1106         if( is_multisite() )
    1107             $curBlogId = get_current_blog_id();
     1127        $blogIdCur = self::_AsyncTask_GetCurBlogId();
    11081128
    11091129        $hr = Gen::S_FALSE;
     
    11121132        foreach( $data as $i => $dataItem )
    11131133        {
    1114             if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $curBlogId )
     1134            if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $blogIdCur )
    11151135                continue;
    11161136
     
    11421162            return( false );
    11431163
    1144         $curBlogId = null;
    1145         if( is_multisite() )
    1146             $curBlogId = get_current_blog_id();
     1164        $blogIdCur = self::_AsyncTask_GetCurBlogId();
    11471165
    11481166        $res = null;
     
    11511169        foreach( $data as $i => $dataItem )
    11521170        {
    1153             if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $curBlogId )
     1171            if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $blogIdCur )
    11541172                continue;
    11551173
     
    11921210        $asyncMode = null;
    11931211
    1194         $prms = array( 'sslverify' => apply_filters( 'https_local_ssl_verify', false ) );
     1212        $prms = array( 'sslverify' => Gen::CallFunc( 'apply_filters', array( 'https_local_ssl_verify', false ), false ) );
    11951213        if( $timeout > 0 )
    11961214            $prms[ 'timeout' ] = $timeout;
     
    14481466        esc_html_x( 'PhpExecMdlNotFound_%1$s', 'admin.Common_Msg', 'seraphinite-accelerator' );
    14491467        esc_html_x( 'PhpExtDirSuffix_%1$s%2$s', 'admin.Common_Msg', 'seraphinite-accelerator' );
     1468
     1469        esc_html_x( 'GzEncodingFail', 'admin.Common_Msg', 'seraphinite-accelerator' );
    14501470    }
    14511471
     
    14601480
    14611481        $urlProductInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductInfo' );
    1462         $urlAboutPluginImg = file_exists( __DIR__ . '/../Images/ProductLogo.png' ) ? add_query_arg( array( 'v' => '2.28.15' ), Plugin::FileUri( '../Images/ProductLogo.png', __FILE__ ) ) : null;
     1482        $urlAboutPluginImg = file_exists( __DIR__ . '/../Images/ProductLogo.png' ) ? add_query_arg( array( 'v' => '2.28.16' ), Plugin::FileUri( '../Images/ProductLogo.png', __FILE__ ) ) : null;
    14631483        $urlAboutPluginDocs = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductDocs' );
    14641484        $urlAboutPluginSupport = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductSupport' );
    1465         $url3rdPartySoft = file_exists( __DIR__ . '/../third-party-software.html' ) ? add_query_arg( array( 'v' => '2.28.15' ), Plugin::FileUri( '../third-party-software.html', __FILE__ ) ) : null;
     1485        $url3rdPartySoft = file_exists( __DIR__ . '/../third-party-software.html' ) ? add_query_arg( array( 'v' => '2.28.16' ), Plugin::FileUri( '../third-party-software.html', __FILE__ ) ) : null;
    14661486
    14671487        $urlEula = null;
     
    14721492
    14731493        {
    1474             $version = esc_html( '2.28.15' );
     1494            $version = esc_html( '2.28.16' );
    14751495
    14761496            $res .= Ui::TagOpen( 'div' );
     
    15211541        $rmtCfg = PluginRmtCfg::Get();
    15221542
    1523         $urlAboutUsLogoImg = file_exists( __DIR__ . '/../Images/VendorLogo.png' ) ? add_query_arg( array( 'v' => '2.28.15' ), Plugin::FileUri( '../Images/VendorLogo.png', __FILE__ ) ) : null;
     1543        $urlAboutUsLogoImg = file_exists( __DIR__ . '/../Images/VendorLogo.png' ) ? add_query_arg( array( 'v' => '2.28.16' ), Plugin::FileUri( '../Images/VendorLogo.png', __FILE__ ) ) : null;
    15241544        $urlMorePlugins = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlMorePlugins' );
    15251545        $urlMoreInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlMain' );
     
    16811701    static function SettGetGlobal( $settRawExt = null, $clearCache = false )
    16821702    {
    1683         if( !is_multisite() )
     1703        if( !Wp::IsMultisite() )
    16841704            return( Plugin::SettGet( $settRawExt, $clearCache ) );
    16851705
     
    17061726    static function SettSetGlobal( $data, $updateCacheOnly = false )
    17071727    {
    1708         if( !is_multisite() )
     1728        if( !Wp::IsMultisite() )
    17091729            return( Plugin::SettSet( $data, $updateCacheOnly ) );
    17101730
     
    20502070
    20512071            $verFrom = self::_PrevVer_GetInt( $plgVerPrev );
    2052             $verTo = self::_PrevVer_GetInt( '2.28.15' );
     2072            $verTo = self::_PrevVer_GetInt( '2.28.16' );
    20532073            if( $verTo < $verFrom )
    20542074                list( $verTo, $verFrom ) = array( $verFrom, $verTo );
     
    21752195                continue;
    21762196
    2177             wp_enqueue_style( Plugin::CmnScriptId( $id ), add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.css' ), array(), '2.28.15' );
     2197            wp_enqueue_style( Plugin::CmnScriptId( $id ), add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.css' ), array(), '2.28.16' );
    21782198
    21792199            self::$g_aAlreadyIncludedObj[ 'css' ][ $id ] = true;
     
    22422262            $scrHndId = Plugin::CmnScriptId( $id );
    22432263
    2244             wp_register_script( $scrHndId, add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.js' ), $deps, '2.28.15' );
     2264            wp_register_script( $scrHndId, add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.js' ), $deps, '2.28.16' );
    22452265            if( $id == 'Gen' )
    22462266                Plugin::Loc_ScriptLoad( $scrHndId );
     
    26872707                            var sendDataUrl = "<?php echo( Gen::GetArrField( $rmtCfg, 'Questionnaires.SendAnswerUrlTpl' ) ); ?>";
    26882708                            sendDataUrl = sendDataUrl.replace( "{EndPointId}",                  encodeURI( "<?php echo( Wp::GetSiteId() ); ?>" ) );
    2689                             sendDataUrl = sendDataUrl.replace( "{PluginVersion}",               encodeURI( "2.28.15" ) );
     2709                            sendDataUrl = sendDataUrl.replace( "{PluginVersion}",               encodeURI( "2.28.16" ) );
    26902710                            sendDataUrl = sendDataUrl.replace( "{PluginMode}",                  encodeURI( "base" ) );
    26912711                            sendDataUrl = sendDataUrl.replace( "{PluginPackage}",               encodeURI( "Base" ) );
  • seraphinite-accelerator/trunk/Cmn/Ui.php

    r3440269 r3485735  
    412412    }
    413413
    414     static function GetSrcAttrData( $v, &$mimeType = null, &$encoding = null )
     414    static function GetSrcAttrDataType( $v, &$encoding = null )
    415415    {
    416416
     
    420420
    421421        $prms = explode( ';', substr( $v, 5, $data - 5 ) );
    422         $data = trim( substr( $v, $data + 1 ) );
     422        $encoding = ($prms[ count( $prms ) - 1 ]??null);
     423        return( ($prms[ 0 ]??null) );
     424    }
     425
     426    static function GetSrcAttrData( $v, &$mimeType = null, &$encoding = null )
     427    {
     428
     429        $data = strpos( $v, ',' );
     430        if( $data === false )
     431            return( false );
     432
     433        $prms = explode( ';', substr( $v, 5, $data - 5 ) );
    423434        $mimeType = ($prms[ 0 ]??null);
    424435        $encoding = ($prms[ count( $prms ) - 1 ]??null);
     436        $data = trim( substr( $v, $data + 1 ) );
    425437        return( $encoding == 'base64' ? base64_decode( $data ) : rawurldecode( $data ) );
    426438    }
     
    442454
    443455        $res = array();
    444         while( preg_match( '@(?:\\s[\\d.]+[wx](,)|(,\\s))@S', $v, $m, PREG_OFFSET_CAPTURE ) )
     456        if( !$v )
     457            return( $res );
     458
     459        while( preg_match( '@(?:\\s[\\d.]+[wx](,)|(,\\s))@S', ( string )$v, $m, PREG_OFFSET_CAPTURE ) )
    445460        {
    446461            if( $m[ 1 ][ 1 ] === -1 )
  • seraphinite-accelerator/trunk/cache.php

    r3468084 r3485735  
    66    exit;
    77
     8if( defined( 'SERAPH_ACCEL_NO_CACHE' ) )
     9    return;
     10
    811if( !defined( 'SERAPH_ACCEL_PLUGIN_DIR' ) ) define( 'SERAPH_ACCEL_PLUGIN_DIR', __DIR__ ); else if( SERAPH_ACCEL_PLUGIN_DIR != __DIR__ ) return;
    912
    1013require_once( __DIR__ . '/common.php' );
     14require_once( __DIR__ . '/cache_ex.php' );
    1115
    1216global $seraph_accel_g_cacheSkipData;
     
    9195        }
    9296
    93         if( !ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'stage' => 'get' ), true, true ) )
     97        if( !ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'stage' => 'get' ), false, true ) )
    9498        {
    9599            http_response_code( 599 );
     
    134138    if( $seraph_accel_g_siteId != 'm' )
    135139    {
    136         if( is_multisite() )
    137             PluginOptions::SetBlogId( ( int )GetBlogIdFromSiteId( $seraph_accel_g_siteId ) );
     140        if( Wp::IsMultisite() )
     141            PluginOptions::SetBlogId( GetBlogIdFromSiteId( $seraph_accel_g_siteId ) );
    138142        $sett = Plugin::SettGet( Gen::CallFunc( 'seraph_accel_siteSettInlineDetach', array( $seraph_accel_g_siteId ) ) );
    139         PluginOptions::SetBlogId( null );
     143        PluginOptions::UnsetBlogId();
    140144    }
    141145    else
     
    413417    $seraph_accel_g_dscFile .= '/' . $objectId . '.' . $objectType . '.dat';
    414418
     419    if( $seraph_accel_g_prepPrms && !ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'dscFile' => $seraph_accel_g_dscFile ) ) )
     420    {
     421        http_response_code( 599 );
     422        return( Gen::E_FAIL );
     423    }
     424
    415425    $seraph_accel_g_dscFilePending = $seraph_accel_g_dscFile . '.p';
    416426
     
    616626}
    617627
    618 function _CacheStdHdrs( $allowExtCache, $ctxCache, $settCache )
    619 {
    620     if( $allowExtCache && ( $ctxCache -> viewCompatId || $ctxCache -> isUserSess || !($settCache[ 'srv' ]??null) ) )
    621         $allowExtCache = false;
    622 
    623     if( $allowExtCache )
    624     {
    625         @header( 'Cache-Control: public, max-age=' . Gen::GetArrField( $settCache, array( 'srvShrdTtl' ), 3600 ) . ', s-maxage=' . Gen::GetArrField( $settCache, array( 'srvShrdTtl' ), 3600 ) );
    626     }
    627     else
    628     {
    629         @header( 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0' );
    630         @header( 'Pragma: no-cache' );
    631     }
    632 
    633     @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
    634     @header( 'Content-Type: text/html; charset=UTF-8' );
    635     @header( 'Vary: Accept-Encoding', false );
    636 }
    637 
    638 function _ProcessOutHdrTrace( $sett, $bHdr, $bLog, $state, $data = null, $dscFile = null )
    639 {
    640     if( $bHdr && !($sett[ 'hdrTrace' ]??null) )
    641         $bHdr = false;
    642 
    643     $userAgent = null;
    644     if( $bLog )
    645         $userAgent = ( isset( $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ] ) ? $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ] : ($_SERVER[ 'HTTP_USER_AGENT' ]??'') );
    646 
    647     if( $bLog && ( !($sett[ 'log' ]??null) || !($sett[ 'logScope' ][ 'request' ]??null) ) )
    648         $bLog = false;
    649     if( $bLog && $state === 'skipped' )
    650     {
    651         if( !($sett[ 'logScope' ][ 'requestSkipped' ]??null) )
    652             $bLog = false;
    653         else if( !($sett[ 'logScope' ][ 'requestSkippedAdmin' ]??null) && Gen::GetArrField( $data, array( 'reason' ) ) === 'admin' )
    654             $bLog = false;
    655     }
    656     if( $bLog && !($sett[ 'logScope' ][ 'requestBots' ]??null) && MatchUserAgentExpressions( strtolower( $userAgent ), Gen::GetArrField( $sett, array( 'bots', 'agents' ), array() ) ) )
    657         $bLog = false;
    658 
    659     $debugInfo = ' state=' . $state . ';';
    660     if( $dscFile )
    661         $debugInfo .= ' dscFile="' . substr( $dscFile, strlen( GetCacheDir() ) ) . '";';
    662 
    663     if( is_array( $data ) )
    664         foreach( $data as $dataK => $dataV )
    665         {
    666             $v = '';
    667             switch( gettype( $dataV ) )
    668             {
    669             case 'array':       $v = @json_encode( $dataV, JSON_INVALID_UTF8_IGNORE ); break;
    670             case 'string':      $v = '"' . $dataV . '"'; break;
    671             case 'boolean':     $v = $dataV ? 'true' : 'false'; break;
    672             default:            $v .= $dataV; break;
    673             }
    674 
    675             $debugInfo .= ' ' . $dataK . '=' . $v . ';';
    676         }
    677 
    678     if( $bHdr )
    679         @header( 'X-Seraph-Accel-Cache: 2.28.15;' . $debugInfo );
    680 
    681     if( $bLog )
    682     {
    683         $txt = $debugInfo . ' URL: ' . GetCurRequestUrl() . '; Agent: ' . $userAgent . '; IP: ' . ($_SERVER[ 'REMOTE_ADDR' ]??'<UNK>');
    684 
    685         LogWrite( $txt, Ui::MsgInfo, 'HTTP trace' );
    686     }
    687 }
    688 
    689 function _ProcessOutCachedData( $allowExtCache, $objSubType, $settGlob, $sett, $settCache, $dsc, $dscFileTm, $tmCur, $stateValidate, $reason, $out, &$output = null )
    690 {
    691     global $seraph_accel_g_dscFile;
    692     global $seraph_accel_g_dscFilePending;
    693     global $seraph_accel_g_dataPath;
    694     global $seraph_accel_g_ctxCache;
    695     global $seraph_accel_g_simpCacheMode;
    696 
    697     if( $objSubType === null && is_string( $seraph_accel_g_simpCacheMode ) && Gen::StrStartsWith( ( string )$seraph_accel_g_simpCacheMode, 'data:' ) )
    698         $objSubType = substr( $seraph_accel_g_simpCacheMode, 5 );
    699 
    700     $bNotMdf = false;
    701 
    702     if( Gen::GetArrField( $settGlob, array( 'cache', 'chkNotMdfSince' ), false ) )
    703     {
    704         $hash = null;
    705         $tmLm = $dscFileTm;
    706         if( $tmLm < 60 )
    707         {
    708             $tmLm = Gen::FileMTime( $seraph_accel_g_dscFilePending );
    709             if( $tmLm === false )
    710                 $tmLm = $tmCur;
    711         }
    712 
    713         {
    714             $tm2 = ( int )Gen::GetArrField( $settGlob, array( '_LM', 'cache', 'chkNotMdfSince' ) );
    715             if( $tmLm < $tm2 )
    716                 $tmLm = $tm2;
    717             unset( $tm2 );
    718         }
    719 
    720         if( isset( $dsc[ 'h' ] ) )
    721         {
    722             $hash = $dsc[ 'h' ];
    723             foreach( ( array )($dsc[ 'p' ]??null) as $oiCi )
    724                 $hash .= GetCacheCh( $oiCi, true );
    725             $hash = md5( $hash );
    726         }
    727 
    728         if( isset( $_SERVER[ 'HTTP_IF_NONE_MATCH' ] ) && $hash )
    729             $bNotMdf = trim( $_SERVER[ 'HTTP_IF_NONE_MATCH' ], " \t\n\r\0\x0B\"" ) == $hash;
    730         else if( isset( $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] ) )
    731         {
    732             $tmIfMdfSince = Net::GetTimeFromHdrVal( $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] );
    733 
    734             if( $seraph_accel_g_ctxCache -> viewStateId )
    735             {
    736                 $tmLm = ( $tmCur == $tmLm ) ? ( $tmCur - 1 ) : $tmCur;
    737                 $bNotMdf = ( $tmIfMdfSince == $tmLm );
    738             }
    739             else
    740                 $bNotMdf = ( $tmIfMdfSince >= $tmLm );
    741         }
    742     }
    743 
    744     if( $bNotMdf )
    745     {
    746         http_response_code( 304 );
    747         $ctxData = null;
    748     }
    749     else
    750     {
    751         $encoding = '';
    752 
    753         $acceptEncodings = array_map( 'trim', explode( ',', strtolower( ($_SERVER[ 'HTTP_ACCEPT_ENCODING' ]??'') ) ) );
    754         {
    755             $acceptEncodingsRaw = $acceptEncodings;
    756             $acceptEncodings = array();
    757             foreach( $acceptEncodingsRaw as $acceptEncodingRaw )
    758             {
    759                 $parts = array_map( 'trim', explode( ';', $acceptEncodingRaw ) );
    760                 if( count( $parts ) )
    761                 {
    762                     $parts = $parts[ 0 ];
    763                     if( $parts != 'br' || IsBrotliAvailable() )
    764                         $acceptEncodings[ $parts ] = true;
    765                 }
    766             }
    767 
    768             unset( $parts );
    769             unset( $acceptEncodingsRaw );
    770             unset( $acceptEncodingRaw );
    771         }
    772 
    773         $encs = Gen::GetArrField( $settCache, array( 'encs' ), array() );
    774 
    775         {
    776             foreach( $encs as $enc )
    777             {
    778                 if( $enc === '' )
    779                     continue;
    780 
    781                 if( ($acceptEncodings[ $enc ]??null) )
    782                 {
    783                     $encoding = $enc;
    784                     break;
    785                 }
    786             }
    787         }
    788         unset( $encs );
    789         unset( $acceptEncodings );
    790 
    791         if( $encoding === 'compress' )
    792             $encoding = '';
    793 
    794         if( !$out )
    795             $encoding = '';
    796 
    797         $ctxData = CacheDscGetDataCtx( $settCache, $dsc, $encoding, $seraph_accel_g_dataPath, $tmCur, $objSubType === null ? 'html' : $objSubType );
    798         if( !$ctxData || ( $objSubType === null && !CacheDscValidateDepsData( $sett, $dsc, $seraph_accel_g_dataPath ) ) )
    799         {
    800 
    801             @unlink( $seraph_accel_g_dscFile );
    802 
    803             return( Gen::S_FALSE );
    804         }
    805 
    806         if( !defined( 'SERAPH_ACCEL_ADVCACHE_COMP' ) )
    807         {
    808             if( $encoding )
    809             {
    810                 @ini_set( 'zlib.output_compression', 'Off' );
    811                 @ini_set( 'brotli.output_compression', 'Off' );
    812             }
    813 
    814             if( Gen::GetArrField( $settGlob, array( 'cache', 'cntLen' ), false ) && $ctxData[ 'contentLen' ] !== null )
    815                 @header( 'Content-Length: '. $ctxData[ 'contentLen' ] );
    816 
    817             if( $encoding )
    818                 @header( 'Content-Encoding: ' . $encoding );
    819         }
    820     }
    821 
    822     if( $objSubType === null )
    823         _CacheStdHdrs( $allowExtCache, $seraph_accel_g_ctxCache, $settCache );
    824     else
    825     {
    826         switch( $objSubType )
    827         {
    828         case 'css':     $objSubType = 'text/css; charset=UTF-8'; break;
    829         case 'js':      $objSubType = 'application/javascript; charset=UTF-8'; break;
    830         case 'json':    $objSubType = 'application/json; charset=UTF-8'; break;
    831         case 'xml':     $objSubType = 'text/xml; charset=UTF-8'; break;
    832         case 'txt':     $objSubType = 'text/plain; charset=UTF-8'; break;
    833         case 'bin':     $objSubType = 'application/octet-stream'; break;
    834         case 'rss':     $objSubType = 'application/rss+xml; charset=UTF-8'; break;
    835         default:        $objSubType = 'text/html; charset=UTF-8'; break;
    836         }
    837 
    838         @header( 'Content-Type: ' . $objSubType );
    839     }
    840 
    841     if( Gen::GetArrField( $settGlob, array( 'cache', 'chkNotMdfSince' ), false ) )
    842     {
    843         if( $hash )
    844             @header( 'ETag: "' . $hash . '"' );
    845         @header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $tmLm ) . ' GMT' );
    846     }
    847 
    848     foreach( Gen::GetArrField( $dsc, array( 'hd' ), array() ) as $hdr )
    849         @header( $hdr );
    850 
    851     if( ($sett[ 'hdrTrace' ]??null) || ( $objSubType === null && ($sett[ 'log' ]??null) && ($sett[ 'logScope' ][ 'request' ]??null) ) )
    852     {
    853         $debugData = array();
    854         if( $reason )
    855             $debugData[ 'reason' ] = $reason;
    856         if( isset( $dsc[ 't' ] ) )
    857             $debugData[ 'cacheTmp' ] = true;
    858         $debugData[ 'date' ] = gmdate( 'Y-m-d H:i:s', $dscFileTm );
    859         $debugData[ 'dscFile' ] = substr( $seraph_accel_g_dscFile, strlen( GetCacheDir() ) );
    860 
    861         if( $ctxData )
    862             $debugData = array_merge( $debugData, array_filter( $ctxData, function( $k ) { return( in_array( $k, array( 'encoding', 'recompress', 'compressedEncoding', 'sizeRaw', 'size' ) ) ); }, ARRAY_FILTER_USE_KEY ), array(),
    863                 ($sett[ 'debugInfo' ]??null) ? array( 'PLG_DIR' => __DIR__, '_SERVER' => $_SERVER ) : array()
    864             );
    865 
    866         _ProcessOutHdrTrace( $sett, true, $objSubType === null, $stateValidate, $debugData );
    867     }
    868 
    869     if( $bNotMdf )
    870         return( Gen::S_OK );
    871 
    872     $output = CacheDscDataOutput( $ctxData, $out );
    873     if( $output !== false )
    874         return( Gen::S_OK );
    875 
    876     @unlink( $seraph_accel_g_dscFile );
    877     return( Gen::E_FAIL );
    878 }
    879 
    880 function _GetCcf( $settCache, $oiCi, $encoding, $dataPath, $tmUpdate, $type, $dataComprExts )
    881 {
    882     $ext = _GetDataFileEncExt( $encoding, true );
    883     if( $ext === null || !in_array( $ext, $dataComprExts ) )
    884         return( null );
    885 
    886     if( $type != 'html' )
    887         $dataPath .= '/' . $type;
    888 
    889     $oiCf = CacheCgf( $settCache, $dataPath, $oiCi, $type, $ext );
    890 
    891     @touch( $oiCf, $tmUpdate );
    892     return( array( 'path' => $oiCf, 'fmt' => $ext ) );
    893 }
    894 
    895 function _GetCfc( $oiCf, $out = false )
    896 {
    897     if( !$out )
    898         return( @file_get_contents( $oiCf[ 'path' ] ) );
    899 
    900     $file = @fopen( $oiCf[ 'path' ], 'rb' );
    901     if( !$file )
    902         return( false );
    903 
    904     while( !@feof( $file ) && ( @connection_status() == 0 ) )
    905         CacheWriteOut( @fread( $file, 0x10000 ) );
    906 
    907     return( true );
    908 }
    909 
    910 function CacheDscGetDataCtxFirstFile( $settCache, $oiCi, &$ctxData, $dataPath, $tmUpdate, $type, $dataComprExts )
    911 {
    912     $encoding = $ctxData[ 'encoding' ];
    913 
    914     $oiCf = _GetCcf( $settCache, $oiCi, $encoding, $dataPath, $tmUpdate, $type, $dataComprExts );
    915     if( $oiCf )
    916     {
    917         $ctxData[ 'compressedEncoding' ] = $encoding;
    918         return( $oiCf );
    919     }
    920 
    921     $ctxData[ 'recompress' ] = true;
    922 
    923     $encodings = array( '', 'gzip', 'deflate', 'compress', 'br' );
    924     if( !in_array( $encoding, $encodings ) )
    925         return( null );
    926 
    927     foreach( $encodings as $encoding )
    928     {
    929         $oiCf = _GetCcf( $settCache, $oiCi, $encoding, $dataPath, $tmUpdate, $type, $dataComprExts );
    930         if( $oiCf )
    931         {
    932             $ctxData[ 'compressedEncoding' ] = $encoding;
    933             return( $oiCf );
    934         }
    935     }
    936 
    937     return( null );
    938 }
    939 
    940 function CacheDscGetDataCtx( $settCache, $dsc, $encoding, $dataPath, $tmUpdate, $type )
    941 {
    942     $oiCs = ($dsc[ 'p' ]??null);
    943     if( !is_array( $oiCs )  || count( $oiCs ) != 1 )
    944     {
    945 
    946         return( null );
    947     }
    948 
    949     $dataComprExts = Gen::GetArrField( $settCache, array( 'dataCompr' ), array() );
    950     if( empty( $dataComprExts ) )
    951         $dataComprExts[] = '';
    952     foreach( $dataComprExts as &$dataComprExt )
    953         $dataComprExt = _GetDataFileComprExt( $dataComprExt );
    954 
    955     $ctxData = array( 'encoding' => $encoding, 'recompress' => false, 'oiFs' => array() );
    956     if( $oiCs )
    957     {
    958         $oiCi = $oiCs[ 0 ];
    959 
    960         $oiCf = CacheDscGetDataCtxFirstFile( $settCache, $oiCi, $ctxData, $dataPath, $tmUpdate, $type, $dataComprExts );
    961         if( !$oiCf )
    962         {
    963 
    964             return( null );
    965         }
    966 
    967         $ctxData[ 'fmt' ] = $oiCf[ 'fmt' ];
    968     }
    969     else
    970         $ctxData[ 'fmt' ] = '';
    971 
    972     $fmt = $ctxData[ 'fmt' ];
    973 
    974     if( !$ctxData[ 'recompress' ] )
    975     {
    976         switch( $encoding )
    977         {
    978         case 'deflate':
    979             if( $fmt != '.deflu' )
    980                 $ctxData[ 'recompress' ] = true;
    981             break;
    982 
    983         case 'compress':
    984             if( $fmt != '.deflu' )
    985                 $ctxData[ 'recompress' ] = true;
    986             break;
    987 
    988         }
    989     }
    990 
    991     if( defined( 'SERAPH_ACCEL_ADVCACHE_COMP' ) )
    992     {
    993         $ctxData[ 'recompress' ] = true;
    994         $encoding = '';
    995     }
    996 
    997     $recompress = $ctxData[ 'recompress' ];
    998 
    999     $size = 0;
    1000     $contentLen = 0;
    1001     $sizeRaw = 0;
    1002     $content = '';
    1003 
    1004         $ctxData[ 'oiFs' ][] = $oiCf;
    1005         $oiCos = GetCacheCos( $oiCi );
    1006         $size += $oiCos;
    1007 
    1008         if( $recompress )
    1009         {
    1010             $oiCd = _GetCfc( $oiCf );
    1011             if( $oiCd === false || !CacheCvs( strlen( $oiCd ), $oiCos ) )
    1012             {
    1013 
    1014                 return( null );
    1015             }
    1016 
    1017             $sizeRaw += strlen( $oiCd );
    1018 
    1019             switch( $fmt )
    1020             {
    1021             case '.gz':             $oiCd = @gzdecode( $oiCd ); break;
    1022             case '.deflu':      $oiCd = @gzinflate( $oiCd . "\x03\0" ); break;
    1023             case '.br':             $oiCd = Gen::CallFunc( 'brotli_uncompress', array( $oiCd ), false ); break;
    1024             case '.brua':       $oiCd = Gen::CallFunc( 'brotli_uncompress', array( "\x6b\x00" . $oiCd . "\x03" ), false ); break;
    1025             }
    1026 
    1027             if( $oiCd === false )
    1028             {
    1029 
    1030                 return( null );
    1031             }
    1032 
    1033             $content .= $oiCd;
    1034         }
    1035         else
    1036         {
    1037             $oiCfs = @filesize( $oiCf[ 'path' ] );
    1038             if( !CacheCvs( $oiCfs, $oiCos ) )
    1039             {
    1040 
    1041                 return( null );
    1042             }
    1043             $contentLen += $oiCfs;
    1044         }
    1045 
    1046     if( !$recompress )
    1047     {
    1048         switch( $encoding )
    1049         {
    1050         case 'deflate':
    1051             if( $fmt == '.deflu' )
    1052                 $contentLen += 2;
    1053             break;
    1054 
    1055         case 'compress':
    1056             if( $fmt == '.deflu' )
    1057                 $contentLen += 2 + 2 + 4;
    1058             break;
    1059 
    1060         case 'gzip':
    1061             if( $fmt == '.deflu' )
    1062                 $contentLen += 10 + 2 + 4 + 4;
    1063             break;
    1064 
    1065         case 'br':
    1066             if( $fmt == '.brua' )
    1067                 $contentLen += 2 + 1;
    1068             break;
    1069         }
    1070 
    1071         $sizeRaw = $contentLen;
    1072     }
    1073     else
    1074     {
    1075         switch( $encoding )
    1076         {
    1077         case 'deflate':     $content = @gzdeflate( $content, 6 ); break;
    1078         case 'compress':    $content = @gzcompress( $content, 6 ); break;
    1079         case 'gzip':        $content = @gzencode( $content, 6 ); break;
    1080         case 'br':          $content = Gen::CallFunc( 'brotli_compress', array( $content, 7 ), false ); break;
    1081         }
    1082 
    1083         if( $content === false )
    1084         {
    1085 
    1086             return( null );
    1087         }
    1088 
    1089         $contentLen = strlen( $content );
    1090     }
    1091 
    1092     $ctxData[ 'content' ] = $content;
    1093     $ctxData[ 'contentLen' ] = $contentLen;
    1094     $ctxData[ 'size' ] = $size;
    1095     $ctxData[ 'sizeRaw' ] = $sizeRaw;
    1096     $ctxData[ 'crc32' ] = $dsc[ 'c' ];
    1097     $ctxData[ 'adler32' ] = $dsc[ 'a' ];
    1098     return( $ctxData );
    1099 }
    1100 
    1101 function CacheDscValidateDepsData( $sett, $dsc, $dataPath )
    1102 {
    1103     static $g_aaCheckExt = array( 'css' => array( 'css' ), 'js' => array( 'js' ), 'img' => array( 'jpe','jpg','jpeg','png','gif','bmp', 'tiff', 'svg', 'webp','avif'  ) );
    1104 
    1105     $settCache = Gen::GetArrField( $sett, array( 'cache' ), array() );
    1106 
    1107     foreach( Gen::GetArrField( $dsc, array( 's' ), array() ) as $childType => $children )
    1108     {
    1109         $aCheckExt = ($g_aaCheckExt[ $childType ]??null);
    1110         if( !$aCheckExt )
    1111             continue;
    1112 
    1113         $dataPathSubType = $dataPath . '/' . $childType;
    1114         foreach( $children as $childId )
    1115         {
    1116             $found = false;
    1117             foreach( $aCheckExt as $fileExt )
    1118             {
    1119                 if( !@file_exists( CacheCgf( $settCache, $dataPathSubType, $childId, $fileExt ) ) )
    1120                     continue;
    1121 
    1122                 $found = true;
    1123                 break;
    1124             }
    1125 
    1126             if( !$found )
    1127             {
    1128                 if( ($sett[ 'log' ]??null) )
    1129                     LogWrite( 'Descriptor child "' . $childType . '" not found: ' . $childId, Ui::MsgErr, 'Errors' );
    1130                 return( false );
    1131             }
    1132         }
    1133     }
    1134 
    1135     foreach( Gen::GetArrField( $dsc, array( 'b' ), array() ) as $idSubPart => $dscPart )
    1136         if( !CacheDscValidateDepsData( $sett, $dscPart, $dataPath ) )
    1137             return( false );
    1138 
    1139     return( true );
    1140 }
    1141 
    1142 function CacheDscDataOutput( $ctxData, $out = true )
    1143 {
    1144     $iubyvadkxs = $ctxData[ 'oiFs' ];
    1145     $encoding = $ctxData[ 'encoding' ];
    1146     $recompress = $ctxData[ 'recompress' ];
    1147     $fmt = $ctxData[ 'fmt' ];
    1148 
    1149     if( $recompress )
    1150     {
    1151         $content = $ctxData[ 'content' ];
    1152         if( !$out )
    1153             return( $content );
    1154 
    1155         CacheWriteOut( $content );
    1156         return( true );
    1157     }
    1158 
    1159     $content = '';
    1160 
    1161     switch( $encoding )
    1162     {
    1163     case 'deflate':
    1164         break;
    1165 
    1166     case 'compress':
    1167         if( $fmt == '.deflu' )
    1168         {
    1169             $oiCd = "\x78\xDA";
    1170             if( $out )
    1171                 CacheWriteOut( $oiCd );
    1172             else
    1173                 $content .= $oiCd;
    1174         }
    1175         break;
    1176 
    1177     case 'gzip':
    1178         if( $fmt == '.deflu' )
    1179         {
    1180             $oiCd = "\x1F\x8B\x08\0\0\0\0\0\x02\x0A";
    1181             if( $out )
    1182                 CacheWriteOut( $oiCd );
    1183             else
    1184                 $content .= $oiCd;
    1185         }
    1186         break;
    1187 
    1188     case 'br':
    1189         if( $fmt == '.brua' )
    1190         {
    1191             $oiCd = "\x6b\x00";
    1192             if( $out )
    1193                 CacheWriteOut( $oiCd );
    1194             else
    1195                 $content .= $oiCd;
    1196         }
    1197         break;
    1198     }
    1199 
    1200         $oiCf = $iubyvadkxs[ 0 ];
    1201 
    1202         $oiCd = _GetCfc( $oiCf, $out );
    1203         if( $oiCd === false )
    1204             return( false );
    1205 
    1206         if( !$out )
    1207             $content .= $oiCd;
    1208 
    1209     switch( $encoding )
    1210     {
    1211     case 'deflate':
    1212         if( $fmt == '.deflu' )
    1213         {
    1214             $oiCd = "\x03\0";
    1215             if( $out )
    1216                 CacheWriteOut( $oiCd );
    1217             else
    1218                 $content .= $oiCd;
    1219         }
    1220         break;
    1221 
    1222     case 'compress':
    1223         if( $fmt == '.deflu' )
    1224         {
    1225             $oiCd = "\x03\0" . $ctxData[ 'adler32' ];
    1226             if( $out )
    1227                 CacheWriteOut( $oiCd );
    1228             else
    1229                 $content .= $oiCd;
    1230         }
    1231         break;
    1232 
    1233     case 'gzip':
    1234         if( $fmt == '.deflu' )
    1235         {
    1236             $oiCd = "\x03\0" . $ctxData[ 'crc32' ] . pack( 'V', $ctxData[ 'size' ] );
    1237             if( $out )
    1238                 CacheWriteOut( $oiCd );
    1239             else
    1240                 $content .= $oiCd;
    1241         }
    1242         break;
    1243 
    1244     case 'br':
    1245         if( $fmt == '.brua' )
    1246         {
    1247             $oiCd = "\x03";
    1248             if( $out )
    1249                 CacheWriteOut( $oiCd );
    1250             else
    1251                 $content .= $oiCd;
    1252         }
    1253         break;
    1254     }
    1255 
    1256     if( !$out )
    1257         return( $content );
    1258 
    1259     CacheWriteOut( $content );
    1260     return( true );
    1261 }
    1262 
    1263 function CacheWriteOut( $data )
    1264 {
    1265 
    1266     print( $data );
    1267 }
    1268 
    1269 function CacheDscWriteCancel( $dscDel = true, $updTime = false )
    1270 {
    1271     global $seraph_accel_g_dscFile;
    1272     global $seraph_accel_g_dscFilePending;
    1273 
    1274     if( $updTime )
    1275         @touch( $seraph_accel_g_dscFile );
    1276 
    1277     @unlink( $seraph_accel_g_dscFilePending );
    1278     if( Gen::GetFileExt( $seraph_accel_g_dscFilePending ) == 'pp' )
    1279         @unlink( substr( $seraph_accel_g_dscFilePending, 0, -1 ) );
    1280 
    1281     if( $dscDel && !$updTime )
    1282     {
    1283 
    1284         @unlink( $seraph_accel_g_dscFile );
    1285     }
    1286 }
    1287 
    1288 function _CacheSetRequestToPrepareAsyncEx( $siteId, $method, $url, $hdrs, $tmp = false )
    1289 {
    1290 
    1291     if( !$siteId )
    1292     {
    1293         $urlProc = ProcessQueueItemCtx::AdjustRequestUrl( $url, Gen::GetCurRequestTime(), array() );
    1294 
    1295         $asyncMode = null;
    1296 
    1297             ProcessQueueItemCtx::MakeRequest( $asyncMode, $method, $urlProc, $hdrs );
    1298         return;
    1299     }
    1300 
    1301     if( $tmp )
    1302     {
    1303         $urlProc = ProcessQueueItemCtx::AdjustRequestUrl( $url, Gen::GetCurRequestTime(), array( 'tmp' => true ) );
    1304 
    1305         $asyncMode = null;
    1306 
    1307             ProcessQueueItemCtx::MakeRequest( $asyncMode, $method, $urlProc, $hdrs );
    1308     }
    1309 
    1310     if( $tmp != 'only' && CachePostPreparePageEx( $method, $url, $siteId, 10, null, $hdrs ) )
    1311         CachePushQueueProcessor();
    1312 }
    1313 
    1314 function CacheSetCurRequestToPrepareAsync( $siteId, $tmp = false, $bgEnabled = false, $early = true )
    1315 {
    1316     global $seraph_accel_g_simpCacheMode;
    1317 
    1318     $obj = new AnyObj();
    1319     $obj -> method = strtoupper( ($_SERVER[ 'REQUEST_METHOD' ]??'GET') );
    1320     $obj -> url = GetCurRequestUrl();
    1321     if( $obj -> method == 'POST' )
    1322     {
    1323         $aRequestArg = array(); AddCurPostArgs( $aRequestArg );
    1324         $obj -> url = Net::UrlAddArgs( $obj -> url, $aRequestArg );
    1325     }
    1326 
    1327     $obj -> hdrs = Net::GetRequestHeaders();
    1328     if( isset( $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ] ) )
    1329         $obj -> hdrs[ 'User-Agent' ] = $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ];
    1330 
    1331     if( Gen::StrStartsWith( ( string )$seraph_accel_g_simpCacheMode, 'fragments' ) )
    1332         $obj -> url = Net::UrlAddArgs( $obj -> url, array( 'seraph_accel_gf' => substr( $seraph_accel_g_simpCacheMode, 10 ) ) );
    1333 
    1334     if( !$bgEnabled && $siteId && !$tmp && $seraph_accel_g_simpCacheMode === null )
    1335     {
    1336         Gen::MakeDir( $fileTempQueue = GetCacheDir() . '/qt', true );
    1337         if( $fileTempQueue = tempnam( $fileTempQueue, '' ) )
    1338         {
    1339             if( @file_put_contents( $fileTempQueue, @serialize( array( 'u' => $obj -> url, 's' => $siteId, 'p' => 10, 'h' => $obj -> hdrs, 't' => microtime( true ) ) ) ) !== false )
    1340             {
    1341 
    1342                 if( @rename( $fileTempQueue, $fileTempQueue . '.dat' ) )
    1343                 {
    1344 
    1345                     return( true );
    1346                 }
    1347                 else
    1348                     @unlink( $fileTempQueue );
    1349             }
    1350             else
    1351                 @unlink( $fileTempQueue );
    1352         }
    1353     }
    1354 
    1355     if( !$early )
    1356     {
    1357         _CacheSetRequestToPrepareAsyncEx( $siteId, $obj -> method, $obj -> url, $obj -> hdrs, $tmp );
    1358         return( false );
    1359     }
    1360 
    1361     $obj -> siteId = $siteId;
    1362     $obj -> tmp = $tmp;
    1363     $obj -> cb = function( $obj ) { _CacheSetRequestToPrepareAsyncEx( $obj -> siteId, $obj -> method, $obj -> url, $obj -> hdrs, $obj -> tmp ); };
    1364     add_action( 'muplugins_loaded', array( $obj, 'cb' ) , 0 );
    1365 
    1366     if( Wp::IsCronEnabled() )
    1367         add_action( 'wp_loaded', function() { if( Wp::GetFilters( 'init', 'wp_cron' ) ) wp_cron(); exit(); }, -999999 );
    1368     else
    1369         add_action( 'muplugins_loaded', function() { exit(); }, 1 );
    1370 
    1371     return( false );
    1372 }
    1373 
    1374 function _CacheContentStart( $tmCur, $procTmLim )
    1375 {
    1376     global $seraph_accel_g_dscFile;
    1377     global $seraph_accel_g_dscFilePending;
    1378 
    1379     for( $try = 1; $try <= 2; $try++ )
    1380     {
    1381         $stm = null;
    1382         $hr = Gen::FileOpenWithMakeDir( $stm, $seraph_accel_g_dscFilePending, 'x' );
    1383         if( $stm )
    1384         {
    1385             @fclose( $stm );
    1386             break;
    1387         }
    1388 
    1389         if( $try == 2 )
    1390             return( false );
    1391 
    1392         $dscFilePendingTm = Gen::FileMTime( $seraph_accel_g_dscFilePending );
    1393         if( $dscFilePendingTm !== false && ( $tmCur - $dscFilePendingTm < $procTmLim ) )
    1394             return( false );
    1395 
    1396         @unlink( $seraph_accel_g_dscFilePending );
    1397     }
    1398 
    1399     return( true );
    1400 }
    1401 
    1402 function _CbContentProcess( $content )
    1403 {
    1404     if( !function_exists( 'seraph_accel\\OnEarlyContentComplete' ) )
    1405         return( $content );
    1406     return( OnEarlyContentComplete( $content, true ) );
    1407 }
    1408 
    1409 function _CbContentFinishSkip( $content )
    1410 {
    1411     global $seraph_accel_g_dscFile;
    1412     global $seraph_accel_g_dscFilePending;
    1413     global $seraph_accel_g_dataPath;
    1414     global $seraph_accel_g_cacheSkipData;
    1415     global $seraph_accel_g_prepPrms;
    1416     global $seraph_accel_g_lazyInvTmp;
    1417     global $seraph_accel_g_bPrepContTmpToMain;
    1418     global $seraph_accel_g_prepOrigContHash;
    1419     global $seraph_accel_g_prepOrigCont;
    1420     global $seraph_accel_g_cacheObjChildren;
    1421     global $seraph_accel_g_cacheObjSubs;
    1422     global $seraph_accel_g_siteId;
    1423     global $seraph_accel_g_prepCont;
    1424     global $seraph_accel_g_simpCacheMode;
    1425 
    1426     $sett = Plugin::SettGet();
    1427     $settGlob = Plugin::SettGetGlobal();
    1428     $settCache = Gen::GetArrField( $sett, array( 'cache' ), array() );
    1429 
    1430     @ignore_user_abort( true );
    1431 
    1432     $skipStatus = Gen::GetArrField( ($seraph_accel_g_cacheSkipData[ 1 ]??null), array( 'reason' ), '' );
    1433 
    1434     if( ($seraph_accel_g_prepPrms[ 'selfTest' ]??null) )
    1435     {
    1436         $content = 'selfTest-' . $seraph_accel_g_prepPrms[ 'selfTest' ];
    1437         sleep( 5 );
    1438     }
    1439 
    1440     if( $skipStatus === 'notChanged' )
    1441     {
    1442         $content = '';
    1443         if( $dsc = CacheReadDsc( $seraph_accel_g_dscFile ) )
    1444         {
    1445             $dscFileTm = Gen::FileMTime( $seraph_accel_g_dscFile );
    1446             _ProcessOutCachedData( $seraph_accel_g_simpCacheMode === null, null, $settGlob, $sett, $settCache, $dsc, $dscFileTm, $dscFileTm, 'revalidated', 'notChanged', false, $content );
    1447         }
    1448         else
    1449             _ProcessOutHdrTrace( $sett, true, true, 'skipped', array( 'reason' => 'brokenDsc' ), $seraph_accel_g_dscFile );
    1450     }
    1451     else
    1452         _ProcessOutHdrTrace( $sett, true, true, $seraph_accel_g_cacheSkipData[ 0 ], ($seraph_accel_g_cacheSkipData[ 1 ]??null) );
    1453 
    1454     if( $seraph_accel_g_prepPrms !== null )
    1455     {
    1456         ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array_merge( array( 'finish' => true, 'skip' => $skipStatus ), ($sett[ 'debugInfo' ]??null) ? array( 'infos' => array( LocId::Pack( 'SrvArgs' ) => PackKvArrInfo( $_SERVER ) ) ) : array() ), false, false );
    1457 
    1458         $httpCode = http_response_code();
    1459         if( $httpCode >= 300 && $httpCode < 400 )
    1460             http_response_code( 200 );
    1461     }
    1462 
    1463     return( $content );
    1464 }
    1465 
    1466 function _CbContentFinish( $content )
    1467 {
    1468     global $post;
    1469 
    1470     global $seraph_accel_g_dscFile;
    1471     global $seraph_accel_g_dscFilePending;
    1472     global $seraph_accel_g_dataPath;
    1473     global $seraph_accel_g_noFo;
    1474     global $seraph_accel_g_cacheObjChildren;
    1475     global $seraph_accel_g_cacheObjSubs;
    1476     global $seraph_accel_g_prepPrms;
    1477     global $seraph_accel_g_prepCont;
    1478     global $seraph_accel_g_bPrepContTmpToMain;
    1479     global $seraph_accel_g_prepOrigContHash;
    1480     global $seraph_accel_g_prepOrigCont;
    1481     global $seraph_accel_g_prepLearnId;
    1482     global $seraph_accel_g_simpCacheMode;
    1483     global $seraph_accel_g_ctxProcess;
    1484 
    1485     $sett = Plugin::SettGet();
    1486     $settGlob = Plugin::SettGetGlobal();
    1487     $settCache = Gen::GetArrField( $sett, array( 'cache' ), array() );
    1488 
    1489     $skipStatus = ContProcGetSkipStatus( $content );
    1490     if( !$skipStatus && ContentProcess_IsAborted() )
    1491         $skipStatus = 'aborted';
    1492 
    1493     $asyncMode = null;
    1494 
    1495     if( $skipStatus )
    1496     {
    1497         if( $skipStatus == 'noHdrOrBody'  && ( $asyncMode == 'ec' || ($settGlob[ 'asyncSmpOpt' ]??null) ) )
    1498         {
    1499             $urlCur = GetCurRequestUrl();
    1500             if( !Gen::StrEndsWith( $urlCur, '/' ) )
    1501                 $skipStatus = 'httpCode:301:' . rawurlencode( $urlCur . '/' );
    1502         }
    1503 
    1504         if( $seraph_accel_g_prepPrms !== null )
    1505         {
    1506 
    1507             $httpCode = http_response_code();
    1508             if( $httpCode >= 300 && $httpCode < 400 )
    1509                 http_response_code( 200 );
    1510 
    1511         }
    1512 
    1513         if( !$seraph_accel_g_noFo && $skipStatus !== 'notChanged' )
    1514             _ProcessOutHdrTrace( $sett, true, true, 'skipped', array( 'reason' => $skipStatus ) );
    1515 
    1516         CacheDscWriteCancel( $skipStatus !== 'aborted' && !Gen::StrStartsWith( $skipStatus, 'lrnNeed' ), $skipStatus === 'notChanged' );
    1517 
    1518         if( $skipStatus !== 'aborted' && !Gen::StrStartsWith( $skipStatus, 'lrnNeed' ) && $skipStatus !== 'notChanged' )
    1519             CacheAdditional_UpdateCurUrl( $settCache );
    1520 
    1521         if( $seraph_accel_g_prepPrms !== null )
    1522             ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array_merge( array( 'finish' => true, 'skip' => $skipStatus ), ($sett[ 'debugInfo' ]??null) ? array( 'infos' => array( LocId::Pack( 'SrvArgs' ) => PackKvArrInfo( $_SERVER ) ) ) : array() ), false, false );
    1523 
    1524         if( $seraph_accel_g_noFo )
    1525             return( '' );
    1526 
    1527         if( $skipStatus === 'notChanged' )
    1528         {
    1529             $content = '';
    1530             if( $dsc = CacheReadDsc( $seraph_accel_g_dscFile ) )
    1531             {
    1532                 $dscFileTm = Gen::FileMTime( $seraph_accel_g_dscFile );
    1533                 _ProcessOutCachedData( $seraph_accel_g_simpCacheMode === null, null, $settGlob, $sett, $settCache, $dsc, $dscFileTm, $dscFileTm, 'revalidated', 'notChanged', false, $content );
    1534             }
    1535             else
    1536                 _ProcessOutHdrTrace( $sett, true, true, 'skipped', array( 'reason' => 'brokenDsc' ), $seraph_accel_g_dscFile );
    1537         }
    1538 
    1539         return( $content );
    1540     }
    1541 
    1542     $lock = new Lock( 'dl', GetCacheDir() );
    1543     $dsc = CacheDscUpdate( $lock, $settCache, $content, $seraph_accel_g_cacheObjChildren, $seraph_accel_g_cacheObjSubs, $seraph_accel_g_dataPath, $seraph_accel_g_bPrepContTmpToMain ? false : Gen::GetArrField( $seraph_accel_g_prepPrms, array( 'tmp' ) ), $seraph_accel_g_prepOrigCont, $seraph_accel_g_prepOrigContHash, $seraph_accel_g_prepLearnId );
    1544     unset( $lock );
    1545 
    1546     if( !$dsc )
    1547     {
    1548         $skipStatus = 'dscFileUpdateError';
    1549 
    1550         if( !$seraph_accel_g_noFo )
    1551             _ProcessOutHdrTrace( $sett, true, true, 'skipped', array( 'reason' => $skipStatus ), $seraph_accel_g_dscFile );
    1552 
    1553         if( $seraph_accel_g_prepPrms !== null )
    1554         {
    1555             if( Gen::LastErrDsc_Is() )
    1556                 $skipStatus .= ':' . rawurlencode( Gen::LastErrDsc_Get() );
    1557             ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array_merge( array( 'finish' => true, 'skip' => $skipStatus ), ($sett[ 'debugInfo' ]??null) ? array( 'infos' => array( LocId::Pack( 'SrvArgs' ) => PackKvArrInfo( $_SERVER ) ) ) : array() ), false, false );
    1558         }
    1559 
    1560         return( $content );
    1561     }
    1562 
    1563     CacheAdditional_UpdateCurUrl( $settCache, true );
    1564 
    1565     if( $seraph_accel_g_prepPrms !== null )
    1566         ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array_merge( array( 'finish' => true, 'warns' => LastWarnDscs_Get() ), ($sett[ 'debugInfo' ]??null) ? array( 'infos' => array( LocId::Pack( 'ProcStat' ) => PackKvArrInfo( ($seraph_accel_g_ctxProcess[ 'stat' ]??null) ), LocId::Pack( 'SrvArgs' ) => PackKvArrInfo( $_SERVER ) ) ) : array() ), false, false );
    1567 
    1568     if( $seraph_accel_g_noFo )
    1569         return( '' );
    1570 
    1571     $content = '';
    1572     $dscFileTm = Gen::FileMTime( $seraph_accel_g_dscFile );
    1573     _ProcessOutCachedData( $seraph_accel_g_simpCacheMode === null, null, $settGlob, $sett, $settCache, $dsc, $dscFileTm, $dscFileTm, 'revalidated', null, false, $content );
    1574     return( $content );
    1575 }
    1576 
    1577 function GetCacheViewId( $ctxCache, $settCache, $userAgent, $path, $pathOrig, &$args, $bFreshParts = false )
    1578 {
    1579     $ctxCache -> viewStateId = '';
    1580     $ctxCache -> viewGeoId = '';
    1581 
    1582     $type = 'cmn';
    1583     if( ($settCache[ 'normAgent' ]??null) )
    1584     {
    1585         $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ] = ($_SERVER[ 'HTTP_USER_AGENT' ]??'');
    1586         $_SERVER[ 'HTTP_USER_AGENT' ] = 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.15';
    1587     }
    1588 
    1589     if( ($settCache[ 'views' ]??null) )
    1590     {
    1591         if( $viewsDeviceGrp = GetCacheViewDeviceGrp( $settCache, $userAgent ) )
    1592         {
    1593             $type = ($viewsDeviceGrp[ 'id' ]??null);
    1594             if( ($settCache[ 'normAgent' ]??null) )
    1595                 $_SERVER[ 'HTTP_USER_AGENT' ] = GetViewTypeUserAgent( $viewsDeviceGrp );
    1596         }
    1597 
    1598         $aCurHdr = null;
    1599 
    1600         $viewsGrps = Gen::GetArrField( $settCache, array( 'viewsGrps' ), array() );
    1601         foreach( $viewsGrps as $viewsGrp )
    1602         {
    1603             if( !($viewsGrp[ 'enable' ]??null) )
    1604                 continue;
    1605 
    1606             if( ($viewsGrp[ 'fr' ]??null) && !$bFreshParts )
    1607                 continue;
    1608 
    1609             if( CheckPathInUriList( Gen::GetArrField( $viewsGrp, array( 'urisExcl' ), array() ), $path, $pathOrig ) )
    1610                 continue;
    1611 
    1612             AccomulateCookiesState( $ctxCache -> viewStateId, $_COOKIE, Gen::GetArrField( $viewsGrp, array( 'cookies' ), array() ) );
    1613             AccomulateHdrsState( $ctxCache -> viewStateId, $aCurHdr, Gen::GetArrField( $viewsGrp, array( 'hdrs' ), array() ) );
    1614 
    1615             $viewsArgs = Gen::GetArrField( $viewsGrp, array( 'args' ), array() );
    1616             foreach( $viewsArgs as $a )
    1617             {
    1618                 foreach( $args as $argKey => $argVal )
    1619                 {
    1620                     if( strpos( $argKey, $a ) === 0 )
    1621                     {
    1622                         $ctxCache -> viewStateId .= $argKey . $argVal;
    1623                         unset( $args[ $argKey ] );
    1624                     }
    1625                 }
    1626             }
    1627         }
    1628 
    1629         if( Gen::GetArrField( $settCache, array( 'viewsGeo', 'enable' ) ) )
    1630         {
    1631             $ctxCache -> viewGeoId = ($_SERVER[ 'HTTP_X_SERAPH_ACCEL_GEOID' ]??null);
    1632             if( !is_string( $ctxCache -> viewGeoId ) )
    1633             {
    1634                 $ip = Net::GetRequestIp();
    1635                 $ctxCache -> viewGeoId = GetViewGeoId( $settCache, $_SERVER, $ip );
    1636 
    1637                 $_SERVER[ 'HTTP_X_SERAPH_ACCEL_GEOID' ] = $ctxCache -> viewGeoId;
    1638                 $_SERVER[ 'HTTP_X_SERAPH_ACCEL_GEO_REMOTE_ADDR' ] = $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ 'HTTP_X_REAL_IP' ] = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] = $ip;
    1639             }
    1640             else if( isset( $_SERVER[ 'HTTP_X_SERAPH_ACCEL_GEO_REMOTE_ADDR' ] ) )
    1641                 $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ 'HTTP_X_REAL_IP' ] = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] = $_SERVER[ 'HTTP_X_SERAPH_ACCEL_GEO_REMOTE_ADDR' ];
    1642         }
    1643     }
    1644 
    1645     $ctxCache -> viewType = $type;
    1646 
    1647     if( strlen( $ctxCache -> viewGeoId ) )
    1648         $type .= '-' . $ctxCache -> viewGeoId;
    1649 
    1650     {
    1651         $serverArgsTmp = Gen::ArrCopy( $_SERVER ); CorrectRequestScheme( $serverArgsTmp, 'client' );
    1652         if( ($serverArgsTmp[ 'REQUEST_SCHEME' ]??null) == 'http' )
    1653         {
    1654             $type .= '-ns';
    1655             $ctxCache -> viewNonSecure = true;
    1656         }
    1657     }
    1658 
    1659     $ctxCache -> viewCompatId = ContProcIsCompatView( $settCache, $userAgent );
    1660     if( $ctxCache -> viewCompatId )
    1661     {
    1662         $type .= '-' . $ctxCache -> viewCompatId;
    1663 
    1664         if( ($settCache[ 'normAgent' ]??null) )
    1665             $_SERVER[ 'HTTP_USER_AGENT' ] = $_SERVER[ 'SERAPH_ACCEL_ORIG_USER_AGENT' ];
    1666     }
    1667 
    1668     if( strlen( $ctxCache -> viewStateId ) )
    1669     {
    1670         $ctxCache -> viewStateId = md5( $ctxCache -> viewStateId );
    1671         $type .= '-' . $ctxCache -> viewStateId;
    1672     }
    1673 
    1674     return( $type );
    1675 }
    1676 
  • seraphinite-accelerator/trunk/cache_ext.php

    r3430109 r3485735  
    397397                $data[ 'urls' ][] = Wp::GetSiteRootUrl( '', false );
    398398
    399                 if( is_multisite() && !is_subdomain_install() )
     399                if( Wp::IsMultisite() && !is_subdomain_install() )
    400400                {
    401401                    $endpoint_path = 'purge-fpc-sub-dir';
  • seraphinite-accelerator/trunk/cache_obj.php

    r3285902 r3485735  
    326326
    327327        \seraph_accel\Gen::MakeDir( @dirname( $file ), true );
    328         $res = \seraph_accel\_FileWriteTmpAndReplace( $file, $v[ 1 ], $data, null, $this -> lock );
     328        $res = \seraph_accel\Gen::FileWriteTmpAndReplace( $this -> lock, $file, $data, $v[ 1 ] );
    329329
    330330        if( $lr )
  • seraphinite-accelerator/trunk/common.php

    r3468084 r3485735  
    1313require_once( __DIR__ . '/Cmn/Plugin.php' );
    1414
    15 const PLUGIN_SETT_VER                               = 190;
     15const PLUGIN_SETT_VER                               = 191;
    1616const PLUGIN_DATA_VER                               = 1;
    1717const PLUGIN_EULA_VER                               = 1;
     
    12191219    }
    12201220
     1221    if( $verFrom && $verFrom < 191 )
     1222    {
     1223        Gen::SetArrField( $sett, array( 'cache', 'procEngn' ), 1 );
     1224    }
     1225
    12211226    return( $sett );
    12221227}
     
    13311336            'srv' => true,
    13321337            'srvClr' => true,
    1333             'srvUpd' => true,
     1338            'srvUpd' => false,
    13341339            'srvUpdTimeout' => 5,
    13351340            'nginx' => array(
     
    13501355            'lazyInv' => true,
    13511356            'lazyInvInitTmp' => true,
    1352             'lazyInvForcedTmp' => false,
     1357            'lazyInvForcedTmp' => true,
    13531358            'lazyInvTmp' => false,
    13541359            'fastTmpOpt' => true,
     
    13671372            'updPostMeta' => false,
    13681373            'updPostMetaExcl' => array(
     1374
    13691375                '@.*@',
    13701376                '@^\\d+$@',
     
    14421448            'procPauseInt' => 0.5,
    14431449
     1450            'procEngn' => 1,
     1451
    14441452            'autoProc' => true,
    14451453
     
    15361544
    15371545                array(
    1538                     'enable' => true,
     1546                    'enable' => false,
    15391547                    'name' => '',
    15401548                    'id' => 'mobile',
     
    26612669function GetSiteId( $site = null )
    26622670{
    2663     if( !is_multisite() )
     2671    if( !Wp::IsMultisite() )
    26642672        return( 'm' );
    26652673
     
    26792687{
    26802688    if( $siteId === 'm' )
    2681         return( Gen::Constant( 'BLOG_ID_CURRENT_SITE', 0 ) );
     2689        return( null );
    26822690
    26832691    $nPos = strpos( $siteId, '_' );
     
    29252933}
    29262934
    2927 function CacheCw( $settCache, $siteRootDataPath, $dataPath, $composite, $content, $type, $fileExt = null )
     2935function CacheCw( $cbWrite, $settCache, $siteRootDataPath, $dataPath, $composite, $content, $type, $fileExt = null )
    29282936{
    29292937    if( !$fileExt )
    29302938        $fileExt = $type;
    29312939
     2940    if( $type != 'html' )
     2941        $dataPath .= '/' . $type;
     2942
    29322943    $oiCi = @md5( $content ) . '.' . sprintf( '%x', strlen( $content ) );
    2933     $oiCif = CacheCgif( $settCache, $oiCi );
    2934 
     2944    $oiCfn = CacheCgif( $settCache, $oiCi ) . '.' . $fileExt;
     2945
     2946    if( !$cbWrite( $settCache, $dataPath, $composite, $content, $type, $oiCfn ) )
     2947        return( null );
     2948
     2949    if( $siteRootDataPath !== null )
     2950        $relFilePath = substr( $dataPath, strlen( $siteRootDataPath ) + 1 ) . '/';
     2951    else
     2952        $relFilePath = '';
     2953    $relFilePath .= $oiCfn;
     2954
     2955    return( array( 'id' => $oiCi, 'relFilePath' => $relFilePath ) );
     2956}
     2957
     2958function Images_ProcessSrc_ConvertAll_GetAssociatedFiles( $file, $a = array() )
     2959{
     2960    if( !in_array( Gen::GetFileExt( $file ), array( 'jpe','jpg','jpeg','png','gif','bmp', 'webp','avif' ) ) )
     2961        return( array() );
     2962
     2963    foreach( array( 'webp','avif' ) as $type )
     2964    {
     2965        $fileCnv = $file . '.' . $type;
     2966        $a[] = $fileCnv;
     2967
     2968        $fileCnvStat = $fileCnv . '.json';
     2969        $a[] = $fileCnvStat;
     2970    }
     2971
     2972    return( $a );
     2973}
     2974
     2975function CacheCts( $file, $mtime = null )
     2976{
     2977    if( $mtime === null )
     2978        $mtime = time();
     2979
     2980    foreach( Images_ProcessSrc_ConvertAll_GetAssociatedFiles( $file, array( $file ) ) as $file )
     2981        Gen::Touch( $file, $mtime );
     2982}
     2983
     2984function CacheCwEx( $settCache, $dataPath, $composite, $content, $type, $oiCfn )
     2985{
    29352986    $dataComprs = Gen::GetArrField( $settCache, array( 'dataCompr' ), array() );
    29362987    if( empty( $dataComprs ) )
    29372988        $dataComprs[] = '';
    29382989
    2939     if( $type != 'html' )
    2940     {
    2941         $dataPath .= '/' . $type;
    2942         if( !$composite )
    2943         {
    2944             if( ( $type != 'css' && $type != 'js' ) || !UseGzAssets( $settCache ) )
    2945                 $dataComprs = array( '' );
    2946             else if( !in_array( '', $dataComprs, true ) )
    2947                 $dataComprs[] = '';
    2948         }
     2990    if( $type != 'html' && !$composite )
     2991    {
     2992        if( ( $type != 'css' && $type != 'js' ) || !UseGzAssets( $settCache ) )
     2993            $dataComprs = array( '' );
     2994        else if( !in_array( '', $dataComprs, true ) )
     2995            $dataComprs[] = '';
    29492996    }
    29502997
    29512998    $writeOk = true;
    2952     $writeFailDsc = null;
    29532999
    29543000    foreach( $dataComprs as $dataCompr )
     
    29623008        }
    29633009
    2964         $oiCf = $dataPath . '/' . $oiCif . '.' . $fileExt . $dataFileExt;
     3010        $oiCf = $dataPath . '/' . $oiCfn . $dataFileExt;
    29653011
    29663012        $lock = new Lock( 'dtl', dirname( $dataPath ) );
     
    29743020        if( CacheCvs( Gen::FileSize( $oiCf ), strlen( $content ) ) )
    29753021        {
    2976             @touch( $oiCf );
     3022            CacheCts( $oiCf );
    29773023            $lock -> Release();
    29783024            continue;
     
    30353081            break;
    30363082        }
     3083        else
     3084            CacheCts( $oiCf );
    30373085
    30383086        $lock -> Release();
    30393087    }
    30403088
    3041     if( !$writeOk )
     3089    return( $writeOk );
     3090}
     3091
     3092function CacheCc( $cbCheck, $settCache, $siteRootDataPath, $dataPath, $oiCi, $type, $fileExt = null )
     3093{
     3094    if( !$fileExt )
     3095        $fileExt = $type;
     3096
     3097    $oiCif = CacheCgif( $settCache, $oiCi );
     3098
     3099    if( $type != 'html' )
     3100        $dataPath .= '/' . $type;
     3101
     3102    if( !$cbCheck( $dataPath, $type, $oiCif . '.' . $fileExt ) )
    30423103        return( null );
    30433104
     
    30513112}
    30523113
    3053 function CacheCc( $settCache, $siteRootDataPath, $dataPath, $oiCi, $type, $fileExt = null )
     3114function CacheCcEx( $dataPath, $type, $oiCfn )
     3115{
     3116    $oiCf = $dataPath . '/' . $oiCfn;
     3117
     3118    $lock = new Lock( 'dtl', dirname( $dataPath ) );
     3119    if( !$lock -> Acquire() )
     3120    {
     3121        Gen::LastErrDsc_Set( $lock -> GetErrDescr() );
     3122        return( null );
     3123    }
     3124
     3125    if( $readOk = @file_exists( $oiCf ) )
     3126        CacheCts( $oiCf );
     3127
     3128    $lock -> Release();
     3129
     3130    return( $readOk );
     3131}
     3132
     3133function _ContentCw( &$dsc, $data, $type, $settCache, $dataPath )
     3134{
     3135    if( !$data )
     3136        return( true );
     3137
     3138    $oiC = CacheCw( '\\seraph_accel\\CacheCwEx', $settCache, null, $dataPath, true, $data, $type );
     3139    if( !$oiC )
     3140        return( false );
     3141
     3142    $dsc[ 'p' ][] = $oiC[ 'id' ];
     3143    return( $oiC[ 'id' ] );
     3144}
     3145
     3146function ReadSceGf( &$dataPath, $settCache, $oiCi, $type, $fileExt = null )
    30543147{
    30553148    if( !$fileExt )
    30563149        $fileExt = $type;
    30573150
    3058     $oiCif = CacheCgif( $settCache, $oiCi );
    3059 
    30603151    if( $type != 'html' )
    30613152        $dataPath .= '/' . $type;
    30623153
    3063     $oiCf = $dataPath . '/' . $oiCif . '.' . $fileExt;
    3064 
    3065     $lock = new Lock( 'dtl', dirname( $dataPath ) );
    3066     if( !$lock -> Acquire() )
    3067     {
    3068         Gen::LastErrDsc_Set( $lock -> GetErrDescr() );
    3069         return( null );
    3070     }
    3071 
    3072     $readOk = @file_exists( $oiCf );
    3073 
    3074     $lock -> Release();
    3075 
    3076     if( !$readOk )
    3077         return( null );
    3078 
    3079     if( $siteRootDataPath !== null )
    3080         $relFilePath = substr( $dataPath, strlen( $siteRootDataPath ) + 1 ) . '/';
    3081     else
    3082         $relFilePath = '';
    3083     $relFilePath .= $oiCif . '.' . $fileExt;
    3084 
    3085     return( array( 'id' => $oiCi, 'relFilePath' => $relFilePath ) );
    3086 }
    3087 
    3088 function _ContentCw( &$dsc, $data, $type, $settCache, $dataPath )
    3089 {
    3090     if( !$data )
    3091         return( true );
    3092 
    3093     $oiC = CacheCw( $settCache, null, $dataPath, true, $data, $type );
    3094     if( !$oiC )
    3095         return( false );
    3096 
    3097     $dsc[ 'p' ][] = $oiC[ 'id' ];
    3098     return( $oiC[ 'id' ] );
    3099 }
    3100 
    3101 function ReadSce( $dataPath, $settCache, $id, $type )
     3154    return( CacheCgif( $settCache, $oiCi ) . '.' . $fileExt );
     3155}
     3156
     3157function ReadSce( $cbRead, $dataPath, $settCache, $oiCi, $type, $fileExt = null )
     3158{
     3159    $oiCfn = ReadSceGf( $dataPath, $settCache, $oiCi, $type, $fileExt );
     3160    return( $cbRead( $dataPath, $settCache, $type, $oiCi, $oiCfn ) );
     3161}
     3162
     3163function CacheCrEx( $dataPath, $settCache, $type, $oiCi, $oiCfn )
    31023164{
    31033165    $dataComprs = Gen::GetArrField( $settCache, array( 'dataCompr' ), array() );
     
    31133175    }
    31143176
    3115     $oiCf = _GetCcf( $settCache, $id, '', $dataPath, time(), $type, $dataComprs );
     3177    $oiCf = _GetCcf2( $oiCfn, '', $dataPath, time(), $dataComprs );
    31163178    if( !$oiCf )
    31173179        return( null );
    31183180
    31193181    $oiCd = _GetCfc( $oiCf );
    3120     if( $oiCd === false || !CacheCvs( strlen( $oiCd ), GetCacheCos( $id ) ) )
     3182    if( $oiCd === false || !CacheCvs( strlen( $oiCd ), GetCacheCos( $oiCi ) ) )
    31213183        return( null );
    31223184
     
    33613423function Tof_GetFileData( $dir, $id, $ver = null, $compressed = false, $oiCi = null )
    33623424{
     3425    return( Tof_GetFileDataCb( '\\seraph_accel\\Tof_GetFileDataEx', $dir, $id, $ver, $compressed, $oiCi ) );
     3426}
     3427
     3428function Tof_GetFileDataCb( $cbGet, $dir, $id, $ver = null, $compressed = false, $oiCi = null )
     3429{
    33633430    if( $oiCi !== null )
    33643431        $id = $oiCi . '.' . $id;
    33653432
    3366     $data = @file_get_contents( $dir . '/' . $id );
     3433    $data = $cbGet( $dir, $id );
    33673434    if( $compressed )
    33683435        $data = @gzdecode( $data );
     
    33873454}
    33883455
    3389 function Tof_SetFileData( $dir, $id, $data, $ver = null, $tmp = false, $compressed = false, &$oiCi = null )
    3390 {
    3391     $hr = Gen::MakeDir( $dir, true );
    3392     if( Gen::HrFail( $hr ) )
    3393         return( $hr );
    3394 
     3456function Tof_GetFileDataEx( $dir, $id )
     3457{
     3458    return( @file_get_contents( $dir . '/' . $id ) );
     3459}
     3460
     3461function Tof_SetFileData( $dir, $id, $data, $ver = null, $compressed = false, &$oiCi = null )
     3462{
     3463    return( Tof_SetFileDataCb( '\\seraph_accel\\Tof_SetFileDataEx', $dir, $id, $data, $ver, $compressed, $oiCi ) );
     3464}
     3465
     3466function Tof_SetFileDataCb( $cbSet, $dir, $id, $data, $ver = null, $compressed = false, &$oiCi = null )
     3467{
    33953468    if( $ver )
    33963469        $data[ 'v' ] = $ver;
    33973470
    33983471    $data = @serialize( $data );
     3472    $overwrite = true;
    33993473
    34003474    if( $oiCi !== null )
     
    34033477        $id = $oiCi . '.' . $id;
    34043478
    3405         if( @file_exists( $dir . '/' . $id ) )
    3406             return( Gen::S_FALSE );
    3407     }
    3408 
    3409     $fileTmp = tempnam( $dir, '' );
    3410     if( !$fileTmp )
    3411         return( Gen::E_FAIL );
     3479        $overwrite = false;
     3480    }
    34123481
    34133482    if( $compressed !== false )
    34143483        $data = @gzencode( $data, is_int( $compressed ) ? $compressed : -1 );
    34153484
    3416     if( @file_put_contents( $fileTmp, $data ) === false )
    3417     {
    3418         @unlink( $fileTmp );
    3419         return( Gen::E_FAIL );
    3420     }
    3421 
    3422     if( !@rename( $fileTmp, $tmp ? ( $fileTmp . '.' . $id ) : ( $dir . '/' . $id ) ) )
    3423     {
    3424         @unlink( $fileTmp );
    3425         return( Gen::E_FAIL );
    3426     }
    3427 
    3428     return( Gen::S_OK );
     3485    return( $cbSet( $dir, $id, $data, $overwrite ) );
     3486}
     3487
     3488function Tof_SetFileDataEx( $dir, $id, $data, $overwrite = true )
     3489{
     3490    $r = Gen::FileWriteTmpAndReplace( null, $dir . '/' . $id, $data, null, false, $overwrite, true );
     3491    return( $r === null ? Gen::S_FALSE : ( $r ? Gen::S_OK : Gen::E_FAIL ) );
    34293492}
    34303493
     
    41704233function GetViewTypeUserAgent( $viewsDeviceGrp )
    41714234{
    4172     return( 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.15 ' . ucwords( implode( ' ', Gen::GetArrField( $viewsDeviceGrp, array( 'agents' ), array() ) ) ) );
     4235    return( 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.16 ' . ucwords( implode( ' ', Gen::GetArrField( $viewsDeviceGrp, array( 'agents' ), array() ) ) ) );
    41734236}
    41744237
     
    42754338            CachePostPreparePageEx( null, Gen::GetArrField( $data, array( 'u' ), '' ), Gen::GetArrField( $data, array( 's' ), '' ), Gen::GetArrField( $data, array( 'p' ), 10 ), null, Gen::GetArrField( $data, array( 'h' ), array() ), Gen::GetArrField( $data, array( 't' ), 0.0 ) );
    42764339    }
     4340
     4341    $pushQueueImmediately = null;
     4342    $bDebug = Gen::GetArrField( $settGlobal, array( 'debug' ), false );
     4343
     4344    $aRestartItem = array();
    42774345
    42784346    $aCurItemsPrior = array();
     
    43044372                    else if( Gen::GetArrField( $ctlRes, array( 'stage' ), '' ) )
    43054373                    {
    4306                         if( !Gen::GetArrField( $ctlRes, array( 'finish' ) ) && !$isLive )
     4374                        if( !Gen::GetArrField( $ctlRes, array( 'finish' ) ) && !Gen::GetArrField( $ctlRes, array( 'remote' ) ) && !$isLive )
    43074375                            $hrItemForce = Gen::E_INVALID_STATE;
    43084376                    }
    43094377                    else if( ( int )($item[ 'tp' ]??0) == 0 && $asyncMode != 'ec' && ($settGlobal[ 'asyncSmpOpt' ]??null) )
    4310                         _CacheProcessItem_RunSmpOpt( $asyncMode );
     4378                        _CacheProcessItem_RunSmpOpt( $asyncMode, ($data[ 'u' ]??null) );
    43114379                }
    43124380            }
    43134381            else
     4382            {
    43144383                $hrItemForce = Gen::E_TIMEOUT;
     4384                if( Gen::GetArrField( ProcessCtlData_Get( $fileCtl ), array( 'remote' ) ) )
     4385                    $hrItemForce = Gen::S_TIMEOUT;
     4386            }
    43154387
    43164388            if( $hrItemForce == Gen::S_OK )
     
    43234395
    43244396            if( $fileCtl )
    4325                 ProcessCtlData_Del( $fileCtl );
     4397                ProcessCtlData_DelSmart( $fileCtl, true );
     4398
     4399            if( $hrItemForce != Gen::S_ABORTED )
     4400            {
     4401                if( Gen::HrFail( $hrItemForce ) )
     4402                {
     4403                    if( ($data[ 'rdr' ]??0) < 10 )
     4404                    {
     4405                        $data[ 'rpt' ] = true;
     4406                        if( !isset( $data[ 'rdr' ] ) )
     4407                            $data[ 'rdr' ] = 0;
     4408                    }
     4409                }
     4410                else
     4411                {
     4412                    if( ($data[ 'rdr' ]??0) < 100 )
     4413                    {
     4414                        $data[ 'rpt' ] = true;
     4415                        if( !isset( $data[ 'rdr' ] ) )
     4416                            $data[ 'rdr' ] = 0;
     4417                    }
     4418                }
     4419            }
    43264420
    43274421            $data[ 'td' ] = $tmDur;
     
    43314425            $item[ 'p' ] = -1000;
    43324426            $item[ 't' ] = $tmCur;
     4427
    43334428            unset( $aProgress[ $id ] );
    43344429            $aDone[ $id ] = $item;
     
    43364431
    43374432        {
    4338             $n = $aDone -> count();
    4339 
    4340             if( Gen::GetArrField( $settGlobal, array( 'debug' ), false ) )
     4433            $aDoneNew = array();
     4434            $nDone = 0;
     4435            $nDoneErr = 0;
     4436            $iconClr = null;
     4437
     4438            for( $aDone -> end(); $aDone -> valid(); $aDone -> prev() )
    43414439            {
    4342                 if( $n > 2 * 10 )
     4440                $id = $aDone -> key();
     4441                $item = $aDone -> current();
     4442                $data = Gen::GetArrField( Gen::Unserialize( ($item[ 'd' ]??null) ), array( '' ), array() );
     4443
     4444                if( $bDebug )
    43434445                {
    4344                     $aDoneNew = array();
    4345                     $nDone = 0;
    4346                     $nDoneErr = 0;
    4347 
    4348                     for( $aDone -> end(); $aDone -> valid(); $aDone -> prev() )
     4446                    list( $iconClr, $state, $stateDsc, $duration ) = GetQueueItem_Done_Attrs( $data );
     4447                    unset( $state, $stateDsc, $duration );
     4448                }
     4449
     4450                $bKeepInDone = false;
     4451                $bRepeat = false;
     4452                if( $iconClr == 'error' )
     4453                {
     4454                    if( $nDoneErr < 10 )
    43494455                    {
    4350                         $item = $aDone -> current();
    4351 
    4352                         $data = Gen::GetArrField( Gen::Unserialize( ($item[ 'd' ]??null) ), array( '' ), array() );
    4353                         list( $iconClr, $state, $stateDsc, $duration ) = GetQueueItem_Done_Attrs( $data );
    4354                         unset( $state, $stateDsc, $duration );
    4355 
    4356                         $bPut = false;
    4357                         if( $iconClr == 'error' )
    4358                         {
    4359                             if( $nDoneErr < 10 )
    4360                             {
    4361                                 $bPut = true;
    4362                                 $nDoneErr++;
    4363                             }
    4364                         }
    4365                         else
    4366                         {
    4367                             if( $nDone < 10 )
    4368                             {
    4369                                 $bPut = true;
    4370                                 $nDone++;
    4371                             }
    4372                         }
    4373 
    4374                         if( $bPut )
    4375                             Gen::ArrSplice( $aDoneNew, 0, 0, array( $aDone -> key() => $item ) );
    4376 
    4377                         if( $nDone == 10 && $nDoneErr == 10 )
    4378                             break;
     4456                        $bKeepInDone = true;
     4457                        $nDoneErr++;
    43794458                    }
    4380 
    4381                     $aDone -> clear();
    4382                     $aDone -> setItems( $aDoneNew );
    43834459                }
     4460                else
     4461                {
     4462                    if( $nDone < 10 )
     4463                    {
     4464                        $bKeepInDone = true;
     4465                        $nDone++;
     4466                    }
     4467                }
     4468
     4469                if( ( $repeatVal = ($data[ 'rpt' ]??null) ) )
     4470                {
     4471                    $bKeepInDone = true;
     4472
     4473                    if( $repeatVal === true )
     4474                        $bRepeat = true;
     4475                    else if( ( $tmCur - $repeatVal ) > ($settCacheGlobal[ 'procIntervalShort' ]??0) )
     4476                        $bRepeat = true;
     4477                    else
     4478                        $pushQueueImmediately = false;
     4479
     4480                    if( $bRepeat )
     4481                        $data[ 'rpt' ] = false;
     4482                }
     4483
     4484                $item[ 'd' ] = Gen::Serialize( $data );
     4485
     4486                if( $bKeepInDone )
     4487                    Gen::ArrSplice( $aDoneNew, 0, 0, array( $id => $item ) );
     4488
     4489                if( $bRepeat )
     4490                {
     4491                    $item[ 's' ] = $siteId;
     4492                    $aRestartItem[ $id ] = $item;
     4493                }
     4494
    43844495            }
    4385             else
    4386             {
    4387                 if( $n > 10 )
    4388                     $aDone -> splice( 0, $n - 10 );
    4389             }
     4496
     4497            $aDone -> clear();
     4498            $aDone -> setItems( $aDoneNew );
     4499
     4500            unset( $aDoneNew, $id, $item, $data );
    43904501        }
    43914502
     
    43934504        unset( $aDone, $aProgress, $lock );
    43944505    }
     4506
     4507    if( $aRestartItem )
     4508    {
     4509        foreach( $aRestartItem as $item )
     4510        {
     4511            $data = Gen::GetArrField( Gen::Unserialize( ($item[ 'd' ]??null) ), array( '' ), array() );
     4512            $itemType = ( int )($item[ 'tp' ]??0);
     4513            if( $itemType == 0 )
     4514                CachePostPreparePageEx( ($data[ 'm' ]??null), ($data[ 'u' ]??null), ($item[ 's' ]??null), isset( $data[ 'l' ] ) ? -480 : ( int )($data[ 'p' ]??null), ($data[ 'p' ]??null), ($data[ 'h' ]??null), $data[ 'to' ], isset( $data[ 'rdr' ] ) ? ( $data[ 'rdr' ] + 1 ) : null, ($data[ 'l' ]??null) );
     4515            else
     4516                CachePostPrepareObjEx( $itemType, ($data[ 'u' ]??null), ($item[ 's' ]??null), ( int )($data[ 'p' ]??null), $data, ( int )($data[ 'p' ]??null), ( float )($item[ 't' ]??null) );
     4517        }
     4518        unset( $item, $data, $itemType );
     4519
     4520        $pushQueueImmediately = true;
     4521    }
     4522
     4523    if( $pushQueueImmediately !== null )
     4524        CachePushQueueProcessor( true, $pushQueueImmediately, !$pushQueueImmediately );
    43954525
    43964526    if( !$nMaxItems )
     
    45864716}
    45874717
     4718function ProcessCtlData_DelSmart( $fileCtl, $bClnDsc = null )
     4719{
     4720    if( $bClnDsc !== false && ( $ctlRes = ProcessCtlData_Get( $fileCtl ) ) )
     4721    {
     4722
     4723        if( $bClnDsc === null && Gen::GetArrField( $ctlRes, array( 'remote' ) ) )
     4724        {
     4725            $bClnDsc = true;
     4726            if( $urlRemoteAbort = Gen::GetArrField( $ctlRes, array( 'remote', 'urlAbort' ) ) )
     4727                Wp::RemotePost( $urlRemoteAbort, array( 'timeout' => 2, 'sslverify' => false ) );
     4728        }
     4729
     4730        if( $bClnDsc && ( $dscFile = Gen::GetArrField( $ctlRes, array( 'dscFile' ) ) ) )
     4731        {
     4732            $lock = new DscLockUpdater();
     4733            $lock -> Acquire();
     4734
     4735            @unlink( $dscFile . '.pp' );
     4736            @unlink( $dscFile . '.p' );
     4737
     4738            $lock -> Release();
     4739        }
     4740    }
     4741
     4742    ProcessCtlData_Del( $fileCtl );
     4743}
     4744
    45884745function ProcessCtlData_Get( $fileCtl, &$isLive = null )
    45894746{
     
    46524809        $dataPrev = @unserialize( $dataPrev );
    46534810
    4654     $res = @file_put_contents( $fileCtl . '.dat', @serialize( array_merge( $dataPrev, $data ) ) ) !== false;
     4811    $res = Gen::FileWriteTmpAndReplace( $lock, $fileCtl . '.dat', @serialize( array_merge( $dataPrev, $data ) ) ) !== false;
    46554812    $lock -> Release();
    46564813
     
    46694826    public $procTmLim = 60 * 60 * 24;
    46704827
    4671     public $needRepeatPage = false;
    46724828    public $needLrn = false;
    4673     public $repeatIdx = null;
     4829
    46744830    public $skipStatus = null;
    46754831    public $warns = null;
     
    47324888            $prepArgs[ 'lrn' ] = ($this -> data[ 'l' ]??null);
    47334889
    4734         $this -> method = ( string )($this -> data[ 'm' ]??'GET');
    4735 
    4736         $this -> url = ProcessQueueItemCtx::AdjustRequestUrl( ($this -> data[ 'u' ]??null), $this -> item[ 't' ], $prepArgs );
    4737 
    4738         $this -> hdrs = ($this -> data[ 'h' ]??null);
    4739         if( !is_array( $this -> hdrs ) )
    4740             $this -> hdrs = array();
    4741 
    4742         $this -> hdrsForRequest = $this -> hdrs;
    4743         Net::GetUrlWithoutProtoEx( $this -> url, $proto );
    4744         if( strtolower( $proto ) == 'https' )
    4745         {
    4746             Net::RemoveHeader( $this -> hdrsForRequest, 'Upgrade-Insecure-Requests' );
    4747             Net::RemoveHeader( $this -> hdrsForRequest, 'Ssl' );
    4748 
    4749         }
    4750 
    4751         Net::RemoveHeader( $this -> hdrsForRequest, 'Accept-Encoding' );
    4752         Net::RemoveHeader( $this -> hdrsForRequest, 'Cloud-Protector-Client-Ip' );
    4753 
    4754         unset( $proto );
    4755 
     4890        if( ($this -> item[ 'tp' ]??0) == 0 )
     4891        {
     4892            $this -> method = ( string )($this -> data[ 'm' ]??'GET');
     4893
     4894            $this -> url = ProcessQueueItemCtx::AdjustRequestUrl( ($this -> data[ 'u' ]??null), $this -> item[ 't' ], $prepArgs );
     4895
     4896            $this -> hdrs = ($this -> data[ 'h' ]??null);
     4897            if( !is_array( $this -> hdrs ) )
     4898                $this -> hdrs = array();
     4899
     4900            $this -> hdrsForRequest = $this -> hdrs;
     4901            Net::GetUrlWithoutProtoEx( $this -> url, $proto );
     4902            if( strtolower( $proto ) == 'https' )
     4903            {
     4904                Net::RemoveHeader( $this -> hdrsForRequest, 'Upgrade-Insecure-Requests' );
     4905                Net::RemoveHeader( $this -> hdrsForRequest, 'Ssl' );
     4906
     4907            }
     4908
     4909            Net::RemoveHeader( $this -> hdrsForRequest, 'Accept-Encoding' );
     4910            Net::RemoveHeader( $this -> hdrsForRequest, 'Cloud-Protector-Client-Ip' );
     4911
     4912            unset( $proto );
     4913
     4914        }
     4915
     4916        ProcessCtlData_Update( $this -> fileCtl, array( 'queue' => array( 'id' => $this -> id, 'siteId' => $this -> siteId, 'hdrsForRequest' => $this -> hdrsForRequest ) ), true );
    47564917    }
    47574918
     
    48044965                }
    48054966
     4967                if( Gen::GetArrField( $ctlRes, array( 'remote' ) ) )
     4968                    return( false );
     4969
    48064970                if( !$isLive )
    48074971                {
     
    48214985            {
    48224986                $this -> hr = Gen::S_ABORTED;
     4987                $this -> httpCode = null;
    48234988                $this -> requestRes = null;
    48244989            }
    48254990            else if( $this -> httpCode && $this -> httpCode != 500 )
    48264991            {
    4827                 if( $this -> httpCode == 524 || $this -> httpCode == 522 || $this -> httpCode == 504 || $this -> httpCode == 503 )
    4828                     if( ( $this -> repeatIdx = ($this -> data[ 'rdr' ]??0) ) <= 3 )
    4829                         $this -> needRepeatPage = true;
     4992                if( ( $this -> httpCode == 524 || $this -> httpCode == 522 || $this -> httpCode == 504 || $this -> httpCode == 503 ) && ($this -> data[ 'rdr' ]??0) < 4 )
     4993                {
     4994                    $this -> data[ 'rpt' ] = true;
     4995                    if( !isset( $this -> data[ 'rdr' ] ) )
     4996                        $this -> data[ 'rdr' ] = 0;
     4997                    $this -> immediatelyPushQueue = true;
     4998
     4999                }
     5000
    48305001                $this -> hr = Gen::HrSuccFromFail( $this -> hr );
    48315002            }
     
    48495020
    48505021            if( ( int )($this -> item[ 'p' ]??null) !== 10 )
    4851                 if( ( $redirIdx = ($this -> data[ 'rdr' ]??0) ) <= 4 )
     5022                if( ( $redirIdx = ($this -> data[ 'rdr' ]??0) ) < 5 )
    48525023                    if( CachePostPreparePageEx( ($this -> data[ 'm' ]??null), $this -> urlRedir, $this -> siteId, ( int )($this -> item[ 'p' ]??null), ($this -> data[ 'p' ]??null), $this -> hdrs, $this -> data[ 'to' ], $redirIdx + 1, ($this -> data[ 'l' ]??null) ) )
    48535024                        $this -> immediatelyPushQueue = true;
    48545025        }
     5026
     5027        return( true );
    48555028    }
    48565029
     
    48715044
    48725045            if( $this -> skipStatus == 'alreadyProcessing' || $this -> skipStatus == 'lrnNeed' )
    4873                 $this -> needRepeatPage = true;
     5046            {
     5047                $this -> data[ 'rpt' ] = true;
     5048                $this -> immediatelyPushQueue = true;
     5049
     5050            }
     5051            else if( Gen::StrStartsWith( $this -> skipStatus, 'engineRemote' ) && !( $this -> skipStatus == 'engineRemoteMgrAccessDenied' || $this -> skipStatus == 'engineRemoteAccessDenied' || $this -> skipStatus == 'engineRemoteNoLicense' ) )
     5052            {
     5053                if( ($this -> data[ 'rdr' ]??0) < 1000000 )
     5054                {
     5055                    $this -> data[ 'rpt' ] = $this -> tmFinish;
     5056                    if( !isset( $this -> data[ 'rdr' ] ) )
     5057                        $this -> data[ 'rdr' ] = 0;
     5058                    $this -> immediatelyPushQueue = true;
     5059                }
     5060            }
    48745061            else if( Gen::StrStartsWith( $this -> skipStatus, 'lrnNeed:' ) )
    48755062                $this -> needLrn = substr( $this -> skipStatus, 8 );
     
    49345121                    if( $dataExtUpdated )
    49355122                    {
    4936                         if( $dataExtUpdated = Gen::GetArrField( Gen::Unserialize( ($dataExtUpdated[ 'd' ]??null) ), array( '' ), array() ) )
    4937                             if( ($dataExtUpdated[ 'rpt' ]??null) )
    4938                                 $this -> needRepeatPage = true;
    4939 
    4940                         unset( $dataExtUpdated );
     5123                        if( $dataExtUpdated = Gen::GetArrField( Gen::Unserialize( ($dataExtUpdated[ 'd' ]??null) ), array( '' ), array() ) )
     5124                            if( $repeatVal = ($dataExtUpdated[ 'rpt' ]??null) )
     5125                            {
     5126                                $this -> data[ 'rpt' ] = $repeatVal;
     5127                                $this -> immediatelyPushQueue = true;
     5128
     5129                            }
     5130
     5131                        unset( $dataExtUpdated );
    49415132                    }
    49425133                }
     
    49585149        PluginFileValues::SetEx( PluginFileValues::GetDirVar( '' ), 'pelt', ( int )$this -> tmFinish );
    49595150
    4960         if( $this -> needRepeatPage && CachePostPreparePageEx( ($this -> data[ 'm' ]??null), ($this -> data[ 'u' ]??null), $this -> siteId, $priorOrig, ($this -> data[ 'p' ]??null), $this -> hdrs, $this -> data[ 'to' ], $this -> repeatIdx !== null ? ( $this -> repeatIdx + 1 ) : null, ($this -> data[ 'l' ]??null) ) )
    4961             $this -> immediatelyPushQueue = true;
    4962 
    49635151        CachePushQueueProcessor( true, $this -> immediatelyPushQueue, $this -> hr != Gen::S_OK && Gen::HrSucc( $this -> hr ) );
    49645152
     
    49745162}
    49755163
    4976 function _CacheProcessItem_RunSmpOpt( $asyncMode )
    4977 {
     5164function _CacheProcessItem_RunSmpOpt( $asyncMode, $url )
     5165{
     5166
     5167    $fileIdx = OnAsyncTasksGetPushUrlFile( true );
     5168    if( isset( $_SERVER[ 'PHP_SELF' ] ) && ( $uriPath = Gen::GetArrField( Net::UrlParse( $url ), 'path' ) ) && $uriPath != '/' )
     5169    {
     5170        $uriPath = substr( $uriPath, strlen( Gen::GetFileDir( $_SERVER[ 'REQUEST_URI' ] ) ) );
     5171        if( @file_exists( Gen::GetFileDir( $_SERVER[ 'SCRIPT_FILENAME' ] ) . $uriPath . '/' . $fileIdx ) )
     5172            $fileIdx = $uriPath . '/' . $fileIdx;
     5173    }
    49785174
    49795175    $tmStamp = microtime( true );
    4980     return( ProcessQueueItemCtx::MakeRequest( $asyncMode, 'GET', Net::UrlAddArgs( Plugin::AsyncTaskPushGetUrlEx( Wp::GetSiteWpRootUrl( OnAsyncTasksGetPushUrlFile( true ) ), 'O', $tmStamp ), array( 'nonce' => hash_hmac( 'md5', Plugin::AsyncTaskPushGetTimerun( $tmStamp ), GetSalt() ) ) ), array(  ) ) );
     5176    return( ProcessQueueItemCtx::MakeRequest( $asyncMode, 'GET', Net::UrlAddArgs( Plugin::AsyncTaskPushGetUrlEx( Wp::GetSiteWpRootUrl( $fileIdx ), 'O', $tmStamp ), array( 'nonce' => hash_hmac( 'md5', Plugin::AsyncTaskPushGetTimerun( $tmStamp ), GetSalt() ) ) ), array(  ) ) );
    49815177}
    49825178
     
    50915287
    50925288        }
    5093 
    5094         $ctx -> WaitForEndRequest();
    50955289    }
    50965290    else
    50975291    {
     5292        $ctx -> PrepareRequest();
     5293
    50985294        global $seraph_accel_g_prepPrms;
    50995295
    51005296        $seraph_accel_g_prepPrms = array( 'pc' => $ctx -> fileCtl, 'p' => ( int )($ctx -> item[ 'p' ]??null) );
    51015297        $sett = Plugin::SettGet();
    5102 
    51035298        $ctxProcess = &GetContentProcessCtx( $_SERVER, $sett );
    5104 
    5105         if( $itemType == 10 )
    5106         {
    5107             ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'stage' => 'images' ) );
    5108 
    5109             $file = ($ctx -> data[ 'u' ]??null);
    5110             Images_ProcessSrc_ConvertAll( $ctxProcess, Gen::GetArrField( $sett, array( 'contPr', 'img' ), array() ), null, $file, Images_ProcessSrcEx_FileMTime( $file ), false );
    5111         }
    5112         else if( $itemType == 20 )
    5113         {
    5114             ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'stage' => 'images' ) );
    5115 
    5116             $file = ($ctx -> data[ 'u' ]??null);
    5117             Images_ProcessSrc_SizeAlternatives( $ctxProcess, $file, $sett, ($ctx -> data[ 'ai' ]??null) );
    5118         }
     5299        $skipStatus = '';
     5300
     5301        ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array( 'stage' => 'get' ) );
     5302
     5303            $skipStatus = ContentProcess_ItemType( $itemType, $ctx -> data, $ctxProcess, $sett );
     5304
     5305        ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), array_merge( array( 'finish' => true, 'skip' => $skipStatus, 'warns' => LastWarnDscs_Get() ), ($sett[ 'debugInfo' ]??null) ? array( 'infos' => array( LocId::Pack( 'ProcStat' ) => PackKvArrInfo( ($ctxProcess[ 'stat' ]??null) ) ) ) : array() ) );
    51195306
    51205307        unset( $ctxProcess );
    5121 
    5122         if( Gen::LastErrDsc_Is() )
    5123         {
    5124             $ctx -> hr = Gen::E_FAIL;
    5125             $ctx -> skipStatus = 'err:' . rawurlencode( Gen::LastErrDsc_Get() );
    5126         }
    5127 
    5128         $ctx -> warns = LastWarnDscs_Get();
    5129 
    51305308        unset( $seraph_accel_g_prepPrms );
    5131 
    5132         $ctx -> tmFinish = microtime( true );
    5133     }
    5134 
    5135     $ctx -> Finish();
     5309    }
     5310
     5311    if( $ctx -> WaitForEndRequest() )
     5312        $ctx -> Finish();
    51365313}
    51375314
     
    52355412}
    52365413
    5237 function _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $data = null )
     5414function _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $repeatVal = null, $data = null )
    52385415{
    52395416    $item = $aProgress[ $id ];
     
    52465423        return;
    52475424
    5248     ProcessCtlData_Del( $fileCtl );
     5425    ProcessCtlData_DelSmart( $fileCtl );
    52495426
    52505427    if( $data )
    52515428        $itemInProgressData = array_merge( $data, $itemInProgressData );
    5252     $itemInProgressData[ 'rpt' ] = true;
     5429    if( $repeatVal )
     5430        $itemInProgressData[ 'rpt' ] = $repeatVal;
    52535431
    52545432    $item[ 'd' ] = Gen::Serialize( $itemInProgressData );
     
    52565434}
    52575435
    5258 function CachePostPreparePageEx( $method , $url, $siteId, $priority, $priorityInitiator, $headers = null, $time = null, $redirIdx = null, $lrnId = null )
     5436function CachePostPreparePageEx( $method , $url, $siteId, $priority, $priorityInitiator, $headers = null, $time = null, $retryIdx = null, $lrnId = null )
    52595437{
    52605438
     
    53205498    if( $method && $method != 'GET' )
    53215499        $data[ 'm' ] = $method;
    5322     if( $redirIdx )
    5323         $data[ 'rdr' ] = $redirIdx;
     5500    if( $retryIdx )
     5501        $data[ 'rdr' ] = $retryIdx;
    53245502    if( $lrnId )
    53255503        $data[ 'l' ] = $lrnId;
     
    53485526        if( $priority !== 10 )
    53495527        {
    5350             _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $data );
     5528            _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, true, $data );
    53515529            if( $id != $idLearn )
    53525530                _CachePostPreparePageEx_StopAndRepeat( $aProgress, $idLearn );
     
    54345612}
    54355613
    5436 function GetExtContents( &$ctxProcess, $url, &$contMimeType = null, $userAgentCmn = true, $timeout = 30, $rememberServerState = true )
    5437 {
    5438     $extCacheId = null;
    5439     if( $ctxProcess !== null )
    5440     {
    5441         $extCacheId = md5( $url );
    5442         $file = null;
    5443         $cont = null;
    5444 
    5445         $lock = new Lock( Gen::GetFileDir( $ctxProcess[ 'dataPath' ] ) . '/eo/l', false );
    5446         if( $lock -> Acquire() )
    5447         {
    5448             foreach( glob( Gen::GetFileDir( $lock -> GetFileName() ) . '/' . $extCacheId . '.*', GLOB_NOSORT ) as $file )
     5614function ExtContents_Local_GetIdxPrms( $dir )
     5615{
     5616    return( array( 'dirFilesPattern' => $dir . '/i/*.dat.gz' ) );
     5617}
     5618
     5619function ExtContents_Local_CacheGet( $siteCacheDir, $extCacheId )
     5620{
     5621    $file = null;
     5622    $cont = null;
     5623
     5624    $cacheDirExtObj = $siteCacheDir . '/eo';
     5625
     5626    $lock = new Lock( $cacheDirExtObj . '/l', false );
     5627    if( $lock -> Acquire() )
     5628    {
     5629        $aIdx = new ArrayOnFiles( ExtContents_Local_GetIdxPrms( $cacheDirExtObj ) );
     5630
     5631        $contId = $aIdx[ $extCacheId ];
     5632
     5633        if( is_string( $contId ) )
     5634        {
     5635            foreach( glob( $cacheDirExtObj . '/' . bin2hex( $contId ) . '.*', GLOB_NOSORT ) as $file )
    54495636                break;
    54505637
     
    54525639            {
    54535640                if( $tmFile > time() )
     5641                {
    54545642                    $cont = @file_get_contents( $file );
     5643                    $file = Gen::GetFileName( $file );
     5644                }
    54555645                else
     5646                {
    54565647                    @unlink( $file );
     5648                    $file = null;
     5649
     5650                    unset( $aIdx[ $extCacheId ] );
     5651                }
    54575652            }
    5458 
    5459             $lock -> Release();
    5460         }
     5653            else
     5654                unset( $aIdx[ $extCacheId ] );
     5655        }
     5656
     5657        $aIdx -> dispose();
     5658        unset( $aIdx );
     5659
     5660        $lock -> Release();
     5661    }
     5662
     5663    return( array( $file, $cont ) );
     5664}
     5665
     5666function ExtContents_Local_CacheSet( $siteCacheDir, $extCacheId, $fileType, $contCacheTtl, $contId, $contCache )
     5667{
     5668    $cacheDirExtObj = $siteCacheDir . '/eo';
     5669
     5670    $lock = new Lock( $cacheDirExtObj . '/l', false );
     5671
     5672    Gen::FileWriteTmpAndReplace( $lock, Gen::GetFileDir( $lock -> GetFileName() ) . '/' . bin2hex( $contId ) . '.' . $fileType, $contCache, time() + $contCacheTtl );
     5673
     5674    if( $lock -> Acquire() )
     5675    {
     5676        $aIdx = new ArrayOnFiles( ExtContents_Local_GetIdxPrms( $cacheDirExtObj ) );
     5677
     5678        $aIdx[ $extCacheId ] = $contId;
     5679
     5680        $aIdx -> dispose();
     5681        unset( $aIdx );
     5682
     5683        $lock -> Release();
     5684    }
     5685}
     5686
     5687function ExtContents_Local_CacheClean( $siteCacheDir, $tm, $tmCur, $cbIsAborted )
     5688{
     5689    $lock = new Lock( $siteCacheDir . '/eo/l', false );
     5690
     5691    $ctx = new AnyObj();
     5692    $ctx -> tm = $tm;
     5693    $ctx -> tmCur = $tmCur;
     5694    $ctx -> cbIsAborted = $cbIsAborted;
     5695
     5696    $bAborted = false;
     5697
     5698    if( Gen::DirEnum( $siteCacheDir . '/eo', $ctx,
     5699        function( $path, $item, &$ctx )
     5700        {
     5701            if( @call_user_func( $ctx -> cbIsAborted ) )
     5702                return( false );
     5703
     5704            $path = $path . '/' . $item;
     5705            if( @is_dir( $path ) || !Gen::GetFileExt( $item ) )
     5706                return;
     5707
     5708            $tmFile = @filectime( $path );
     5709            if( $tmFile !== false )
     5710            {
     5711                if( $tmFile < $ctx -> tm )
     5712                    @unlink( $path );
     5713                else if( ( $tmFile = @filemtime( $path ) ) !== false && $tmFile < $ctx -> tmCur )
     5714                    @unlink( $path );
     5715            }
     5716        }
     5717    , true ) === false )
     5718    {
     5719        $bAborted = true;
     5720    }
     5721
     5722    return( !$bAborted );
     5723}
     5724
     5725function GetExtContents( &$ctxProcess, $url, &$contMimeType = null, $userAgentCmn = true, $timeout = 30, $rememberServerState = true )
     5726{
     5727    global $seraph_accel_g_aGetExtContentsFailedSrvs;
     5728    global $seraph_accel_g_getExtContentsNetTransport;
     5729
     5730    $extCacheId = null;
     5731    if( $ctxProcess !== null )
     5732    {
     5733        $extCacheId = md5( $url, true );
     5734        list( $file, $cont ) = $ctxProcess[ 'cbs' ] -> ExtContents_CacheGet( $extCacheId );
    54615735
    54625736        if( is_string( $cont ) && Gen::GetFileExt( $file ) == 'gz' && is_string( $cont = @gzdecode( $cont ) ) )
     
    54745748    $args = array( 'sslverify' => false, 'timeout' => $timeout, 'headers' => array() );
    54755749    if( $userAgentCmn )
    5476         $args[ 'headers' ][ 'User-Agent' ] = 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.15';
    5477 
    5478     global $seraph_accel_g_aGetExtContentsFailedSrvs;
     5750        $args[ 'headers' ][ 'User-Agent' ] = 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.16';
    54795751
    54805752    if( $serverId = Net::UrlParse( $url ) )
     
    54885760    if( $rememberServerState && $serverId && Gen::HrFail( ($seraph_accel_g_aGetExtContentsFailedSrvs[ $serverId ]??null) ) )
    54895761        return( false );
     5762
     5763    if( $seraph_accel_g_getExtContentsNetTransport === null )
     5764    {
     5765        $seraph_accel_g_getExtContentsNetTransport = Wp::GetRemoteTransport();
     5766        if( !$seraph_accel_g_getExtContentsNetTransport )
     5767            $seraph_accel_g_getExtContentsNetTransport = false;
     5768    }
     5769
     5770    if( $seraph_accel_g_getExtContentsNetTransport )
     5771    {
     5772        $args[ 'transport' ] = $seraph_accel_g_getExtContentsNetTransport;
     5773
     5774        $args[ 'headers' ][ 'Connection' ] = 'keep-alive';
     5775        $args[ 'headers' ][ 'Keep-Alive' ] = 'timeout=570, max=1000';
     5776    }
    54905777
    54915778    $res = Wp::RemoteGet( $url, $args );
     
    55415828            }
    55425829
    5543             _FileWriteTmpAndReplace( Gen::GetFileDir( $lock -> GetFileName() ) . '/' . $extCacheId . '.' . $fileType, time() + $contCacheTtl, $contCache, null, $lock );
     5830            $ctxProcess[ 'cbs' ] -> ExtContents_CacheSet( $extCacheId, $fileType, $contCacheTtl, md5( $cont, true ), $contCache );
    55445831            unset( $contCache );
    55455832        }
     
    55475834
    55485835    return( $cont );
    5549 }
    5550 
    5551 function Images_ProcessSrcEx_FileMTime( $file )
    5552 {
    5553     return( Gen::FileSize( $file ) ? @filemtime( $file ) : false );
    55545836}
    55555837
     
    56965978}
    56975979
    5698 function _FileWriteTmpAndReplace( $file, $fileTime = null, $data = null, $fileTmp = null, $lock = null )
    5699 {
    5700 
    5701     if( $fileTmp === null )
    5702         $fileTmp = $file . '.tmp';
    5703 
    5704     if( !$lock )
    5705         $lock = new Lock( $fileTmp . '.l', false, true );
    5706 
    5707     if( ( $lr = $lock -> Acquire() ) !== false )
    5708     {
    5709         if( $data === null || @file_put_contents( $fileTmp, $data ) )
    5710         {
    5711             if( $fileTime === null || @touch( $fileTmp, $fileTime ) )
    5712             {
    5713                 if( @file_exists( $file ) )
    5714                     @unlink( $file );
    5715 
    5716                 if( @rename( $fileTmp, $file ) )
    5717                 {
    5718                     $lock -> Release();
    5719                     return( true );
    5720                 }
    5721                 else
    5722                     Gen::LastErrDsc_Set( LocId::Pack( 'FileRenameErr_%1$s%2$s', 'Common', array( $fileTmp, $file ) ) );
    5723             }
    5724             else
    5725                 Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );
    5726         }
    5727         else
    5728             Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );
    5729 
    5730         if( $lr )
    5731             $lock -> Release();
    5732     }
    5733     else
    5734         Gen::LastErrDsc_Set( $lock -> GetErrDescr() );
    5735 
    5736     @unlink( $fileTmp );
    5737     @unlink( $file );
    5738 
    5739     return( false );
    5740 }
    5741 
    57425980function _FileReadWithLocker( $file, $lock = null )
    57435981{
     
    59506188        if( isset( $a[ $type ] ) && !count( $a[ $type ] ) )
    59516189            unset( $a[ $type ] );
     6190    }
     6191}
     6192
     6193class DscLockUpdater
     6194{
     6195    private $timeout;
     6196
     6197    private $lock;
     6198    private $tmLastUpdate = 0.0;
     6199
     6200    function __construct( $timeout = 0.0 )
     6201    {
     6202        $this -> timeout = $timeout;
     6203        $this -> lock = new Lock( 'dl', GetCacheDir() );
     6204    }
     6205
     6206    function __destruct()
     6207    {
     6208        $this -> Release();
     6209    }
     6210
     6211    function Acquire()
     6212    {
     6213        return( $this -> lock -> Acquire() );
     6214    }
     6215
     6216    function Release( $force = false )
     6217    {
     6218        if( $this -> timeout && !$force )
     6219        {
     6220            $tmCur = microtime( true );
     6221            if( $tmCur - $this -> tmLastUpdate < $this -> timeout )
     6222                return;
     6223
     6224            $this -> tmLastUpdate = $tmCur;
     6225        }
     6226
     6227        $this -> lock -> Release();
    59526228    }
    59536229}
     
    59826258    {
    59836259        if( !isset( $headers[ 'User-Agent' ] ) )
    5984             $headers[ 'User-Agent' ] = ($headers[ 'X-Seraph-Accel-Postpone-User-Agent' ]??'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.15');
     6260            $headers[ 'User-Agent' ] = ($headers[ 'X-Seraph-Accel-Postpone-User-Agent' ]??'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.16');
    59856261        $headers[ 'User-Agent' ] = str_replace( 'seraph-accel-Agent/', 'seraph-accel-Agent-WarmUp/', $headers[ 'User-Agent' ] );
    59866262
     
    60186294}
    60196295
    6020 function CacheAdditional_UpdateCurUrl( $settCache, $srvUpd = false )
     6296function CacheAdditional_UpdateCurUrl( $settCache, $srvUpd = false, $urlCur = null )
    60216297{
    60226298    global $seraph_accel_g_simpCacheMode;
     
    60266302        return;
    60276303
    6028     $url = null;
    6029 
    60306304    if( IsBatCacheRtm() )
    60316305    {
    6032         if( $url === null )
    6033             $url = GetCurRequestUrl();
    6034         BatCache_Clear( $url );
     6306        if( $urlCur === null )
     6307            $urlCur = GetCurRequestUrl();
     6308        BatCache_Clear( $urlCur );
    60356309    }
    60366310
    60376311    if( Gen::GetArrField( $settCache, array( 'srvClr' ), false ) && function_exists( 'seraph_accel\\CacheExt_Clear' ) )
    60386312    {
    6039         if( $url === null )
    6040             $url = GetCurRequestUrl();
    6041         CacheExt_Clear( $url );
     6313        if( $urlCur === null )
     6314            $urlCur = GetCurRequestUrl();
     6315        CacheExt_Clear( $urlCur );
    60426316    }
    60436317
    60446318    if( $srvUpd && Gen::GetArrField( $settCache, array( 'srvUpd' ), false ) )
    60456319    {
    6046         if( $url === null )
    6047             $url = GetCurRequestUrl();
     6320        if( $urlCur === null )
     6321            $urlCur = GetCurRequestUrl();
    60486322
    60496323        global $seraph_accel_g_ctxCache;
    60506324
    60516325        $aHdrs = array( $seraph_accel_g_ctxCache !== null ? $seraph_accel_g_ctxCache -> viewId : 'cur' => Net::GetRequestHeaders() );
    6052         CacheAdditional_WarmupUrl( $settCache, $url, $aHdrs );
     6326        CacheAdditional_WarmupUrl( $settCache, $urlCur, $aHdrs );
    60536327    }
    60546328}
  • seraphinite-accelerator/trunk/content.php

    r3450747 r3485735  
    2020        'siteContPath' => Gen::SetLastSlash( $siteContentPath, false ),
    2121        'siteRootDataPath' => null,
     22        'siteCacheRootDir' => $cacheDir,
    2223        'dataPath' => GetCacheDataDir( $cacheDir . '/s/' . $siteId ),
    2324        'wpRootSubPath' => $wpRootSubPath . '/',
     
    3738        'aCssRpl' => array(),
    3839        'aCssRplExcl' => array(),
     40
     41        'bJsCssAddType' => apply_filters( 'seraph_accel_jscss_addtype', false ),
    3942
    4043    );
     
    9295
    9396        $seraph_accel_g_ctxProcess = GetContentProcessCtxEx( $serverArgs, $sett, GetSiteId(), $siteRootUrl, $siteRootPath, WP_CONTENT_DIR, $siteWpRootSubPath, GetCacheDir(), defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG );
     97        ContentProcess_InitLocalCbs( $seraph_accel_g_ctxProcess );
    9498    }
    9599
  • seraphinite-accelerator/trunk/languages/seraphinite-accelerator-admin.pot

    r3468084 r3485735  
    77msgid ""
    88msgstr ""
    9 "#-#-#-#-#  cmn.admin.pot (seraphinite-accelerator 2.28.15)  #-#-#-#-#\n"
    10 "Project-Id-Version: seraphinite-accelerator 2.28.15\n"
     9"#-#-#-#-#  cmn.admin.pot (seraphinite-accelerator 2.28.16)  #-#-#-#-#\n"
     10"Project-Id-Version: seraphinite-accelerator 2.28.16\n"
    1111"Report-Msgid-Bugs-To: support@s-sols.com\n"
    1212"MIME-Version: 1.0\n"
    1313"Content-Type: text/plain; charset=UTF-8\n"
    1414"Content-Transfer-Encoding: 8bit\n"
    15 "#-#-#-#-#  main.admin.pot (seraphinite-accelerator 2.28.15)  #-#-#-#-#\n"
    16 "Project-Id-Version: seraphinite-accelerator 2.28.15\n"
     15"#-#-#-#-#  main.admin.pot (seraphinite-accelerator 2.28.16)  #-#-#-#-#\n"
     16"Project-Id-Version: seraphinite-accelerator 2.28.16\n"
    1717"Report-Msgid-Bugs-To: support@s-sols.com\n"
    1818"MIME-Version: 1.0\n"
     
    299299msgstr ""
    300300
     301# GZIP encoding failed
     302msgctxt "admin.Common_Msg"
     303msgid "GzEncodingFail"
     304msgstr ""
     305
    301306# About
    302307msgctxt "admin.Common_About"
     
    865870msgstr ""
    866871
     872# Requesting remote processing
     873msgctxt "admin.Msg"
     874msgid "StateSubProgress_RemotePrepare"
     875msgstr ""
     876
     877# Waiting remote processing
     878msgctxt "admin.Msg"
     879msgid "StateSubProgress_RemoteWait"
     880msgstr ""
     881
     882# Unable to retrieve data from the site: %1$s
     883#, php-format
     884msgctxt "admin.Msg"
     885msgid "RemoteSiteGetDataErr_%1$s"
     886msgstr ""
     887
    867888# Geo location
    868889msgctxt "admin.Settings_Views_Geo"
     
    13411362msgstr ""
    13421363
     1364# Engine: %1$s
     1365#, php-format
     1366msgctxt "admin.Settings_Cache_Revalidate"
     1367msgid "ProcEngine_%1$s"
     1368msgstr ""
     1369
     1370# local only
     1371msgctxt "admin.Settings_Cache_Revalidate"
     1372msgid "ProcEngineLocal"
     1373msgstr ""
     1374
     1375# remote (if available), otherwise local
     1376msgctxt "admin.Settings_Cache_Revalidate"
     1377msgid "ProcEngineRemoteLocal"
     1378msgstr ""
     1379
     1380# remote only (if available)
     1381msgctxt "admin.Settings_Cache_Revalidate"
     1382msgid "ProcEngineRemote"
     1383msgstr ""
     1384
    13431385# Intervals
    13441386msgctxt "admin.Settings_Cache_Revalidate_Intervals"
     
    19932035msgstr ""
    19942036
    1995 # String or regular expression
     2037# Optional description to identify
     2038msgctxt "admin.Settings_Styles_Custom"
     2039msgid "DescrPhlr"
     2040msgstr ""
     2041
     2042# Search (string or regular expression)
    19962043msgctxt "admin.Settings_Html_Rpl"
    19972044msgid "FindExprPhlr"
     2045msgstr ""
     2046
     2047# Scope (element(s) XPath selector)
     2048msgctxt "admin.Settings_Html_Rpl"
     2049msgid "SelectorPhlr"
    19982050msgstr ""
    19992051
     
    20682120msgstr ""
    20692121
     2122# Form of Chauffeur Booking System
    20702123msgctxt "admin.Settings_Html_RandCorr"
    20712124msgid "ChbsBkngFrmChk"
     
    25732626msgstr ""
    25742627
    2575 # WooPrdGallSldChk
     2628# Product Gallery Slider, Additional Variation Images for WooCommerce
    25762629msgctxt "admin.Settings_Frames_ContParts"
    25772630msgid "WooPrdGallSldChk"
     
    33953448msgstr ""
    33963449
    3397 # Optional description to identify
    3398 msgctxt "admin.Settings_Styles_Custom"
    3399 msgid "DescrPhlr"
    3400 msgstr ""
    3401 
    34023450# Use even if scripts are not delay loaded
    34033451msgctxt "admin.Settings_Styles_Custom"
  • seraphinite-accelerator/trunk/languages/seraphinite-accelerator.pot

    r3468084 r3485735  
    77msgid ""
    88msgstr ""
    9 "Project-Id-Version: seraphinite-accelerator 2.28.15\n"
     9"Project-Id-Version: seraphinite-accelerator 2.28.16\n"
    1010"Report-Msgid-Bugs-To: support@s-sols.com\n"
    1111"MIME-Version: 1.0\n"
  • seraphinite-accelerator/trunk/main.php

    r3468084 r3485735  
    1212require_once( __DIR__ . '/options.php' );
    1313require_once( __DIR__ . '/tune.php' );
     14require_once( __DIR__ . '/cache_ex.php' );
    1415require_once( __DIR__ . '/cache_ext.php' );
    1516
     
    4243function _AddMenus( $accepted = false )
    4344{
    44     add_menu_page( Plugin::GetPluginString( 'TitleLong' ), Plugin::GetNavMenuTitle(), 'manage_options', 'seraph_accel_manage',                                                                      $accepted ? 'seraph_accel\\_ManagePage' : 'seraph_accel\\Plugin::OutputNotAcceptedPageContent', Plugin::FileUri( 'icon.png?v=2.28.15', __FILE__ ) );
     45    add_menu_page( Plugin::GetPluginString( 'TitleLong' ), Plugin::GetNavMenuTitle(), 'manage_options', 'seraph_accel_manage',                                                                      $accepted ? 'seraph_accel\\_ManagePage' : 'seraph_accel\\Plugin::OutputNotAcceptedPageContent', Plugin::FileUri( 'icon.png?v=2.28.16', __FILE__ ) );
    4546    add_submenu_page( 'seraph_accel_manage', esc_html_x( 'Title', 'admin.Manage', 'seraphinite-accelerator' ), esc_html_x( 'Title', 'admin.Manage', 'seraphinite-accelerator' ), 'manage_options', 'seraph_accel_manage',   $accepted ? 'seraph_accel\\_ManagePage' : 'seraph_accel\\Plugin::OutputNotAcceptedPageContent' );
    4647    add_submenu_page( 'seraph_accel_manage', Wp::GetLocString( 'Settings' ), Wp::GetLocString( 'Settings' ), 'manage_options', 'seraph_accel_settings',                                     $accepted ? 'seraph_accel\\_SettingsPage' : 'seraph_accel\\Plugin::OutputNotAcceptedPageContent' );
     
    304305    }
    305306
    306     if( $isGet || ( is_string( $seraph_accel_g_simpCacheMode ) && Gen::StrStartsWith( $seraph_accel_g_simpCacheMode, 'data:' ) ) )
     307    if( $isGet || ( is_string( $seraph_accel_g_simpCacheMode ) && Gen::StrStartsWith( $seraph_accel_g_simpCacheMode, 'data:' ) ) || ( ($_REQUEST[ 'seraph_accel_at' ]??null) == 'ORC' ) )
    307308    {
    308309        {
     
    876877            $continue = true;
    877878
    878             if( is_multisite() )
    879                 switch_to_blog( ( int )GetBlogIdFromSiteId( $siteId ) );
     879            if( Wp::IsMultisite() )
     880                switch_to_blog( (GetBlogIdFromSiteId( $siteId )??BLOG_ID_CURRENT_SITE) );
    880881
    881882            _CheckUpdatePostProcess( $aPostUpdated, null, array( $ctx, 'isAborted' ) );
     
    11611162        return;
    11621163
    1163     _FileWriteTmpAndReplace( GetCacheDir() . '/db/mm/ip2c.mmdb', null, $data, null, $lock );
     1164    Gen::FileWriteTmpAndReplace( $lock, GetCacheDir() . '/db/mm/ip2c.mmdb', $data );
    11641165}
    11651166
     
    12421243    ksort( $aRegionsIp );
    12431244
    1244     _FileWriteTmpAndReplace( GetCacheDir() . '/db/mm/c2ip-v1.dat', null, @serialize( $aRegionsIp ), null, $lock );
     1245    Gen::FileWriteTmpAndReplace( $lock, GetCacheDir() . '/db/mm/c2ip-v1.dat', @serialize( $aRegionsIp ) );
    12451246}
    12461247
     
    12861287{
    12871288    Plugin::CmnScripts( array( 'Cmn', 'Gen', 'Ui', 'Net', 'AdminUi' ) );
    1288     wp_register_script( Plugin::ScriptId( 'Admin' ), add_query_arg( Plugin::GetFileUrlPackageParams(), Plugin::FileUrl( 'Admin.js', __FILE__ ) ), array_merge( array( 'jquery' ), Plugin::CmnScriptId( array( 'Cmn', 'Gen', 'Ui', 'Net' ) ) ), '2.28.15' );
     1289    wp_register_script( Plugin::ScriptId( 'Admin' ), add_query_arg( Plugin::GetFileUrlPackageParams(), Plugin::FileUrl( 'Admin.js', __FILE__ ) ), array_merge( array( 'jquery' ), Plugin::CmnScriptId( array( 'Cmn', 'Gen', 'Ui', 'Net' ) ) ), '2.28.16' );
    12891290    Plugin::Loc_ScriptLoad( Plugin::ScriptId( 'Admin' ) );
    12901291    wp_enqueue_script( Plugin::ScriptId( 'Admin' ) );
     
    14531454                        Ui::Button( Wp::safe_html_x( 'SrvDel', 'admin.Manage_Operate', 'seraphinite-accelerator' ), false, null, null, 'button', array( 'class' => array( 'ctlSpaceAfter', 'ctlSpaceVBefore', 'ctlVaMiddle' ), 'style' => array( 'min-width' => '7em' ), 'onclick' => 'seraph_accel.Manager._int.OnCacheOp(this,10,"' . wp_create_nonce( 'op-10' ) . '");return false;' ) ) .
    14541455                        Ui::Button( Wp::GetLocString( 'Cancel' ), false, null, null, 'button', array( 'class' => array( 'ctlSpaceAfter', 'ctlSpaceVBefore', 'ctlVaMiddle', 'cancel' ), 'style' => array( 'min-width' => '7em' ), 'disabled' => true, 'onclick' => 'seraph_accel.Manager._int.OnCacheOpCancel(this,undefined,"' . wp_create_nonce( 'op-cancel' ) . '");return false;' ) ) .
    1455                         Ui::NumberBox( null, 5, array( 'min' => 1, 'class' => array( 'ctlSpaceAfter', 'ctlSpaceVBefore', 'ctlVaMiddle', 'tmDataRefresh' ), 'style' => array( 'width' => '4em', 'display' => 'none' ) ) ) .
     1456                        Ui::NumberBox( null, 5, array( 'min' => 1, 'class' => array( 'ctlSpaceAfter', 'ctlSpaceVBefore', 'ctlVaMiddle', 'tmDataRefresh' ), 'style' => array( 'display' => 'none', 'width' => '4em' ) ) ) .
    14561457                        Ui::Spinner( false, array( 'class' => 'ctlSpaceAfter ctlSpaceVBefore ctlVaMiddle', 'style' => array( 'display' => 'none' ) ) ) .
    14571458                        Ui::Tag( 'span', null, array( 'class' => 'ctlSpaceAfter ctlSpaceVBefore ctlVaMiddle ctlInlineBlock descr', 'style' => array( 'display' => 'none' ) ) ) .
     
    15281529    $rmtCfg = PluginRmtCfg::Get();
    15291530
    1530     $urlLogoImg = add_query_arg( array( 'v' => '2.28.15' ), Plugin::FileUri( 'Images/hosting-icon-banner.svg', __FILE__ ) );
     1531    $urlLogoImg = add_query_arg( array( 'v' => '2.28.16' ), Plugin::FileUri( 'Images/hosting-icon-banner.svg', __FILE__ ) );
    15311532    $urlMoreInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlHostingInfo' );
    15321533
     
    18441845
    18451846    {
    1846         $loadAvgCont = GetLoadAvg( null );
    1847         $info[ 'cont' ][ 'loadAvg' ] = ( $loadAvgCont !== null ) ? ( ( string )$loadAvgCont . '%' ) : '-';
     1847        $loadAvgCont = Gen::GetCpuLoad();
     1848        $info[ 'cont' ][ 'loadAvg' ] = ( $loadAvgCont !== null ) ? ( ( string )round( 100 * $loadAvgCont ) . '%' ) : '-';
    18481849    }
    18491850
     
    18661867            $dbIP2CFile = GetCacheDir() . '/db/mm/ip2c.mmdb';
    18671868
    1868         $aDbFileTm[ 'GeoIP (MaxMind)' ] = Images_ProcessSrcEx_FileMTime( $dbIP2CFile );
    1869         $aDbFileTm[ 'GeoIP (MaxMind-C2IP)' ] = Images_ProcessSrcEx_FileMTime( GetCacheDir() . '/db/mm/c2ip-v1.dat' );
     1869        $aDbFileTm[ 'GeoIP (MaxMind)' ] = Gen::FileMTime( $dbIP2CFile );
     1870        $aDbFileTm[ 'GeoIP (MaxMind-C2IP)' ] = Gen::FileMTime( GetCacheDir() . '/db/mm/c2ip-v1.dat' );
    18701871
    18711872        $aDbFileTmDisp = array();
     
    23042305    esc_html_x( 'ProcStat', 'admin.Msg', 'seraphinite-accelerator' );
    23052306    esc_html_x( 'TimeDurSec_%1$s', 'admin.Msg', 'seraphinite-accelerator' );
     2307
     2308    esc_html_x( 'StateSubProgress_RemotePrepare', 'admin.Msg', 'seraphinite-accelerator' );
     2309    esc_html_x( 'StateSubProgress_RemoteWait', 'admin.Msg', 'seraphinite-accelerator' );
     2310
     2311    esc_html_x( 'RemoteSiteGetDataErr_%1$s', 'admin.Msg', 'seraphinite-accelerator' );
     2312
    23062313}
    23072314
  • seraphinite-accelerator/trunk/oper.php

    r3468084 r3485735  
    417417}
    418418
    419 class DscLockUpdater
    420 {
    421     private $timeout;
    422 
    423     private $lock;
    424     private $tmLastUpdate = 0.0;
    425 
    426     function __construct( $timeout = 0.0 )
    427     {
    428         $this -> timeout = $timeout;
    429         $this -> lock = new Lock( 'dl', GetCacheDir() );
    430     }
    431 
    432     function __destruct()
    433     {
    434         $this -> Release();
    435     }
    436 
    437     function Acquire()
    438     {
    439         return( $this -> lock -> Acquire() );
    440     }
    441 
    442     function Release( $force = false )
    443     {
    444         if( $this -> timeout && !$force )
    445         {
    446             $tmCur = microtime( true );
    447             if( $tmCur - $this -> tmLastUpdate < $this -> timeout )
    448                 return;
    449 
    450             $this -> tmLastUpdate = $tmCur;
    451         }
    452 
    453         $this -> lock -> Release();
    454     }
    455 }
    456 
    457419function _CacheOp_Clear_Dsc_MarkExistedParts( &$datasDel, $dsc, $aTypes )
    458420{
     
    726688                            return( false );
    727689
    728                         if( Gen::DirEnum( $siteDir . '/eo', $ctx,
    729                             function( $path, $item, &$ctx )
    730                             {
    731                                 if( $ctx -> isAborted() )
    732                                     return( false );
    733 
    734                                 $path = $path . '/' . $item;
    735                                 if( @is_dir( $path ) || !Gen::GetFileExt( $item ) )
    736                                     return;
    737 
    738                                 $tmFile = @filectime( $path );
    739                                 if( $tmFile !== false )
    740                                 {
    741                                     if( $tmFile < $ctx -> tmCur - $ctx -> timeoutExtObj )
    742                                         @unlink( $path );
    743                                     else if( ( $tmFile = @filemtime( $path ) ) !== false && $tmFile < $ctx -> tmCur )
    744                                         @unlink( $path );
    745                                 }
    746                             }
    747                         , true ) === false )
    748                         {
     690                        if( ExtContents_Local_CacheClean( $siteDir, $ctx -> tmCur - $ctx -> timeoutExtObj, $ctx -> tmCur, array( $ctx, 'isAborted' ) ) === false )
    749691                            return( false );
    750                         }
    751692                    }
    752693                }
     
    12161157    foreach( $viewId === null ? array( 'cmn' ) : $viewId as $viewIdI )
    12171158        if( CacheOpViewsHeadersGetViewId( $viewIdI ) == 'cmn' )
    1218             $res[ $viewIdI ] = array( 'User-Agent' => 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.15' );
     1159            $res[ $viewIdI ] = array( 'User-Agent' => 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.16' );
    12191160
    12201161    if( ($settCache[ 'views' ]??null) )
     
    13551296    {
    13561297        $bCurBlogRevert = false;
    1357         if( is_multisite() && defined( 'BLOG_ID_CURRENT_SITE' ) && get_current_blog_id() != BLOG_ID_CURRENT_SITE )
     1298        if( Wp::IsMultisite() && get_current_blog_id() != BLOG_ID_CURRENT_SITE )
    13581299        {
    13591300            switch_to_blog( BLOG_ID_CURRENT_SITE );
     
    19721913{
    19731914
    1974     if( !Gen::DoesFuncExist( 'get_sites' ) || !is_multisite() )
     1915    if( !Gen::DoesFuncExist( 'get_sites' ) || !Wp::IsMultisite() )
    19751916    {
    19761917        $settSite = $init ? $sett : null;
     
    21222063}
    21232064
    2124 function GetLoadAvg( $def = 0 )
    2125 {
    2126     if( !function_exists( 'sys_getloadavg' ) )
    2127         return( $def );
    2128 
    2129     $loadavg = sys_getloadavg();
    2130     if( !is_array( $loadavg ) )
    2131         return( $def );
    2132 
    2133     $loadavg = ( float )($loadavg[ 0 ]??null);
    2134     if( $loadavg > 1 )
    2135         $loadavg = 1;
    2136     return( $loadavg !== null ? ( int )( round( 100 * $loadavg ) ) : $def );
    2137 }
    2138 
    21392065function UpdateClientSessId( $curUserId, $token = null, $expirationNew = null )
    21402066{
  • seraphinite-accelerator/trunk/options.php

    r3468084 r3485735  
    142142
    143143    Plugin::CmnScripts( array( 'Cmn', 'Gen', 'Ui', 'Net', 'AdminUi' ) );
    144     wp_register_script( Plugin::ScriptId( 'Admin' ), add_query_arg( Plugin::GetFileUrlPackageParams(), Plugin::FileUrl( 'Admin.js', __FILE__ ) ), array_merge( array( 'jquery' ), Plugin::CmnScriptId( array( 'Cmn', 'Gen', 'Ui', 'Net' ) ) ), '2.28.15' );
     144    wp_register_script( Plugin::ScriptId( 'Admin' ), add_query_arg( Plugin::GetFileUrlPackageParams(), Plugin::FileUrl( 'Admin.js', __FILE__ ) ), array_merge( array( 'jquery' ), Plugin::CmnScriptId( array( 'Cmn', 'Gen', 'Ui', 'Net' ) ) ), '2.28.16' );
    145145    Plugin::Loc_ScriptLoad( Plugin::ScriptId( 'Admin' ) );
    146146    wp_enqueue_script( Plugin::ScriptId( 'Admin' ) );
     
    819819                            }
    820820                            $o .= ( Ui::TagClose( 'tr' ) );
     821
     822                            $o .= ( Ui::TagOpen( 'tr', array( 'style' => array( 'display' => 'none' ) ) ) );
     823                            {
     824                                $o .= ( Ui::TagOpen( 'td' ) );
     825                                {
     826                                    $fldId = 'cache/procEngn';
     827                                    $o .= ( Ui::Label( sprintf( esc_html_x( 'ProcEngine_%1$s', 'admin.Settings_Cache_Revalidate', 'seraphinite-accelerator' ),
     828                                        Ui::ComboBox(
     829                                            'seraph_accel/' . $fldId,
     830                                            array(
     831                                                1                                       => esc_html_x( 'ProcEngineLocal', 'admin.Settings_Cache_Revalidate', 'seraphinite-accelerator' ),
     832                                                2 | 1       => esc_html_x( 'ProcEngineRemoteLocal', 'admin.Settings_Cache_Revalidate', 'seraphinite-accelerator' ),
     833                                                2                                       => esc_html_x( 'ProcEngineRemote', 'admin.Settings_Cache_Revalidate', 'seraphinite-accelerator' ),
     834                                            ),
     835                                            Gen::GetArrField( $sett, $fldId, 1, '/' ), true, array( 'class' => array( 'inline' ) ) )
     836                                    ) ) );
     837
     838                                    $o .= ( Ui::Tag( 'p', implode( '<br>', array_map( function( $v ) { return( Net::UrlDeParse( Net::UrlParse( $v ), 0, array(), array( PHP_URL_HOST, PHP_URL_PORT, PHP_URL_PATH ) ) ); }, Gen::GetArrField( $rmtCfg, 'Prms.UrlsProcMgr', array() ) ) ), array( 'class' => 'description', 'style' => array( 'display' => 'none' ) ) ) );
     839                                }
     840                                $o .= ( Ui::TagClose( 'td' ) );
     841                            }
     842                            $o .= ( Ui::TagClose( 'tr' ) );
     843
    821844                        }
    822845                        $o .= ( Ui::SettBlock_ItemSubTbl_End() );
     
    24812504                                        {
    24822505                                            $fldId = 'enable';
    2483                                             $fldIdEx = 'expr';
     2506                                            $fldIdEx = 'descr';
    24842507                                            $o .= ( Ui::Tag( 'tr',
    2485                                                 Ui::Tag( 'td',Ui::CheckBox( null, $idItems . '/' . $itemKey . '/' . $fldId, Gen::GetArrField( $item, $fldId, true, '/' ), true ), array( 'class' => 'ctlMinSizeX' ) ) .
    2486                                                 Ui::Tag( 'td', Ui::TextBox( $idItems . '/' . $itemKey . '/' . $fldIdEx, Gen::GetArrField( $item, $fldIdEx, '', '/' ), array( 'masked' => true, 'placeholder' => _x( 'FindExprPhlr', 'admin.Settings_Html_Rpl', 'seraphinite-accelerator' ), 'style' => array( 'width' => '100%' ) ), true ) )
     2508                                                Ui::Tag( 'td', Ui::CheckBox( null, $idItems . '/' . $itemKey . '/' . $fldId, Gen::GetArrField( $item, $fldId, true, '/' ), true ), array( 'class' => 'ctlMinSizeX' ) ) .
     2509                                                Ui::Tag( 'td', Ui::TextBox( $idItems . '/' . $itemKey . '/' . $fldIdEx, Gen::GetArrField( $item, $fldIdEx, '', '/' ), array( 'placeholder' => _x( 'DescrPhlr', 'admin.Settings_Styles_Custom', 'seraphinite-accelerator' ), 'style' => array( 'width' => '100%' ) ), true ) )
    24872510                                            ) );
     2511                                        }
     2512
     2513                                        {
     2514                                            $fldId = 'expr';
     2515                                            $o .= ( Ui::Tag( 'tr', Ui::Tag( 'td', Ui::TextBox( $idItems . '/' . $itemKey . '/' . $fldId, Gen::GetArrField( $item, $fldId, '', '/' ), array( 'masked' => true, 'placeholder' => _x( 'FindExprPhlr', 'admin.Settings_Html_Rpl', 'seraphinite-accelerator' ), 'style' => array( 'width' => '100%' ) ), true ), array( 'colspan' => 2 ) ) ) );
     2516                                        }
     2517
     2518                                        ;
     2519
     2520                                        {
     2521                                            $fldId = 'scope';
     2522                                            $o .= ( Ui::Tag( 'tr', Ui::Tag( 'td', Ui::TextBox( $idItems . '/' . $itemKey . '/' . $fldId, Gen::GetArrField( $item, $fldId, '', '/' ), array( 'masked' => true, 'class' => 'ctlMaxSizeX', 'placeholder' => _x( 'SelectorPhlr', 'admin.Settings_Html_Rpl', 'seraphinite-accelerator' ) ), true ), array( 'colspan' => 2 ) ) ) );
    24882523                                        }
    24892524
     
    58095844            $fldId = 'reLnch';
    58105845
    5811             $v = Gen::SanitizeTextData( trim( ($args[ 'seraph_accel/' . $fldId ]??'') ) );
     5846            $v = Gen::SanitizeTextData( trim( stripslashes( ($args[ 'seraph_accel/' . $fldId ]??'') ) ) );
    58125847            if( $v )
    58135848                Gen::SetArrField( $sett, $fldId, $v, '/' );
     
    58365871            Gen::SetArrField( $sett, $fldId, $v ? $v : 1, '/' );
    58375872        }
     5873
     5874        { $fldId = 'cache/procEngn';                        Gen::SetArrField( $sett, $fldId, @intval( $args[ 'seraph_accel/' . $fldId ] ), '/' ); }
    58385875
    58395876        { $fldId = 'cache/srv';                             Gen::SetArrField( $sett, $fldId, isset( $args[ 'seraph_accel/' . $fldId ] ), '/' ); }
     
    65096546
    65106547                    { $fldId = 'enable';                        Gen::SetArrField( $item, $fldId, isset( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ), '/' ); }
     6548                    { $fldId = 'descr';                         Gen::SetArrField( $item, $fldId, Wp::SanitizeText( @stripslashes( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ) ), '/' ); }
    65116549                    { $fldId = 'expr';                          Gen::SetArrField( $item, $fldId, @trim( Ui::UnmaskValue( @stripslashes( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ) ) ), '/' ); }
     6550                    { $fldId = 'sel';                           Gen::SetArrField( $item, $fldId, @trim( Wp::SanitizeXPath( Ui::UnmaskValue( @stripslashes( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ) ) ) ), '/' ); }
    65126551                    { $fldId = 'data';                          Gen::SetArrField( $item, $fldId, Ui::UnmaskValue( @stripslashes( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ) ), '/' ); }
    65136552
     
    67246763    if( Gen::GetArrField( $sett, array( 'cache', 'viewsGeo', 'enable' ), false ) )
    67256764    {
    6726         if( !Images_ProcessSrcEx_FileMTime( $dbIP2CFile ) || !Images_ProcessSrcEx_FileMTime( GetCacheDir() . '/db/mm/c2ip-v1.dat' ) )
     6765        if( !Gen::FileMTime( $dbIP2CFile ) || !Gen::FileMTime( GetCacheDir() . '/db/mm/c2ip-v1.dat' ) )
    67276766            ExtDbUpd();
    67286767
  • seraphinite-accelerator/trunk/plugin_root.php

    r3468084 r3485735  
    66Text Domain: seraphinite-accelerator
    77Domain Path: /languages
    8 Version: 2.28.15
     8Version: 2.28.16
    99Author: Seraphinite Solutions
    1010Author URI: https://www.s-sols.com
  • seraphinite-accelerator/trunk/readme.txt

    r3468084 r3485735  
    66Requires at least: 4.5
    77Tested up to: 6.9
    8 Stable tag: 2.28.15
     8Stable tag: 2.28.16
    99License: GPLv2 or later (if another license is not provided)
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    163163== Changelog ==
    164164
     165= 2.28.16 =
     166
     167Improvements:
     168
     169* Defining scope in HTML replacement.
     170* Restarting failed queue items.
     171* Self-learning: Ultra-fast processing.
     172* Storing the same bodies in single file in external object cache.
     173
     174Fixes:
     175
     176* If self-learning is canceled processing of item continue only after 1 minute.
     177* Regenerating compressed images of unchanged images in cache directory.
     178* Simple thread of optimization doesnt work with custom 'index.php'.
     179* YouTube video preview images are not loaded for playlist URLs.
     180
    165181= 2.28.15 =
    166182
Note: See TracChangeset for help on using the changeset viewer.