Beispiel #1
0
 /**
  * Generates feed's content
  *
  * @param ChannelFeed $feed ChannelFeed subclass object (generally the one returned
  *   by getFeedObject())
  * @param ResultWrapper $rows ResultWrapper object with rows in recentchanges table
  * @param int $lastmod Timestamp of the last item in the recentchanges table (only
  *   used for the cache key)
  * @param FormOptions $opts As in SpecialRecentChanges::getDefaultOptions()
  * @return null|bool True or null
  */
 public function execute($feed, $rows, $lastmod, $opts)
 {
     global $wgLang, $wgRenderHashAppend;
     if (!FeedUtils::checkFeedOutput($this->format)) {
         return null;
     }
     $optionsHash = md5(serialize($opts->getAllValues())) . $wgRenderHashAppend;
     $timekey = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp');
     $key = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash);
     FeedUtils::checkPurge($timekey, $key);
     /**
      * Bumping around loading up diffs can be pretty slow, so where
      * possible we want to cache the feed output so the next visitor
      * gets it quick too.
      */
     $cachedFeed = $this->loadFromCache($lastmod, $timekey, $key);
     if (is_string($cachedFeed)) {
         wfDebug("RC: Outputting cached feed\n");
         $feed->httpHeaders();
         echo $cachedFeed;
     } else {
         wfDebug("RC: rendering new feed and caching it\n");
         ob_start();
         self::generateFeed($rows, $feed);
         $cachedFeed = ob_get_contents();
         ob_end_flush();
         $this->saveToCache($cachedFeed, $timekey, $key);
     }
     return true;
 }