Merge "API: Use message-per-value for apihelp-query+alllinks-param-prop"
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index 55f9677..7b71e6c 100644 (file)
@@ -1056,7 +1056,6 @@ abstract class ApiBase extends ContextSource {
         */
        protected function validateLimit( $paramName, &$value, $min, $max, $botMax = null, $enforceLimits = false ) {
                if ( !is_null( $min ) && $value < $min ) {
-
                        $msg = $this->encodeParamName( $paramName ) . " may not be less than $min (set to $value)";
                        $this->warnOrDie( $msg, $enforceLimits );
                        $value = $min;
@@ -1230,7 +1229,7 @@ abstract class ApiBase extends ContextSource {
                                $this->dieUsage( 'Specified user does not exist', 'bad_wlowner' );
                        }
                        $token = $user->getOption( 'watchlisttoken' );
-                       if ( $token == '' || $token != $params['token'] ) {
+                       if ( $token == '' || !hash_equals( $token, $params['token'] ) ) {
                                $this->dieUsage(
                                        'Incorrect watchlist token provided -- please set a correct token in Special:Preferences',
                                        'bad_wltoken'
@@ -2482,7 +2481,7 @@ abstract class ApiBase extends ContextSource {
         * Returns the description string for this module
         *
         * Ignored if an i18n message exists for
-        * "apihelp-{$this->getModulePathString()}-description".
+        * "apihelp-{$this->getModulePath()}-description".
         *
         * @deprecated since 1.25
         * @return Message|string|array
@@ -2496,7 +2495,7 @@ abstract class ApiBase extends ContextSource {
         *
         * For each parameter, ignored if an i18n message exists for the parameter.
         * By default that message is
-        * "apihelp-{$this->getModulePathString()}-param-{$param}", but it may be
+        * "apihelp-{$this->getModulePath()}-param-{$param}", but it may be
         * overridden using ApiBase::PARAM_HELP_MSG in the data returned by
         * self::getFinalParams().
         *
@@ -2646,7 +2645,6 @@ abstract class ApiBase extends ContextSource {
                wfDeprecated( __METHOD__, '1.25' );
                $params = $this->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
                if ( $params ) {
-
                        $paramsDescription = $this->getFinalParamDescription();
                        $msg = '';
                        $paramPrefix = "\n" . str_repeat( ' ', 24 );
@@ -2872,6 +2870,16 @@ abstract class ApiBase extends ContextSource {
                return $this->getResult()->getData();
        }
 
+       /**
+        * Call wfTransactionalTimeLimit() if this request was POSTed
+        * @since 1.26
+        */
+       protected function useTransactionalTimeLimit() {
+               if ( $this->getRequest()->wasPosted() ) {
+                       wfTransactionalTimeLimit();
+               }
+       }
+
        /**@}*/
 }