Index: trunk/phase3/includes/Block.php |
— | — | @@ -377,9 +377,10 @@ |
378 | 378 | * |
379 | 379 | * @return Boolean: whether or not the insertion was successful. |
380 | 380 | */ |
381 | | - public function insert() { |
| 381 | + public function insert($dbw = null) { |
382 | 382 | wfDebug( "Block::insert; timestamp {$this->mTimestamp}\n" ); |
383 | | - $dbw = wfGetDB( DB_MASTER ); |
| 383 | + if ( $dbw === null) |
| 384 | + $dbw = wfGetDB( DB_MASTER ); |
384 | 385 | |
385 | 386 | $this->validateBlockParams(); |
386 | 387 | $this->initialiseRange(); |
Index: trunk/extensions/CentralAuth/CentralAuthUser.php |
— | — | @@ -1088,30 +1088,34 @@ |
1089 | 1089 | $blockReason = wfMsgReal( 'centralauth-admin-suppressreason', |
1090 | 1090 | array( $by, $reason ), true, $lang ); |
1091 | 1091 | |
1092 | | - $ipbID = $dbw->nextSequenceValue( 'ipblocks_ipb_id_seq' ); |
1093 | | - $dbw->insert( 'ipblocks', |
1094 | | - array( |
1095 | | - 'ipb_id' => $ipbID, |
1096 | | - 'ipb_address' => $this->mName, |
1097 | | - 'ipb_user' => $data['id'], |
1098 | | - 'ipb_by' => 0, |
1099 | | - 'ipb_by_text' => $by, |
1100 | | - 'ipb_reason' => $blockReason, |
1101 | | - 'ipb_timestamp' => $dbw->timestamp( wfTimestampNow() ), |
1102 | | - 'ipb_auto' => false, |
1103 | | - 'ipb_anon_only' => false, |
1104 | | - 'ipb_create_account' => true, |
1105 | | - 'ipb_enable_autoblock' => true, |
1106 | | - 'ipb_expiry' => Block::infinity(), |
1107 | | - 'ipb_range_start' => '', |
1108 | | - 'ipb_range_end' => '', |
1109 | | - 'ipb_deleted' => true, |
1110 | | - 'ipb_block_email' => true, |
1111 | | - 'ipb_allow_usertalk' => false |
1112 | | - ), __METHOD__, array( 'IGNORE' ) |
1113 | | - ); |
1114 | | - |
| 1092 | + $block = new Block( |
| 1093 | + /* $address */ $this->mName, |
| 1094 | + /* $user */ $data['id'], |
| 1095 | + /* $by */ 0, |
| 1096 | + //'ipb_by_text' => $by, |
| 1097 | + /* $reason */ $blockReason, |
| 1098 | + /* $timestamp */ wfTimestampNow(), |
| 1099 | + /* $auto */ false, |
| 1100 | + /* $expiry */ Block::infinity(), |
| 1101 | + /* anonOnly */ false, |
| 1102 | + /* $createAccount */ true, |
| 1103 | + /* $enableAutoblock */ true, |
| 1104 | + /* $hideName (ipb_deleted) */ true, |
| 1105 | + /* $blockEmail */ true, |
| 1106 | + /* $allowUsertalk */ false |
| 1107 | + ); |
| 1108 | + |
| 1109 | + # On normal block, BlockIp hook would be run here, but doing |
| 1110 | + # that from CentralAuth doesn't seem a good idea... |
| 1111 | + |
| 1112 | + if ( !$block->insert( $dbw ) ) { |
| 1113 | + return array( 'ipb_already_blocked' ); |
| 1114 | + } |
| 1115 | + # Ditto for BlockIpComplete hook. |
| 1116 | + |
1115 | 1117 | IPBlockForm::suppressUserName( $this->mName, $data['id'], $dbw ); |
| 1118 | + |
| 1119 | + # Locally log to suppress ? |
1116 | 1120 | } else { |
1117 | 1121 | $dbw->delete( |
1118 | 1122 | 'ipblocks', |