protected function reallyDoCheckParameters()
 {
     # WMF temp hack...protection limit quota
     global $wgFlaggedRevsProtectQuota;
     $oldConfig = $this->getOldConfig();
     if (isset($wgFlaggedRevsProtectQuota) && $this->autoreview != '' && FRPageConfig::getProtectionLevel($oldConfig) == 'none') {
         $dbw = wfGetDB(DB_MASTER);
         $count = $dbw->selectField('flaggedpage_config', 'COUNT(*)', '', __METHOD__);
         if ($count >= $wgFlaggedRevsProtectQuota) {
             return 'stabilize_protect_quota';
         }
     }
     # Autoreview only when protecting currently unprotected pages
     $this->reviewThis = FRPageConfig::getProtectionLevel($oldConfig) == 'none';
     # Autoreview restriction => use stable
     # No autoreview restriction => site default
     $this->override = $this->autoreview != '' ? 1 : (int) FlaggedRevs::isStableShownByDefault();
     // site default
     # Check that settings are a valid protection level...
     $newConfig = array('override' => $this->override, 'autoreview' => $this->autoreview);
     if (FRPageConfig::getProtectionLevel($newConfig) == 'invalid') {
         return 'stabilize_invalid_level';
         // double-check configuration
     }
     # Check autoreview restriction setting
     if (!FlaggedRevs::userCanSetAutoreviewLevel($this->user, $this->autoreview)) {
         return 'stabilize_denied';
         // invalid value
     }
     return true;
 }
 protected function buildSelector($selected)
 {
     $allowedLevels = array();
     $levels = FlaggedRevs::getRestrictionLevels();
     array_unshift($levels, '');
     // Add a "none" level
     foreach ($levels as $key) {
         # Don't let them choose levels they can't set,
         # but *show* them all when the form is disabled.
         if ($this->form->isAllowed() && !FlaggedRevs::userCanSetAutoreviewLevel($this->getUser(), $key)) {
             continue;
         }
         $allowedLevels[] = $key;
     }
     $id = 'mwProtect-level-autoreview';
     $attribs = array('id' => $id, 'name' => $id, 'size' => count($allowedLevels)) + $this->disabledAttr();
     $out = Xml::openElement('select', $attribs);
     foreach ($allowedLevels as $key) {
         $out .= Xml::option($this->getOptionLabel($key), $key, $key == $selected);
     }
     $out .= Xml::closeElement('select');
     return $out;
 }