/** * Main method. * * @since 0.1 * * @param $arg String */ public function execute($arg) { global $wgOut, $wgUser, $wgVersion, $wgExtensionCredits; $wgOut->setPageTitle(wfMsg('update-title')); // If the user is authorized, display the page, if not, show an error. if ($this->userCanExecute($wgUser)) { $allExtensions = array(); foreach ($wgExtensionCredits as $type => $extensions) { foreach ($extensions as $extension) { if (array_key_exists('name', $extension) && array_key_exists('version', $extension)) { $allExtensions[$extension['name']] = $extension['version']; } } } $repository = wfGetRepository(); $updates = $repository->installationHasUpdates($wgVersion, $allExtensions); if ($updates === false) { $this->showCoreStatus(false); $this->showExtensionStatuses(); } else { // Check if there is a MediaWiki update. if (array_key_exists('MediaWiki', $updates)) { $this->showCoreStatus($updates['MediaWiki']); unset($updates['MediaWiki']); } else { $this->showCoreStatus(false); } $this->showExtensionStatuses($updates, $allExtensions); } } else { $this->displayRestrictionError(); } }
/** * Queries the repository for a list of extensions matching the search criteria * and returns these. * * @since 0.1 * * @param $filterType String * @param $filterValue String * * @return arrau */ protected function findExtenions($filterType, $filterValue) { $repository = wfGetRepository(); return $repository->findExtenions($filterType, $filterValue); }