+ /* 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);
+ Banana::$spool = null;
+ }
+ print "\n";
+ }
+ }
+
+ static public function refreshAllFeeds(array $protos)
+ {
+ Banana::load('feed');
+ Banana::$feed_updateOnDemand = true; // In order to force update
+ 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 feed cache for $g: ";
+ Banana::$group = $g;
+ $spool = $banana->loadSpool($g);
+ if (!$banana->checkErrors()) {
+ break;
+ }
+ $feed =& BananaFeed::getFeed();
+ print "done.\n";
+ unset($feed);
+ unset($spool);
+ Banana::$spool = null;
+ }
+ print "\n";
+ }
+ }
+
+ /**************************************************************************/