Exemplo n.º 1
0
 public function doExecute()
 {
     global $wgUser;
     $params = $this->extractRequestParams();
     $form = new PageStabilityProtectForm($wgUser);
     $form->setPage($this->title);
     # Our target page
     $form->setWatchThis($params['watch']);
     # Watch this page
     $form->setReason($params['reason']);
     # Reason
     $form->setReasonSelection('other');
     # Reason dropdown
     $form->setExpiry($params['expiry']);
     # Expiry
     $form->setExpirySelection('other');
     # Expiry dropdown
     $restriction = $params['protectlevel'];
     if ($restriction == 'none') {
         $restriction = '';
         // 'none' => ''
     }
     $form->setAutoreview($restriction);
     # Autoreview restriction
     $form->ready();
     $status = $form->submit();
     // true/error message key
     if ($status !== true) {
         $this->dieUsageMsg(wfMsg($status));
     }
     # Output success line with the title and config parameters
     $res = array();
     $res['title'] = $this->title->getPrefixedText();
     $res['protectlevel'] = $params['protectlevel'];
     $res['expiry'] = $form->getExpiry();
     $this->getResult()->addValue(null, $this->getModuleName(), $res);
 }