Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -440,9 +440,6 @@ |
441 | 441 | 'Blankpage' => array( 'BlankPage' ), |
442 | 442 | 'LinkSearch' => array( 'LinkSearch' ), |
443 | 443 | 'DeletedContributions' => array( 'DeletedContributions' ), |
444 | | - 'ListUserRestrictions' => array( 'ListUserRestrictions' ), |
445 | | - 'RemoveRestrictions' => array( 'RemoveRestrictions' ), |
446 | | - 'RestrictUser' => array( 'RestrictUser' ), |
447 | 444 | ); |
448 | 445 | |
449 | 446 | /** |
— | — | @@ -1201,39 +1198,7 @@ |
1202 | 1199 | 'edit-no-change' => 'Your edit was ignored, because no change was made to the text.', |
1203 | 1200 | 'edit-already-exists' => 'Could not create a new page. |
1204 | 1201 | It already exists.', |
1205 | | -'userrestricted-page' => '<big>\'\'\'Your user name or IP address has been restricted from editing page "$1".\'\'\'</big> |
1206 | 1202 | |
1207 | | -The restriction was put by [[User:$2|$2]]. |
1208 | | -The reason given is \'\'$3\'\'. |
1209 | | - |
1210 | | -Restriction was put on $4 at $5 and expires on $6 at $7. |
1211 | | - |
1212 | | -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.', |
1213 | | -'userrestricted-namespace' => "<big>'''Your user name or IP address has been restricted from editing $1 namespace.'''</big> |
1214 | | - |
1215 | | -The restriction was put by [[User:$2|$2]]. |
1216 | | -The reason given is ''$3''. |
1217 | | - |
1218 | | -Restriction was put on $4 at $5 and expires on $6 at $7. |
1219 | | - |
1220 | | -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.", |
1221 | | -'userrestricted-page-indef' => '<big>\'\'\'Your user name or IP address has been restricted from editing page "$1".\'\'\'</big> |
1222 | | - |
1223 | | -The restriction was put by [[User:$2|$2]]. |
1224 | | -The reason given is \'\'$3\'\'. |
1225 | | - |
1226 | | -Restriction was put on $4 at $5 and will not expire. |
1227 | | - |
1228 | | -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.', |
1229 | | -'userrestricted-namespace-indef' => "<big>'''Your user name or IP address has been restricted from editing $1 namespace.'''</big> |
1230 | | - |
1231 | | -The restriction was put by [[User:$2|$2]]. |
1232 | | -The reason given is ''$3''. |
1233 | | - |
1234 | | -Restriction was put on $4 at $5 and will not expire. |
1235 | | - |
1236 | | -You can contact [[User:$2|$2]] or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the restriction.", |
1237 | | - |
1238 | 1203 | # Parser/template warnings |
1239 | 1204 | 'expensive-parserfunction-warning' => 'Warning: This page contains too many expensive parser function calls. |
1240 | 1205 | |
— | — | @@ -2537,7 +2502,6 @@ |
2538 | 2503 | 'ipbsubmit' => 'Block this user', |
2539 | 2504 | 'ipbother' => 'Other time:', |
2540 | 2505 | '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,... |
2541 | | -'ipbinfinite' => 'infinite', |
2542 | 2506 | 'ipbotheroption' => 'other', |
2543 | 2507 | 'ipbotherreason' => 'Other/additional reason:', |
2544 | 2508 | 'ipbhidename' => 'Hide username from the block log, active block list and user list', |
— | — | @@ -2610,70 +2574,6 @@ |
2611 | 2575 | You cannot create an account', |
2612 | 2576 | 'cant-block-while-blocked' => 'You cannot block other users while you are blocked.', |
2613 | 2577 | |
2614 | | -# Special:ListUserRestrictions |
2615 | | -'listuserrestrictions' => 'List of user restrictions', |
2616 | | -'listuserrestrictions-intro' => 'This list contains all restrictions from editing certain pages and namespaces put on users. |
2617 | | -[[Special:Ipblocklist|Blocks]] are not listed here.', |
2618 | | -'listuserrestrictions-row-ns' => 'restricted $1 from editing $2 namespace ($3)', |
2619 | | -'listuserrestrictions-row-page' => 'restricted $1 from editing $2 ($3)', |
2620 | | -'listuserrestrictions-row-expiry' => 'expires on $1 at $2', |
2621 | | -'listuserrestrictions-legend' => 'Find a restriction', |
2622 | | -'listuserrestrictions-type' => 'Type:', |
2623 | | -'listuserrestrictions-user' => 'User:', |
2624 | | -'listuserrestrictions-namespace' => 'Namespace:', |
2625 | | -'listuserrestrictions-page' => 'Page:', |
2626 | | -'listuserrestrictions-submit' => 'Go', |
2627 | | -'listuserrestrictions-notfound' => 'There is no restriction that matches specified criteria.', |
2628 | | -'listuserrestrictions-empty' => 'This list is empty.', |
2629 | | -'listuserrestrictions-remove' => 'remove', |
2630 | | -'userrestrictiontype-none' => '(none)', |
2631 | | -'userrestrictiontype-namespace' => 'Namespace', |
2632 | | -'userrestrictiontype-page' => 'Page', |
2633 | | - |
2634 | | -# Special:RemoveRestrictions |
2635 | | -'removerestrictions' => 'Remove restriction from a user', |
2636 | | -'removerestrictions-intro' => 'Use the form below to remove a restriction from a certain user.', |
2637 | | -'removerestrictions-noid' => 'No restriction ID was specified.', |
2638 | | -'removerestrictions-wrongid' => 'Restriction with that ID not found. |
2639 | | -Most probably someone has removed it or it expired.', |
2640 | | -'removerestrictions-legend' => 'Remove a restriction', |
2641 | | -'removerestrictions-user' => 'Restricted user:', |
2642 | | -'removerestrictions-type' => 'Restriction type:', |
2643 | | -'removerestrictions-page' => 'Page:', |
2644 | | -'removerestrictions-namespace' => 'Namespace:', |
2645 | | -'removerestrictions-reason' => 'Reason:', |
2646 | | -'removerestrictions-submit' => 'Remove the restriction', |
2647 | | -'removerestrictions-success' => 'Successfully removed the restriction from [[User:$1|$1]].', |
2648 | | - |
2649 | | -# Special:RestrictUser |
2650 | | -'restrictuser' => 'Restrict user', |
2651 | | -'restrictuser-userselect' => 'Select a user', |
2652 | | -'restrictuser-user' => 'User:', |
2653 | | -'restrictuser-go' => 'Restrict user', |
2654 | | -'restrictuser-notfound' => 'User not found', |
2655 | | -'restrictuser-existing' => 'Existing restrictions', |
2656 | | -'restrictuser-legend-page' => 'Restrict from editing certain page', |
2657 | | -'restrictuser-legend-namespace' => 'Restrict from editing certain namespace', |
2658 | | -'restrictuser-title' => 'Page to restrict:', |
2659 | | -'restrictuser-namespace' => 'Namespace:', |
2660 | | -'restrictuser-expiry' => 'Expires:', |
2661 | | -'restrictuser-reason' => 'Reason:', |
2662 | | -'restrictuser-submit' => 'Restrict user', |
2663 | | -'restrictuser-badtitle' => 'Invalid title specified: $1.', |
2664 | | -'restrictuser-badnamespace' => 'Invalid namespace specified.', |
2665 | | -'restrictuser-badexpiry' => 'Invalid expiry specified: $1.', |
2666 | | -'restrictuser-duptitle' => 'User is already restricted from editing this title.', |
2667 | | -'restrictuser-dupnamespace' => 'User is already restricted from editing this namespace.', |
2668 | | -'restrictuser-success' => 'Successfully restricted user $1.', |
2669 | | - |
2670 | | -# Special:Log/restrict |
2671 | | -'restrictionlog' => 'User restriction log', |
2672 | | -'restrictionlogtext' => 'This log contains all restrictions put on users by administrators.', |
2673 | | -'restrictentry' => 'restricted $1 from editing $2 (expiry set to $3)', |
2674 | | -'restrictremoveentry' => 'removed restriction from $1 for editing $2', |
2675 | | -'restrictlognamespace' => '$1 namespace', |
2676 | | -'restrictlogpage' => '[[$1]]', # do not translate or duplicate this message to other languages |
2677 | | - |
2678 | 2578 | # Developer tools |
2679 | 2579 | 'lockdb' => 'Lock database', |
2680 | 2580 | 'unlockdb' => 'Unlock database', |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -265,20 +265,6 @@ |
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
269 | | - * A convenience function that returns the same thing as |
270 | | - * getFormattedNsText() except with '(Main)' for zero namespace. |
271 | | - * |
272 | | - * @return array |
273 | | - */ |
274 | | - function getDisplayNsText( $index ) { |
275 | | - if( $index == 0 ) { |
276 | | - return wfMsg( 'blanknamespace' ); |
277 | | - } else { |
278 | | - return $this->getFormattedNsText( $index ); |
279 | | - } |
280 | | - } |
281 | | - |
282 | | - /** |
283 | 269 | * Get a namespace key by value, case insensitive. |
284 | 270 | * Only matches namespace names for the current language, not the |
285 | 271 | * canonical ones defined in Namespace.php. |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -142,11 +142,10 @@ |
143 | 143 | * Improved upload file type detection for OpenDocument formats |
144 | 144 | * Added the ability to set the target attribute on external links with |
145 | 145 | $wgExternalLinkTarget |
146 | | -* (bug 674) Allow admins to block users from editing specific articles and |
147 | | - namespaces |
148 | 146 | * (bug 368) Don't use caption for alt attribute; allow manual specification |
149 | 147 | using new "alt=" parameter for images |
150 | 148 | |
| 149 | + |
151 | 150 | === Bug fixes in 1.14 === |
152 | 151 | |
153 | 152 | * (bug 14907) DatabasePostgres::fieldType now defined. |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -145,10 +145,9 @@ |
146 | 146 | array( 'update_password_format' ), |
147 | 147 | |
148 | 148 | // 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' ), |
150 | 150 | 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' ) |
153 | 152 | ); |
154 | 153 | |
155 | 154 | |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -1243,44 +1243,4 @@ |
1244 | 1244 | PRIMARY KEY (ul_key) |
1245 | 1245 | ) /*$wgDBTableOptions*/; |
1246 | 1246 | |
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 varbinary(255) 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 tinyblob 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 tinyblob 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 |
1276 | | - INDEX ur_user (ur_user,ur_user_text(255)), |
1277 | | - -- For Special:ListUserRestrictions |
1278 | | - INDEX ur_type (ur_type(255),ur_timestamp), |
1279 | | - INDEX ur_namespace (ur_namespace,ur_timestamp), |
1280 | | - INDEX ur_page (ur_page_namespace,ur_page_title,ur_timestamp), |
1281 | | - INDEX ur_timestamp (ur_timestamp), |
1282 | | - -- For quick removal of expired restrictions |
1283 | | - INDEX ur_expiry (ur_expiry) |
1284 | | -) /*$wgDBTableOptions*/; |
1285 | | - |
1286 | 1247 | -- vim: sw=2 sts=2 et |
Index: trunk/phase3/maintenance/archives/patch-user_restrictions.sql |
— | — | @@ -1,40 +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 varbinary(255) 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 tinyblob 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 tinyblob 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 |
32 | | - INDEX ur_user (ur_user,ur_user_text(255)), |
33 | | - -- For Special:ListUserRestrictions |
34 | | - INDEX ur_type (ur_type(255),ur_timestamp), |
35 | | - INDEX ur_namespace (ur_namespace,ur_timestamp), |
36 | | - INDEX ur_page (ur_page_namespace,ur_page_title,ur_timestamp), |
37 | | - INDEX ur_timestamp (ur_timestamp), |
38 | | - -- For quick removal of expired restrictions |
39 | | - INDEX ur_expiry (ur_expiry) |
40 | | -) /*$wgDBTableOptions*/; |
Index: trunk/phase3/includes/UserRestriction.php |
— | — | @@ -1,158 +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 newFromId( $id, $forWrite = false ) { |
54 | | - $dbr = wfGetDB( $forWrite ? DB_MASTER : DB_SLAVE ); |
55 | | - if( !$id || !is_numeric( $id ) ) |
56 | | - return null; |
57 | | - $res = $dbr->selectRow( 'user_restrictions', '*', array( 'ur_id' => $id ), __METHOD__ ); |
58 | | - return self::newFromRow( $res ); |
59 | | - } |
60 | | - |
61 | | - public function getId() { return $this->mId; } |
62 | | - public function setId( $v ) { $this->mId = $v; } |
63 | | - public function getType() { return $this->mType; } |
64 | | - public function setType( $v ) { $this->mType = $v; } |
65 | | - public function getNamespace() { return $this->mNamespace; } |
66 | | - public function setNamespace( $v ) { $this->mNamespace = $v; } |
67 | | - public function getPage() { return $this->mPage; } |
68 | | - public function setPage( $v ) { $this->mPage = $v; } |
69 | | - public function getSubjectId() { return $this->mSubjectId; } |
70 | | - public function setSubjectId( $v ) { $this->mSubjectId = $v; } |
71 | | - public function getSubjectText() { return $this->mSubjectText; } |
72 | | - public function setSubjectText( $v ) { $this->mSubjectText = $v; } |
73 | | - public function getBlockerId() { return $this->mBlockerId; } |
74 | | - public function setBlockerId( $v ) { $this->mBlockerId = $v; } |
75 | | - public function getBlockerText() { return $this->mBlockerText; } |
76 | | - public function setBlockerText( $v ) { $this->mBlockerText = $v; } |
77 | | - public function getReason() { return $this->mReason; } |
78 | | - public function setReason( $v ) { $this->mReason = $v; } |
79 | | - public function getTimestamp() { return $this->mTimestamp; } |
80 | | - public function setTimestamp( $v ) { $this->mTimestamp = $v; } |
81 | | - public function getExpiry() { return $this->mExpiry; } |
82 | | - public function setExpiry( $v ) { $this->mExpiry = $v; } |
83 | | - |
84 | | - public function isPage() { |
85 | | - return $this->mType == self::PAGE; |
86 | | - } |
87 | | - public function isNamespace() { |
88 | | - return $this->mType == self::NAMESPACE; |
89 | | - } |
90 | | - |
91 | | - public function isExpired() { |
92 | | - return is_numeric( $this->mExpiry ) && $this->mExpiry < wfTimestampNow( TS_MW ); |
93 | | - } |
94 | | - |
95 | | - public function deleteIfExpired() { |
96 | | - if( $this->isExpired() ) { |
97 | | - $this->delete(); |
98 | | - return true; |
99 | | - } else { |
100 | | - return false; |
101 | | - } |
102 | | - } |
103 | | - |
104 | | - public function delete() { |
105 | | - $dbw = wfGetDB( DB_MASTER ); |
106 | | - $dbw->delete( 'user_restrictions', array( 'ur_id' => $this->mId ), __METHOD__ ); |
107 | | - return $dbw->affectedRows(); |
108 | | - } |
109 | | - |
110 | | - public static function purgeExpired() { |
111 | | - $dbw = wfGetDB( DB_MASTER ); |
112 | | - $dbw->delete( 'user_restrictions', array( 'ur_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), __METHOD__ ); |
113 | | - } |
114 | | - |
115 | | - public function commit() { |
116 | | - $dbw = wfGetDB( DB_MASTER ); |
117 | | - $this->setId( $dbw->nextSequenceValue('user_restrictions_ur_id_val') ); |
118 | | - $row = array( |
119 | | - 'ur_id' => $this->mId, |
120 | | - 'ur_type' => $this->mType, |
121 | | - 'ur_user' => $this->mSubjectId, |
122 | | - 'ur_user_text' => $this->mSubjectText, |
123 | | - 'ur_by' => $this->mBlockerId, |
124 | | - 'ur_by_text' => $this->mBlockerText, |
125 | | - 'ur_reason' => $this->mReason, |
126 | | - 'ur_timestamp' => $dbw->timestamp( $this->mTimestamp ), |
127 | | - 'ur_expiry' => $this->mExpiry, |
128 | | - ); |
129 | | - if( $this->isPage() ) { |
130 | | - $row['ur_page_namespace'] = $this->mPage->getNamespace(); |
131 | | - $row['ur_page_title'] = $this->mPage->getDbKey(); |
132 | | - } |
133 | | - if( $this->isNamespace() ) { |
134 | | - $row['ur_namespace'] = $this->mNamespace; |
135 | | - } |
136 | | - $dbw->insert( 'user_restrictions', $row, __METHOD__ ); |
137 | | - } |
138 | | - |
139 | | - public static function formatType( $type ) { |
140 | | - return wfMsg( 'userrestrictiontype-' . $type ); |
141 | | - } |
142 | | - |
143 | | - /** |
144 | | - * Converts expiry which user input to the internal representation. |
145 | | - * Returns false if invalid expiry is set, Block::infinity() on empty value, |
146 | | - * Block::infinity() on infinity or 14-symbol timestamp |
147 | | - */ |
148 | | - public static function convertExpiry( $expiry ) { |
149 | | - if( !$expiry ) |
150 | | - return Block::infinity(); |
151 | | - if( in_array( $expiry, array( 'infinite', 'infinity', 'indefinite' ) ) ) |
152 | | - return Block::infinity(); |
153 | | - $unix = @strtotime( $expiry ); |
154 | | - if( !$unix || $unix === -1 ) |
155 | | - return false; |
156 | | - else |
157 | | - return wfTimestamp( TS_MW, $unix ); |
158 | | - } |
159 | | -} |
Index: trunk/phase3/includes/User.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * \type{\int} Serialized record version. |
16 | 16 | * @ingroup Constants |
17 | 17 | */ |
18 | | -define( 'MW_USER_VERSION', 7 ); |
| 18 | +define( 'MW_USER_VERSION', 6 ); |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * \type{\string} Some punctuation to prevent editing from broken text-mangling proxies. |
— | — | @@ -118,8 +118,6 @@ |
119 | 119 | 'mEditCount', |
120 | 120 | // user_group table |
121 | 121 | 'mGroups', |
122 | | - // user_restrictions table |
123 | | - 'mRestrictions', |
124 | 122 | ); |
125 | 123 | |
126 | 124 | /** |
— | — | @@ -158,7 +156,6 @@ |
159 | 157 | 'proxyunbannable', |
160 | 158 | 'purge', |
161 | 159 | 'read', |
162 | | - 'restrict', |
163 | 160 | 'reupload', |
164 | 161 | 'reupload-shared', |
165 | 162 | 'rollback', |
— | — | @@ -180,8 +177,7 @@ |
181 | 178 | //@{ |
182 | 179 | var $mId, $mName, $mRealName, $mPassword, $mNewpassword, $mNewpassTime, |
183 | 180 | $mEmail, $mOptions, $mTouched, $mToken, $mEmailAuthenticated, |
184 | | - $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, |
185 | | - $mRestrictions; |
| 181 | + $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups; |
186 | 182 | //@} |
187 | 183 | |
188 | 184 | /** |
— | — | @@ -301,7 +297,6 @@ |
302 | 298 | function saveToCache() { |
303 | 299 | $this->load(); |
304 | 300 | $this->loadGroups(); |
305 | | - $this->loadRestrictions(); |
306 | 301 | if ( $this->isAnon() ) { |
307 | 302 | // Anonymous users are uncached |
308 | 303 | return; |
— | — | @@ -883,7 +878,6 @@ |
884 | 879 | # Initialise user table data |
885 | 880 | $this->loadFromRow( $s ); |
886 | 881 | $this->mGroups = null; // deferred |
887 | | - $this->mRestrictions = null; |
888 | 882 | $this->getEditCount(); // revalidation for nulls |
889 | 883 | return true; |
890 | 884 | } else { |
— | — | @@ -3243,50 +3237,4 @@ |
3244 | 3238 | return true; |
3245 | 3239 | } |
3246 | 3240 | |
3247 | | - // Restrictions-related block |
3248 | | - |
3249 | | - public function loadRestrictions() { |
3250 | | - if( is_null( $this->mRestrictions ) ) |
3251 | | - $this->mRestrictions = UserRestriction::fetchForUser( $this->isLoggedIn() ? |
3252 | | - intval( $this->getId() ) : $this->getName() ); |
3253 | | - } |
3254 | | - |
3255 | | - public function getRestrictions() { |
3256 | | - $this->loadRestrictions(); |
3257 | | - |
3258 | | - // Check for expired restrictions. Recache if found expired ones |
3259 | | - static $checked = false; |
3260 | | - if( !$checked ) { |
3261 | | - $expired = false; |
3262 | | - $old = $this->mRestrictions; |
3263 | | - $this->mRestrictions = array(); |
3264 | | - foreach( $old as $restriction ) { |
3265 | | - if( $restriction->deleteIfExpired() ) |
3266 | | - $expired = true; |
3267 | | - else |
3268 | | - $this->mRestrictions[] = $restriction; |
3269 | | - } |
3270 | | - if( $expired ) |
3271 | | - $this->saveToCache(); |
3272 | | - $checked = true; |
3273 | | - } |
3274 | | - |
3275 | | - return $this->mRestrictions; |
3276 | | - } |
3277 | | - |
3278 | | - public function getRestrictionForPage( Title $page ) { |
3279 | | - foreach( $this->getRestrictions() as $r ) { |
3280 | | - if( $r->isPage() && $page->equals( $r->getPage() ) ) |
3281 | | - return $r; |
3282 | | - } |
3283 | | - return null; |
3284 | | - } |
3285 | | - |
3286 | | - public function getRestrictionForNamespace( $nsid ) { |
3287 | | - foreach( $this->getRestrictions() as $r ) { |
3288 | | - if( $r->isNamespace() && $r->getNamespace() == $nsid ) |
3289 | | - return $r; |
3290 | | - } |
3291 | | - return null; |
3292 | | - } |
3293 | 3241 | } |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -126,9 +126,6 @@ |
127 | 127 | 'Allpages' => 'SpecialAllpages', |
128 | 128 | 'Prefixindex' => 'SpecialPrefixindex', |
129 | 129 | 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ), |
130 | | - 'ListUserRestrictions' => array( 'SpecialPage', 'ListUserRestrictions' ), |
131 | | - 'RemoveRestrictions' => array( 'UnlistedSpecialPage', 'RemoveRestrictions', 'restrict' ), |
132 | | - 'RestrictUser' => array( 'SpecialPage', 'RestrictUser', 'restrict' ), |
133 | 130 | 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ), |
134 | 131 | 'Contributions' => array( 'SpecialPage', 'Contributions' ), |
135 | 132 | 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ), |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1011,7 +1011,9 @@ |
1012 | 1012 | } |
1013 | 1013 | $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries ); |
1014 | 1014 | |
1015 | | - global $wgContLang, $wgLang, $wgEmailConfirmToEdit; |
| 1015 | + global $wgContLang; |
| 1016 | + global $wgLang; |
| 1017 | + global $wgEmailConfirmToEdit; |
1016 | 1018 | |
1017 | 1019 | if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() && $action != 'createaccount' ) { |
1018 | 1020 | $errors[] = array( 'confirmedittext' ); |
— | — | @@ -1043,7 +1045,20 @@ |
1044 | 1046 | $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true ); |
1045 | 1047 | |
1046 | 1048 | if ( $blockExpiry == 'infinity' ) { |
1047 | | - $blockExpiry = wfMsg( 'ipbinfinite' ); |
| 1049 | + // Entry in database (table ipblocks) is 'infinity' but 'ipboptions' uses 'infinite' or 'indefinite' |
| 1050 | + $scBlockExpiryOptions = wfMsg( 'ipboptions' ); |
| 1051 | + |
| 1052 | + foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) { |
| 1053 | + if ( strpos( $option, ':' ) == false ) |
| 1054 | + continue; |
| 1055 | + |
| 1056 | + list ($show, $value) = explode( ":", $option ); |
| 1057 | + |
| 1058 | + if ( $value == 'infinite' || $value == 'indefinite' ) { |
| 1059 | + $blockExpiry = $show; |
| 1060 | + break; |
| 1061 | + } |
| 1062 | + } |
1048 | 1063 | } else { |
1049 | 1064 | $blockExpiry = $wgLang->timeanddate( wfTimestamp( TS_MW, $blockExpiry ), true ); |
1050 | 1065 | } |
— | — | @@ -1053,9 +1068,9 @@ |
1054 | 1069 | $errors[] = array( ($block->mAuto ? 'autoblockedtext' : 'blockedtext'), $link, $reason, $ip, $name, |
1055 | 1070 | $blockid, $blockExpiry, $intended, $blockTimestamp ); |
1056 | 1071 | } |
1057 | | - |
| 1072 | + |
1058 | 1073 | // Remove the errors being ignored. |
1059 | | - |
| 1074 | + |
1060 | 1075 | foreach( $errors as $index => $error ) { |
1061 | 1076 | $error_key = is_array($error) ? $error[0] : $error; |
1062 | 1077 | |
— | — | @@ -1078,8 +1093,6 @@ |
1079 | 1094 | * @return \type{\array} Array of arrays of the arguments to wfMsg to explain permissions problems. |
1080 | 1095 | */ |
1081 | 1096 | private function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true ) { |
1082 | | - global $wgLang; |
1083 | | - |
1084 | 1097 | wfProfileIn( __METHOD__ ); |
1085 | 1098 | |
1086 | 1099 | $errors = array(); |
— | — | @@ -1225,31 +1238,6 @@ |
1226 | 1239 | $errors[] = $return; |
1227 | 1240 | } |
1228 | 1241 | |
1229 | | - // Check per-user restrictions |
1230 | | - if( $action != 'read' ) { |
1231 | | - $r = $user->getRestrictionForPage( $this ); |
1232 | | - if( !$r ) |
1233 | | - $r = $user->getRestrictionForNamespace( $this->getNamespace() ); |
1234 | | - if( $r ) { |
1235 | | - $error = array(); |
1236 | | - $start = array( $wgLang->date( $r->getTimestamp() ), $wgLang->time( $r->getTimestamp() ) ); |
1237 | | - if( $r->isPage() ) |
1238 | | - $error = array( 'userrestricted-page', $this->getFullText(), |
1239 | | - $r->getBlockerText(), $r->getReason(), $start[0], $start[1] ); |
1240 | | - elseif( $r->isNamespace() ) |
1241 | | - $error = array( 'userrestricted-namespace', $wgLang->getDisplayNsText( $this->getNamespace() ), |
1242 | | - $r->getBlockerText(), $r->getReason(), $start[0], $start[1] ); |
1243 | | - |
1244 | | - if( $r->getExpiry() == 'infinity' ) { |
1245 | | - $error[0] .= '-indef'; |
1246 | | - } else { |
1247 | | - $error[] = $wgLang->date( $r->getExpiry() ); |
1248 | | - $error[] = $wgLang->time( $r->getExpiry() ); |
1249 | | - } |
1250 | | - $errors[] = $error; |
1251 | | - } |
1252 | | - } |
1253 | | - |
1254 | 1242 | wfProfileOut( __METHOD__ ); |
1255 | 1243 | return $errors; |
1256 | 1244 | } |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -198,7 +198,6 @@ |
199 | 199 | 'UserArray' => 'includes/UserArray.php', |
200 | 200 | 'UserArrayFromResult' => 'includes/UserArray.php', |
201 | 201 | 'UserMailer' => 'includes/UserMailer.php', |
202 | | - 'UserRestriction' => 'includes/UserRestriction.php', |
203 | 202 | 'UserRightsProxy' => 'includes/UserRightsProxy.php', |
204 | 203 | 'WatchedItem' => 'includes/WatchedItem.php', |
205 | 204 | 'WatchlistEditor' => 'includes/WatchlistEditor.php', |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1183,7 +1183,6 @@ |
1184 | 1184 | $wgGroupPermissions['sysop']['apihighlimits'] = true; |
1185 | 1185 | $wgGroupPermissions['sysop']['browsearchive'] = true; |
1186 | 1186 | $wgGroupPermissions['sysop']['noratelimit'] = true; |
1187 | | -$wgGroupPermissions['sysop']['restrict'] = true; |
1188 | 1187 | #$wgGroupPermissions['sysop']['mergehistory'] = true; |
1189 | 1188 | |
1190 | 1189 | // Permission to change users' group assignments |
— | — | @@ -2669,7 +2668,6 @@ |
2670 | 2669 | 'patrol', |
2671 | 2670 | 'merge', |
2672 | 2671 | 'suppress', |
2673 | | - 'restrict', |
2674 | 2672 | ); |
2675 | 2673 | |
2676 | 2674 | /** |
— | — | @@ -2700,7 +2698,6 @@ |
2701 | 2699 | 'patrol' => 'patrol-log-page', |
2702 | 2700 | 'merge' => 'mergelog', |
2703 | 2701 | 'suppress' => 'suppressionlog', |
2704 | | - 'restrict' => 'restrictionlog', |
2705 | 2702 | ); |
2706 | 2703 | |
2707 | 2704 | /** |
— | — | @@ -2721,7 +2718,6 @@ |
2722 | 2719 | 'patrol' => 'patrol-log-header', |
2723 | 2720 | 'merge' => 'mergelogpagetext', |
2724 | 2721 | 'suppress' => 'suppressionlogtext', |
2725 | | - 'restrict' => 'restrictionlogtext', |
2726 | 2722 | ); |
2727 | 2723 | |
2728 | 2724 | /** |
— | — | @@ -2755,8 +2751,6 @@ |
2756 | 2752 | 'suppress/event' => 'logdelete-logentry', |
2757 | 2753 | 'suppress/delete' => 'suppressedarticle', |
2758 | 2754 | 'suppress/block' => 'blocklogentry', |
2759 | | - 'restrict/restrict' => 'restrictentry', |
2760 | | - 'restrict/remove' => 'restrictremoveentry', |
2761 | 2755 | ); |
2762 | 2756 | |
2763 | 2757 | /** |
— | — | @@ -2827,8 +2821,6 @@ |
2828 | 2822 | 'Preferences' => 'users', |
2829 | 2823 | 'Resetpass' => 'users', |
2830 | 2824 | 'DeletedContributions' => 'users', |
2831 | | - 'ListUserRestrictions' => 'users', |
2832 | | - 'RestrictUser' => 'users', |
2833 | 2825 | |
2834 | 2826 | 'Mostlinked' => 'highuse', |
2835 | 2827 | 'Mostlinkedcategories' => 'highuse', |
Index: trunk/phase3/includes/specials/SpecialRemoveRestrictions.php |
— | — | @@ -56,7 +56,5 @@ |
57 | 57 | if( $r->isNamespace() ) |
58 | 58 | $params[] = $r->getNamespace(); |
59 | 59 | $log->addEntry( 'remove', Title::makeTitle( NS_USER, $r->getSubjectText() ), $reason, $params ); |
60 | | - $userObj = User::newFromName( $r->getSubjectText(), false ); |
61 | | - $userObj->invalidateCache(); |
62 | 60 | return $result; |
63 | 61 | } |
Index: trunk/phase3/includes/specials/SpecialListUserRestrictions.php |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | $subjlink = $sk->userLink( $r->getSubjectId(), $r->getSubjectText() ) . |
136 | 136 | $sk->userToolLinks( $r->getSubjectId(), $r->getSubjectText() ); |
137 | 137 | $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() ) ) : |
139 | 139 | wfMsg( 'ipbinfinite' ); |
140 | 140 | $msg = ''; |
141 | 141 | if( $r->isNamespace() ) { |
Index: trunk/phase3/includes/specials/SpecialListusers.php |
— | — | @@ -123,13 +123,10 @@ |
124 | 124 | } |
125 | 125 | |
126 | 126 | $item = wfSpecialList( $name, $groups ); |
127 | | - $edits = ''; |
128 | | - if ( $row->edits ) { |
129 | | - $editCount = $wgLang->formatNum( $row->edits ); |
130 | | - $edits = ' [' . wfMsgExt( 'usereditcount', 'parsemag', $editCount ) . ']'; |
131 | | - } |
| 127 | + $editCount = $wgLang->formatNum( $row->edits ); |
| 128 | + $edits = wfMsgExt( 'usereditcount', 'parsemag', $editCount ); |
132 | 129 | wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); |
133 | | - return "<li>{$item}{$edits}</li>"; |
| 130 | + return "<li>{$item} [$edits]</li>"; |
134 | 131 | } |
135 | 132 | |
136 | 133 | function getBody() { |
Index: trunk/phase3/includes/specials/SpecialRestrictUser.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | if ( $error ) |
108 | 108 | $wgOut->wrapWikiMsg( '<strong class="error">$1</strong>', $error ); |
109 | 109 | if ( $success ) |
110 | | - $wgOut->wrapWikiMsg( '<strong class="success">$1</strong>', $success ); |
| 110 | + $wgOut->wrapWikiMsg( '<strong class="success">$1/strong>', $success ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | public static function doPageRestriction( $uid, $user ) { |
— | — | @@ -126,7 +126,6 @@ |
127 | 127 | $l = new LogPage( 'restrict' ); |
128 | 128 | $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(), |
129 | 129 | array( $r->getType(), $r->getPage()->getFullText(), $logExpiry) ); |
130 | | - self::invalidateCache( $user ); |
131 | 130 | } |
132 | 131 | |
133 | 132 | public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) { |
— | — | @@ -137,13 +136,13 @@ |
138 | 137 | $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) { |
139 | 138 | $ns = $wgRequest->getVal( 'namespace' ); |
140 | 139 | if( $wgContLang->getNsText( $ns ) === false ) |
141 | | - $error = array( 'restrictuser-badnamespace' ); |
| 140 | + $error = wfMsgExt( 'restrictuser-badnamespace', 'parseinline' ); |
142 | 141 | elseif( UserRestriction::convertExpiry( $wgRequest->getVal( 'expiry' ) ) === false ) |
143 | | - $error = array( 'restrictuser-badexpiry', $wgRequest->getVal( 'expiry' ) ); |
| 142 | + $error = wfMsgExt( 'restrictuser-badexpiry', 'parseinline', $wgRequest->getVal( 'expiry' ) ); |
144 | 143 | else |
145 | 144 | foreach( $oldRestrictions as $r ) |
146 | 145 | if( $r->isNamespace() && $r->getNamespace() == $ns ) |
147 | | - $error = array( 'restrictuser-dupnamespace' ); |
| 146 | + $error = wfMsgExt( 'restrictuser-dupnamespace', 'parse' ); |
148 | 147 | if( !$error ) { |
149 | 148 | self::doNamespaceRestriction( $uid, $user ); |
150 | 149 | $success = array('restrictuser-success', $user); |
— | — | @@ -186,11 +185,5 @@ |
187 | 186 | $l = new LogPage( 'restrict' ); |
188 | 187 | $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(), |
189 | 188 | array( $r->getType(), $r->getNamespace(), $logExpiry ) ); |
190 | | - self::invalidateCache( $user ); |
191 | 189 | } |
192 | | - |
193 | | - private static function invalidateCache( $user ) { |
194 | | - $userObj = User::newFromName( $user, false ); |
195 | | - $userObj->invalidateCache(); |
196 | | - } |
197 | 190 | } |
Index: trunk/phase3/includes/LogPage.php |
— | — | @@ -193,19 +193,6 @@ |
194 | 194 | } else { |
195 | 195 | $rv = wfMsgForContent( $wgLogActions[$key], $titleLink ); |
196 | 196 | } |
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 | | - } |
210 | 197 | } else { |
211 | 198 | $details = ''; |
212 | 199 | array_unshift( $params, $titleLink ); |
— | — | @@ -273,7 +260,6 @@ |
274 | 261 | } |
275 | 262 | break; |
276 | 263 | case 'rights': |
277 | | - case 'restrict': |
278 | 264 | $text = $wgContLang->ucfirst( $title->getText() ); |
279 | 265 | $titleLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $text ) ); |
280 | 266 | break; |