r45241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45240‎ | r45241 | r45242 >
Date:18:56, 31 December 2008
Author:brion
Status:ok
Tags:
Comment:
Revert r45231, r45235 "* (bug 674) Allow users to be blocked from editing a specific article"
Unexpected schema changes in the middle of code review and run-up to 1.14 freeze
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/UserRestriction.php (deleted) (history)
  • /trunk/phase3/includes/specials/SpecialListUserRestrictions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRemoveRestrictions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRestrictUser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-user_restrictions.sql (deleted) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-user_restrictions.sql
@@ -1,41 +0,0 @@
2 -
3 -CREATE TABLE /*$wgDBprefix*/user_restrictions (
4 - -- ID of the restriction
5 - ur_id int NOT NULL auto_increment,
6 -
7 - -- Restriction type. Block from either editing namespace or page
8 - ur_type ENUM('namespace','page') NOT NULL,
9 - -- Namespace to restrict if ur_type = namespace
10 - ur_namespace int default NULL,
11 - -- Page to restrict if ur_type = page
12 - ur_page_namespace int default NULL,
13 - ur_page_title varchar(255) binary default '',
14 -
15 - -- User that is restricted
16 - ur_user int unsigned NOT NULL,
17 - ur_user_text varchar(255) NOT NULL,
18 -
19 - -- User who has done this restriction
20 - ur_by int unsigned NOT NULL,
21 - ur_by_text varchar(255) binary NOT NULL default '',
22 - -- Reason for this restriction
23 - ur_reason mediumblob NOT NULL,
24 -
25 - -- Time when this restriction was made
26 - ur_timestamp varbinary(14) NOT NULL default '',
27 - -- Expiry or "infinity"
28 - ur_expiry varbinary(14) NOT NULL default '',
29 -
30 - PRIMARY KEY ur_id (ur_id),
31 - -- For looking up restrictions for user and title
32 - INDEX ur_user_page(ur_user,ur_page_namespace,ur_page_title(255)),
33 - INDEX ur_user_namespace(ur_user,ur_namespace),
34 - -- For Special:ListUserRestrictions
35 - INDEX ur_type (ur_type,ur_timestamp),
36 - INDEX ur_namespace (ur_namespace,ur_timestamp),
37 - INDEX ur_page (ur_page_namespace,ur_page_title,ur_timestamp),
38 - INDEX ur_timestamp (ur_timestamp),
39 - -- For quick removal of expired restrictions
40 - INDEX ur_expiry (ur_expiry)
41 -) /*$wgDBTableOptions*/;
Index: trunk/phase3/maintenance/parserTests.inc
@@ -593,7 +593,7 @@
594594 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage',
595595 'recentchanges', 'watchlist', 'math', 'interwiki',
596596 'querycache', 'objectcache', 'job', 'redirect', 'querycachetwo',
597 - 'archive', 'user_groups', 'page_props', 'category', 'user_restrictions',
 597+ 'archive', 'user_groups', 'page_props', 'category'
598598 );
599599
600600 if ($wgDBtype === 'mysql')
Index: trunk/phase3/maintenance/updaters.inc
@@ -145,10 +145,9 @@
146146 array( 'update_password_format' ),
147147
148148 // 1.14
149 - array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
 149+ array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
150150 array( 'do_active_users_init' ),
151 - array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
152 - array( 'add_table', 'user_restrictions', 'patch-user_restrictions.sql' ),
 151+ array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' )
153152 );
154153
155154
Index: trunk/phase3/maintenance/language/messages.inc
@@ -569,10 +569,6 @@
570570 'edit-conflict',
571571 'edit-no-change',
572572 'edit-already-exists',
573 - 'userrestricted-page',
574 - 'userrestricted-namespace',
575 - 'userrestricted-page-indef',
576 - 'userrestricted-namespace-indef',
577573 ),
578574 'parserwarnings' => array(
579575 'expensive-parserfunction-warning',
@@ -1775,7 +1771,6 @@
17761772 'ipbsubmit',
17771773 'ipbother',
17781774 'ipboptions',
1779 - 'ipbinfinite',
17801775 'ipbotheroption',
17811776 'ipbotherreason',
17821777 'ipbhidename',
@@ -1849,69 +1844,6 @@
18501845 'sorbs_create_account_reason',
18511846 'cant-block-while-blocked',
18521847 ),
1853 - 'listuserrestrictions' => array(
1854 - 'listuserrestrictions',
1855 - 'listuserrestrictions-intro',
1856 - 'listuserrestrictions-row-ns',
1857 - 'listuserrestrictions-row-page',
1858 - 'listuserrestrictions-row-expiry',
1859 - 'listuserrestrictions-legend',
1860 - 'listuserrestrictions-type',
1861 - 'listuserrestrictions-user',
1862 - 'listuserrestrictions-namespace',
1863 - 'listuserrestrictions-page',
1864 - 'listuserrestrictions-submit',
1865 - 'listuserrestrictions-notfound',
1866 - 'listuserrestrictions-empty',
1867 - 'listuserrestrictions-remove',
1868 - 'userrestrictiontype-none',
1869 - 'userrestrictiontype-namespace',
1870 - 'userrestrictiontype-page',
1871 - ),
1872 - 'removerestrictions' => array(
1873 - 'removerestrictions',
1874 - 'removerestrictions-intro',
1875 - 'removerestrictions-noid',
1876 - 'removerestrictions-wrongid',
1877 - 'removerestrictions-legend',
1878 - 'removerestrictions-user',
1879 - 'removerestrictions-type',
1880 - 'removerestrictions-page',
1881 - 'removerestrictions-namespace',
1882 - 'removerestrictions-reason',
1883 - 'removerestrictions-submit',
1884 - 'removerestrictions-success',
1885 - ),
1886 - 'restrictuser' => array(
1887 - 'restrictuser',
1888 - 'restrictuser-userselect',
1889 - 'restrictuser-user',
1890 - 'restrictuser-go',
1891 - 'restrictuser-notfound',
1892 - 'restrictuser-existing',
1893 - 'restrictuser-legend-page',
1894 - 'restrictuser-legend-namespace',
1895 - 'restrictuser-title',
1896 - 'restrictuser-namespace',
1897 - 'restrictuser-expiry',
1898 - 'restrictuser-reason',
1899 - 'restrictuser-submit',
1900 - 'restrictuser-badtitle',
1901 - 'restrictuser-badnamespace',
1902 - 'restrictuser-badexpiry',
1903 - 'restrictuser-duptitle',
1904 - 'restrictuser-dupnamespace',
1905 - 'restrictuser-success',
1906 - 'restrictuser-description',
1907 - ),
1908 - 'restrictlog' => array(
1909 - 'restrictionlog',
1910 - 'restrictionlogtext',
1911 - 'restrictentry',
1912 - 'restrictremoveentry',
1913 - 'restrictlognamespace',
1914 - 'restrictlogpage',
1915 - ),
19161848 'developertools' => array(
19171849 'lockdb',
19181850 'unlockdb',
@@ -3039,10 +2971,6 @@
30402972 'sp-contributions' => '',
30412973 'whatlinkshere' => 'What links here',
30422974 'block' => 'Block/unblock',
3043 - 'listuserrestrictions' => 'Special:ListUserRestrictions',
3044 - 'removerestrictions' => 'Special:RemoveRestrictions',
3045 - 'restrictuser' => 'Restrict user',
3046 - 'restrictlog' => 'Special:Log/restrict',
30472975 'developertools' => 'Developer tools',
30482976 'movepage' => 'Move page',
30492977 'export' => 'Export',
Index: trunk/phase3/maintenance/tables.sql
@@ -1243,47 +1243,4 @@
12441244 PRIMARY KEY (ul_key)
12451245 ) /*$wgDBTableOptions*/;
12461246
1247 -CREATE TABLE /*$wgDBprefix*/user_restrictions (
1248 - -- ID of the restriction
1249 - ur_id int NOT NULL auto_increment,
1250 -
1251 - -- Restriction type. Block from either editing namespace or page
1252 - ur_type ENUM('namespace','page') NOT NULL,
1253 - -- Namespace to restrict if ur_type = namespace
1254 - ur_namespace int default NULL,
1255 - -- Page to restrict if ur_type = page
1256 - ur_page_namespace int default NULL,
1257 - ur_page_title varchar(255) binary default '',
1258 -
1259 - -- User that is restricted
1260 - ur_user int unsigned NOT NULL,
1261 - ur_user_text varchar(255) NOT NULL,
1262 -
1263 - -- User who has done this restriction
1264 - ur_by int unsigned NOT NULL,
1265 - ur_by_text varchar(255) binary NOT NULL default '',
1266 - -- Reason for this restriction
1267 - ur_reason mediumblob NOT NULL,
1268 -
1269 - -- Time when this restriction was made
1270 - ur_timestamp varbinary(14) NOT NULL default '',
1271 - -- Expiry or "infinity"
1272 - ur_expiry varbinary(14) NOT NULL default '',
1273 -
1274 - PRIMARY KEY ur_id (ur_id),
1275 - -- For looking up restrictions for user and title
1276 - INDEX ur_user (ur_user),
1277 - INDEX ur_user_page(ur_user,ur_page_namespace,ur_page_title(255)),
1278 - INDEX ur_user_namespace(ur_user,ur_namespace),
1279 - -- For Special:ListUserRestrictions
1280 - INDEX ur_type (ur_type,ur_timestamp),
1281 - INDEX ur_namespace (ur_namespace,ur_timestamp),
1282 - INDEX ur_page (ur_page_namespace,ur_page_title,ur_timestamp),
1283 - INDEX ur_timestamp (ur_timestamp),
1284 - -- For quick removal of expired restrictions
1285 - INDEX ur_expiry (ur_expiry)
1286 -) /*$wgDBTableOptions*/;
1287 -
1288 -
12891247 -- vim: sw=2 sts=2 et
Index: trunk/phase3/includes/UserRestriction.php
@@ -1,189 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Object that represents a user restriction
6 - */
7 -class UserRestriction {
8 - const PAGE = 'page';
9 - const NAMESPACE = 'namespace';
10 -
11 - private $mId, $mType, $mNamespace, $mPage, $mSubjectText, $mSubjectId,
12 - $mBlockerId, $mBlockerText, $mReason, $mTimestamp, $mExpiry;
13 -
14 - public static function newFromRow( $row ) {
15 - if( !$row )
16 - return null;
17 -
18 - $obj = new UserRestriction();
19 - $obj->mId = $row->ur_id;
20 - $obj->mType = $row->ur_type;
21 - if( $obj->mType == self::PAGE ) {
22 - $obj->mPage = Title::makeTitle( $row->ur_page_namespace, $row->ur_page_title );
23 - } elseif( $obj->mType == self::NAMESPACE ) {
24 - $obj->mNamespace = $row->ur_namespace;
25 - } else {
26 - throw new MWException( "Unknown user restriction type: {$row->ur_type}" );
27 - }
28 -
29 - $obj->mSubjectId = $row->ur_user;
30 - $obj->mSubjectText = $row->ur_user_text;
31 - $obj->mBlockerId = $row->ur_by;
32 - $obj->mBlockerText = $row->ur_by_text;
33 - $obj->mReason = $row->ur_reason;
34 - $obj->mTimestamp = wfTimestamp( TS_MW, $row->ur_timestamp );
35 - $obj->mExpiry = $row->ur_expiry;
36 - return $obj;
37 - }
38 -
39 - public static function fetchForUser( $user, $forWrite = false ) {
40 - $dbr = wfGetDB( $forWrite ? DB_MASTER : DB_SLAVE );
41 - if( is_int( $user ) )
42 - $query = array( 'ur_user' => $user );
43 - else
44 - $query = array( 'ur_user_text' => $user );
45 - $res = $dbr->select( 'user_restrictions', '*', $query, __METHOD__ );
46 - $result = array();
47 - foreach( $res as $row ) {
48 - $result[] = self::newFromRow( $row );
49 - }
50 - return $result;
51 - }
52 -
53 - public static function fetchForTitle( $user, $title ) {
54 - $dbr = wfGetDB( DB_SLAVE );
55 - if( $user->isLoggedIn() )
56 - $query = array( 'ur_user' => $user->getId() );
57 - else
58 - $query = array( 'ur_user_text' => $user->getName() );
59 - $query['ur_page_namespace'] = $title->getNamespace();
60 - $query['ur_page_title'] = $title->getDBKey();
61 - $res = $dbr->select( 'user_restrictions', '*', $query, __METHOD__ );
62 - $result = array();
63 - foreach( $res as $row ) {
64 - $result[] = self::newFromRow( $row );
65 - }
66 - return $result;
67 - }
68 -
69 - public static function fetchForNamespace( $user, $ns ) {
70 - $dbr = wfGetDB( DB_SLAVE );
71 - if( $user->isLoggedIn() )
72 - $query = array( 'ur_user' => $user->getId() );
73 - else
74 - $query = array( 'ur_user_text' => $user->getName() );
75 - $query['ur_namespace'] = $ns;
76 - $res = $dbr->select( 'user_restrictions', '*', $query, __METHOD__ );
77 - $result = array();
78 - foreach( $res as $row ) {
79 - $result[] = self::newFromRow( $row );
80 - }
81 - return $result;
82 - }
83 -
84 - public static function newFromId( $id, $forWrite = false ) {
85 - $dbr = wfGetDB( $forWrite ? DB_MASTER : DB_SLAVE );
86 - if( !$id || !is_numeric( $id ) )
87 - return null;
88 - $res = $dbr->selectRow( 'user_restrictions', '*', array( 'ur_id' => $id ), __METHOD__ );
89 - return self::newFromRow( $res );
90 - }
91 -
92 - public function getId() { return $this->mId; }
93 - public function setId( $v ) { $this->mId = $v; }
94 - public function getType() { return $this->mType; }
95 - public function setType( $v ) { $this->mType = $v; }
96 - public function getNamespace() { return $this->mNamespace; }
97 - public function setNamespace( $v ) { $this->mNamespace = $v; }
98 - public function getPage() { return $this->mPage; }
99 - public function setPage( $v ) { $this->mPage = $v; }
100 - public function getSubjectId() { return $this->mSubjectId; }
101 - public function setSubjectId( $v ) { $this->mSubjectId = $v; }
102 - public function getSubjectText() { return $this->mSubjectText; }
103 - public function setSubjectText( $v ) { $this->mSubjectText = $v; }
104 - public function getBlockerId() { return $this->mBlockerId; }
105 - public function setBlockerId( $v ) { $this->mBlockerId = $v; }
106 - public function getBlockerText() { return $this->mBlockerText; }
107 - public function setBlockerText( $v ) { $this->mBlockerText = $v; }
108 - public function getReason() { return $this->mReason; }
109 - public function setReason( $v ) { $this->mReason = $v; }
110 - public function getTimestamp() { return $this->mTimestamp; }
111 - public function setTimestamp( $v ) { $this->mTimestamp = $v; }
112 - public function getExpiry() { return $this->mExpiry; }
113 - public function setExpiry( $v ) { $this->mExpiry = $v; }
114 -
115 - public function isPage() {
116 - return $this->mType == self::PAGE;
117 - }
118 - public function isNamespace() {
119 - return $this->mType == self::NAMESPACE;
120 - }
121 -
122 - public function isExpired() {
123 - return is_numeric( $this->mExpiry ) && $this->mExpiry < wfTimestampNow( TS_MW );
124 - }
125 -
126 - public function deleteIfExpired() {
127 - if( $this->isExpired() ) {
128 - $this->delete();
129 - return true;
130 - } else {
131 - return false;
132 - }
133 - }
134 -
135 - public function delete() {
136 - $dbw = wfGetDB( DB_MASTER );
137 - $dbw->delete( 'user_restrictions', array( 'ur_id' => $this->mId ), __METHOD__ );
138 - return $dbw->affectedRows();
139 - }
140 -
141 - public static function purgeExpired() {
142 - $dbw = wfGetDB( DB_MASTER );
143 - $dbw->delete( 'user_restrictions', array( 'ur_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), __METHOD__ );
144 - }
145 -
146 - public function commit() {
147 - $dbw = wfGetDB( DB_MASTER );
148 - $this->setId( $dbw->nextSequenceValue('user_restrictions_ur_id_val') );
149 - $row = array(
150 - 'ur_id' => $this->mId,
151 - 'ur_type' => $this->mType,
152 - 'ur_user' => $this->mSubjectId,
153 - 'ur_user_text' => $this->mSubjectText,
154 - 'ur_by' => $this->mBlockerId,
155 - 'ur_by_text' => $this->mBlockerText,
156 - 'ur_reason' => $this->mReason,
157 - 'ur_timestamp' => $dbw->timestamp( $this->mTimestamp ),
158 - 'ur_expiry' => $this->mExpiry,
159 - );
160 - if( $this->isPage() ) {
161 - $row['ur_page_namespace'] = $this->mPage->getNamespace();
162 - $row['ur_page_title'] = $this->mPage->getDbKey();
163 - }
164 - if( $this->isNamespace() ) {
165 - $row['ur_namespace'] = $this->mNamespace;
166 - }
167 - $dbw->insert( 'user_restrictions', $row, __METHOD__ );
168 - }
169 -
170 - public static function formatType( $type ) {
171 - return wfMsg( 'userrestrictiontype-' . $type );
172 - }
173 -
174 - /**
175 - * Converts expiry which user input to the internal representation.
176 - * Returns false if invalid expiry is set, Block::infinity() on empty value,
177 - * Block::infinity() on infinity or 14-symbol timestamp
178 - */
179 - public static function convertExpiry( $expiry ) {
180 - if( !$expiry )
181 - return Block::infinity();
182 - if( in_array( $expiry, array( 'infinite', 'infinity', 'indefinite' ) ) )
183 - return Block::infinity();
184 - $unix = @strtotime( $expiry );
185 - if( !$unix || $unix === -1 )
186 - return false;
187 - else
188 - return wfTimestamp( TS_MW, $unix );
189 - }
190 -}
Index: trunk/phase3/includes/User.php
@@ -151,7 +151,7 @@
152152 'markbotedits',
153153 'minoredit',
154154 'move',
155 - 'movefile',
 155+ 'movepage',
156156 'move-rootuserpages',
157157 'move-subpages',
158158 'nominornewtalk',
@@ -161,7 +161,6 @@
162162 'proxyunbannable',
163163 'purge',
164164 'read',
165 - 'restrict',
166165 'reupload',
167166 'reupload-shared',
168167 'rollback',
Index: trunk/phase3/includes/Article.php
@@ -2435,12 +2435,7 @@
24362436 );
24372437
24382438 # Delete restrictions for it
2439 - $dbw->delete( 'page_restrictions', array( 'pr_page' => $id ), __METHOD__ );
2440 - $dbw->delete( 'user_restrictions',
2441 - array(
2442 - 'ur_page_namespace' => $this->mTitle->getNamespace(),
2443 - 'ur_page_title' => $this->mTitle->getDBKey()
2444 - ), __METHOD__ );
 2439+ $dbw->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__ );
24452440
24462441 # Now that it's safely backed up, delete it
24472442 $dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__);
Index: trunk/phase3/includes/AutoLoader.php
@@ -201,8 +201,6 @@
202202 'UserArray' => 'includes/UserArray.php',
203203 'UserArrayFromResult' => 'includes/UserArray.php',
204204 'UserMailer' => 'includes/UserMailer.php',
205 - 'UserRestriction' => 'includes/UserRestriction.php',
206 - 'UserRestrictionsPager' => 'includes/specials/SpecialListUserRestrictions.php',
207205 'UserRightsProxy' => 'includes/UserRightsProxy.php',
208206 'WatchedItem' => 'includes/WatchedItem.php',
209207 'WatchlistEditor' => 'includes/WatchlistEditor.php',
Index: trunk/phase3/includes/Title.php
@@ -1009,7 +1009,9 @@
10101010 }
10111011 $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries );
10121012
1013 - global $wgContLang, $wgLang, $wgEmailConfirmToEdit;
 1013+ global $wgContLang;
 1014+ global $wgLang;
 1015+ global $wgEmailConfirmToEdit;
10141016
10151017 if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() && $action != 'createaccount' ) {
10161018 $errors[] = array( 'confirmedittext' );
@@ -1041,7 +1043,20 @@
10421044 $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true );
10431045
10441046 if ( $blockExpiry == 'infinity' ) {
1045 - $blockExpiry = wfMsg( 'ipbinfinite' );
 1047+ // Entry in database (table ipblocks) is 'infinity' but 'ipboptions' uses 'infinite' or 'indefinite'
 1048+ $scBlockExpiryOptions = wfMsg( 'ipboptions' );
 1049+
 1050+ foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) {
 1051+ if ( strpos( $option, ':' ) == false )
 1052+ continue;
 1053+
 1054+ list ($show, $value) = explode( ":", $option );
 1055+
 1056+ if ( $value == 'infinite' || $value == 'indefinite' ) {
 1057+ $blockExpiry = $show;
 1058+ break;
 1059+ }
 1060+ }
10461061 } else {
10471062 $blockExpiry = $wgLang->timeanddate( wfTimestamp( TS_MW, $blockExpiry ), true );
10481063 }
@@ -1051,9 +1066,9 @@
10521067 $errors[] = array( ($block->mAuto ? 'autoblockedtext' : 'blockedtext'), $link, $reason, $ip, $name,
10531068 $blockid, $blockExpiry, $intended, $blockTimestamp );
10541069 }
1055 -
 1070+
10561071 // Remove the errors being ignored.
1057 -
 1072+
10581073 foreach( $errors as $index => $error ) {
10591074 $error_key = is_array($error) ? $error[0] : $error;
10601075
@@ -1076,8 +1091,6 @@
10771092 * @return \type{\array} Array of arrays of the arguments to wfMsg to explain permissions problems.
10781093 */
10791094 private function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true ) {
1080 - global $wgLang;
1081 -
10821095 wfProfileIn( __METHOD__ );
10831096
10841097 $errors = array();
@@ -1249,34 +1262,6 @@
12501263 $errors[] = $return;
12511264 }
12521265
1253 - // Check per-user restrictions
1254 - if( $doExpensiveQueries && $action != 'read' ) {
1255 - $rs = UserRestriction::fetchForTitle( $user, $this );
1256 - if( !$rs )
1257 - $rs = UserRestriction::fetchForNamespace( $user, $this->getNamespace() );
1258 - if( $rs ) {
1259 - $r = $rs[0];
1260 - if( !$r->deleteIfExpired() ) {
1261 - $error = array();
1262 - $start = array( $wgLang->date( $r->getTimestamp() ), $wgLang->time( $r->getTimestamp() ) );
1263 - if( $r->isPage() )
1264 - $error = array( 'userrestricted-page', $this->getFullText(),
1265 - $r->getBlockerText(), $r->getReason(), $start[0], $start[1] );
1266 - elseif( $r->isNamespace() )
1267 - $error = array( 'userrestricted-namespace', $wgLang->getDisplayNsText( $this->getNamespace() ),
1268 - $r->getBlockerText(), $r->getReason(), $start[0], $start[1] );
1269 -
1270 - if( $r->getExpiry() == 'infinity' ) {
1271 - $error[0] .= '-indef';
1272 - } else {
1273 - $error[] = $wgLang->date( $r->getExpiry() );
1274 - $error[] = $wgLang->time( $r->getExpiry() );
1275 - }
1276 - $errors[] = $error;
1277 - }
1278 - }
1279 - }
1280 -
12811266 wfProfileOut( __METHOD__ );
12821267 return $errors;
12831268 }
@@ -2573,12 +2558,6 @@
25742559 $log->addEntry( 'move_prot', $nt, $comment, array($this->getPrefixedText()) ); // FIXME: $params?
25752560 }
25762561
2577 - # Update user restrictions
2578 - $dbw->update( 'user_restrictions',
2579 - array( 'ur_page_namespace' => $nt->getNamespace(), 'ur_page_title' => $nt->getDBKey() ),
2580 - array( 'ur_page_namespace' => $this->getNamespace(), 'ur_page_title' => $this->getDBKey() ),
2581 - __METHOD__ );
2582 -
25832562 # Update watchlists
25842563 $oldnamespace = $this->getNamespace() & ~1;
25852564 $newnamespace = $nt->getNamespace() & ~1;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1232,7 +1232,6 @@
12331233 $wgGroupPermissions['sysop']['apihighlimits'] = true;
12341234 $wgGroupPermissions['sysop']['browsearchive'] = true;
12351235 $wgGroupPermissions['sysop']['noratelimit'] = true;
1236 -$wgGroupPermissions['sysop']['restrict'] = true;
12371236 $wgGroupPermissions['sysop']['movefile'] = true;
12381237 #$wgGroupPermissions['sysop']['mergehistory'] = true;
12391238
@@ -2797,7 +2796,6 @@
27982797 'patrol',
27992798 'merge',
28002799 'suppress',
2801 - 'restrict',
28022800 );
28032801
28042802 /**
@@ -2852,7 +2850,6 @@
28532851 'patrol' => 'patrol-log-page',
28542852 'merge' => 'mergelog',
28552853 'suppress' => 'suppressionlog',
2856 - 'restrict' => 'restrictionlog',
28572854 );
28582855
28592856 /**
@@ -2873,7 +2870,6 @@
28742871 'patrol' => 'patrol-log-header',
28752872 'merge' => 'mergelogpagetext',
28762873 'suppress' => 'suppressionlogtext',
2877 - 'restrict' => 'restrictionlogtext',
28782874 );
28792875
28802876 /**
@@ -2909,8 +2905,6 @@
29102906 'suppress/delete' => 'suppressedarticle',
29112907 'suppress/block' => 'blocklogentry',
29122908 'suppress/reblock' => 'reblock-logentry',
2913 - 'restrict/restrict' => 'restrictentry',
2914 - 'restrict/remove' => 'restrictremoveentry',
29152909 );
29162910
29172911 /**
@@ -2982,8 +2976,6 @@
29832977 'Preferences' => 'users',
29842978 'Resetpass' => 'users',
29852979 'DeletedContributions' => 'users',
2986 - 'ListUserRestrictions' => 'users',
2987 - 'RestrictUser' => 'users',
29882980
29892981 'Mostlinked' => 'highuse',
29902982 'Mostlinkedcategories' => 'highuse',
Index: trunk/phase3/includes/specials/SpecialRestrictUser.php
@@ -2,8 +2,6 @@
33
44 function wfSpecialRestrictUser( $par = null ) {
55 global $wgOut, $wgRequest;
6 - $wgOut->addHTML( wfMsgExt( 'restrictuser-description', 'parse' ) );
7 -
86 $user = $userOrig = null;
97 if( $par ) {
108 $userOrig = $par;
@@ -50,6 +48,8 @@
5149 }
5250
5351 public static function existingRestrictions( $restrictions ) {
 52+ //TODO: autoload?
 53+ require_once( dirname( __FILE__ ) . '/SpecialListUserRestrictions.php' );
5454 $s = Xml::fieldset( wfMsg( 'restrictuser-existing' ) ) . '<ul>';
5555 foreach( $restrictions as $r )
5656 $s .= UserRestrictionsPager::formatRestriction( $r );
@@ -126,7 +126,6 @@
127127 $l = new LogPage( 'restrict' );
128128 $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(),
129129 array( $r->getType(), $r->getPage()->getFullText(), $logExpiry) );
130 - self::invalidateCache( $user );
131130 }
132131
133132 public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) {
@@ -137,13 +136,13 @@
138137 $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) {
139138 $ns = $wgRequest->getVal( 'namespace' );
140139 if( $wgContLang->getNsText( $ns ) === false )
141 - $error = array( 'restrictuser-badnamespace' );
 140+ $error = wfMsgExt( 'restrictuser-badnamespace', 'parseinline' );
142141 elseif( UserRestriction::convertExpiry( $wgRequest->getVal( 'expiry' ) ) === false )
143 - $error = array( 'restrictuser-badexpiry', $wgRequest->getVal( 'expiry' ) );
 142+ $error = wfMsgExt( 'restrictuser-badexpiry', 'parseinline', $wgRequest->getVal( 'expiry' ) );
144143 else
145144 foreach( $oldRestrictions as $r )
146145 if( $r->isNamespace() && $r->getNamespace() == $ns )
147 - $error = array( 'restrictuser-dupnamespace' );
 146+ $error = wfMsgExt( 'restrictuser-dupnamespace', 'parse' );
148147 if( !$error ) {
149148 self::doNamespaceRestriction( $uid, $user );
150149 $success = array('restrictuser-success', $user);
@@ -186,11 +185,5 @@
187186 $l = new LogPage( 'restrict' );
188187 $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(),
189188 array( $r->getType(), $r->getNamespace(), $logExpiry ) );
190 - self::invalidateCache( $user );
191189 }
192 -
193 - private static function invalidateCache( $user ) {
194 - $userObj = User::newFromName( $user, false );
195 - $userObj->invalidateCache();
196 - }
197190 }
Index: trunk/phase3/includes/specials/SpecialRemoveRestrictions.php
@@ -56,7 +56,5 @@
5757 if( $r->isNamespace() )
5858 $params[] = $r->getNamespace();
5959 $log->addEntry( 'remove', Title::makeTitle( NS_USER, $r->getSubjectText() ), $reason, $params );
60 - $userObj = User::newFromName( $r->getSubjectText(), false );
61 - $userObj->invalidateCache();
6260 return $result;
6361 }
Index: trunk/phase3/includes/specials/SpecialListUserRestrictions.php
@@ -134,7 +134,7 @@
135135 $subjlink = $sk->userLink( $r->getSubjectId(), $r->getSubjectText() ) .
136136 $sk->userToolLinks( $r->getSubjectId(), $r->getSubjectText() );
137137 $expiry = is_numeric( $r->getExpiry() ) ?
138 - wfMsg( 'listuserrestrictions-row-expiry', $wgLang->date( $r->getExpiry() ), $wgLang->time( $r->getExpiry() ) ) :
 138+ wfMsg( 'listuserrestrictions-row-expiry', $wgLang->timeanddate( $r->getExpiry() ) ) :
139139 wfMsg( 'ipbinfinite' );
140140 $msg = '';
141141 if( $r->isNamespace() ) {
Index: trunk/phase3/includes/SpecialPage.php
@@ -129,9 +129,6 @@
130130 'Allpages' => 'SpecialAllpages',
131131 'Prefixindex' => 'SpecialPrefixindex',
132132 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
133 - 'ListUserRestrictions' => array( 'SpecialPage', 'ListUserRestrictions' ),
134 - 'RemoveRestrictions' => array( 'UnlistedSpecialPage', 'RemoveRestrictions', 'restrict' ),
135 - 'RestrictUser' => array( 'SpecialPage', 'RestrictUser', 'restrict' ),
136133 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
137134 'Contributions' => 'SpecialContributions',
138135 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
Index: trunk/phase3/includes/LogPage.php
@@ -193,19 +193,6 @@
194194 } else {
195195 $rv = wfMsgForContent( $wgLogActions[$key], $titleLink );
196196 }
197 - } elseif( $type == 'restrict' ) {
198 - if( $params[0] == UserRestriction::PAGE )
199 - $subj = wfMsgExt( 'restrictlogpage', 'parseinline', $params[1] );
200 - if( $params[0] == UserRestriction::NAMESPACE )
201 - $subj = wfMsgExt( 'restrictlognamespace', 'parseinline', $wgLang->getDisplayNsText( $params[1] ) );
202 - $expiry = '';
203 - if( $key == 'restrict/restrict' )
204 - $expiry = $wgLang->translateBlockExpiry( $params[2] );
205 - if ( $skin ) {
206 - $rv = wfMsg( $wgLogActions[$key], $titleLink, $subj, $expiry );
207 - } else {
208 - $rv = wfMsgForContent( $wgLogActions[$key], $titleLink, $subj, $expiry );
209 - }
210197 } else {
211198 $details = '';
212199 array_unshift( $params, $titleLink );
@@ -277,7 +264,6 @@
278265 }
279266 break;
280267 case 'rights':
281 - case 'restrict':
282268 $text = $wgContLang->ucfirst( $title->getText() );
283269 $titleLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $text ) );
284270 break;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -431,9 +431,6 @@
432432 'LinkSearch' => array( 'LinkSearch' ),
433433 'DeletedContributions' => array( 'DeletedContributions' ),
434434 'Interwiki' => array( 'Interwiki' ),
435 - 'ListUserRestrictions' => array( 'ListUserRestrictions' ),
436 - 'RemoveRestrictions' => array( 'RemoveRestrictions' ),
437 - 'RestrictUser' => array( 'RestrictUser' ),
438435 );
439436
440437 /**
@@ -1199,39 +1196,7 @@
12001197 'edit-no-change' => 'Your edit was ignored, because no change was made to the text.',
12011198 'edit-already-exists' => 'Could not create a new page.
12021199 It already exists.',
1203 -'userrestricted-page' => '<big>\'\'\'Your user name or IP address has been restricted from editing page "$1".\'\'\'</big>
12041200
1205 -The restriction was set by [[User:$2|$2]].
1206 -The reason given is \'\'$3\'\'.
1207 -
1208 -The restriction was set on $4 at $5 and expires on $6 at $7.
1209 -
1210 -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.',
1211 -'userrestricted-namespace' => "<big>'''Your user name or IP address has been restricted from editing the $1 namespace.'''</big>
1212 -
1213 -The restriction was put by [[User:$2|$2]].
1214 -The reason given is ''$3''.
1215 -
1216 -Restriction was put on $4 at $5 and expires on $6 at $7.
1217 -
1218 -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.",
1219 -'userrestricted-page-indef' => '<big>\'\'\'Your user name or IP address has been restricted from editing page "$1".\'\'\'</big>
1220 -
1221 -The restriction was set by [[User:$2|$2]].
1222 -The reason given is \'\'$3\'\'.
1223 -
1224 -The restriction was set on $4 at $5 and will not expire.
1225 -
1226 -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.',
1227 -'userrestricted-namespace-indef' => "<big>'''Your user name or IP address has been restricted from editing $1 namespace.'''</big>
1228 -
1229 -The restriction was put by [[User:$2|$2]].
1230 -The reason given is ''$3''.
1231 -
1232 -Restriction was put on $4 at $5 and will not expire.
1233 -
1234 -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.",
1235 -
12361201 # Parser/template warnings
12371202 'expensive-parserfunction-warning' => 'Warning: This page contains too many expensive parser function calls.
12381203
@@ -2601,7 +2566,6 @@
26022567 'ipbsubmit' => 'Block this user',
26032568 'ipbother' => 'Other time:',
26042569 'ipboptions' => '2 hours:2 hours,1 day:1 day,3 days:3 days,1 week:1 week,2 weeks:2 weeks,1 month:1 month,3 months:3 months,6 months:6 months,1 year:1 year,infinite:infinite', # display1:time1,display2:time2,...
2605 -'ipbinfinite' => 'infinite',
26062570 'ipbotheroption' => 'other',
26072571 'ipbotherreason' => 'Other/additional reason:',
26082572 'ipbhidename' => 'Hide username from the block log, active block list and user list',
@@ -2684,72 +2648,6 @@
26852649 You cannot create an account',
26862650 'cant-block-while-blocked' => 'You cannot block other users while you are blocked.',
26872651
2688 -# Special:ListUserRestrictions
2689 -'listuserrestrictions' => 'List of user restrictions',
2690 -'listuserrestrictions-intro' => 'This list contains all restrictions from editing certain pages and namespaces put on users.
2691 -[[Special:Ipblocklist|Blocks]] are not listed here.',
2692 -'listuserrestrictions-row-ns' => 'restricted $1 from editing $2 namespace ($3)',
2693 -'listuserrestrictions-row-page' => 'restricted $1 from editing $2 ($3)',
2694 -'listuserrestrictions-row-expiry' => 'expires on $1 at $2',
2695 -'listuserrestrictions-legend' => 'Find a restriction',
2696 -'listuserrestrictions-type' => 'Type:',
2697 -'listuserrestrictions-user' => 'User:',
2698 -'listuserrestrictions-namespace' => 'Namespace:',
2699 -'listuserrestrictions-page' => 'Page:',
2700 -'listuserrestrictions-submit' => 'Go',
2701 -'listuserrestrictions-notfound' => 'There is no restriction that matches specified criteria.',
2702 -'listuserrestrictions-empty' => 'This list is empty.',
2703 -'listuserrestrictions-remove' => 'remove',
2704 -'userrestrictiontype-none' => '(none)',
2705 -'userrestrictiontype-namespace' => 'Namespace',
2706 -'userrestrictiontype-page' => 'Page',
2707 -
2708 -# Special:RemoveRestrictions
2709 -'removerestrictions' => 'Remove the restriction for a user',
2710 -'removerestrictions-intro' => 'Use the form below to remove a restriction from a certain user.',
2711 -'removerestrictions-noid' => 'No restriction ID was specified.',
2712 -'removerestrictions-wrongid' => 'Restriction with that ID not found.
2713 -Most probably someone has removed it or it expired.',
2714 -'removerestrictions-legend' => 'Remove a restriction',
2715 -'removerestrictions-user' => 'Restricted user:',
2716 -'removerestrictions-type' => 'Restriction type:',
2717 -'removerestrictions-page' => 'Page:',
2718 -'removerestrictions-namespace' => 'Namespace:',
2719 -'removerestrictions-reason' => 'Reason:',
2720 -'removerestrictions-submit' => 'Remove the restriction',
2721 -'removerestrictions-success' => 'Successfully removed the restriction from [[User:$1|$1]].',
2722 -
2723 -# Restrict user
2724 -'restrictuser' => 'Restrict user',
2725 -'restrictuser-userselect' => 'Select a user',
2726 -'restrictuser-user' => 'User:',
2727 -'restrictuser-go' => 'Restrict user',
2728 -'restrictuser-notfound' => 'User not found',
2729 -'restrictuser-existing' => 'Existing restrictions',
2730 -'restrictuser-legend-page' => 'Restrict from editing a page',
2731 -'restrictuser-legend-namespace' => 'Restrict from editing a namespace',
2732 -'restrictuser-title' => 'Page to restrict:',
2733 -'restrictuser-namespace' => 'Namespace:',
2734 -'restrictuser-expiry' => 'Expires:',
2735 -'restrictuser-reason' => 'Reason:',
2736 -'restrictuser-submit' => 'Restrict user',
2737 -'restrictuser-badtitle' => 'Invalid title specified: $1.',
2738 -'restrictuser-badnamespace' => 'Invalid namespace specified.',
2739 -'restrictuser-badexpiry' => 'Invalid expiry specified: $1.',
2740 -'restrictuser-duptitle' => 'User is already restricted from editing this title.',
2741 -'restrictuser-dupnamespace' => 'User is already restricted from editing this namespace.',
2742 -'restrictuser-success' => 'Successfully restricted user $1.',
2743 -'restrictuser-description' => 'Use the form below to block write access to a specific page or namespace from a specific IP address or username.
2744 -This should be done only in accordance with policy. Fill in a specific reason below.',
2745 -
2746 -# Special:Log/restrict
2747 -'restrictionlog' => 'User restriction log',
2748 -'restrictionlogtext' => 'This log contains all restrictions put on users by administrators.',
2749 -'restrictentry' => 'restricted $1 from editing $2 (expiry set to $3)',
2750 -'restrictremoveentry' => 'removed restriction from $1 for editing $2',
2751 -'restrictlognamespace' => '$1 namespace',
2752 -'restrictlogpage' => '[[$1]]', # do not translate or duplicate this message to other languages
2753 -
27542652 # Developer tools
27552653 'lockdb' => 'Lock database',
27562654 'unlockdb' => 'Unlock database',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r41352* (bug 674) Allow users to be blocked from editing a specific article...vasilievvv16:08, 28 September 2008
r45231* (bug 674) Allow users to be blocked from editing a specific article...vasilievvv17:25, 31 December 2008
r45235* Fix up schema per Brion's notesvasilievvv18:10, 31 December 2008

Status & tagging log