当前位置: 首页>>代码示例>>PHP>>正文


PHP Status::getErrorsArray方法代码示例

本文整理汇总了PHP中Status::getErrorsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getErrorsArray方法的具体用法?PHP Status::getErrorsArray怎么用?PHP Status::getErrorsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Status的用法示例。


在下文中一共展示了Status::getErrorsArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showStatusMessage

 public function showStatusMessage(Status $status)
 {
     $warnings = array_merge($status->getWarningsArray(), $status->getErrorsArray());
     if (count($warnings) !== 0) {
         foreach ($warnings as $w) {
             call_user_func_array(array($this, 'showMessage'), $w);
         }
     }
     if (!$status->isOk()) {
         echo "\n";
         exit;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:CliInstaller.php

示例2: getErrorFromStatus

 /**
  * Get error (as code, string) from a Status object.
  *
  * @since 1.23
  * @param Status $status
  * @return array Array of code and error string
  * @throws MWException
  */
 public function getErrorFromStatus($status)
 {
     if ($status->isGood()) {
         throw new MWException('Successful status passed to ApiBase::dieStatus');
     }
     $errors = $status->getErrorsArray();
     if (!$errors) {
         // No errors? Assume the warnings should be treated as errors
         $errors = $status->getWarningsArray();
     }
     if (!$errors) {
         // Still no errors? Punt
         $errors = array(array('unknownerror-nocode'));
     }
     // Cannot use dieUsageMsg() because extensions might return custom
     // error messages.
     if ($errors[0] instanceof Message) {
         $msg = $errors[0];
         $code = $msg->getKey();
     } else {
         $code = array_shift($errors[0]);
         $msg = wfMessage($code, $errors[0]);
     }
     if (isset(ApiBase::$messageMap[$code])) {
         // Translate message to code, for backwards compatibility
         $code = ApiBase::$messageMap[$code]['code'];
     }
     return array($code, $msg->inLanguage('en')->useDatabase(false)->plain());
 }
开发者ID:pirater,项目名称:mediawiki,代码行数:37,代码来源:ApiBase.php

示例3: testMergeWithOverwriteValue

 /**
  * @covers Status::merge
  */
 public function testMergeWithOverwriteValue()
 {
     $status1 = new Status();
     $status2 = new Status();
     $message1 = $this->getMockMessage('warn1');
     $message2 = $this->getMockMessage('error2');
     $status1->warning($message1);
     $status2->error($message2);
     $status2->value = 'FooValue';
     $status1->merge($status2, true);
     $this->assertEquals(2, count($status1->getWarningsArray()) + count($status1->getErrorsArray()));
     $this->assertEquals('FooValue', $status1->getValue());
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:16,代码来源:StatusTest.php

示例4: errorText

 /**
  * Returns wikitext of status error message in content language
  *
  * @param Status $s
  * @return String
  */
 private function errorText(Status $s)
 {
     $errors = array_merge($s->getErrorsArray(), $s->getWarningsArray());
     if (!count($errors)) {
         return '';
     }
     $err = $errors[0];
     $message = array_shift($err);
     return wfMessage($message)->params($err)->inContentLanguage()->plain();
 }
开发者ID:yusufchang,项目名称:app,代码行数:16,代码来源:CoordinatesParserFunction.php

示例5: showStatusMessage

 /**
  * @param $status Status
  */
 public function showStatusMessage(Status $status)
 {
     $errors = array_merge($status->getErrorsArray(), $status->getWarningsArray());
     foreach ($errors as $error) {
         call_user_func_array(array($this, 'showMessage'), $error);
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:10,代码来源:WebInstaller.php

示例6: leaveMessage

 /**
  * Leave a message on the user talk page or in the session according to
  * $params['leaveMessage'].
  *
  * @param Status $status
  */
 protected function leaveMessage($status)
 {
     if ($this->params['leaveMessage']) {
         if ($status->isGood()) {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-success-subj')->text(), wfMessage('upload-success-msg', $this->upload->getTitle()->getText(), $this->params['url'])->text());
         } else {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-failure-subj')->text(), wfMessage('upload-failure-msg', $status->getWikiText(), $this->params['url'])->text());
         }
     } else {
         wfSetupSession($this->params['sessionId']);
         if ($status->isOk()) {
             $this->storeResultInSession('Success', 'filename', $this->upload->getLocalFile()->getName());
         } else {
             $this->storeResultInSession('Failure', 'errors', $status->getErrorsArray());
         }
         session_write_close();
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:26,代码来源:UploadFromUrlJob.php

示例7: editPageAttemptSaveAfter

 /**
  * This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.
  *
  * @param EditPage $editPage
  * @param Status $status
  * @return boolean
  */
 public static function editPageAttemptSaveAfter(EditPage $editPage, Status $status)
 {
     $article = $editPage->getArticle();
     $request = $article->getContext()->getRequest();
     if ($request->getVal('editingStatsId')) {
         $data = array();
         $data['editingSessionId'] = $request->getVal('editingStatsId');
         if ($status->isOK()) {
             $action = 'saveSuccess';
         } else {
             $action = 'saveFailure';
             $errors = $status->getErrorsArray();
             if (isset($errors[0][0])) {
                 $data['action.saveFailure.message'] = $errors[0][0];
             }
             if ($status->value === EditPage::AS_CONFLICT_DETECTED) {
                 $data['action.saveFailure.type'] = 'editConflict';
             } elseif ($status->value === EditPage::AS_ARTICLE_WAS_DELETED) {
                 $data['action.saveFailure.type'] = 'editPageDeleted';
             } elseif (isset($errors[0][0]) && $errors[0][0] === 'abusefilter-disallowed') {
                 $data['action.saveFailure.type'] = 'extensionAbuseFilter';
             } elseif (isset($editPage->getArticle()->getPage()->ConfirmEdit_ActivateCaptcha)) {
                 // TODO: :(
                 $data['action.saveFailure.type'] = 'extensionCaptcha';
             } elseif (isset($errors[0][0]) && $errors[0][0] === 'spamprotectiontext') {
                 $data['action.saveFailure.type'] = 'extensionSpamBlacklist';
             } else {
                 // Catch everything else... We don't seem to get userBadToken or
                 // userNewUser through this hook.
                 $data['action.saveFailure.type'] = 'responseUnknown';
             }
         }
         self::doEventLogging($action, $article, $data);
     }
     return true;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:43,代码来源:WikiEditor.hooks.php

示例8: leaveMessage

 /**
  * Leave a message on the user talk page or in the session according to
  * $params['leaveMessage'].
  *
  * @param Status $status
  */
 protected function leaveMessage($status)
 {
     if ($this->params['leaveMessage']) {
         if ($status->isGood()) {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-success-subj')->text(), wfMessage('upload-success-msg', $this->upload->getTitle()->getText(), $this->params['url'])->text());
         } else {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-failure-subj')->text(), wfMessage('upload-failure-msg', $status->getWikiText(), $this->params['url'])->text());
         }
     } else {
         $session = MediaWiki\Session\SessionManager::singleton()->getSessionById($this->params['sessionId']);
         if ($status->isOk()) {
             $this->storeResultInSession($session, 'Success', 'filename', $this->upload->getLocalFile()->getName());
         } else {
             $this->storeResultInSession($session, 'Failure', 'errors', $status->getErrorsArray());
         }
     }
 }
开发者ID:Gomyul,项目名称:mediawiki,代码行数:25,代码来源:UploadFromUrlJob.php


注:本文中的Status::getErrorsArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。