X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fbanana.inc.php.in;h=df1768b4a5399edeef608ae4664319febdf048b0;hb=b052aab700be8ff1e786df137be250bc4f51b4c5;hp=f4b19b0880e2d90150fc849ab9a8d9898f555b7b;hpb=57efc445e11b5420269ba7c4a90ae534ae44771f;p=banana.git diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index f4b19b0..df1768b 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -445,6 +445,49 @@ class Banana } /**************************************************************************/ + /* Spoolgen functions */ + /**************************************************************************/ + + private function checkErrors() + { + if (Banana::$protocole->lastErrno()) { + echo "\nL'erreur suivante s'est produite : " + . Banana::$protocole->lastErrno() . " " + . Banana::$protocole->lastError() . "\n"; + return false; + } + return true; + } + + static public function createAllSpool(array $protos) + { + foreach ($protos as $proto) { + $banana = new Banana(array(), $proto); + + if (!$banana->checkErrors()) { + continue; + } + $groups = Banana::$protocole->getBoxList(); + if (!$banana->checkErrors()) { + continue; + } + + print "** $proto **\n"; + foreach (array_keys($groups) as $g) { + print "Generating spool for $g : "; + Banana::$group = $g; + $spool = $banana->loadSpool($g); + if (!$banana->checkErrors()) { + break; + } + print "done.\n"; + unset($spool); + } + print "\n"; + } + } + + /**************************************************************************/ /* Private functions */ /**************************************************************************/ @@ -456,6 +499,10 @@ class Banana if ($group == @$_SESSION['banana_group'] && isset($_SESSION['banana_spool'])) { Banana::$spool = unserialize($_SESSION['banana_spool']); $clean = @(Banana::$profile['lastnews'] != $_SESSION['banana_lastnews']); + } else { + unset($_SESSION['banana_message']); + unset($_SESSION['banana_artid']); + unset($_SESSION['banana_showhdr']); } BananaSpool::getSpool($group, Banana::$profile['lastnews'], Banana::$profile['autoup'] || $clean); $_SESSION['banana_group'] = $group;