From: Victor Vasiliev Date: Mon, 18 Feb 2008 12:16:23 +0000 (+0000) Subject: * (bug 12999) introduce ipb_by_text colomn X-Git-Tag: 1.31.0-rc.0~49449 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=1bf9ad3bf0c934fe38ac28d8a0bc51ce0619ab10;p=lhc%2Fweb%2Fwiklou.git * (bug 12999) introduce ipb_by_text colomn N.B.: this is schema change (obviously) --- diff --git a/includes/Block.php b/includes/Block.php index 3688d7cf6d..1733ebc0ab 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -16,8 +16,8 @@ class Block { /* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry, $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName, - $mBlockEmail; - /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster, $mByName; + $mBlockEmail, $mByName; + /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster; const EB_KEEP_EXPIRED = 1; const EB_FOR_UPDATE = 2; @@ -270,7 +270,7 @@ class Block if ( isset( $row->user_name ) ) { $this->mByName = $row->user_name; } else { - $this->mByName = false; + $this->mByName = $row->ipb_by_text; } $this->mRangeStart = $row->ipb_range_start; $this->mRangeEnd = $row->ipb_range_end; @@ -376,6 +376,15 @@ class Block $this->mBlockEmail = 0; //Same goes for email... } + if( !$this->mByName ) { + if( $this->mBy ) { + $this->mByName = User::whoIs( $this->mBy ); + } else { + global $wgUser; + $this->mByName = $wgUser->getName(); + } + } + # Don't collide with expired blocks Block::purgeExpired(); @@ -386,6 +395,7 @@ class Block 'ipb_address' => $this->mAddress, 'ipb_user' => $this->mUser, 'ipb_by' => $this->mBy, + 'ipb_by_text' => $this->mByName, 'ipb_reason' => $this->mReason, 'ipb_timestamp' => $dbw->timestamp($this->mTimestamp), 'ipb_auto' => $this->mAuto, @@ -592,9 +602,6 @@ class Block */ function getByName() { - if ( $this->mByName === false ) { - $this->mByName = User::whoIs( $this->mBy ); - } return $this->mByName; } diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index c2de9e2fc8..641e1fdde6 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -393,7 +393,7 @@ class IPBlocklistPager extends ReverseChronologicalPager { # Usernames and titles are in fact related by a simple substitution of space -> underscore # The last few lines of Title::secureAndSplit() tell the story. while ( $row = $this->mResult->fetchObject() ) { - $name = str_replace( ' ', '_', $row->user_name ); + $name = str_replace( ' ', '_', $row->ipb_by_text ); $lb->add( NS_USER, $name ); $lb->add( NS_USER_TALK, $name ); $name = str_replace( ' ', '_', $row->ipb_address ); @@ -414,10 +414,9 @@ class IPBlocklistPager extends ReverseChronologicalPager { function getQueryInfo() { $conds = $this->mConds; $conds[] = 'ipb_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() ); - $conds[] = 'ipb_by=user_id'; return array( - 'tables' => array( 'ipblocks', 'user' ), - 'fields' => $this->mDb->tableName( 'ipblocks' ) . '.*,user_name', + 'tables' => 'ipblocks', + 'fields' => '*', 'conds' => $conds, ); } diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 6282f52287..b26498b290 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -597,6 +597,9 @@ CREATE TABLE /*$wgDBprefix*/ipblocks ( -- User ID who made the block. ipb_by int unsigned NOT NULL default '0', + --User name of blocker + ipb_by_text varchar(255) binary NOT NULL default '', + -- Text comment made by blocker. ipb_reason tinyblob NOT NULL, diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 41a2b0ae4b..e9a6ffc49d 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -23,21 +23,21 @@ $wgRenamedTables = array( $wgNewTables = array( # table patch file (in maintenance/archives) - array( 'hitcounter', 'patch-hitcounter.sql' ), - array( 'querycache', 'patch-querycache.sql' ), - array( 'objectcache', 'patch-objectcache.sql' ), - array( 'categorylinks', 'patch-categorylinks.sql' ), - array( 'logging', 'patch-logging.sql' ), - array( 'user_newtalk', 'patch-usernewtalk2.sql' ), - array( 'transcache', 'patch-transcache.sql' ), - array( 'trackbacks', 'patch-trackbacks.sql' ), - array( 'externallinks', 'patch-externallinks.sql' ), - array( 'job', 'patch-job.sql' ), - array( 'langlinks', 'patch-langlinks.sql' ), - array( 'querycache_info', 'patch-querycacheinfo.sql' ), - array( 'filearchive', 'patch-filearchive.sql' ), - array( 'querycachetwo', 'patch-querycachetwo.sql' ), - array( 'redirect', 'patch-redirect.sql' ), + array( 'hitcounter', 'patch-hitcounter.sql' ), + array( 'querycache', 'patch-querycache.sql' ), + array( 'objectcache', 'patch-objectcache.sql' ), + array( 'categorylinks', 'patch-categorylinks.sql' ), + array( 'logging', 'patch-logging.sql' ), + array( 'user_newtalk', 'patch-usernewtalk2.sql' ), + array( 'transcache', 'patch-transcache.sql' ), + array( 'trackbacks', 'patch-trackbacks.sql' ), + array( 'externallinks', 'patch-externallinks.sql' ), + array( 'job', 'patch-job.sql' ), + array( 'langlinks', 'patch-langlinks.sql' ), + array( 'querycache_info', 'patch-querycacheinfo.sql' ), + array( 'filearchive', 'patch-filearchive.sql' ), + array( 'querycachetwo', 'patch-querycachetwo.sql' ), + array( 'redirect', 'patch-redirect.sql' ), array( 'protected_titles', 'patch-protected_titles.sql' ), ); @@ -84,6 +84,7 @@ $wgNewFields = array( array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql'), array( 'archive', 'ar_page_id', 'patch-archive-page_id.sql'), array( 'image', 'img_sha1', 'patch-img_sha1.sql' ), + array( 'ipblocks', 'ipb_by_text', 'patch-ipb_by_text.sql' ), ); # For extensions only, should be populated via hooks