示例#1
0
 public function execute()
 {
     wfProfileIn(__METHOD__);
     $params = $this->extractRequestParams();
     global $wgFeedClasses;
     if (!isset($wgFeedClasses[$params['feedformat']])) {
         wfProfileOut(__METHOD__);
         $this->dieUsage('Invalid subscription feed type', 'feed-invalid');
     }
     $language = isset($params['language']) ? $params['language'] : false;
     if ($language !== false && !Language::isValidCode($language)) {
         $language = false;
     }
     $feeds = FeaturedFeeds::getFeeds($language);
     $ourFeed = $feeds[$params['feed']];
     $feedClass = new $wgFeedClasses[$params['feedformat']]($ourFeed->title, $ourFeed->description, wfExpandUrl(Title::newMainPage()->getFullURL()));
     ApiFormatFeedWrapper::setResult($this->getResult(), $feedClass, $ourFeed->getFeedItems());
     // Cache stuff in squids
     $this->getMain()->setCacheMode('public');
     $this->getMain()->setCacheMaxAge(FeaturedFeeds::getMaxAge());
     wfProfileOut(__METHOD__);
 }