/**
  * @desc Changes city_flags field in city_visualization table
  *
  * @param string $type one of: 'block', 'unblock', 'promote', 'remove-promote'
  * @requestParam integer $wikiId id of wiki that flags we want to change
  * @requestParam integer $corpWikiId id of wiki which "hosts" visualization
  * @requestParam string $lang language code of wiki which "hosts" visualization
  */
 protected function changeFlag($type)
 {
     $this->wf->ProfileIn(__METHOD__);
     $wikiId = $this->request->getInt('wikiId', 0);
     $corpWikiId = $this->request->getInt('corpWikiId', 0);
     $langCode = $this->request->getVal('lang', 'en');
     switch ($type) {
         case self::FLAG_TYPE_BLOCK:
             $result = $this->helper->setFlag($wikiId, WikisModel::FLAG_BLOCKED, $corpWikiId, $langCode);
             break;
         case self::FLAG_TYPE_UNBLOCK:
             $result = $this->helper->removeFlag($wikiId, WikisModel::FLAG_BLOCKED, $corpWikiId, $langCode);
             break;
         case self::FLAG_TYPE_PROMOTE:
             $result = $this->helper->setFlag($wikiId, WikisModel::FLAG_PROMOTED, $corpWikiId, $langCode);
             break;
         case self::FLAG_TYPE_DEMOTE:
             $result = $this->helper->removeFlag($wikiId, WikisModel::FLAG_PROMOTED, $corpWikiId, $langCode);
             break;
         default:
             $result = false;
             break;
     }
     $this->wf->ProfileOut(__METHOD__);
     return $result;
 }
 /**
  * @desc Changes city_flags field in city_visualization table
  *
  * @requestParam string $type one of: self::CHANGE_FLAG_ADD or self::CHANGE_FLAG_REMOVE
  * @requestParam integer $flag from WikisModel which should be changed
  * @requestParam integer $wikiId id of wiki that flags we want to change
  * @requestParam integer $corpWikiId id of wiki which "hosts" visualization
  * @requestParam string $lang language code of wiki which "hosts" visualization
  *
  * @return bool
  */
 public function changeFlag()
 {
     wfProfileIn(__METHOD__);
     if (!$this->checkAccess()) {
         $this->status = false;
     } else {
         $type = $this->request->getVal('type');
         $flag = $this->request->getInt('flag');
         $wikiId = $this->request->getInt('wikiId', 0);
         $corpWikiId = $this->request->getInt('corpWikiId', 0);
         $langCode = $this->request->getVal('lang', 'en');
         if ($type == self::CHANGE_FLAG_ADD) {
             $this->status = $this->helper->setFlag($wikiId, $flag, $corpWikiId, $langCode);
         } else {
             $this->status = $this->helper->removeFlag($wikiId, $flag, $corpWikiId, $langCode);
         }
     }
     wfProfileOut(__METHOD__);
 }