r23226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23225‎ | r23226 | r23227 >
Date:14:52, 22 June 2007
Author:brion
Status:old
Tags:
Comment:
Revert r23166, 23178, 23179, and probably some other related bits.
There are issues with putting robots stuff into the current protection system, so we're backing this out to prevent another backwards-compatibility disaster when it's done in a more reliable way. :)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1182,9 +1182,6 @@
11831183 'protect-summary-cascade',
11841184 'protect-expiring',
11851185 'protect-cascade',
1186 - 'protect-robotspolicy',
1187 - 'protect-robots-noindex',
1188 - 'protect-robots-nofollow',
11891186 'restriction-type',
11901187 'restriction-level',
11911188 'minimum-size',
Index: trunk/phase3/includes/ProtectionForm.php
@@ -43,7 +43,6 @@
4444 // but the db allows multiples separated by commas.
4545 $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
4646 }
47 - $this->mRestrictions['robots'] = implode( ',', $this->mTitle->getRestrictions( 'robots' ) );
4847
4948 $this->mCascade = $this->mTitle->areRestrictionsCascading();
5049
@@ -73,17 +72,9 @@
7473 $this->mRestrictions[$action] = $val;
7574 }
7675 }
77 -
78 - // Read checkboxes only if user is allowed to change robots policy, otherwise keep previous policy
79 - if ( $wgUser->isAllowed( 'editrobots' ) ) {
80 - $robotspolicy = $wgRequest->getBool( 'mwProtect-robots-noindex' ) ? 'noindex' : 'index';
81 - $robotspolicy .= $wgRequest->getBool( 'mwProtect-robots-nofollow' ) ? ',nofollow' : ',follow';
82 - // 'index,follow' is default, no need to set this explicitly at this point; is done at Article::view()
83 - $this->mRestrictions['robots'] = ( $robotspolicy == 'index,follow' ) ? '' : $robotspolicy;
84 - }
8576 }
8677 }
87 -
 78+
8879 function execute() {
8980 global $wgRequest;
9081 if( $wgRequest->wasPosted() ) {
@@ -208,7 +199,7 @@
209200 }
210201
211202 function buildForm() {
212 - global $wgUser, $wgRestrictionTypes;
 203+ global $wgUser;
213204
214205 $out = '';
215206 if( !$this->disabled ) {
@@ -232,17 +223,14 @@
233224 $out .= "<tr>\n";
234225 foreach( $this->mRestrictions as $action => $required ) {
235226 /* Not all languages have V_x <-> N_x relation */
236 - if ( in_array( $action, $wgRestrictionTypes ) )
237 - $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
 227+ $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
238228 }
239229 $out .= "</tr>\n";
240230 $out .= "<tr>\n";
241231 foreach( $this->mRestrictions as $action => $selected ) {
242 - if ( in_array( $action, $wgRestrictionTypes ) ) {
243 - $out .= "<td>\n";
244 - $out .= $this->buildSelector( $action, $selected );
245 - $out .= "</td>\n";
246 - }
 232+ $out .= "<td>\n";
 233+ $out .= $this->buildSelector( $action, $selected );
 234+ $out .= "</td>\n";
247235 }
248236 $out .= "</tr>\n";
249237
@@ -258,7 +246,6 @@
259247 if( $wgEnableCascadingProtection )
260248 $out .= '<tr><td></td><td>' . $this->buildCascadeInput() . "</td></tr>\n";
261249
262 - $out .= $this->buildRobotsInput();
263250 $out .= $this->buildExpiryInput();
264251
265252 if( !$this->disabled ) {
@@ -328,21 +315,6 @@
329316 return $ci;
330317 }
331318
332 - function buildRobotsInput() {
333 - global $wgUser, $wgContLang;
334 - $robotsallowed = $wgUser->isAllowed( 'editrobots' ) ? array() : array( 'disabled' => 'disabled' );
335 - $noindexset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'noindex' ) ) ? true : false;
336 - $nofollowset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'nofollow' ) ) ? true : false;
337 - $ret = "<tr><td align=\"right\">";
338 - $ret .= '<label>' . wfMsgExt( 'protect-robotspolicy', array( 'parseinline' ) ) . '</label>';
339 - $ret .= "</td><td align=\"left\" width=\"60\">";
340 - $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-noindex' ), 'mwProtect-robots-noindex', 'mwProtect-robots-noindex', $noindexset, $robotsallowed );
341 - $ret .= $wgContLang->getDirMark();
342 - $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-nofollow' ), 'mwProtect-robots-nofollow', 'mwProtect-robots-nofollow', $nofollowset, $robotsallowed );
343 - $ret .= "</td></tr>";
344 - return $ret;
345 - }
346 -
347319 function buildExpiryInput() {
348320 $attribs = array( 'id' => 'expires' ) + $this->disabledAttrib;
349321 return '<tr>'
Index: trunk/phase3/includes/Article.php
@@ -641,8 +641,6 @@
642642 } elseif( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
643643 # Honour customised robot policies for this namespace
644644 $policy = $wgNamespaceRobotPolicies[$ns];
645 - } elseif ( $this->mTitle->getRestrictions( 'robots' ) ) {
646 - $policy = implode( ',', $this->mTitle->getRestrictions( 'robots' ) );
647645 } else {
648646 # Default to encourage indexing and following links
649647 $policy = 'index,follow';
@@ -1677,7 +1675,6 @@
16781676 $current = array();
16791677 foreach( $wgRestrictionTypes as $action )
16801678 $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
1681 - $current['robots'] = implode( '', $this->mTitle->getRestrictions( 'robots' ) );
16821679
16831680 $current = Article::flattenRestrictions( $current );
16841681 $updated = Article::flattenRestrictions( $limit );
@@ -1713,9 +1710,7 @@
17141711 foreach( $limit as $action => $restrictions ) {
17151712 # Check if the group level required to edit also can protect pages
17161713 # Otherwise, people who cannot normally protect can "protect" pages via transclusion
1717 - if ( in_array( $restrictions, $wgRestrictionTypes ) ) {
1718 - $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] );
1719 - }
 1714+ $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] );
17201715 }
17211716
17221717 $cascade_description = '';
Index: trunk/phase3/includes/Title.php
@@ -940,9 +940,6 @@
941941 if( $this->getNamespace() == NS_SPECIAL )
942942 return true;
943943
944 - if ( $this->getRestrictions( 'robots' ) && $this->getRestrictions( 'robots' ) != '' )
945 - return true;
946 -
947944 # Check regular protection levels
948945 if( $action == 'edit' || $action == '' ) {
949946 $r = $this->getRestrictions( 'edit' );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1063,7 +1063,6 @@
10641064 $wgGroupPermissions['sysop']['upload_by_url'] = true;
10651065 $wgGroupPermissions['sysop']['ipblock-exempt'] = true;
10661066 $wgGroupPermissions['sysop']['blockemail'] = true;
1067 -$wgGroupPermissions['sysop']['editrobots'] = true;
10681067
10691068 // Permission to change users' group assignments
10701069 $wgGroupPermissions['bureaucrat']['userrights'] = true;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1839,9 +1839,6 @@
18401840 'protect-summary-cascade' => 'cascading',
18411841 'protect-expiring' => 'expires $1 (UTC)',
18421842 'protect-cascade' => 'Protect pages included in this page (cascading protection)',
1843 -'protect-robotspolicy' => 'Robot policy:',
1844 -'protect-robots-noindex' => 'Do not index',
1845 -'protect-robots-nofollow' => 'Do not follow links',
18461843 'restriction-type' => 'Permission:',
18471844 'restriction-level' => 'Restriction level:',
18481845 'minimum-size' => 'Min size',
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -1440,9 +1440,6 @@
14411441 'protect-summary-cascade' => 'kaskadierend',
14421442 'protect-expiring' => 'bis $1 (UTC)',
14431443 'protect-cascade' => 'Kaskadierende Sperre – alle in diese Seite eingebundenen Vorlagen werden ebenfalls gesperrt.',
1444 -'protect-robotspolicy' => 'Anweisung für Suchroboter:',
1445 -'protect-robots-noindex' => 'nicht indizieren (noindex)',
1446 -'protect-robots-nofollow' => 'Links nicht folgen (nofollow)',
14471444 'restriction-type' => 'Schutzstatus',
14481445 'restriction-level' => 'Schutzhöhe',
14491446 'minimum-size' => 'Mindestgröße:',
Index: trunk/phase3/RELEASE-NOTES
@@ -95,8 +95,6 @@
9696 * Throw a showstopper exception when a hook function fails to return a value.
9797 Forgetting to give a 'true' return value is a very common error which tends
9898 to cause hard-to-track-down interactions between extensions.
99 -* (bug 9415) Added options to Special:Protect to allow setting of per-page robot
100 - policies. This can be done only by users with the 'editrobots' permission
10199 * Use $wgJobClasses to determine the correct Job to instantiate for a particular
102100 queued task; allows extensions to introduce custom jobs
103101

Follow-up revisions

RevisionCommit summaryAuthorDate
r23407Merged revisions 23203-23405 via svnmerge from...david23:00, 25 June 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r23166* (bug 9415) Added options to Special:Protect to allow setting of per-page robot...raymond15:51, 21 June 2007

Status & tagging log