Changeset 3485735
- Timestamp:
- 03/18/2026 01:44:41 PM (2 weeks ago)
- Location:
- seraphinite-accelerator
- Files:
-
- 145 added
- 20 edited
-
tags/2.28.16 (added)
-
tags/2.28.16/Admin.js (added)
-
tags/2.28.16/Cmn (added)
-
tags/2.28.16/Cmn/AdminUi.css (added)
-
tags/2.28.16/Cmn/AdminUi.js (added)
-
tags/2.28.16/Cmn/Cmn.js (added)
-
tags/2.28.16/Cmn/Db.php (added)
-
tags/2.28.16/Cmn/Ext (added)
-
tags/2.28.16/Cmn/Ext/JS (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/lazysizes.js (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/lazysizes.min.js (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/plugins (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/plugins/unveilhooks (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/plugins/unveilhooks/ls.unveilhooks.js (added)
-
tags/2.28.16/Cmn/Ext/JS/lazysizes/plugins/unveilhooks/ls.unveilhooks.min.js (added)
-
tags/2.28.16/Cmn/Ext/PHP (added)
-
tags/2.28.16/Cmn/Ext/PHP/JShrink (added)
-
tags/2.28.16/Cmn/Ext/PHP/JShrink/Minifier.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/Options.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/PHPSQLParser.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/exceptions (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/exceptions/InvalidParameterException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/exceptions/UnableToCalculatePositionException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/exceptions/UnableToCreateSQLException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/exceptions/UnsupportedFeatureException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/lexer (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/lexer/LexerSplitter.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/lexer/PHPSQLLexer.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/positions (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/positions/PositionCalculator.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/AbstractProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/BracketProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ColumnDefinitionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ColumnListProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/CreateDefinitionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/CreateProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DefaultProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DeleteProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DescProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DescribeProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DropProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/DuplicateProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ExplainProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ExpressionListProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/FromProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/GroupByProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/HavingProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/IndexColumnListProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/IndexProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/InsertProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/IntoProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/LimitProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/OptionsProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/OrderByProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/PartitionDefinitionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/PartitionOptionsProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/RecordProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ReferenceDefinitionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/RenameProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ReplaceProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SQLChunkProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SQLProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SelectExpressionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SelectProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SetProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ShowProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/SubpartitionDefinitionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/TableProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/UnionProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/UpdateProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/UsingProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/ValuesProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/WhereProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/processors/WithProcessor.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/utils (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/utils/ExpressionToken.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/utils/ExpressionType.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/PHPSQLParser/utils/PHPSQLParserConstants.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/YUI-CSS-compressor-PHP-port (added)
-
tags/2.28.16/Cmn/Ext/PHP/YUI-CSS-compressor-PHP-port/Colors.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/YUI-CSS-compressor-PHP-port/Command.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/YUI-CSS-compressor-PHP-port/Minifier.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/YUI-CSS-compressor-PHP-port/Utils.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/jsmin-php (added)
-
tags/2.28.16/Cmn/Ext/PHP/jsmin-php/JSMin.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/jsmin-php/UnterminatedCommentException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/jsmin-php/UnterminatedRegExpException.php (added)
-
tags/2.28.16/Cmn/Ext/PHP/jsmin-php/UnterminatedStringException.php (added)
-
tags/2.28.16/Cmn/Fs.php (added)
-
tags/2.28.16/Cmn/Gen.js (added)
-
tags/2.28.16/Cmn/Gen.php (added)
-
tags/2.28.16/Cmn/Img.php (added)
-
tags/2.28.16/Cmn/Net.js (added)
-
tags/2.28.16/Cmn/Plugin.php (added)
-
tags/2.28.16/Cmn/Ui.js (added)
-
tags/2.28.16/Cmn/Ui.php (added)
-
tags/2.28.16/Images (added)
-
tags/2.28.16/Images/ProductLogo.png (added)
-
tags/2.28.16/Images/Test.css (added)
-
tags/2.28.16/Images/Test.css.gz (added)
-
tags/2.28.16/Images/Test.js (added)
-
tags/2.28.16/Images/Test.js.gz (added)
-
tags/2.28.16/Images/Test.png (added)
-
tags/2.28.16/Images/Test.png.avif (added)
-
tags/2.28.16/Images/Test.png.webp (added)
-
tags/2.28.16/Images/VendorLogo.png (added)
-
tags/2.28.16/Images/hosting-icon-banner.svg (added)
-
tags/2.28.16/cache.php (added)
-
tags/2.28.16/cache_ex.php (added)
-
tags/2.28.16/cache_ext.php (added)
-
tags/2.28.16/cache_ext_CloudFlareHooksEx.php (added)
-
tags/2.28.16/cache_obj.php (added)
-
tags/2.28.16/common.php (added)
-
tags/2.28.16/content.php (added)
-
tags/2.28.16/content_css.php (added)
-
tags/2.28.16/content_css_ex.php (added)
-
tags/2.28.16/content_ex.php (added)
-
tags/2.28.16/content_frm.php (added)
-
tags/2.28.16/content_img.php (added)
-
tags/2.28.16/content_js.php (added)
-
tags/2.28.16/htmlparser.php (added)
-
tags/2.28.16/icon.png (added)
-
tags/2.28.16/languages (added)
-
tags/2.28.16/languages/seraphinite-accelerator-Admin-en_US.json (added)
-
tags/2.28.16/languages/seraphinite-accelerator-Admin-ru_RU.json (added)
-
tags/2.28.16/languages/seraphinite-accelerator-Gen-en_US.json (added)
-
tags/2.28.16/languages/seraphinite-accelerator-Gen-ru_RU.json (added)
-
tags/2.28.16/languages/seraphinite-accelerator-admin-en_US.mo (added)
-
tags/2.28.16/languages/seraphinite-accelerator-admin-ru_RU.mo (added)
-
tags/2.28.16/languages/seraphinite-accelerator-admin.pot (added)
-
tags/2.28.16/languages/seraphinite-accelerator-en_US.mo (added)
-
tags/2.28.16/languages/seraphinite-accelerator-ru_RU.mo (added)
-
tags/2.28.16/languages/seraphinite-accelerator.pot (added)
-
tags/2.28.16/main.php (added)
-
tags/2.28.16/oper.php (added)
-
tags/2.28.16/options.php (added)
-
tags/2.28.16/plugin_root.php (added)
-
tags/2.28.16/readme.txt (added)
-
tags/2.28.16/sql.php (added)
-
tags/2.28.16/third-party-software.html (added)
-
tags/2.28.16/tune.php (added)
-
trunk/Admin.js (modified) (1 diff)
-
trunk/Cmn/Gen.php (modified) (27 diffs)
-
trunk/Cmn/Plugin.php (modified) (27 diffs)
-
trunk/Cmn/Ui.php (modified) (3 diffs)
-
trunk/cache.php (modified) (5 diffs)
-
trunk/cache_ex.php (added)
-
trunk/cache_ext.php (modified) (1 diff)
-
trunk/cache_obj.php (modified) (1 diff)
-
trunk/common.php (modified) (53 diffs)
-
trunk/content.php (modified) (3 diffs)
-
trunk/languages/seraphinite-accelerator-admin-en_US.mo (modified) (previous)
-
trunk/languages/seraphinite-accelerator-admin-ru_RU.mo (modified) (previous)
-
trunk/languages/seraphinite-accelerator-admin.pot (modified) (8 diffs)
-
trunk/languages/seraphinite-accelerator-en_US.mo (modified) (previous)
-
trunk/languages/seraphinite-accelerator-ru_RU.mo (modified) (previous)
-
trunk/languages/seraphinite-accelerator.pot (modified) (1 diff)
-
trunk/main.php (modified) (12 diffs)
-
trunk/oper.php (modified) (6 diffs)
-
trunk/options.php (modified) (7 diffs)
-
trunk/plugin_root.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
seraphinite-accelerator/trunk/Admin.js
r3450747 r3485735 1 1 function 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)})}} 2 2 function _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= 4 v.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= 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=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"]&& 6 6 (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} 7 7 function 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-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",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); 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[t]=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(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= 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(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<= 12 m;--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- 13 13 1;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"=== 14 14 a.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&& 15 15 (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= 18 l.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, 19 q.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), 20 20 h="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= 22 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 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"), 24 g=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; 25 case 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:"", 26 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 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= 27 27 g.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)'),28 d=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), 30 v="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)} 32 function 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, 33 g,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); 34 seraph_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)'), 35 35 h=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()+36 allSites: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"), 38 u=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), 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 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"); 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()}},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, 43 arguments)},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, 44 p,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()+ 45 45 "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= 47 v.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? 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&&(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", 51 d.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"); 52 52 l.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 22 22 const S_TIMEOUT = 0x000705B4; 23 23 const S_ABORTED = 0x000704C7; 24 const S_ACCESS_DENIED = 0x00070005; 24 25 25 26 const E_DISPATCH_9 = 0x80020009; … … 699 700 break; 700 701 701 if( $filePathRoot && strlen( $filePathRoot ) > =strlen( $filePath ) )702 if( $filePathRoot && strlen( $filePathRoot ) > strlen( $filePath ) ) 702 703 break; 703 704 … … 768 769 } 769 770 770 static function CopyDir( $path, $pathNew )771 static function CopyDir( $path, $pathNew, $bMove = false ) 771 772 { 772 773 if( Gen::HrFail( Gen::MakeDir( $pathNew, true ) ) ) 773 774 return( false ); 774 775 775 $ctx = array( 'pathNew' => $pathNew );776 $ctx = array( 'pathNew' => $pathNew, 'bMove' => $bMove ); 776 777 if( Gen::DirEnum( $path, $ctx, 777 778 function( $path, $file, &$ctx ) … … 781 782 if( @is_dir( $path ) ) 782 783 { 783 if( !Gen::CopyDir( $path, $pathNew ) )784 if( !Gen::CopyDir( $path, $pathNew, $ctx[ 'bMove' ] ) ) 784 785 $ctx[ 'notAll' ] = true; 785 786 } 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 } 788 797 789 798 return( true ); … … 791 800 ) === null ) 792 801 return( false ); 802 803 if( $bMove && !Gen::DelDir( $path ) ) 804 $ctx[ 'notAll' ] = true; 793 805 794 806 return( !( isset( $ctx[ 'notAll' ] ) ? $ctx[ 'notAll' ] : false ) ); … … 804 816 if( @is_dir( $path ) ) 805 817 { 806 if( !Gen::DelDir( $path ))818 if( Gen::DelDir( $path ) === false ) 807 819 $notAll = true; 808 820 } … … 817 829 return( false ); 818 830 819 return( $selfToo ? @rmdir( $path) : true );831 return( $selfToo ? ( file_exists( $path ) ? @rmdir( $path ) : null ) : true ); 820 832 } 821 833 … … 924 936 static function FileContentExclusive_Close( $h ) 925 937 { 938 if( !$h ) 939 return; 940 926 941 @flock( $h, LOCK_UN ); 927 942 @fclose( $h ); … … 1023 1038 } 1024 1039 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 1025 1050 static function FileGetContents( $file ) 1026 1051 { … … 1033 1058 Gen::DelDir( $file ); 1034 1059 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 ); 1035 1122 } 1036 1123 … … 1160 1247 1161 1248 return( $subject ); 1249 } 1250 1251 static function StrReplaceKeyed( $searchReplace, $subject ) 1252 { 1253 return( Gen::StrReplace( array_keys( $searchReplace ), array_values( $searchReplace ), $subject ) ); 1162 1254 } 1163 1255 … … 1406 1498 if( gettype( $data ) != 'string' ) 1407 1499 return( '' ); 1408 return( preg_replace( '@[^A-Za-z0-9_\\-:+=|/,\\.\\ ]@', '', $data ) );1500 return( preg_replace( '@[^A-Za-z0-9_\\-:+=|/,\\.\\ \\\\]@', '', $data ) ); 1409 1501 } 1410 1502 … … 1633 1725 1634 1726 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 ); 1635 1790 } 1636 1791 … … 1900 2055 } 1901 2056 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 ); 1905 2085 } 1906 2086 … … 1990 2170 } 1991 2171 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 1992 2181 static private $_lastErrDsc = null; 1993 2182 static private $_fnGetTmpDir = null; … … 2405 2594 usort( $this -> aChunk, function( $chunk1, $chunk2 ) { return( Gen::VarCmp( $chunk1 -> idx, $chunk2 -> idx ) ); } ); 2406 2595 } 2596 2597 function GetDir() 2598 { 2599 return( implode( '*', $this -> dir ) ); 2600 } 2407 2601 2408 2602 #[\ReturnTypeWillChange] … … 3248 3442 const E_HTTP_STATUS_END = 0x400; 3249 3443 3444 const E_HTTP_STATUS_400 = 0x80190290; 3445 const E_HTTP_STATUS_403 = 0x80190293; 3446 3447 const E_HTTP_STATUS_500 = 0x801902F4; 3448 3250 3449 static function GetHrFromResponseCode( $code, $soft = false ) 3251 3450 { 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 3257 3474 if( Gen::HrFacility( $hr ) != Gen::FACILITY_HTTP ) 3258 3475 return( null ); … … 3268 3485 return( Gen::E_FAIL ); 3269 3486 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' ]??''); 3273 3500 if( $httpStatus == 200 || $httpStatus === false ) 3274 3501 return( Gen::S_OK ); … … 3277 3504 if( $smart ) 3278 3505 { 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 ) 3280 3515 $hr = Gen::E_NOT_FOUND; 3516 else if( $httpStatus == 503 ) 3517 $hr = Gen::E_BUSY; 3281 3518 } 3282 3519 3283 3520 return( $hr ); 3284 3521 } 3285 3286 $errCode = $requestRes -> get_error_code();3287 $errMsg = $requestRes -> get_error_message( $errCode );3288 3522 3289 3523 if( $errCode == 'http_request_failed' && strpos( $errMsg, 'cURL error 28:' ) !== false ) … … 3479 3713 } 3480 3714 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 ); 3484 3720 return( Net::UrlAddArgsEx( $url, $args ) ); 3485 3721 } … … 3655 3891 $args[ 'provider' ] = 'CURL'; 3656 3892 if( !isset( $args[ 'user-agent' ] ) ) 3657 $args[ 'user-agent' ] = 'seraph-accel-Agent/2.28.1 5';3893 $args[ 'user-agent' ] = 'seraph-accel-Agent/2.28.16'; 3658 3894 if( !isset( $args[ 'timeout' ] ) ) 3659 3895 $args[ 'timeout' ] = 5; … … 5164 5400 $obj = new AnyObj(); 5165 5401 $obj -> method = $method; 5402 $obj -> transport = ($args[ 'transport' ]??null); 5166 5403 5167 5404 $obj -> _cbRequestBefore = … … 5170 5407 if( $options && isset( $options[ 'timeout' ] ) && $options[ 'timeout' ] ) 5171 5408 $options[ 'connect_timeout' ] = $options[ 'timeout' ] - 1; 5409 if( $obj -> transport ) 5410 $options[ 'transport' ] = $obj -> transport; 5172 5411 }; 5173 5412 … … 5271 5510 5272 5511 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 ); 5273 5530 } 5274 5531 … … 6512 6769 { 6513 6770 $res = array( 'global' => true, 'local' => true ); 6514 if( ! is_multisite() )6771 if( !Wp::IsMultisite() ) 6515 6772 return( $res ); 6516 6773 … … 6520 6777 } 6521 6778 6779 static function IsMultisite() 6780 { 6781 return( Gen::CallFunc( 'is_multisite' ) && defined( 'BLOG_ID_CURRENT_SITE' ) ); 6782 } 6783 6522 6784 static function IsMultisiteMain() 6523 6785 { 6524 if( ! is_multisite() || !defined( 'BLOG_ID_CURRENT_SITE') )6786 if( !Wp::IsMultisite() ) 6525 6787 return( true ); 6526 6788 return( get_current_blog_id() == BLOG_ID_CURRENT_SITE ); … … 6529 6791 static function IsMultisiteGlobalAdmin() 6530 6792 { 6531 if( ! is_multisite() )6793 if( !Wp::IsMultisite() ) 6532 6794 return( false ); 6533 6795 return( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN == true ); -
seraphinite-accelerator/trunk/Cmn/Plugin.php
r3468084 r3485735 64 64 { 65 65 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-- ) 67 67 delete_option( 'seraph_accel_' . $name . 'V' . $verFromDel ); 68 68 } … … 122 122 static function GetMultiSitePrefix() 123 123 { 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 ); 125 135 } 126 136 … … 128 138 { 129 139 $idPrev = self::$_blogId; 130 self::$_blogId = $id;140 self::$_blogId = ( int )$id; 131 141 return( $idPrev ); 132 142 } 133 143 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 ); 139 149 } 140 150 } … … 307 317 $args[ 'id' ] = 'wordpress-accelerator'; 308 318 $args[ 'name' ] = 'Accelerator'; 309 $args[ 'v' ] = '2.28.1 5';319 $args[ 'v' ] = '2.28.16'; 310 320 $args[ 'pk' ] = 'Base'; 311 321 $args[ 'cfg' ] = ''; … … 329 339 $lastCheckPackage = 'Base'; 330 340 331 if( $lastCheckVer !== '2.28.1 5' || $lastCheckPackage !== 'Base' )341 if( $lastCheckVer !== '2.28.16' || $lastCheckPackage !== 'Base' ) 332 342 { 333 343 $state = Plugin::StateGet(); 334 344 335 if( $lastCheckVer !== '2.28.1 5' && !isset( $state[ 'changeVerCheck' ] ) )345 if( $lastCheckVer !== '2.28.16' && !isset( $state[ 'changeVerCheck' ] ) ) 336 346 { 337 347 $state[ 'changeVerCheck' ] = $lastCheckVer !== null ? $lastCheckVer : ''; … … 350 360 if( !$bForce ) 351 361 { 352 if( $bFirstTimeOnly && $lastCheckVer == '2.28.1 5' )362 if( $bFirstTimeOnly && $lastCheckVer == '2.28.16' ) 353 363 return( Gen::S_FALSE ); 354 364 … … 369 379 $args[ 'id' ] = 'wordpress-accelerator'; 370 380 $args[ 'name' ] = 'Accelerator'; 371 $args[ 'v' ] = '2.28.1 5';381 $args[ 'v' ] = '2.28.16'; 372 382 $args[ 'pk' ] = 'Base'; 373 383 $args[ 'cfg' ] = ''; … … 386 396 { 387 397 $data[ 'updTime' ] = $curUpdTime; 388 $data[ 'plgVer' ] = '2.28.1 5';398 $data[ 'plgVer' ] = '2.28.16'; 389 399 $data[ 'plgPk' ] = 'Base'; 390 400 … … 403 413 $data[ 'mdfTime' ] = $timeMdf; 404 414 $data[ 'updTime' ] = $curUpdTime; 405 $data[ 'plgVer' ] = '2.28.1 5';415 $data[ 'plgVer' ] = '2.28.16'; 406 416 $data[ 'plgPk' ] = 'Base'; 407 417 … … 737 747 const ASYNCTASK_PUSH_AUTO = 'A'; 738 748 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 739 761 static private function _AsyncTasksProcess() 740 762 { … … 914 936 { 915 937 916 if( is_multisite() )917 switch_to_blog( $dataItem[ 'b' ]);938 if( Wp::IsMultisite() ) 939 switch_to_blog( ($dataItem[ 'b' ]??BLOG_ID_CURRENT_SITE) ); 918 940 Gen::CallFunc( 'seraph_accel\\OnAsyncTask_' . $dataItem[ 'n' ], array( Gen::CallFunc( 'seraph_accel\\OnAsyncTask_' . $dataItem[ 'n' ] . '_AU', array( $dataItem[ 'a' ] ), $dataItem[ 'a' ] ) ) ); 919 941 … … 1030 1052 } 1031 1053 1032 if( is_multisite() )1033 $dataItemNew[ 'b' ] = get_current_blog_id();1054 if( $blogIdCur = self::_AsyncTask_GetCurBlogId() ) 1055 $dataItemNew[ 'b' ] = $blogIdCur; 1034 1056 1035 1057 if( $fast ) … … 1103 1125 return( $hr ); 1104 1126 1105 $curBlogId = null; 1106 if( is_multisite() ) 1107 $curBlogId = get_current_blog_id(); 1127 $blogIdCur = self::_AsyncTask_GetCurBlogId(); 1108 1128 1109 1129 $hr = Gen::S_FALSE; … … 1112 1132 foreach( $data as $i => $dataItem ) 1113 1133 { 1114 if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $ curBlogId)1134 if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $blogIdCur ) 1115 1135 continue; 1116 1136 … … 1142 1162 return( false ); 1143 1163 1144 $curBlogId = null; 1145 if( is_multisite() ) 1146 $curBlogId = get_current_blog_id(); 1164 $blogIdCur = self::_AsyncTask_GetCurBlogId(); 1147 1165 1148 1166 $res = null; … … 1151 1169 foreach( $data as $i => $dataItem ) 1152 1170 { 1153 if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $ curBlogId)1171 if( $dataItem[ 'n' ] !== $name || ($dataItem[ 'b' ]??null) !== $blogIdCur ) 1154 1172 continue; 1155 1173 … … 1192 1210 $asyncMode = null; 1193 1211 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 ) ); 1195 1213 if( $timeout > 0 ) 1196 1214 $prms[ 'timeout' ] = $timeout; … … 1448 1466 esc_html_x( 'PhpExecMdlNotFound_%1$s', 'admin.Common_Msg', 'seraphinite-accelerator' ); 1449 1467 esc_html_x( 'PhpExtDirSuffix_%1$s%2$s', 'admin.Common_Msg', 'seraphinite-accelerator' ); 1468 1469 esc_html_x( 'GzEncodingFail', 'admin.Common_Msg', 'seraphinite-accelerator' ); 1450 1470 } 1451 1471 … … 1460 1480 1461 1481 $urlProductInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductInfo' ); 1462 $urlAboutPluginImg = file_exists( __DIR__ . '/../Images/ProductLogo.png' ) ? add_query_arg( array( 'v' => '2.28.1 5' ), 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; 1463 1483 $urlAboutPluginDocs = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductDocs' ); 1464 1484 $urlAboutPluginSupport = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlProductSupport' ); 1465 $url3rdPartySoft = file_exists( __DIR__ . '/../third-party-software.html' ) ? add_query_arg( array( 'v' => '2.28.1 5' ), 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; 1466 1486 1467 1487 $urlEula = null; … … 1472 1492 1473 1493 { 1474 $version = esc_html( '2.28.1 5' );1494 $version = esc_html( '2.28.16' ); 1475 1495 1476 1496 $res .= Ui::TagOpen( 'div' ); … … 1521 1541 $rmtCfg = PluginRmtCfg::Get(); 1522 1542 1523 $urlAboutUsLogoImg = file_exists( __DIR__ . '/../Images/VendorLogo.png' ) ? add_query_arg( array( 'v' => '2.28.1 5' ), 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; 1524 1544 $urlMorePlugins = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlMorePlugins' ); 1525 1545 $urlMoreInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlMain' ); … … 1681 1701 static function SettGetGlobal( $settRawExt = null, $clearCache = false ) 1682 1702 { 1683 if( ! is_multisite() )1703 if( !Wp::IsMultisite() ) 1684 1704 return( Plugin::SettGet( $settRawExt, $clearCache ) ); 1685 1705 … … 1706 1726 static function SettSetGlobal( $data, $updateCacheOnly = false ) 1707 1727 { 1708 if( ! is_multisite() )1728 if( !Wp::IsMultisite() ) 1709 1729 return( Plugin::SettSet( $data, $updateCacheOnly ) ); 1710 1730 … … 2050 2070 2051 2071 $verFrom = self::_PrevVer_GetInt( $plgVerPrev ); 2052 $verTo = self::_PrevVer_GetInt( '2.28.1 5' );2072 $verTo = self::_PrevVer_GetInt( '2.28.16' ); 2053 2073 if( $verTo < $verFrom ) 2054 2074 list( $verTo, $verFrom ) = array( $verFrom, $verTo ); … … 2175 2195 continue; 2176 2196 2177 wp_enqueue_style( Plugin::CmnScriptId( $id ), add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.css' ), array(), '2.28.1 5' );2197 wp_enqueue_style( Plugin::CmnScriptId( $id ), add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.css' ), array(), '2.28.16' ); 2178 2198 2179 2199 self::$g_aAlreadyIncludedObj[ 'css' ][ $id ] = true; … … 2242 2262 $scrHndId = Plugin::CmnScriptId( $id ); 2243 2263 2244 wp_register_script( $scrHndId, add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.js' ), $deps, '2.28.1 5' );2264 wp_register_script( $scrHndId, add_query_arg( Plugin::GetFileUrlPackageParams(), $fileUrl . '/' . $id . '.js' ), $deps, '2.28.16' ); 2245 2265 if( $id == 'Gen' ) 2246 2266 Plugin::Loc_ScriptLoad( $scrHndId ); … … 2687 2707 var sendDataUrl = "<?php echo( Gen::GetArrField( $rmtCfg, 'Questionnaires.SendAnswerUrlTpl' ) ); ?>"; 2688 2708 sendDataUrl = sendDataUrl.replace( "{EndPointId}", encodeURI( "<?php echo( Wp::GetSiteId() ); ?>" ) ); 2689 sendDataUrl = sendDataUrl.replace( "{PluginVersion}", encodeURI( "2.28.1 5" ) );2709 sendDataUrl = sendDataUrl.replace( "{PluginVersion}", encodeURI( "2.28.16" ) ); 2690 2710 sendDataUrl = sendDataUrl.replace( "{PluginMode}", encodeURI( "base" ) ); 2691 2711 sendDataUrl = sendDataUrl.replace( "{PluginPackage}", encodeURI( "Base" ) ); -
seraphinite-accelerator/trunk/Cmn/Ui.php
r3440269 r3485735 412 412 } 413 413 414 static function GetSrcAttrData ( $v, &$mimeType = null, &$encoding = null )414 static function GetSrcAttrDataType( $v, &$encoding = null ) 415 415 { 416 416 … … 420 420 421 421 $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 ) ); 423 434 $mimeType = ($prms[ 0 ]??null); 424 435 $encoding = ($prms[ count( $prms ) - 1 ]??null); 436 $data = trim( substr( $v, $data + 1 ) ); 425 437 return( $encoding == 'base64' ? base64_decode( $data ) : rawurldecode( $data ) ); 426 438 } … … 442 454 443 455 $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 ) ) 445 460 { 446 461 if( $m[ 1 ][ 1 ] === -1 ) -
seraphinite-accelerator/trunk/cache.php
r3468084 r3485735 6 6 exit; 7 7 8 if( defined( 'SERAPH_ACCEL_NO_CACHE' ) ) 9 return; 10 8 11 if( !defined( 'SERAPH_ACCEL_PLUGIN_DIR' ) ) define( 'SERAPH_ACCEL_PLUGIN_DIR', __DIR__ ); else if( SERAPH_ACCEL_PLUGIN_DIR != __DIR__ ) return; 9 12 10 13 require_once( __DIR__ . '/common.php' ); 14 require_once( __DIR__ . '/cache_ex.php' ); 11 15 12 16 global $seraph_accel_g_cacheSkipData; … … 91 95 } 92 96 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 ) ) 94 98 { 95 99 http_response_code( 599 ); … … 134 138 if( $seraph_accel_g_siteId != 'm' ) 135 139 { 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 ) ); 138 142 $sett = Plugin::SettGet( Gen::CallFunc( 'seraph_accel_siteSettInlineDetach', array( $seraph_accel_g_siteId ) ) ); 139 PluginOptions:: SetBlogId( null);143 PluginOptions::UnsetBlogId(); 140 144 } 141 145 else … … 413 417 $seraph_accel_g_dscFile .= '/' . $objectId . '.' . $objectType . '.dat'; 414 418 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 415 425 $seraph_accel_g_dscFilePending = $seraph_accel_g_dscFile . '.p'; 416 426 … … 616 626 } 617 627 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 else628 {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 else740 $bNotMdf = ( $tmIfMdfSince >= $tmLm );741 }742 }743 744 if( $bNotMdf )745 {746 http_response_code( 304 );747 $ctxData = null;748 }749 else750 {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 else825 {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 else970 $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 else1036 {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 else1074 {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 else1173 $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 else1184 $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 else1195 $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 else1218 $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 else1229 $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 else1240 $content .= $oiCd;1241 }1242 break;1243 1244 case 'br':1245 if( $fmt == '.brua' )1246 {1247 $oiCd = "\x03";1248 if( $out )1249 CacheWriteOut( $oiCd );1250 else1251 $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 else1348 @unlink( $fileTempQueue );1349 }1350 else1351 @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 else1369 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 else1449 _ProcessOutHdrTrace( $sett, true, true, 'skipped', array( 'reason' => 'brokenDsc' ), $seraph_accel_g_dscFile );1450 }1451 else1452 _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 else1536 _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 397 397 $data[ 'urls' ][] = Wp::GetSiteRootUrl( '', false ); 398 398 399 if( is_multisite() && !is_subdomain_install() )399 if( Wp::IsMultisite() && !is_subdomain_install() ) 400 400 { 401 401 $endpoint_path = 'purge-fpc-sub-dir'; -
seraphinite-accelerator/trunk/cache_obj.php
r3285902 r3485735 326 326 327 327 \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 ] ); 329 329 330 330 if( $lr ) -
seraphinite-accelerator/trunk/common.php
r3468084 r3485735 13 13 require_once( __DIR__ . '/Cmn/Plugin.php' ); 14 14 15 const PLUGIN_SETT_VER = 19 0;15 const PLUGIN_SETT_VER = 191; 16 16 const PLUGIN_DATA_VER = 1; 17 17 const PLUGIN_EULA_VER = 1; … … 1219 1219 } 1220 1220 1221 if( $verFrom && $verFrom < 191 ) 1222 { 1223 Gen::SetArrField( $sett, array( 'cache', 'procEngn' ), 1 ); 1224 } 1225 1221 1226 return( $sett ); 1222 1227 } … … 1331 1336 'srv' => true, 1332 1337 'srvClr' => true, 1333 'srvUpd' => true,1338 'srvUpd' => false, 1334 1339 'srvUpdTimeout' => 5, 1335 1340 'nginx' => array( … … 1350 1355 'lazyInv' => true, 1351 1356 'lazyInvInitTmp' => true, 1352 'lazyInvForcedTmp' => false,1357 'lazyInvForcedTmp' => true, 1353 1358 'lazyInvTmp' => false, 1354 1359 'fastTmpOpt' => true, … … 1367 1372 'updPostMeta' => false, 1368 1373 'updPostMetaExcl' => array( 1374 1369 1375 '@.*@', 1370 1376 '@^\\d+$@', … … 1442 1448 'procPauseInt' => 0.5, 1443 1449 1450 'procEngn' => 1, 1451 1444 1452 'autoProc' => true, 1445 1453 … … 1536 1544 1537 1545 array( 1538 'enable' => true,1546 'enable' => false, 1539 1547 'name' => '', 1540 1548 'id' => 'mobile', … … 2661 2669 function GetSiteId( $site = null ) 2662 2670 { 2663 if( ! is_multisite() )2671 if( !Wp::IsMultisite() ) 2664 2672 return( 'm' ); 2665 2673 … … 2679 2687 { 2680 2688 if( $siteId === 'm' ) 2681 return( Gen::Constant( 'BLOG_ID_CURRENT_SITE', 0 ));2689 return( null ); 2682 2690 2683 2691 $nPos = strpos( $siteId, '_' ); … … 2925 2933 } 2926 2934 2927 function CacheCw( $ settCache, $siteRootDataPath, $dataPath, $composite, $content, $type, $fileExt = null )2935 function CacheCw( $cbWrite, $settCache, $siteRootDataPath, $dataPath, $composite, $content, $type, $fileExt = null ) 2928 2936 { 2929 2937 if( !$fileExt ) 2930 2938 $fileExt = $type; 2931 2939 2940 if( $type != 'html' ) 2941 $dataPath .= '/' . $type; 2942 2932 2943 $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 2958 function 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 2975 function 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 2984 function CacheCwEx( $settCache, $dataPath, $composite, $content, $type, $oiCfn ) 2985 { 2935 2986 $dataComprs = Gen::GetArrField( $settCache, array( 'dataCompr' ), array() ); 2936 2987 if( empty( $dataComprs ) ) 2937 2988 $dataComprs[] = ''; 2938 2989 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[] = ''; 2949 2996 } 2950 2997 2951 2998 $writeOk = true; 2952 $writeFailDsc = null;2953 2999 2954 3000 foreach( $dataComprs as $dataCompr ) … … 2962 3008 } 2963 3009 2964 $oiCf = $dataPath . '/' . $oiC if . '.' . $fileExt. $dataFileExt;3010 $oiCf = $dataPath . '/' . $oiCfn . $dataFileExt; 2965 3011 2966 3012 $lock = new Lock( 'dtl', dirname( $dataPath ) ); … … 2974 3020 if( CacheCvs( Gen::FileSize( $oiCf ), strlen( $content ) ) ) 2975 3021 { 2976 @touch( $oiCf );3022 CacheCts( $oiCf ); 2977 3023 $lock -> Release(); 2978 3024 continue; … … 3035 3081 break; 3036 3082 } 3083 else 3084 CacheCts( $oiCf ); 3037 3085 3038 3086 $lock -> Release(); 3039 3087 } 3040 3088 3041 if( !$writeOk ) 3089 return( $writeOk ); 3090 } 3091 3092 function 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 ) ) 3042 3103 return( null ); 3043 3104 … … 3051 3112 } 3052 3113 3053 function CacheCc( $settCache, $siteRootDataPath, $dataPath, $oiCi, $type, $fileExt = null ) 3114 function 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 3133 function _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 3146 function ReadSceGf( &$dataPath, $settCache, $oiCi, $type, $fileExt = null ) 3054 3147 { 3055 3148 if( !$fileExt ) 3056 3149 $fileExt = $type; 3057 3150 3058 $oiCif = CacheCgif( $settCache, $oiCi );3059 3060 3151 if( $type != 'html' ) 3061 3152 $dataPath .= '/' . $type; 3062 3153 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 3157 function 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 3163 function CacheCrEx( $dataPath, $settCache, $type, $oiCi, $oiCfn ) 3102 3164 { 3103 3165 $dataComprs = Gen::GetArrField( $settCache, array( 'dataCompr' ), array() ); … … 3113 3175 } 3114 3176 3115 $oiCf = _GetCcf ( $settCache, $id, '', $dataPath, time(), $type, $dataComprs );3177 $oiCf = _GetCcf2( $oiCfn, '', $dataPath, time(), $dataComprs ); 3116 3178 if( !$oiCf ) 3117 3179 return( null ); 3118 3180 3119 3181 $oiCd = _GetCfc( $oiCf ); 3120 if( $oiCd === false || !CacheCvs( strlen( $oiCd ), GetCacheCos( $ id) ) )3182 if( $oiCd === false || !CacheCvs( strlen( $oiCd ), GetCacheCos( $oiCi ) ) ) 3121 3183 return( null ); 3122 3184 … … 3361 3423 function Tof_GetFileData( $dir, $id, $ver = null, $compressed = false, $oiCi = null ) 3362 3424 { 3425 return( Tof_GetFileDataCb( '\\seraph_accel\\Tof_GetFileDataEx', $dir, $id, $ver, $compressed, $oiCi ) ); 3426 } 3427 3428 function Tof_GetFileDataCb( $cbGet, $dir, $id, $ver = null, $compressed = false, $oiCi = null ) 3429 { 3363 3430 if( $oiCi !== null ) 3364 3431 $id = $oiCi . '.' . $id; 3365 3432 3366 $data = @file_get_contents( $dir . '/' .$id );3433 $data = $cbGet( $dir, $id ); 3367 3434 if( $compressed ) 3368 3435 $data = @gzdecode( $data ); … … 3387 3454 } 3388 3455 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 3456 function Tof_GetFileDataEx( $dir, $id ) 3457 { 3458 return( @file_get_contents( $dir . '/' . $id ) ); 3459 } 3460 3461 function 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 3466 function Tof_SetFileDataCb( $cbSet, $dir, $id, $data, $ver = null, $compressed = false, &$oiCi = null ) 3467 { 3395 3468 if( $ver ) 3396 3469 $data[ 'v' ] = $ver; 3397 3470 3398 3471 $data = @serialize( $data ); 3472 $overwrite = true; 3399 3473 3400 3474 if( $oiCi !== null ) … … 3403 3477 $id = $oiCi . '.' . $id; 3404 3478 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 } 3412 3481 3413 3482 if( $compressed !== false ) 3414 3483 $data = @gzencode( $data, is_int( $compressed ) ? $compressed : -1 ); 3415 3484 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 3488 function 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 ) ); 3429 3492 } 3430 3493 … … 4170 4233 function GetViewTypeUserAgent( $viewsDeviceGrp ) 4171 4234 { 4172 return( 'Mozilla/99999.9 AppleWebKit/9999999.99 (KHTML, like Gecko) Chrome/999999.0.9999.99 Safari/9999999.99 seraph-accel-Agent/2.28.1 5' . 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() ) ) ) ); 4173 4236 } 4174 4237 … … 4275 4338 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 ) ); 4276 4339 } 4340 4341 $pushQueueImmediately = null; 4342 $bDebug = Gen::GetArrField( $settGlobal, array( 'debug' ), false ); 4343 4344 $aRestartItem = array(); 4277 4345 4278 4346 $aCurItemsPrior = array(); … … 4304 4372 else if( Gen::GetArrField( $ctlRes, array( 'stage' ), '' ) ) 4305 4373 { 4306 if( !Gen::GetArrField( $ctlRes, array( 'finish' ) ) && ! $isLive )4374 if( !Gen::GetArrField( $ctlRes, array( 'finish' ) ) && !Gen::GetArrField( $ctlRes, array( 'remote' ) ) && !$isLive ) 4307 4375 $hrItemForce = Gen::E_INVALID_STATE; 4308 4376 } 4309 4377 else if( ( int )($item[ 'tp' ]??0) == 0 && $asyncMode != 'ec' && ($settGlobal[ 'asyncSmpOpt' ]??null) ) 4310 _CacheProcessItem_RunSmpOpt( $asyncMode );4378 _CacheProcessItem_RunSmpOpt( $asyncMode, ($data[ 'u' ]??null) ); 4311 4379 } 4312 4380 } 4313 4381 else 4382 { 4314 4383 $hrItemForce = Gen::E_TIMEOUT; 4384 if( Gen::GetArrField( ProcessCtlData_Get( $fileCtl ), array( 'remote' ) ) ) 4385 $hrItemForce = Gen::S_TIMEOUT; 4386 } 4315 4387 4316 4388 if( $hrItemForce == Gen::S_OK ) … … 4323 4395 4324 4396 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 } 4326 4420 4327 4421 $data[ 'td' ] = $tmDur; … … 4331 4425 $item[ 'p' ] = -1000; 4332 4426 $item[ 't' ] = $tmCur; 4427 4333 4428 unset( $aProgress[ $id ] ); 4334 4429 $aDone[ $id ] = $item; … … 4336 4431 4337 4432 { 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() ) 4341 4439 { 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 ) 4343 4445 { 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 ) 4349 4455 { 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++; 4379 4458 } 4380 4381 $aDone -> clear();4382 $aDone -> setItems( $aDoneNew );4383 4459 } 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 4384 4495 } 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 ); 4390 4501 } 4391 4502 … … 4393 4504 unset( $aDone, $aProgress, $lock ); 4394 4505 } 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 ); 4395 4525 4396 4526 if( !$nMaxItems ) … … 4586 4716 } 4587 4717 4718 function 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 4588 4745 function ProcessCtlData_Get( $fileCtl, &$isLive = null ) 4589 4746 { … … 4652 4809 $dataPrev = @unserialize( $dataPrev ); 4653 4810 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; 4655 4812 $lock -> Release(); 4656 4813 … … 4669 4826 public $procTmLim = 60 * 60 * 24; 4670 4827 4671 public $needRepeatPage = false;4672 4828 public $needLrn = false; 4673 public $repeatIdx = null; 4829 4674 4830 public $skipStatus = null; 4675 4831 public $warns = null; … … 4732 4888 $prepArgs[ 'lrn' ] = ($this -> data[ 'l' ]??null); 4733 4889 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 ); 4756 4917 } 4757 4918 … … 4804 4965 } 4805 4966 4967 if( Gen::GetArrField( $ctlRes, array( 'remote' ) ) ) 4968 return( false ); 4969 4806 4970 if( !$isLive ) 4807 4971 { … … 4821 4985 { 4822 4986 $this -> hr = Gen::S_ABORTED; 4987 $this -> httpCode = null; 4823 4988 $this -> requestRes = null; 4824 4989 } 4825 4990 else if( $this -> httpCode && $this -> httpCode != 500 ) 4826 4991 { 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 4830 5001 $this -> hr = Gen::HrSuccFromFail( $this -> hr ); 4831 5002 } … … 4849 5020 4850 5021 if( ( int )($this -> item[ 'p' ]??null) !== 10 ) 4851 if( ( $redirIdx = ($this -> data[ 'rdr' ]??0) ) < = 4)5022 if( ( $redirIdx = ($this -> data[ 'rdr' ]??0) ) < 5 ) 4852 5023 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) ) ) 4853 5024 $this -> immediatelyPushQueue = true; 4854 5025 } 5026 5027 return( true ); 4855 5028 } 4856 5029 … … 4871 5044 4872 5045 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 } 4874 5061 else if( Gen::StrStartsWith( $this -> skipStatus, 'lrnNeed:' ) ) 4875 5062 $this -> needLrn = substr( $this -> skipStatus, 8 ); … … 4934 5121 if( $dataExtUpdated ) 4935 5122 { 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 ); 4941 5132 } 4942 5133 } … … 4958 5149 PluginFileValues::SetEx( PluginFileValues::GetDirVar( '' ), 'pelt', ( int )$this -> tmFinish ); 4959 5150 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 4963 5151 CachePushQueueProcessor( true, $this -> immediatelyPushQueue, $this -> hr != Gen::S_OK && Gen::HrSucc( $this -> hr ) ); 4964 5152 … … 4974 5162 } 4975 5163 4976 function _CacheProcessItem_RunSmpOpt( $asyncMode ) 4977 { 5164 function _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 } 4978 5174 4979 5175 $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( ) ) ); 4981 5177 } 4982 5178 … … 5091 5287 5092 5288 } 5093 5094 $ctx -> WaitForEndRequest();5095 5289 } 5096 5290 else 5097 5291 { 5292 $ctx -> PrepareRequest(); 5293 5098 5294 global $seraph_accel_g_prepPrms; 5099 5295 5100 5296 $seraph_accel_g_prepPrms = array( 'pc' => $ctx -> fileCtl, 'p' => ( int )($ctx -> item[ 'p' ]??null) ); 5101 5297 $sett = Plugin::SettGet(); 5102 5103 5298 $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() ) ); 5119 5306 5120 5307 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 5130 5308 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(); 5136 5313 } 5137 5314 … … 5235 5412 } 5236 5413 5237 function _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $ data = null )5414 function _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $repeatVal = null, $data = null ) 5238 5415 { 5239 5416 $item = $aProgress[ $id ]; … … 5246 5423 return; 5247 5424 5248 ProcessCtlData_Del ( $fileCtl );5425 ProcessCtlData_DelSmart( $fileCtl ); 5249 5426 5250 5427 if( $data ) 5251 5428 $itemInProgressData = array_merge( $data, $itemInProgressData ); 5252 $itemInProgressData[ 'rpt' ] = true; 5429 if( $repeatVal ) 5430 $itemInProgressData[ 'rpt' ] = $repeatVal; 5253 5431 5254 5432 $item[ 'd' ] = Gen::Serialize( $itemInProgressData ); … … 5256 5434 } 5257 5435 5258 function CachePostPreparePageEx( $method , $url, $siteId, $priority, $priorityInitiator, $headers = null, $time = null, $re dirIdx = null, $lrnId = null )5436 function CachePostPreparePageEx( $method , $url, $siteId, $priority, $priorityInitiator, $headers = null, $time = null, $retryIdx = null, $lrnId = null ) 5259 5437 { 5260 5438 … … 5320 5498 if( $method && $method != 'GET' ) 5321 5499 $data[ 'm' ] = $method; 5322 if( $re dirIdx )5323 $data[ 'rdr' ] = $re dirIdx;5500 if( $retryIdx ) 5501 $data[ 'rdr' ] = $retryIdx; 5324 5502 if( $lrnId ) 5325 5503 $data[ 'l' ] = $lrnId; … … 5348 5526 if( $priority !== 10 ) 5349 5527 { 5350 _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, $data );5528 _CachePostPreparePageEx_StopAndRepeat( $aProgress, $id, true, $data ); 5351 5529 if( $id != $idLearn ) 5352 5530 _CachePostPreparePageEx_StopAndRepeat( $aProgress, $idLearn ); … … 5434 5612 } 5435 5613 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 ) 5614 function ExtContents_Local_GetIdxPrms( $dir ) 5615 { 5616 return( array( 'dirFilesPattern' => $dir . '/i/*.dat.gz' ) ); 5617 } 5618 5619 function 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 ) 5449 5636 break; 5450 5637 … … 5452 5639 { 5453 5640 if( $tmFile > time() ) 5641 { 5454 5642 $cont = @file_get_contents( $file ); 5643 $file = Gen::GetFileName( $file ); 5644 } 5455 5645 else 5646 { 5456 5647 @unlink( $file ); 5648 $file = null; 5649 5650 unset( $aIdx[ $extCacheId ] ); 5651 } 5457 5652 } 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 5666 function 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 5687 function 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 5725 function 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 ); 5461 5735 5462 5736 if( is_string( $cont ) && Gen::GetFileExt( $file ) == 'gz' && is_string( $cont = @gzdecode( $cont ) ) ) … … 5474 5748 $args = array( 'sslverify' => false, 'timeout' => $timeout, 'headers' => array() ); 5475 5749 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'; 5479 5751 5480 5752 if( $serverId = Net::UrlParse( $url ) ) … … 5488 5760 if( $rememberServerState && $serverId && Gen::HrFail( ($seraph_accel_g_aGetExtContentsFailedSrvs[ $serverId ]??null) ) ) 5489 5761 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 } 5490 5777 5491 5778 $res = Wp::RemoteGet( $url, $args ); … … 5541 5828 } 5542 5829 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 ); 5544 5831 unset( $contCache ); 5545 5832 } … … 5547 5834 5548 5835 return( $cont ); 5549 }5550 5551 function Images_ProcessSrcEx_FileMTime( $file )5552 {5553 return( Gen::FileSize( $file ) ? @filemtime( $file ) : false );5554 5836 } 5555 5837 … … 5696 5978 } 5697 5979 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 else5722 Gen::LastErrDsc_Set( LocId::Pack( 'FileRenameErr_%1$s%2$s', 'Common', array( $fileTmp, $file ) ) );5723 }5724 else5725 Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );5726 }5727 else5728 Gen::LastErrDsc_Set( LocId::Pack( 'FileWriteErr_%1$s', 'Common', array( $fileTmp ) ) );5729 5730 if( $lr )5731 $lock -> Release();5732 }5733 else5734 Gen::LastErrDsc_Set( $lock -> GetErrDescr() );5735 5736 @unlink( $fileTmp );5737 @unlink( $file );5738 5739 return( false );5740 }5741 5742 5980 function _FileReadWithLocker( $file, $lock = null ) 5743 5981 { … … 5950 6188 if( isset( $a[ $type ] ) && !count( $a[ $type ] ) ) 5951 6189 unset( $a[ $type ] ); 6190 } 6191 } 6192 6193 class 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(); 5952 6228 } 5953 6229 } … … 5982 6258 { 5983 6259 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.1 5');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'); 5985 6261 $headers[ 'User-Agent' ] = str_replace( 'seraph-accel-Agent/', 'seraph-accel-Agent-WarmUp/', $headers[ 'User-Agent' ] ); 5986 6262 … … 6018 6294 } 6019 6295 6020 function CacheAdditional_UpdateCurUrl( $settCache, $srvUpd = false )6296 function CacheAdditional_UpdateCurUrl( $settCache, $srvUpd = false, $urlCur = null ) 6021 6297 { 6022 6298 global $seraph_accel_g_simpCacheMode; … … 6026 6302 return; 6027 6303 6028 $url = null;6029 6030 6304 if( IsBatCacheRtm() ) 6031 6305 { 6032 if( $url === null )6033 $url = GetCurRequestUrl();6034 BatCache_Clear( $url );6306 if( $urlCur === null ) 6307 $urlCur = GetCurRequestUrl(); 6308 BatCache_Clear( $urlCur ); 6035 6309 } 6036 6310 6037 6311 if( Gen::GetArrField( $settCache, array( 'srvClr' ), false ) && function_exists( 'seraph_accel\\CacheExt_Clear' ) ) 6038 6312 { 6039 if( $url === null )6040 $url = GetCurRequestUrl();6041 CacheExt_Clear( $url );6313 if( $urlCur === null ) 6314 $urlCur = GetCurRequestUrl(); 6315 CacheExt_Clear( $urlCur ); 6042 6316 } 6043 6317 6044 6318 if( $srvUpd && Gen::GetArrField( $settCache, array( 'srvUpd' ), false ) ) 6045 6319 { 6046 if( $url === null )6047 $url = GetCurRequestUrl();6320 if( $urlCur === null ) 6321 $urlCur = GetCurRequestUrl(); 6048 6322 6049 6323 global $seraph_accel_g_ctxCache; 6050 6324 6051 6325 $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 ); 6053 6327 } 6054 6328 } -
seraphinite-accelerator/trunk/content.php
r3450747 r3485735 20 20 'siteContPath' => Gen::SetLastSlash( $siteContentPath, false ), 21 21 'siteRootDataPath' => null, 22 'siteCacheRootDir' => $cacheDir, 22 23 'dataPath' => GetCacheDataDir( $cacheDir . '/s/' . $siteId ), 23 24 'wpRootSubPath' => $wpRootSubPath . '/', … … 37 38 'aCssRpl' => array(), 38 39 'aCssRplExcl' => array(), 40 41 'bJsCssAddType' => apply_filters( 'seraph_accel_jscss_addtype', false ), 39 42 40 43 ); … … 92 95 93 96 $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 ); 94 98 } 95 99 -
seraphinite-accelerator/trunk/languages/seraphinite-accelerator-admin.pot
r3468084 r3485735 7 7 msgid "" 8 8 msgstr "" 9 "#-#-#-#-# cmn.admin.pot (seraphinite-accelerator 2.28.1 5) #-#-#-#-#\n"10 "Project-Id-Version: seraphinite-accelerator 2.28.1 5\n"9 "#-#-#-#-# cmn.admin.pot (seraphinite-accelerator 2.28.16) #-#-#-#-#\n" 10 "Project-Id-Version: seraphinite-accelerator 2.28.16\n" 11 11 "Report-Msgid-Bugs-To: support@s-sols.com\n" 12 12 "MIME-Version: 1.0\n" 13 13 "Content-Type: text/plain; charset=UTF-8\n" 14 14 "Content-Transfer-Encoding: 8bit\n" 15 "#-#-#-#-# main.admin.pot (seraphinite-accelerator 2.28.1 5) #-#-#-#-#\n"16 "Project-Id-Version: seraphinite-accelerator 2.28.1 5\n"15 "#-#-#-#-# main.admin.pot (seraphinite-accelerator 2.28.16) #-#-#-#-#\n" 16 "Project-Id-Version: seraphinite-accelerator 2.28.16\n" 17 17 "Report-Msgid-Bugs-To: support@s-sols.com\n" 18 18 "MIME-Version: 1.0\n" … … 299 299 msgstr "" 300 300 301 # GZIP encoding failed 302 msgctxt "admin.Common_Msg" 303 msgid "GzEncodingFail" 304 msgstr "" 305 301 306 # About 302 307 msgctxt "admin.Common_About" … … 865 870 msgstr "" 866 871 872 # Requesting remote processing 873 msgctxt "admin.Msg" 874 msgid "StateSubProgress_RemotePrepare" 875 msgstr "" 876 877 # Waiting remote processing 878 msgctxt "admin.Msg" 879 msgid "StateSubProgress_RemoteWait" 880 msgstr "" 881 882 # Unable to retrieve data from the site: %1$s 883 #, php-format 884 msgctxt "admin.Msg" 885 msgid "RemoteSiteGetDataErr_%1$s" 886 msgstr "" 887 867 888 # Geo location 868 889 msgctxt "admin.Settings_Views_Geo" … … 1341 1362 msgstr "" 1342 1363 1364 # Engine: %1$s 1365 #, php-format 1366 msgctxt "admin.Settings_Cache_Revalidate" 1367 msgid "ProcEngine_%1$s" 1368 msgstr "" 1369 1370 # local only 1371 msgctxt "admin.Settings_Cache_Revalidate" 1372 msgid "ProcEngineLocal" 1373 msgstr "" 1374 1375 # remote (if available), otherwise local 1376 msgctxt "admin.Settings_Cache_Revalidate" 1377 msgid "ProcEngineRemoteLocal" 1378 msgstr "" 1379 1380 # remote only (if available) 1381 msgctxt "admin.Settings_Cache_Revalidate" 1382 msgid "ProcEngineRemote" 1383 msgstr "" 1384 1343 1385 # Intervals 1344 1386 msgctxt "admin.Settings_Cache_Revalidate_Intervals" … … 1993 2035 msgstr "" 1994 2036 1995 # String or regular expression 2037 # Optional description to identify 2038 msgctxt "admin.Settings_Styles_Custom" 2039 msgid "DescrPhlr" 2040 msgstr "" 2041 2042 # Search (string or regular expression) 1996 2043 msgctxt "admin.Settings_Html_Rpl" 1997 2044 msgid "FindExprPhlr" 2045 msgstr "" 2046 2047 # Scope (element(s) XPath selector) 2048 msgctxt "admin.Settings_Html_Rpl" 2049 msgid "SelectorPhlr" 1998 2050 msgstr "" 1999 2051 … … 2068 2120 msgstr "" 2069 2121 2122 # Form of Chauffeur Booking System 2070 2123 msgctxt "admin.Settings_Html_RandCorr" 2071 2124 msgid "ChbsBkngFrmChk" … … 2573 2626 msgstr "" 2574 2627 2575 # WooPrdGallSldChk2628 # Product Gallery Slider, Additional Variation Images for WooCommerce 2576 2629 msgctxt "admin.Settings_Frames_ContParts" 2577 2630 msgid "WooPrdGallSldChk" … … 3395 3448 msgstr "" 3396 3449 3397 # Optional description to identify3398 msgctxt "admin.Settings_Styles_Custom"3399 msgid "DescrPhlr"3400 msgstr ""3401 3402 3450 # Use even if scripts are not delay loaded 3403 3451 msgctxt "admin.Settings_Styles_Custom" -
seraphinite-accelerator/trunk/languages/seraphinite-accelerator.pot
r3468084 r3485735 7 7 msgid "" 8 8 msgstr "" 9 "Project-Id-Version: seraphinite-accelerator 2.28.1 5\n"9 "Project-Id-Version: seraphinite-accelerator 2.28.16\n" 10 10 "Report-Msgid-Bugs-To: support@s-sols.com\n" 11 11 "MIME-Version: 1.0\n" -
seraphinite-accelerator/trunk/main.php
r3468084 r3485735 12 12 require_once( __DIR__ . '/options.php' ); 13 13 require_once( __DIR__ . '/tune.php' ); 14 require_once( __DIR__ . '/cache_ex.php' ); 14 15 require_once( __DIR__ . '/cache_ext.php' ); 15 16 … … 42 43 function _AddMenus( $accepted = false ) 43 44 { 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.1 5', __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__ ) ); 45 46 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' ); 46 47 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' ); … … 304 305 } 305 306 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' ) ) 307 308 { 308 309 { … … 876 877 $continue = true; 877 878 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) ); 880 881 881 882 _CheckUpdatePostProcess( $aPostUpdated, null, array( $ctx, 'isAborted' ) ); … … 1161 1162 return; 1162 1163 1163 _FileWriteTmpAndReplace( GetCacheDir() . '/db/mm/ip2c.mmdb', null, $data, null, $lock);1164 Gen::FileWriteTmpAndReplace( $lock, GetCacheDir() . '/db/mm/ip2c.mmdb', $data ); 1164 1165 } 1165 1166 … … 1242 1243 ksort( $aRegionsIp ); 1243 1244 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 ) ); 1245 1246 } 1246 1247 … … 1286 1287 { 1287 1288 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.1 5' );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' ); 1289 1290 Plugin::Loc_ScriptLoad( Plugin::ScriptId( 'Admin' ) ); 1290 1291 wp_enqueue_script( Plugin::ScriptId( 'Admin' ) ); … … 1453 1454 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;' ) ) . 1454 1455 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' ) ) ) . 1456 1457 Ui::Spinner( false, array( 'class' => 'ctlSpaceAfter ctlSpaceVBefore ctlVaMiddle', 'style' => array( 'display' => 'none' ) ) ) . 1457 1458 Ui::Tag( 'span', null, array( 'class' => 'ctlSpaceAfter ctlSpaceVBefore ctlVaMiddle ctlInlineBlock descr', 'style' => array( 'display' => 'none' ) ) ) . … … 1528 1529 $rmtCfg = PluginRmtCfg::Get(); 1529 1530 1530 $urlLogoImg = add_query_arg( array( 'v' => '2.28.1 5' ), 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__ ) ); 1531 1532 $urlMoreInfo = Plugin::RmtCfgFld_GetLoc( $rmtCfg, 'Links.UrlHostingInfo' ); 1532 1533 … … 1844 1845 1845 1846 { 1846 $loadAvgCont = Ge tLoadAvg( null);1847 $info[ 'cont' ][ 'loadAvg' ] = ( $loadAvgCont !== null ) ? ( ( string ) $loadAvgCont. '%' ) : '-';1847 $loadAvgCont = Gen::GetCpuLoad(); 1848 $info[ 'cont' ][ 'loadAvg' ] = ( $loadAvgCont !== null ) ? ( ( string )round( 100 * $loadAvgCont ) . '%' ) : '-'; 1848 1849 } 1849 1850 … … 1866 1867 $dbIP2CFile = GetCacheDir() . '/db/mm/ip2c.mmdb'; 1867 1868 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' ); 1870 1871 1871 1872 $aDbFileTmDisp = array(); … … 2304 2305 esc_html_x( 'ProcStat', 'admin.Msg', 'seraphinite-accelerator' ); 2305 2306 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 2306 2313 } 2307 2314 -
seraphinite-accelerator/trunk/oper.php
r3468084 r3485735 417 417 } 418 418 419 class DscLockUpdater420 {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 457 419 function _CacheOp_Clear_Dsc_MarkExistedParts( &$datasDel, $dsc, $aTypes ) 458 420 { … … 726 688 return( false ); 727 689 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 ) 749 691 return( false ); 750 }751 692 } 752 693 } … … 1216 1157 foreach( $viewId === null ? array( 'cmn' ) : $viewId as $viewIdI ) 1217 1158 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.1 5' );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' ); 1219 1160 1220 1161 if( ($settCache[ 'views' ]??null) ) … … 1355 1296 { 1356 1297 $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 ) 1358 1299 { 1359 1300 switch_to_blog( BLOG_ID_CURRENT_SITE ); … … 1972 1913 { 1973 1914 1974 if( !Gen::DoesFuncExist( 'get_sites' ) || ! is_multisite() )1915 if( !Gen::DoesFuncExist( 'get_sites' ) || !Wp::IsMultisite() ) 1975 1916 { 1976 1917 $settSite = $init ? $sett : null; … … 2122 2063 } 2123 2064 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 2139 2065 function UpdateClientSessId( $curUserId, $token = null, $expirationNew = null ) 2140 2066 { -
seraphinite-accelerator/trunk/options.php
r3468084 r3485735 142 142 143 143 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.1 5' );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' ); 145 145 Plugin::Loc_ScriptLoad( Plugin::ScriptId( 'Admin' ) ); 146 146 wp_enqueue_script( Plugin::ScriptId( 'Admin' ) ); … … 819 819 } 820 820 $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 821 844 } 822 845 $o .= ( Ui::SettBlock_ItemSubTbl_End() ); … … 2481 2504 { 2482 2505 $fldId = 'enable'; 2483 $fldIdEx = ' expr';2506 $fldIdEx = 'descr'; 2484 2507 $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 ) ) 2487 2510 ) ); 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 ) ) ) ); 2488 2523 } 2489 2524 … … 5809 5844 $fldId = 'reLnch'; 5810 5845 5811 $v = Gen::SanitizeTextData( trim( ($args[ 'seraph_accel/' . $fldId ]??'') ) );5846 $v = Gen::SanitizeTextData( trim( stripslashes( ($args[ 'seraph_accel/' . $fldId ]??'') ) ) ); 5812 5847 if( $v ) 5813 5848 Gen::SetArrField( $sett, $fldId, $v, '/' ); … … 5836 5871 Gen::SetArrField( $sett, $fldId, $v ? $v : 1, '/' ); 5837 5872 } 5873 5874 { $fldId = 'cache/procEngn'; Gen::SetArrField( $sett, $fldId, @intval( $args[ 'seraph_accel/' . $fldId ] ), '/' ); } 5838 5875 5839 5876 { $fldId = 'cache/srv'; Gen::SetArrField( $sett, $fldId, isset( $args[ 'seraph_accel/' . $fldId ] ), '/' ); } … … 6509 6546 6510 6547 { $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 ] ) ), '/' ); } 6511 6549 { $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 ] ) ) ) ), '/' ); } 6512 6551 { $fldId = 'data'; Gen::SetArrField( $item, $fldId, Ui::UnmaskValue( @stripslashes( $args[ $idItems . '/' . $itemKey . '/' . $fldId ] ) ), '/' ); } 6513 6552 … … 6724 6763 if( Gen::GetArrField( $sett, array( 'cache', 'viewsGeo', 'enable' ), false ) ) 6725 6764 { 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' ) ) 6727 6766 ExtDbUpd(); 6728 6767 -
seraphinite-accelerator/trunk/plugin_root.php
r3468084 r3485735 6 6 Text Domain: seraphinite-accelerator 7 7 Domain Path: /languages 8 Version: 2.28.1 58 Version: 2.28.16 9 9 Author: Seraphinite Solutions 10 10 Author URI: https://www.s-sols.com -
seraphinite-accelerator/trunk/readme.txt
r3468084 r3485735 6 6 Requires at least: 4.5 7 7 Tested up to: 6.9 8 Stable tag: 2.28.1 58 Stable tag: 2.28.16 9 9 License: GPLv2 or later (if another license is not provided) 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 163 163 == Changelog == 164 164 165 = 2.28.16 = 166 167 Improvements: 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 174 Fixes: 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 165 181 = 2.28.15 = 166 182
Note: See TracChangeset
for help on using the changeset viewer.