From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/api/ApiResult.php | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'includes/api/ApiResult.php') diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 9d42a58e..f7ea0045 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -1,6 +1,6 @@ mCheckingSize ) { $newsize = $this->mSize + self::size( $value ); if ( $newsize > $wgAPIMaxResultSize ) { + $this->setWarning( + "This result was truncated because it would otherwise be larger than the " . + "limit of {$wgAPIMaxResultSize} bytes" ); return false; } $this->mSize = $newsize; @@ -327,6 +336,8 @@ class ApiResult extends ApiBase { /** * Callback function for cleanUpUTF8() + * + * @param $s string */ private static function cleanUp_helper( &$s ) { if ( !is_string( $s ) ) { @@ -336,11 +347,31 @@ class ApiResult extends ApiBase { $s = $wgContLang->normalize( $s ); } + /** + * Converts a Status object to an array suitable for addValue + * @param Status $status + * @param string $errorType + * @return array + */ + public function convertStatusToArray( $status, $errorType = 'error' ) { + if ( $status->isGood() ) { + return array(); + } + + $result = array(); + foreach ( $status->getErrorsByType( $errorType ) as $error ) { + $this->setIndexedTagName( $error['params'], 'param' ); + $result[] = $error; + } + $this->setIndexedTagName( $result, $errorType ); + return $result; + } + public function execute() { ApiBase::dieDebug( __METHOD__, 'execute() is not supported on Result object' ); } public function getVersion() { - return __CLASS__ . ': $Id: ApiResult.php 74230 2010-10-03 19:07:11Z reedy $'; + return __CLASS__ . ': $Id: ApiResult.php 91144 2011-06-29 23:46:39Z reedy $'; } } -- cgit v1.2.3-54-g00ecf