Add the concept of "system blocks"
[lhc/web/wiklou.git] / includes / user / User.php
index f1742b3..4e8a5ff 100644 (file)
@@ -1643,16 +1643,20 @@ class User implements IDBAccessObject {
                if ( !$block instanceof Block && $ip !== null && !in_array( $ip, $wgProxyWhitelist ) ) {
                        // Local list
                        if ( self::isLocallyBlockedProxy( $ip ) ) {
-                               $block = new Block;
-                               $block->setBlocker( wfMessage( 'proxyblocker' )->text() );
-                               $block->mReason = wfMessage( 'proxyblockreason' )->text();
-                               $block->setTarget( $ip );
+                               $block = new Block( [
+                                       'byText' => wfMessage( 'proxyblocker' )->text(),
+                                       'reason' => wfMessage( 'proxyblockreason' )->text(),
+                                       'address' => $ip,
+                                       'systemBlock' => 'proxy',
+                               ] );
                                $this->blockTrigger = 'proxy-block';
                        } elseif ( $this->isAnon() && $this->isDnsBlacklisted( $ip ) ) {
-                               $block = new Block;
-                               $block->setBlocker( wfMessage( 'sorbs' )->text() );
-                               $block->mReason = wfMessage( 'sorbsreason' )->text();
-                               $block->setTarget( $ip );
+                               $block = new Block( [
+                                       'byText' => wfMessage( 'sorbs' )->text(),
+                                       'reason' => wfMessage( 'sorbsreason' )->text(),
+                                       'address' => $ip,
+                                       'systemBlock' => 'dnsbl',
+                               ] );
                                $this->blockTrigger = 'openproxy-block';
                        }
                }
@@ -2067,8 +2071,10 @@ class User implements IDBAccessObject {
 
                if ( $blocked && $block === null ) {
                        // back-compat: UserIsBlockedGlobally didn't have $block param first
-                       $block = new Block;
-                       $block->setTarget( $ip );
+                       $block = new Block( [
+                               'address' => $ip,
+                               'systemBlock' => 'global-block'
+                       ] );
                }
 
                $this->mGlobalBlock = $blocked ? $block : false;