diff --git a/ecrire/inc_cron.php3 b/ecrire/inc_cron.php3 index 1959c42b091df5a1eaf1e92818d28d39504e3f34..ebbf67534c424c5b6b26398de84a856a9cadddf6 100644 --- a/ecrire/inc_cron.php3 +++ b/ecrire/inc_cron.php3 @@ -101,15 +101,6 @@ function spip_cron($taches = array()) { // Un autre lock dans _DIR_SESSIONS, pour plus de securite $lock = _DIR_SESSIONS . $tache . '.lock'; if (spip_touch($lock, $taches[$tache])) { - - // essayer d'eviter la lenteur d'affichage en envoyant 16 ko de - // donnees invisibles (aleatoires pour contrer la compression) - if (!$GLOBALS['flag_preserver']) { - $b = array(' ',"\t", "\n"); - for ($i=0;$i<16*1024;$i++) echo $b[rand(0,2)]; - } - flush(); ob_flush(); - // preparer la tache spip_timer('tache'); include_ecrire('inc_' . $tache); diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index bb355410c2b42594e303f0e553cf72cf20dd9fc0..74fdeb154a16d8c4370e994bb40aec84ec627e82 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -3252,18 +3252,15 @@ function fin_page($credits='') { debut_grand_cadre(); # ici on en profite pour glisser une tache de fond - echo "<div align='right' class='verdana2' style='background: url(\"", - generer_url_public('spip_background'), - "\");'>"; + + echo generer_spip_cron(); if ($spip_display == 4) { echo "<div><a href='./?set_disp=2'>", _T("access_interface_graphique"), "</a></div>"; } else { - echo info_copyright(); - echo "<br>"._T('info_copyright_doc'); - echo "</div><p>"; + echo info_copyright(), "<br />"._T('info_copyright_doc'); } fin_grand_cadre(); diff --git a/ecrire/inc_utils.php b/ecrire/inc_utils.php index 84c912c34795193cadbf6f3c813d0c2b98b1a9b2..64d00faa2c2d5deaa76ecc55474b0523c71a76c8 100644 --- a/ecrire/inc_utils.php +++ b/ecrire/inc_utils.php @@ -432,12 +432,41 @@ function spip_touch($fichier, $duree=0, $touch=true) { return false; } +// Pour executer des taches de fond discretement, on utilise background-image +// car contrairement a un iframe vide, les navigateurs ne diront pas qu'ils +// n'ont pas fini de charger, c'est plus rassurant. +// C'est aussi plus discret qu'un <img> sous un navigateur non graphique. +// Cette fonction est utilisee pour l'espace prive (cf inc_presentation) +// et pour l'espace public (cf #SPIP_CRON dans inc_balise) + +function generer_spip_cron() { + return '<div align="right" class="verdana2" style="background-image: url(\'' . + generer_url_public('spip_action.php', 'action=cron') . + '\');">'; +} + +// envoi de l'image demandee dans le code ci-dessus + +function spip_action_cron() { + + $image = pack("H*", "47494638396118001800800000ffffff00000021f90401000000002c0000000018001800000216848fa9cbed0fa39cb4da8bb3debcfb0f86e248965301003b"); + header("Content-Type: image/gif"); + header("Content-Length: ".strlen($image)); + header("Cache-Control: no-cache,no-store"); + header("Pragma: no-cache"); + header("Connection: close"); + echo $image; + flush(); + cron (1); +} + // // cron() : execution des taches de fond -// quand il est appele par spip_background, il est gourmand ; -// quand il est appele par inc-public il n'est pas gourmand -// -function cron($gourmand = false) { +// quand il est appele par inc-public.php il n'est pas gourmand; +// quand il est appele par spip_action.php, il est gourmand + +function cron ($gourmand=false) { + // Si on est gourmand, ou si le fichier gourmand n'existe pas // (ou est trop vieux -> 60 sec), on va voir si un cron est necessaire. // Au passage si on est gourmand on le dit aux autres @@ -454,7 +483,6 @@ function cron($gourmand = false) { } - // // Entetes les plus courants (voir inc_headers.php pour les autres) // diff --git a/inc-balises.php3 b/inc-balises.php3 index 7ca468e9861e4077bda674b78ed10097017e4329..81f5abf3eb2e902ed3d0b8ec64958674163bdff2 100644 --- a/inc-balises.php3 +++ b/inc-balises.php3 @@ -382,7 +382,7 @@ function balise_FIN_SURLIGNE_dist($p) { // quasiment jamais se trouver ralenti par des taches de fond un peu lentes // ATTENTION: cette balise efface parfois les boutons admin implicites function balise_SPIP_CRON_dist ($p) { - $p->code = "'<div style=\\'position: absolute; background-image: url(\"spip_background" . _EXTENSION_PHP . "\"); height: 1px; width: 1px;\\'></div>'"; + $p->code = '"' . str_replace('"', '\"', (generer_spip_cron())) . '"'; $p->interdire_scripts = false; return $p; } diff --git a/spip_background.php3 b/spip_background.php3 deleted file mode 100644 index 9772dad81b2a07927422c03cb11025b756bd1a99..0000000000000000000000000000000000000000 --- a/spip_background.php3 +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -/***************************************************************************\ - * SPIP, Systeme de publication pour l'internet * - * * - * Copyright (c) 2001-2006 * - * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * - * * - * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * - * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * -\***************************************************************************/ - - -// Du cote de la page HTML, utiliser un background-image en feuille de style -// plutot qu'un <img>, c'est plus discret notamment sous navigateur texte -$image = pack("H*", "47494638396118001800800000ffffff00000021f90401000000002c0000000018001800000216848fa9cbed0fa39cb4da8bb3debcfb0f86e248965301003b"); - -Header("Content-Type: image/gif"); -Header("Content-Length: ".strlen($image)); -Header("Cache-Control: no-cache,no-store"); -Header("Pragma: no-cache"); -Header("Connection: close"); - -echo $image; - -flush(); - -include("ecrire/inc_version.php3"); - -$GLOBALS['flag_preserver'] = true; // pas d'espaces pour le flush() -cron(1); // acces gourmand (on veut bosser, nous, pas comme inc-public !) - -?>