Changeset 2113474
- Timestamp:
- 06/27/2019 08:50:27 AM (7 years ago)
- Location:
- wp-admin-cache/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-admin-cache/trunk/index.js
r2050442 r2113474 2 2 if (urls.length == 0) return; 3 3 4 var countDown = 0; 4 var dbI = urls.indexOf("index.php"); 5 if (dbI > 0) {// priority for dashboard 6 urls.splice(0, 0, urls.splice(dbI, 1)[0]); 7 } 8 9 var urlIndex = 0; 10 var expiration = 0; 5 11 var refresh = 0; 6 12 7 13 function exec() { 8 countDown--; 9 if (countDown < 0) { 10 countDown = 60; 11 jQuery.ajax({ 12 url: urls[0], 13 method: 'POST', 14 data: {'wp_admin_cache_prefetch': 1, 'wp_admin_cache_refresh': refresh} 15 }).done(function (data) { 16 if (data.indexOf("prefetched") == 0) { 17 var expiration = data.split(':')[1] * 1; 18 if (expiration < 60) { 19 countDown = expiration - 2; 20 refresh = 1; 21 } 22 } 23 else { 24 for (var i = 1; i < urls.length; i++) { 25 function exec2(url) { 26 jQuery.ajax({ 27 url: url, 28 method: 'POST', 29 data: {'wp_admin_cache_prefetch': 1, 'wp_admin_cache_refresh': refresh} 30 }).done(function (data) { 31 32 }); 33 } 34 if (urls[i] != '') exec2(urls[i]); 35 } 36 refresh = false; 37 } 38 }); 14 if (urls.length == 0) return; 15 if (urlIndex == urls.length) { 16 urlIndex = 0; 17 var delay = expiration - 10000; 18 if (delay < 2000) delay = 2000; 19 expiration = 0; 20 setTimeout(exec, delay); 21 refresh = 1; 22 return; 39 23 } 40 24 jQuery.ajax({ 25 url: urls[urlIndex], 26 method: 'POST', 27 data: {'wp_admin_cache_prefetch': 1, 'wp_admin_cache_refresh': refresh} 28 }).done(function (data) { 29 if (data.indexOf("prefetched") == 0 || data.indexOf("prefetching") == 0) { 30 var exp = data.split(':')[1] * 1000; 31 if (exp < expiration || expiration == 0) expiration = exp; 32 33 } 34 urlIndex++; 35 setTimeout(exec, 10); 36 }).fail(function (jqXHR, textStatus, errorThrown) { 37 urlIndex++; 38 setTimeout(exec, 10); 39 }); 41 40 42 41 43 42 } 44 setInterval(exec, 1000);43 jQuery(exec); 45 44 46 45 } -
wp-admin-cache/trunk/index.php
r2060162 r2113474 5 5 Plugin URI: https://www.wpadmincache.com 6 6 Description: The first cache plugin for WordPress admin area 7 Version: 0.2. 27 Version: 0.2.3 8 8 Author: Grf Studio 9 9 Author URI: https://www.grfstudio.com … … 58 58 function init() { 59 59 add_options_page('WP Admin Cache', 'WP Admin Cache', 'manage_options', 'wp-admin-cache', array($this, 'options_page')); 60 wp_enqueue_script('wp-admin-cache-script', plugin_dir_url(__FILE__) . 'index.js', array(), '0.2. 2');61 wp_enqueue_style('wp-admin-cache-style', plugin_dir_url(__FILE__) . 'index.css', array(), '0.2. 2');60 wp_enqueue_script('wp-admin-cache-script', plugin_dir_url(__FILE__) . 'index.js', array(), '0.2.3'); 61 wp_enqueue_style('wp-admin-cache-style', plugin_dir_url(__FILE__) . 'index.css', array(), '0.2.3'); 62 62 $session = wp_get_session_token(); 63 63 if (!isset($_COOKIE['wp-admin-cache-session']) || $_COOKIE['wp-admin-cache-session'] != $session) setcookie('wp-admin-cache-session', $session, 0, admin_url()); … … 157 157 set_transient($this->currentCaching, $content, 60 * $duration); 158 158 if (isset($_POST['wp_admin_cache_prefetch'])) { 159 return 'prefetching ';159 return 'prefetching:'.($this->settings['duration'] * 60); 160 160 } 161 161 return $content; -
wp-admin-cache/trunk/readme.txt
r2060162 r2113474 1 1 === WP Admin Cache === 2 2 Contributors: grfstudio 3 Tags: admin cache, admin performance, admin speed, slow admin 4 Stable tag: 0.2. 23 Tags: admin cache, admin performance, admin speed, slow admin, woocommerce performance, slow woocommerce 4 Stable tag: 0.2.3 5 5 Requires PHP: 5.6 6 6 Requires at least: 4.6 7 Tested up to: 5. 17 Tested up to: 5.2 8 8 License: GPLv2 or later 9 9 … … 14 14 This lightweight plugin caches the most visited pages in the admin area; it uses ajax to prefetch the pages and stores them on the server for each user. 15 15 16 The plugin is useful for sites with many installed plugins, which often make the administrative section very slow. 16 The cache is useful for sites with many installed plugins, which often make the administrative section very slow, especially in the case of woocommerce with many displayed products. 17 17 18 18 19 == Installation == … … 41 42 42 43 == Changelog == 44 45 = 0.2.3 = 46 47 * Changed prefetching script: optimized page load 43 48 44 49 = 0.2.2 =
Note: See TracChangeset
for help on using the changeset viewer.