* - timestamp: A timestamp in any format recognized by MWTimestamp, or the
* string 'now' representing the current timestamp. Will be returned in
* TS_MW format.
- * - user: A MediaWiki username. Will be returned normalized but not canonicalized.
+ * - user: A MediaWiki username or IP. Will be returned normalized but not canonicalized.
* - upload: An uploaded file. Will be returned as a WebRequestUpload object.
* Cannot be used with PARAM_ISMULTI.
*/
}
}
-
/************************************************************************//**
* @name Methods to implement
* @{
);
}
+ /**
+ * Throw a UsageException, which will (if uncaught) call the main module's
+ * error handler and die with an error message including block info.
+ *
+ * @since 1.27
+ * @param Block $block The block used to generate the UsageException
+ * @throws UsageException always
+ */
+ public function dieBlocked( Block $block ) {
+ // Die using the appropriate message depending on block type
+ if ( $block->getType() == Block::TYPE_AUTO ) {
+ $this->dieUsage(
+ 'Your IP address has been blocked automatically, because it was used by a blocked user',
+ 'autoblocked',
+ 0,
+ array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) )
+ );
+ } else {
+ $this->dieUsage(
+ 'You have been blocked from editing',
+ 'blocked',
+ 0,
+ array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) )
+ );
+ }
+ }
+
/**
* Get error (as code, string) from a Status object.
*