From: Sam Reed Date: Sun, 3 Oct 2010 20:29:44 +0000 (+0000) Subject: Minor tweaks to r74232, add a value for $botMax on calls for integer validation ... X-Git-Tag: 1.31.0-rc.0~34637 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=9cda0105a9ac6f7011b7e8e33e525c82f89e71fa;p=lhc%2Fweb%2Fwiklou.git Minor tweaks to r74232, add a value for $botMax on calls for integer validation (otherwise the bool gets pushed into it!) Documentation in ApiDelete --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index f2af6e2a38..6d4ed2a1fc 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -677,8 +677,6 @@ abstract class ApiBase { break; case 'integer': // Force everything using intval() and optionally validate limits - $value = is_array( $value ) ? array_map( 'intval', $value ) : intval( $value ); - $min = isset ( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[self::PARAM_MIN] : null; $max = isset ( $paramSettings[self::PARAM_MAX] ) ? $paramSettings[self::PARAM_MAX] : null; $enforceLimits = isset ( $paramSettings[self::PARAM_RANGE_ENFORCE] ) @@ -686,11 +684,13 @@ abstract class ApiBase { if ( !is_null( $min ) || !is_null( $max ) ) { if ( is_array( $value ) ) { + $value = array_map( 'intval', $value ); foreach ( $value as &$v ) { - $this->validateLimit( $paramName, $v, $min, $max, $enforceLimits ); + $this->validateLimit( $paramName, $v, $min, $max, null, $enforceLimits ); } } else { - $this->validateLimit( $paramName, $value, $min, $max, $enforceLimits ); + $value = intval( $value ); + $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits ); } } break; @@ -866,7 +866,7 @@ abstract class ApiBase { */ private function warnOrDie( $msg, $enforceLimits = false ) { if ( $enforceLimits ) { - $this->dieUsageMsg( $msg ); + $this->dieUsage( 'integeroutofrange', $msg ); } else { $this->setWarning( $msg ); } diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index f4e2ec249e..93baa4e33a 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -97,6 +97,11 @@ class ApiDelete extends ApiBase { $this->getResult()->addValue( null, $this->getModuleName(), $r ); } + /** + * + * @param &$title Title + * @param $token String + */ private static function getPermissionsError( &$title, $token ) { global $wgUser;