From 35740e302753e7ddd2c77c70d56d8c1328480f20 Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Fri, 3 Dec 2004 21:59:44 +0000 Subject: [PATCH] plus jolis logs de spip_cron --- ecrire/inc_cron.php3 | 46 +++++++++++++++++++++++------------------- inc-public-global.php3 | 6 +++--- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/ecrire/inc_cron.php3 b/ecrire/inc_cron.php3 index 4573cb0665..b61bc31400 100644 --- a/ecrire/inc_cron.php3 +++ b/ecrire/inc_cron.php3 @@ -56,31 +56,35 @@ function spip_cron($taches=array()) { } } - if (!$taches) $taches = taches_generales(); + if (!$taches) + $taches = taches_generales(); include_ecrire("inc_meta.php3"); - foreach ($taches as $tache) - { - $lock = _DIR_SESSIONS . $tache . '.lock'; - clearstatcache(); - $last = (@file_exists($lock) ? filemtime($lock) : 0); - - if (($t - $frequence_taches[$tache]) > $last) { - @touch($lock); - include_ecrire('inc_' . $tache . _EXTENSION_PHP); - $fonction = 'cron_' . $tache; - $code_de_retour = $fonction($t); - if ($code_de_retour) { - $msg = $GLOBALS['PHP_SELF'] . ": tache $tache"; - if ($code_de_retour < 0) { - @touch($lock, $last); - spip_log($msg . " en cours"); + + foreach ($taches as $tache) { + $lock = _DIR_SESSIONS . $tache . '.lock'; + clearstatcache(); + $last = (@file_exists($lock) ? filemtime($lock) : 0); + + if (($t - $frequence_taches[$tache]) > $last) { + @touch($lock); + spip_timer('tache'); + include_ecrire('inc_' . $tache . _EXTENSION_PHP); + $fonction = 'cron_' . $tache; + $code_de_retour = $fonction($t); + if ($code_de_retour) { + $msg = "cron: $tache"; + if ($code_de_retour < 0) { + @touch($lock, $last); + spip_log($msg . " (en cours, " . spip_timer('tache') .")"); + spip_timer('tache'); + } + else + spip_log($msg . " (" . spip_timer('tache') . ")"); + break; } - else spip_log($msg . " faite en " . (time() - $t) . " secondes"); - break; } - } - } + } } // Construction de la liste ordonnee des taches. diff --git a/inc-public-global.php3 b/inc-public-global.php3 index bdd08c7805..bfbf312c9a 100644 --- a/inc-public-global.php3 +++ b/inc-public-global.php3 @@ -200,11 +200,11 @@ function terminer_public_global($use_cache, $chemin_cache='') { // Si on a pu utiliser un cache, // il reste du temps pour une tache de fond, notamment le cache - if ($use_cache) - { + if ($use_cache) { include_ecrire('inc_cron.php3'); spip_cron(); - } + } + // Gestion des statistiques du site public // (a la fin pour ne pas forcer le $db_ok) if (lire_meta("activer_statistiques") != "non") { -- GitLab