[SPIP] ~version 3.0.7-->3.0.10
[ptitvelo/web/www.git] / www / ecrire / public / cacher.php
index 6602aee..7f1a0ec 100644 (file)
@@ -114,7 +114,9 @@ function cache_valide(&$page, $date) {
        if (defined('_VAR_NOCACHE') AND _VAR_NOCACHE) return -1;
        if (isset($GLOBALS['meta']['cache_inhib']) AND $_SERVER['REQUEST_TIME']<$GLOBALS['meta']['cache_inhib']) return -1;
        if (defined('_NO_CACHE')) return (_NO_CACHE==0 AND !isset($page['texte']))?1:_NO_CACHE;
-       if (!$page OR !isset($page['texte']) OR !isset($page['entetes']['X-Spip-Cache'])) return 1;
+
+       // pas de cache ? on le met a jour, sauf pour les bots (on leur calcule la page sans mise en cache)
+       if (!$page OR !isset($page['texte']) OR !isset($page['entetes']['X-Spip-Cache'])) return _IS_BOT?-1:1;
 
        // #CACHE{n,statique} => on n'invalide pas avec derniere_modif
        // cf. ecrire/public/balises.php, balise_CACHE_dist()
@@ -144,7 +146,8 @@ function cache_valide(&$page, $date) {
        $duree = intval($page['entetes']['X-Spip-Cache']);
        if ($duree == 0)  #CACHE{0}
                return -1;
-       else if ($date + $duree < time())
+       // sauf pour les bots, qui utilisent toujours le cache
+       else if (!_IS_BOT AND $date + $duree < time())
                return 1;
        else
                return 0;