r47041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47040‎ | r47041 | r47042 >
Date:14:39, 9 February 2009
Author:catrope
Status:deferred
Tags:
Comment:
Backport part of r47039: fix handling of errors on API talk page move
Modified paths:
  • /branches/REL1_14/phase3/includes/api/ApiBase.php (modified) (history)
  • /branches/REL1_14/phase3/includes/api/ApiMove.php (modified) (history)

Diff [purge]

Index: branches/REL1_14/phase3/includes/api/ApiMove.php
@@ -95,8 +95,9 @@
9696 // We're not gonna dieUsage() on failure, since we already changed something
9797 else
9898 {
99 - $r['talkmove-error-code'] = ApiBase::$messageMap[reset($retval)]['code'];
100 - $r['talkmove-error-info'] = ApiBase::$messageMap[reset($retval)]['info'];
 99+ $parsed = $this->parseMsg(reset($retval));
 100+ $r['talkmove-error-code'] = $parsed['code'];
 101+ $r['talkmove-error-info'] = $parsed['info'];
101102 }
102103 }
103104
Index: branches/REL1_14/phase3/includes/api/ApiBase.php
@@ -743,14 +743,28 @@
744744
745745 /**
746746 * Output the error message related to a certain array
747 - * @param array $error Element of a getUserPermissionsErrors()
 747+ * @param array $error Element of a getUserPermissionsErrors()-style array
748748 */
749749 public function dieUsageMsg($error) {
 750+ $parsed = $this->parseMsg($error);
 751+ $this->dieUsage($parsed['code'], $parsed['info']);
 752+ }
 753+
 754+ /**
 755+ * Return the error message related to a certain array
 756+ * @param array $error Element of a getUserPermissionsErrors()-style array
 757+ * @return array('code' => code, 'info' => info)
 758+ */
 759+ public function parseMsg($error) {
750760 $key = array_shift($error);
751761 if(isset(self::$messageMap[$key]))
752 - $this->dieUsage(wfMsgReplaceArgs(self::$messageMap[$key]['info'], $error), wfMsgReplaceArgs(self::$messageMap[$key]['code'], $error));
 762+ return array( 'code' =>
 763+ wfMsgReplaceArgs(self::$messageMap[$key]['code'], $error),
 764+ 'info' =>
 765+ wfMsgReplaceArgs(self::$messageMap[$key]['info'], $error)
 766+ );
753767 // If the key isn't present, throw an "unknown error"
754 - $this->dieUsageMsg(array('unknownerror', $key));
 768+ return $this->parseMsg(array('unknownerror', $key));
755769 }
756770
757771 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r47039* API: (bug 17357) Add subpage moving to the API...catrope14:16, 9 February 2009

Status & tagging log