Completed
Push — master ( 973190...c61990 )
by cam
04:49
created
ecrire/public/cacher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 function generer_nom_fichier_cache($contexte, $page) {
30 30
 	$u = md5(var_export(array($contexte, $page), true));
31 31
 
32
-	return $u . ".cache";
32
+	return $u.".cache";
33 33
 }
34 34
 
35 35
 /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	$rep = sous_repertoire($rep, '', false, true);
47 47
 	$rep = sous_repertoire($rep, $d, false, true);
48 48
 
49
-	return ecrire_fichier($rep . $u . ".cache", serialize(array("nom_cache" => $nom_cache, "valeur" => $valeur)));
49
+	return ecrire_fichier($rep.$u.".cache", serialize(array("nom_cache" => $nom_cache, "valeur" => $valeur)));
50 50
 }
51 51
 
52 52
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 function lire_cache($nom_cache) {
59 59
 	$d = substr($nom_cache, 0, 2);
60 60
 	$u = substr($nom_cache, 2, 2);
61
-	if (file_exists($f = _DIR_CACHE . "$d/$u.cache")
61
+	if (file_exists($f = _DIR_CACHE."$d/$u.cache")
62 62
 		and lire_fichier($f, $tmp)
63 63
 		and $tmp = unserialize($tmp)
64 64
 		and $tmp['nom_cache'] == $nom_cache
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			), 'non');
85 85
 	}
86 86
 
87
-	return crc32($GLOBALS['meta']['cache_signature'] . $page['texte']);
87
+	return crc32($GLOBALS['meta']['cache_signature'].$page['texte']);
88 88
 }
89 89
 
90 90
 /**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		// "cache sessionne" ; sa date indique la date de validite
239 239
 		// des caches sessionnes
240 240
 		if (!$tmp = lire_cache($chemin_cache)) {
241
-			spip_log('Creation cache sessionne ' . $chemin_cache);
241
+			spip_log('Creation cache sessionne '.$chemin_cache);
242 242
 			$tmp = array(
243 243
 				'invalideurs' => array('session' => ''),
244 244
 				'lastmodified' => $_SERVER['REQUEST_TIME']
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	// l'enregistrer, compresse ou non...
263 263
 	$ok = ecrire_cache($chemin_cache, $pagez);
264 264
 
265
-	spip_log((_IS_BOT ? "Bot:" : "") . "Creation du cache $chemin_cache pour "
266
-		. $page['entetes']['X-Spip-Cache'] . " secondes" . ($ok ? '' : ' (erreur!)'), _LOG_INFO);
265
+	spip_log((_IS_BOT ? "Bot:" : "")."Creation du cache $chemin_cache pour "
266
+		. $page['entetes']['X-Spip-Cache']." secondes".($ok ? '' : ' (erreur!)'), _LOG_INFO);
267 267
 
268 268
 	// Inserer ses invalideurs
269 269
 	include_spip('inc/invalideur');
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 function nettoyer_petit_cache($prefix, $duree = 300) {
286 286
 	// determiner le repertoire a purger : 'tmp/CACHE/rech/'
287 287
 	$dircache = sous_repertoire(_DIR_CACHE, $prefix);
288
-	if (spip_touch($dircache . 'purger_' . $prefix, $duree, true)) {
288
+	if (spip_touch($dircache.'purger_'.$prefix, $duree, true)) {
289 289
 		foreach (preg_files($dircache, '[.]txt$') as $f) {
290 290
 			if ($_SERVER['REQUEST_TIME'] - (@file_exists($f) ? @filemtime($f) : 0) > $duree) {
291 291
 				spip_unlink($f);
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 		if (spip_connect()) {
376 376
 			include_spip('inc/invalideur');
377 377
 			retire_caches($chemin_cache); # API invalideur inutile
378
-			supprimer_fichier(_DIR_CACHE . $chemin_cache);
378
+			supprimer_fichier(_DIR_CACHE.$chemin_cache);
379 379
 			if (isset($chemin_cache_session) and $chemin_cache_session) {
380
-				supprimer_fichier(_DIR_CACHE . $chemin_cache_session);
380
+				supprimer_fichier(_DIR_CACHE.$chemin_cache_session);
381 381
 			}
382 382
 		}
383 383
 	}
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		$page = array('contexte_implicite' => $contexte_implicite); // ignorer le cache deja lu
393 393
 		include_spip('inc/invalideur');
394 394
 		retire_caches($chemin_cache); # API invalideur inutile
395
-		supprimer_fichier(_DIR_CACHE . $chemin_cache);
395
+		supprimer_fichier(_DIR_CACHE.$chemin_cache);
396 396
 		if (isset($chemin_cache_session) and $chemin_cache_session) {
397
-			supprimer_fichier(_DIR_CACHE . $chemin_cache_session);
397
+			supprimer_fichier(_DIR_CACHE.$chemin_cache_session);
398 398
 		}
399 399
 	}
400 400
 
Please login to merge, or discard this patch.