[SPIP] ~maj v2.1.25-->2.1.26
[velocampus/web/www.git] / www / plugins / auto / couteau_suisse / couteau_suisse / outils / spip_cache_config.php
1 <?php
2 if (!defined("_ECRIRE_INC_VERSION")) return;
3
4 # Fichier de configuration pris en compte par config_outils.php et specialement dedie a la configuration du cache SPIP
5 # --------------------------------------------------------------------------------------------------------------------
6
7 function outils_spip_cache_config_dist() {
8
9 // Ajout de l'outil 'spip_cache'
10 add_outil(array(
11 'id' => 'spip_cache',
12 'code:spip_options' => "%%radio_desactive_cache"
13 .(defined('_SPIP19300')?'4%%%%compacte_prive%%%%compacte_tout':'3')
14 ."%%%%duree_cache%%%%duree_cache_mutu%%%%quota_cache%%%%derniere_modif_invalide%%",
15 'categorie' => 'admin',
16 'description' =>
17 (defined('_SPIP19300')
18 ?'<:spip_cache:2:><:spip_cache::><:spip_cache:3:> [[%compacte_css%]][[->%compacte_js%]][[->%compacte_prive%]]'
19 .(defined('_SPIP20200')?'[[->%compacte_tout%]]':'')
20 :'<:spip_cache:1:><:spip_cache::>'),
21 ));
22
23 // Ajout des variables utilisees ci-dessus
24 add_variables(
25
26 // SPIP<=1.92
27 array(
28 'nom' => 'radio_desactive_cache3',
29 'format' => _format_NOMBRE,
30 'radio' => array(0 => 'couteauprive:cache_nornal', 1 => 'couteauprive:cache_sans'),
31 'defaut' => 0,
32 // si la variable est egale a 1, on code (jquery.js et forms_styles.css restent en cache)
33 'code:%s' => defined('_SPIP19300')?'':"\$cs_fond = isset(\$GLOBALS['fond'])?\$GLOBALS['fond']:_request('page');
34 if (!in_array(\$cs_fond, array('jquery.js','forms_styles.css'))) \$_SERVER['REQUEST_METHOD']='POST';\n",
35 ),
36
37 /*
38 pour SPIP 2.0 :
39 define('_NO_CACHE',0); -> toujours prendre tous les fichiers en cache
40 define('_NO_CACHE',-1); -> ne jamais utiliser le cache ni meme creer les fichiers cache
41 define('_NO_CACHE',1); -> ne pas utiliser le fichier en cache, mais stocker le resultat du calcul dans le fichier cache
42 La fonction cache_valide() retourne :
43 '1' si il faut mettre le cache a jour, '0' si le cache est valide, '-1' s'il faut calculer sans stocker en cache
44 */
45 array(
46 'nom' => 'radio_desactive_cache4',
47 'format' => _format_NOMBRE,
48 'radio' => array(2 => 'couteauprive:cache_nornal', 0 => 'couteauprive:cache_permanent', -1 => 'couteauprive:cache_sans', 1 => 'couteauprive:cache_controle'),
49 'radio/ligne' => 2,
50 'defaut' => 2,
51 'code:%s!=2' => "define('_NO_CACHE',%s);\n",
52 ), array(
53 'nom' => 'duree_cache',
54 'format' => _format_NOMBRE,
55 'defaut' => "24", // 1 jour
56 'code' => "\$GLOBALS['delais']=%s*3600;\n",
57 ), array(
58 'nom' => 'duree_cache_mutu',
59 'format' => _format_NOMBRE,
60 'defaut' => "24", // 1 jour
61 'code:%s!=24' => "define('_DUREE_CACHE_DEFAUT', %s*3600);\n",
62 ), array(
63 'nom' => 'quota_cache',
64 'format' => _format_NOMBRE,
65 'defaut' => 10, // 10 Mo
66 'code:%s!=10' => "\$GLOBALS['quota_cache']=%s;\n",
67 ), array(
68 'nom' => 'derniere_modif_invalide',
69 'format' => _format_NOMBRE,
70 'radio' => array(0 => 'item_oui', 1 => 'item_non'),
71 'defaut' => 0,
72 'code:%s' => "\$GLOBALS['derniere_modif_invalide']=false;\n",
73 ), array(
74 'nom' => 'compacte_tout',
75 'check' => 'couteauprive:compacte_tout',
76 'defaut' => 0,
77 'code:%s' => "define('_INTERDIRE_COMPACTE_HEAD',1);\n",
78 ), array(
79 'nom' => 'compacte_prive',
80 'check' => 'couteauprive:compacte_prive',
81 'defaut' => 0,
82 'code:%s' => "define('_INTERDIRE_COMPACTE_HEAD_ECRIRE',1);\n",
83 ), array(
84 'nom' => 'compacte_css',
85 'check' => 'couteauprive:compacte_css',
86 // variable externe au Couteau Suisse
87 'externe' => "\$GLOBALS['meta']['auto_compress_css']=='oui'",
88 // action lors d'un changement de valeur
89 'action' => "ecrire_meta('auto_compress_css', %s?'oui':non);",
90 ), array(
91 'nom' => 'compacte_js',
92 'check' => 'couteauprive:compacte_js',
93 'externe' => "\$GLOBALS['meta']['auto_compress_js']=='oui'",
94 'action' => "ecrire_meta('auto_compress_js', %s?'oui':non);",
95 ));
96
97 }
98
99 ?>