Changeset 67804 in spip-zone
- Timestamp:
- Nov 19, 2012, 12:40:00 PM (8 years ago)
- Location:
- _plugins_/cache_cool
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/cache_cool/cache_cool_options.php
r62802 r67804 58 58 $where = is_null($contexte_cache)?"principal":"inclure_page"; 59 59 // on reprogramme avec un $use_cache=2 qui permettra de reconnaitre ces calculs 60 job_queue_add('public_produire_page',$c="Calcul du cache $fond [$where]",array($fond, $contexte, 2, $chemin_cache, $contexte_cache, array('contexte_implicite'=>$page['contexte_implicite']), $lastinclude, $connect, cache_cool_get_global_context(), $_SERVER['REQUEST_TIME']),"",TRUE); 60 $args = array($fond, $contexte, 2, $chemin_cache, $contexte_cache, array('contexte_implicite'=>$page['contexte_implicite']), $lastinclude, $connect, cache_cool_get_global_context(), $_SERVER['REQUEST_TIME']); 61 62 // mode de fonctionnement de cache_cool : QUEUE ou MEMORY 63 if (!defined('_CACHE_COOL_MODE')) define('_CACHE_COOL_MODE','QUEUE'); 64 if (_CACHE_COOL_MODE=="QUEUE"){ 65 job_queue_add('public_produire_page',$c="Calcul du cache $fond [$where]",$args,"",TRUE); 66 } 67 else { 68 if (!is_array($GLOBALS['cache_cool_queue'])){ 69 spip_log("ob:".ob_get_level(),'cachecool'._LOG_DEBUG); 70 ob_start("cache_cool_flush"); 71 register_shutdown_function("cache_cool_process"); 72 $GLOBALS['cache_cool_queue'] = array(); 73 } 74 $GLOBALS['cache_cool_queue'][] = $args; 75 } 61 76 spip_log("au frigo : $fond [$where]",'cachecool'._LOG_DEBUG); 62 77 } … … 108 123 } 109 124 125 function cache_cool_flush($content){ 126 header("Content-Length: ".($l=ob_get_length())); 127 header("Connection: close"); 128 spip_log("Connection: close ($l)",'cachecool'._LOG_DEBUG); 129 return $content; 130 } 131 132 function cache_cool_process(){ 133 ob_end_flush(); 134 flush(); 135 if (function_exists('fastcgi_finish_request')) 136 fastcgi_finish_request(); 137 138 139 // se remettre dans le bon dossier, car Apache le change parfois (toujours?) 140 chdir(_ROOT_CWD); 141 142 while (is_array($GLOBALS['cache_cool_queue']) 143 AND $args = array_shift($GLOBALS['cache_cool_queue'])){ 144 spip_log("calcul en fin de hit public_produire_page($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6],$args[7],$args[8],$args[9])",'cachecool'._LOG_DEBUG); 145 public_produire_page($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6],$args[7],$args[8],$args[9]); 146 } 147 } 148 110 149 // en SPIP 3 le test de doublon sur f_jQuery a ete supprime, 111 150 // plus la peine de surcharger -
_plugins_/cache_cool/plugin.xml
r62802 r67804 2 2 <nom>Cache Cool</nom> 3 3 <auteur>[Cedric->http://www.yterium.net]</auteur> 4 <version>0. 2.5</version>4 <version>0.3.0</version> 5 5 <etat>test</etat> 6 6 <icon>images/cache_cool-128.png</icon> … … 8 8 <description>Servir le cache froid pour aller plus vite, et calculer en différé en tâche de fond</description> 9 9 <options>cache_cool_options.php</options> 10 <lien>http:// www.spip-contrib.net/Cache-Cool</lien>10 <lien>http://contrib.spip.net/Cache-Cool</lien> 11 11 <prefix>cache_cool</prefix> 12 12 <categorie>performance</categorie>
Note: See TracChangeset
for help on using the changeset viewer.