/**
  * Show the special page
  *
  * @param $query Mixed: parameter passed to the special page or null
  */
 public function execute($query)
 {
     global $wgUser, $wgOut;
     // Check that the user is allowed to access this special page
     if (!$wgUser->isAllowed('admanager')) {
         $wgOut->permissionRequired('admanager');
         return;
     }
     // Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     // If user is blocked, s/he doesn't need to access this page
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage(false);
         return false;
     }
     // Set the page title, robot policies, etc.
     $this->setHeaders();
     // Add CSS via ResourceLoader
     if (defined('MW_SUPPORTS_RESOURCE_MODULES')) {
         $wgOut->addModuleStyles('mediawiki.special');
     }
     $fullTableName = AD_ZONES_TABLE;
     $dbr = wfGetDB(DB_SLAVE);
     if (AdManagerUtils::checkForAndDisplayError($dbr->tableExists($fullTableName), 'admanager_notable')) {
         return;
     }
     $this->doSpecialAdManagerZones();
 }
 /**
  * Show the special page
  *
  * @param $query Mixed: parameter passed to the special page or null
  */
 public function execute($query)
 {
     global $wgUser, $wgOut;
     // Check that the user is allowed to access this special page
     if (!$wgUser->isAllowed('admanager')) {
         $wgOut->permissionRequired('admanager');
         return;
     }
     // Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     // If user is blocked, s/he doesn't need to access this page
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage(false);
         return false;
     }
     // Set the page title, robot policies, etc.
     $this->setHeaders();
     // Add CSS via ResourceLoader
     if (defined('MW_SUPPORTS_RESOURCE_MODULES')) {
         $wgOut->addModuleStyles('mediawiki.special');
     }
     $dbr = wfGetDB(DB_SLAVE);
     $fullTableName = AD_TABLE;
     $fullTableNameZones = AD_ZONES_TABLE;
     if (AdManagerUtils::checkForAndDisplayError($dbr->tableExists($fullTableName) && $dbr->tableExists($fullTableNameZones), 'admanager_notable')) {
         return;
     }
     $currentZones = $dbr->select($fullTableNameZones, array('*'), array(), __METHOD__);
     if (AdManagerUtils::checkForAndDisplayError($currentZones->numRows() > 0, 'admanager_noAdManagerZones')) {
         return;
     }
     // Fetch current zones table into array
     $this->adManagerZones = array();
     while ($currentRow = $currentZones->fetchObject()) {
         $this->adManagerZones[] = $currentRow->ad_zone_id;
     }
     $this->adManagerZones[] = wfMsg('admanager_noads');
     $this->doSpecialAdManager();
 }