&$scalerParams: Array with scaler parameters
&$mto: null, set to a MediaTransformOutput
+'PerformRetroactiveAutoblock': called before a retroactive autoblock is applied to a user
+$block: Block object (which is set to be autoblocking)
+&$blockIds: Array of block IDs of the autoblock
+
'BlockIp': before an IP address or user is blocked
$block: the Block object about to be saved
$user: the user _doing_ the block (not the one being blocked)
* @return Array: block IDs of retroactive autoblocks made
*/
protected function doRetroactiveAutoblock() {
- global $wgAutoblockHandlers;
-
$blockIds = array();
# If autoblock is enabled, autoblock the LAST IP(s) used
if ( $this->isAutoblocking() && $this->getType() == self::TYPE_USER ) {
wfDebug( "Doing retroactive autoblocks for " . $this->getTarget() . "\n" );
- $call = isset( $wgAutoblockHandlers['retroactiveAutoblock'] )
- ? $wgAutoblockHandlers['retroactiveAutoblock']
- : null; // default
+ $continue = wfRunHooks(
+ 'PerformRetroactiveAutoblock', array( $this, &$blockIds ) );
- if ( is_callable( $call ) ) { // custom handler
- $blockIds = MWFunction::call( $call, $this );
- } else { // regular handler
- if ( $call !== null ) { // something given, but bad
- wfWarn( 'doRetroactiveAutoblock given uncallable handler, check $wgAutoblockHandlers; using default handler.' );
- }
- $blockIds = self::defaultRetroactiveAutoblock( $this );
+ if ( $continue ) {
+ self::defaultRetroactiveAutoblock( $this, $blockIds );
}
}
-
return $blockIds;
}
* Retroactively autoblocks the last IP used by the user (if it is a user)
* blocked by this Block. This will use the recentchanges table.
*
+ * @param Block $block
+ * @param Array &$blockIds
* @return Array: block IDs of retroactive autoblocks made
*/
- protected static function defaultRetroactiveAutoblock( Block $block ) {
+ protected static function defaultRetroactiveAutoblock( Block $block, array &$blockIds ) {
$dbr = wfGetDB( DB_SLAVE );
$options = array( 'ORDER BY' => 'rc_timestamp DESC' );
}
}
}
-
- return $blockIds;
}
/**
'IPv6' => 64, # 2^64 = ~1.8x10^19 addresses
);
-/**
- * Functions to handle autoblocking users. The default handlers will be used
- * where null is given. They can otherwise be overridden with custom callbacks.
- *
- * 'retroactiveAutoblock' handlers must return the array of autoblock IDs
- */
-$wgAutoblockHandlers = array( 'retroactiveAutoblock' => null );
-
/**
* If true, blocked users will not be allowed to login. When using this with
* a public wiki, the effect of logging out blocked users may actually be