[SPIP] +2.1.12
[velocampus/web/www.git] / www / plugins / auto / couteau_suisse / couteau_suisse / outils / spip_cache_config.php
diff --git a/www/plugins/auto/couteau_suisse/couteau_suisse/outils/spip_cache_config.php b/www/plugins/auto/couteau_suisse/couteau_suisse/outils/spip_cache_config.php
new file mode 100644 (file)
index 0000000..e757387
--- /dev/null
@@ -0,0 +1,99 @@
+<?php\r
+if (!defined("_ECRIRE_INC_VERSION")) return;\r
+\r
+# Fichier de configuration pris en compte par config_outils.php et specialement dedie a la configuration du cache SPIP\r
+# --------------------------------------------------------------------------------------------------------------------\r
+\r
+function outils_spip_cache_config_dist() {\r
+\r
+// Ajout de l'outil 'spip_cache'\r
+add_outil(array(\r
+       'id' => 'spip_cache',\r
+       'code:spip_options' => "%%radio_desactive_cache"\r
+               .(defined('_SPIP19300')?'4%%%%compacte_prive%%%%compacte_tout':'3')\r
+               ."%%%%duree_cache%%%%duree_cache_mutu%%%%quota_cache%%%%derniere_modif_invalide%%",\r
+       'categorie' => 'admin',\r
+       'description' => \r
+               (defined('_SPIP19300')\r
+                       ?'<:spip_cache:2:><:spip_cache::><:spip_cache:3:> [[%compacte_css%]][[->%compacte_js%]][[->%compacte_prive%]]'\r
+                               .(defined('_SPIP20200')?'[[->%compacte_tout%]]':'')\r
+                       :'<:spip_cache:1:><:spip_cache::>'),\r
+));\r
+\r
+// Ajout des variables utilisees ci-dessus\r
+add_variables(\r
+\r
+// SPIP<=1.92\r
+array(\r
+       'nom' => 'radio_desactive_cache3',\r
+       'format' => _format_NOMBRE,\r
+       'radio' => array(0 => 'couteauprive:cache_nornal', 1 => 'couteauprive:cache_sans'),\r
+       'defaut' => 0,\r
+       // si la variable est egale a 1, on code (jquery.js et forms_styles.css restent en cache)\r
+       'code:%s' => defined('_SPIP19300')?'':"\$cs_fond = isset(\$GLOBALS['fond'])?\$GLOBALS['fond']:_request('page');\r
+if (!in_array(\$cs_fond, array('jquery.js','forms_styles.css'))) \$_SERVER['REQUEST_METHOD']='POST';\n",\r
+),\r
+\r
+/*\r
+pour SPIP 2.0 :\r
+ define('_NO_CACHE',0); -> toujours prendre tous les fichiers en cache\r
+ define('_NO_CACHE',-1); -> ne jamais utiliser le cache ni meme creer les fichiers cache\r
+ define('_NO_CACHE',1); -> ne pas utiliser le fichier en cache, mais stocker le resultat du calcul dans le fichier cache\r
+ La fonction cache_valide() retourne :\r
+       '1' si il faut mettre le cache a jour, '0' si le cache est valide, '-1' s'il faut calculer sans stocker en cache\r
+*/\r
+array(\r
+       'nom' => 'radio_desactive_cache4',\r
+       'format' => _format_NOMBRE,\r
+       'radio' => array(2 => 'couteauprive:cache_nornal', 0 => 'couteauprive:cache_permanent', -1 => 'couteauprive:cache_sans', 1 => 'couteauprive:cache_controle'),\r
+       'radio/ligne' => 2,\r
+       'defaut' => 2,\r
+       'code:%s!=2' => "define('_NO_CACHE',%s);\n",\r
+), array(\r
+       'nom' => 'duree_cache',\r
+       'format' => _format_NOMBRE,\r
+       'defaut' => "24", // 1 jour\r
+       'code' => "\$GLOBALS['delais']=%s*3600;\n",\r
+), array(\r
+       'nom' => 'duree_cache_mutu',\r
+       'format' => _format_NOMBRE,\r
+       'defaut' => "24", // 1 jour\r
+       'code:%s!=24' => "define('_DUREE_CACHE_DEFAUT', %s*3600);\n",\r
+), array(\r
+       'nom' => 'quota_cache',\r
+       'format' => _format_NOMBRE,\r
+       'defaut' => 10, // 10 Mo\r
+       'code:%s!=10' => "\$GLOBALS['quota_cache']=%s;\n",\r
+), array(\r
+       'nom' => 'derniere_modif_invalide',\r
+       'format' => _format_NOMBRE,\r
+       'radio' => array(0 => 'item_oui', 1 => 'item_non'),\r
+       'defaut' => 0,\r
+       'code:%s' => "\$GLOBALS['derniere_modif_invalide']=false;\n",\r
+), array(\r
+       'nom' => 'compacte_tout',\r
+       'check' => 'couteauprive:compacte_tout',\r
+       'defaut' => 0,\r
+       'code:%s' => "define('_INTERDIRE_COMPACTE_HEAD',1);\n",\r
+), array(\r
+       'nom' => 'compacte_prive',\r
+       'check' => 'couteauprive:compacte_prive',\r
+       'defaut' => 0,\r
+       'code:%s' => "define('_INTERDIRE_COMPACTE_HEAD_ECRIRE',1);\n",\r
+), array(\r
+       'nom' => 'compacte_css',\r
+       'check' => 'couteauprive:compacte_css',\r
+       // variable externe au Couteau Suisse\r
+       'externe' => "\$GLOBALS['meta']['auto_compress_css']=='oui'",\r
+       // action lors d'un changement de valeur\r
+       'action' => "ecrire_meta('auto_compress_css', %s?'oui':non);",\r
+), array(\r
+       'nom' => 'compacte_js',\r
+       'check' => 'couteauprive:compacte_js',\r
+       'externe' => "\$GLOBALS['meta']['auto_compress_js']=='oui'",\r
+       'action' => "ecrire_meta('auto_compress_js', %s?'oui':non);",\r
+));\r
+\r
+}\r
+\r
+?>
\ No newline at end of file