From e926f0de8983b8a55037920ca337c2a72dd87c76 Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <pitrou@free.fr>
Date: Sun, 15 Jun 2003 20:17:00 +0000
Subject: [PATCH] =?UTF-8?q?cosm=C3=A9tique=20log?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 inc-public-global.php3 | 18 +++++++++++-------
 inc-public.php3        |  5 ++---
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/inc-public-global.php3 b/inc-public-global.php3
index c494e03521..82278ae1b0 100644
--- a/inc-public-global.php3
+++ b/inc-public-global.php3
@@ -24,12 +24,14 @@ function inclure_fichier($fond, $delais, $contexte_inclus = "") {
 
 	if (!$use_cache) {
 		include_local("inc-calcul.php3");
+		$timer_a = explode(" ", microtime());
 		$fond = chercher_squelette($fond, $contexte_inclus['id_rubrique']);
-		$timer_a = time(); $timer_b = microtime();
 		$page = calculer_page($fond, $contexte_inclus);
+		$timer_b = explode(" ", microtime());
 		if ($page) {
-			$timer = ceil(1000*(time()-$timer_a + microtime() - $timer_b));
-			spip_log("inclus ${timer}ms: $chemin_cache (${delais}s)");
+			$timer = ceil(1000 * ($timer_b[0] + $timer_b[1] - $timer_a[0] - $timer_a[1]));
+			$taille = ceil(strlen($page) / 1024);
+			spip_log("inclus ($timer ms): $chemin_cache ($taille ko, delai: $delais s)");
 			ecrire_fichier_cache($chemin_cache, $page);
 		}
 	}
@@ -114,11 +116,13 @@ if (!$use_cache) {
 
 	if ($calculer_cache) {
 		include_local ("inc-calcul.php3");
-		$timer_a = time(); $timer_b = microtime();
+		$timer_a = explode(" ", microtime());
 		$page = calculer_page_globale($fond);
+		$timer_b = explode(" ", microtime());
 		if ($page) {
-			$timer = ceil(1000*(time()-$timer_a + microtime() - $timer_b));
-			spip_log("calcul ${timer}ms: $chemin_cache (${delais}s)");
+			$timer = ceil(1000 * ($timer_b[0] + $timer_b[1] - $timer_a[0] - $timer_a[1]));
+			$taille = ceil(strlen($page) / 1024);
+			spip_log("calcul ($timer ms): $chemin_cache ($taille ko, delai: $delais s)");
 			ecrire_fichier_cache($chemin_cache, $page);
 		}
 	}
@@ -173,7 +177,7 @@ if ($var_recherche) {
 
 // nettoie
 if ($effacer_cache) @unlink($chemin_cache);
-while (list(,$chemin_cache_supprime) = each ($cache_supprimes))
+while (list(, $chemin_cache_supprime) = each($cache_supprimes))
 	@unlink($chemin_cache_supprime);
 
 //
diff --git a/inc-public.php3 b/inc-public.php3
index 2b8a6aa801..745a222f12 100644
--- a/inc-public.php3
+++ b/inc-public.php3
@@ -6,9 +6,8 @@ if (!defined("_INC_PUBLIC")) {
 }
 else {
 	$cache_inclus = inclure_fichier($fond, $delais, $contexte_inclus);
-	if (!$delais)
-		$cache_supprimes[]=$cache_inclus; // message pour suppression
+	if (!$delais) $cache_supprimes[] = $cache_inclus; // message pour suppression
 	include($cache_inclus);
 }
 
-?>
\ No newline at end of file
+?>
-- 
GitLab