function loopTillEnd($curArticleNr, $increment = 1000) { $processed = 0; $headersProcessed = 0; $highestMessageId = ''; # make sure we handle articlenumber wrap arounds if ($curArticleNr < $this->_msgdata['first']) { $curArticleNr = $this->_msgdata['first']; } # if $this->displayStatus("groupmessagecount", $this->_msgdata['last'] - $this->_msgdata['first']); $this->displayStatus("firstmsg", $this->_msgdata['first']); $this->displayStatus("lastmsg", $this->_msgdata['last']); $this->displayStatus("curartnr", $curArticleNr); $this->displayStatus("", ""); SpotTiming::start(__CLASS__ . '::' . __FUNCTION__ . ':whileLoop'); while ($curArticleNr < $this->_msgdata['last']) { $timer = microtime(true); # get the list of headers (XOVER) SpotTiming::start(__CLASS__ . '::' . __FUNCTION__ . ':getOverview'); $hdrList = $this->_svcNntpText->getOverview($curArticleNr, $curArticleNr + $increment); SpotTiming::stop(__CLASS__ . '::' . __FUNCTION__ . ':getOverview'); $saveCurArtNr = $curArticleNr; # If no spots were found, just manually increase the # messagenumber with the increment to make sure we advance if (count($hdrList) < 1 || $hdrList[count($hdrList) - 1]['Number'] < $curArticleNr) { $curArticleNr += $increment; } else { $curArticleNr = $hdrList[count($hdrList) - 1]['Number'] + 1; } # else # run the processing method SpotTiming::start(__CLASS__ . '::' . __FUNCTION__ . ':callProcess'); $processOutput = $this->process($hdrList, $saveCurArtNr, $curArticleNr, $timer); SpotTiming::stop(__CLASS__ . '::' . __FUNCTION__ . ':callProcess'); $processed += $processOutput['count']; $headersProcessed += $processOutput['headercount']; $highestMessageId = $processOutput['lastmsgid']; # reset the start time to prevent a another retriever from starting # during the intial retrieve which can take many hours $this->_usenetStateDao->setRetrieverRunning(true); /* * Make sure if we run with timing on, we do not fetch too many * spots as that would make us run out of memory */ if ($processed > 3000 && SpotTiming::isEnabled()) { break; } # if } # while SpotTiming::stop(__CLASS__ . '::' . __FUNCTION__ . ':whileLoop'); # we are done updating, make sure that if the newsserver deleted # earlier retrieved messages, we remove them from our database if ($highestMessageId != '') { SpotDebug::msg(SpotDebug::DEBUG, 'loopTillEnd() finished, highestMessageId = ' . $highestMessageId); $this->removeTooNewRecords($highestMessageId); } # if $this->displayStatus("totalprocessed", $processed); return $headersProcessed; }