diff --git a/ecrire/inc_cron.php3 b/ecrire/inc_cron.php3 index 4573cb0665977909cf77bfeefe238e9c0dd3318c..b61bc31400b38dc066033d7f3e3fbb66cf81b79e 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 bdd08c7805f199d4900e8eeced9cf6d3d2d4f9ff..bfbf312c9a8b345c496dc935ac32db912bee667b 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") {