Exemple #1
0
 /**
  * Checks if there are any updates for MediaWiki core.
  * Found updates are added to the API call result.
  * 
  * @since 0.1
  * 
  * @param $mwVersion String
  * @param $states Array: a list of allowed release states.
  */
 protected function checkForCoreUpdates($mwVersion, array $states)
 {
     $latestRelease = ReleaseRepo::singleton()->getLatestStableRelease();
     if ($latestRelease !== false && version_compare($latestRelease->getNumber(), $mwVersion, '>')) {
         $this->getResult()->addValue(null, 'mediawiki', $latestRelease->getNumber());
     }
 }
 public static function singleton()
 {
     if (is_null(self::$_i)) {
         self::$_i = new self();
     }
     return self::$_i;
 }
 public function execute()
 {
     $results = array();
     $params = $this->extractRequestParams();
     $releases = $params['allreleases'] ? ReleaseRepo::singleton()->getAllReleases() : ReleaseRepo::singleton()->getSupportedReleases();
     foreach ($releases as $release) {
         $r = array();
         if (ReleaseRepo::singleton()->getLatestStableRelease()->getId() == $release->getId()) {
             $r['latest'] = '';
         }
         foreach ($params['prop'] as $prop) {
             switch ($prop) {
                 case 'name':
                     $r['name'] = $release->getName();
                     break;
                 case 'number':
                     $r['number'] = $release->getNumber();
                     break;
                 case 'reldate':
                     $r['reldate'] = $release->getReldate();
                     break;
                 case 'eoldate':
                     $r['eoldate'] = $release->getEoldate();
                     break;
                 case 'tagurl':
                     $r['tagurl'] = $release->getTagUrl();
                     break;
                 case 'branchurl':
                     $r['branchurl'] = $release->getBranchUrl();
                     break;
                 case 'announceurl':
                     $r['announceturl'] = $release->getAnnounceUrl();
                     break;
                 case 'supported':
                     if ($release->isSupported()) {
                         $r['supported'] = '';
                     }
                     break;
             }
         }
         $results[] = $r;
     }
     $this->getResult()->setIndexedTagName($results, 'release');
     $this->getResult()->addValue(null, $this->getModuleName(), $results);
 }
 public function execute($par)
 {
     global $wgUser, $wgRequest, $wgOut;
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     $this->setHeaders();
     $this->rels = ReleaseRepo::singleton();
     $this->out = $wgOut;
     $this->skin = $wgUser->getSkin();
     $params = explode('/', $par);
     switch ($params[0]) {
         case 'edit':
             if (isset($params[1])) {
                 if ($wgRequest->wasPosted()) {
                     $this->postEdit($params[1], $wgRequest);
                 }
                 $this->showEdit($params[1]);
             }
             break;
         case 'delete':
             if (isset($params[1])) {
                 if ($wgRequest->wasPosted()) {
                     $this->postDelete($params[1], $wgRequest);
                 } else {
                     $this->showDelete($params[1]);
                     break;
                 }
             }
         case 'add':
             if ($wgRequest->wasPosted()) {
                 $this->postAdd($wgRequest);
             }
             $this->showAdd();
             break;
         default:
             $this->showList();
     }
 }
 public function execute($par)
 {
     $this->setHeaders();
     $releases = ReleaseRepo::singleton()->getSupportedReleases();
 }