From cd3924342e7daa084f751d9eaaa3ad34fea36643 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 22 Jun 2007 14:52:49 +0000 Subject: [PATCH] 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. :) --- RELEASE-NOTES | 2 -- includes/Article.php | 7 +----- includes/DefaultSettings.php | 1 - includes/ProtectionForm.php | 40 +++++-------------------------- includes/Title.php | 3 --- languages/messages/MessagesDe.php | 3 --- languages/messages/MessagesEn.php | 3 --- maintenance/language/messages.inc | 3 --- 8 files changed, 7 insertions(+), 55 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 64b3724ba0..a706f50f0b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -95,8 +95,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Throw a showstopper exception when a hook function fails to return a value. Forgetting to give a 'true' return value is a very common error which tends to cause hard-to-track-down interactions between extensions. -* (bug 9415) Added options to Special:Protect to allow setting of per-page robot - policies. This can be done only by users with the 'editrobots' permission * Use $wgJobClasses to determine the correct Job to instantiate for a particular queued task; allows extensions to introduce custom jobs diff --git a/includes/Article.php b/includes/Article.php index b4eab7bfde..5a541594c0 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -641,8 +641,6 @@ class Article { } elseif( isset( $wgNamespaceRobotPolicies[$ns] ) ) { # Honour customised robot policies for this namespace $policy = $wgNamespaceRobotPolicies[$ns]; - } elseif ( $this->mTitle->getRestrictions( 'robots' ) ) { - $policy = implode( ',', $this->mTitle->getRestrictions( 'robots' ) ); } else { # Default to encourage indexing and following links $policy = 'index,follow'; @@ -1677,7 +1675,6 @@ class Article { $current = array(); foreach( $wgRestrictionTypes as $action ) $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); - $current['robots'] = implode( '', $this->mTitle->getRestrictions( 'robots' ) ); $current = Article::flattenRestrictions( $current ); $updated = Article::flattenRestrictions( $limit ); @@ -1713,9 +1710,7 @@ class Article { foreach( $limit as $action => $restrictions ) { # Check if the group level required to edit also can protect pages # Otherwise, people who cannot normally protect can "protect" pages via transclusion - if ( in_array( $restrictions, $wgRestrictionTypes ) ) { - $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] ); - } + $cascade = ( $cascade && isset($wgGroupPermissions[$restrictions]['protect']) && $wgGroupPermissions[$restrictions]['protect'] ); } $cascade_description = ''; diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 616b9e25a8..a1cdd2a5b4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1063,7 +1063,6 @@ $wgGroupPermissions['sysop']['autoconfirmed'] = true; $wgGroupPermissions['sysop']['upload_by_url'] = true; $wgGroupPermissions['sysop']['ipblock-exempt'] = true; $wgGroupPermissions['sysop']['blockemail'] = true; -$wgGroupPermissions['sysop']['editrobots'] = true; // Permission to change users' group assignments $wgGroupPermissions['bureaucrat']['userrights'] = true; diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 258dabcab6..5eff237861 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -43,7 +43,6 @@ class ProtectionForm { // but the db allows multiples separated by commas. $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); } - $this->mRestrictions['robots'] = implode( ',', $this->mTitle->getRestrictions( 'robots' ) ); $this->mCascade = $this->mTitle->areRestrictionsCascading(); @@ -73,17 +72,9 @@ class ProtectionForm { $this->mRestrictions[$action] = $val; } } - - // Read checkboxes only if user is allowed to change robots policy, otherwise keep previous policy - if ( $wgUser->isAllowed( 'editrobots' ) ) { - $robotspolicy = $wgRequest->getBool( 'mwProtect-robots-noindex' ) ? 'noindex' : 'index'; - $robotspolicy .= $wgRequest->getBool( 'mwProtect-robots-nofollow' ) ? ',nofollow' : ',follow'; - // 'index,follow' is default, no need to set this explicitly at this point; is done at Article::view() - $this->mRestrictions['robots'] = ( $robotspolicy == 'index,follow' ) ? '' : $robotspolicy; - } } } - + function execute() { global $wgRequest; if( $wgRequest->wasPosted() ) { @@ -208,7 +199,7 @@ class ProtectionForm { } function buildForm() { - global $wgUser, $wgRestrictionTypes; + global $wgUser; $out = ''; if( !$this->disabled ) { @@ -232,17 +223,14 @@ class ProtectionForm { $out .= "\n"; foreach( $this->mRestrictions as $action => $required ) { /* Not all languages have V_x <-> N_x relation */ - if ( in_array( $action, $wgRestrictionTypes ) ) - $out .= "" . wfMsgHtml( 'restriction-' . $action ) . "\n"; + $out .= "" . wfMsgHtml( 'restriction-' . $action ) . "\n"; } $out .= "\n"; $out .= "\n"; foreach( $this->mRestrictions as $action => $selected ) { - if ( in_array( $action, $wgRestrictionTypes ) ) { - $out .= "\n"; - $out .= $this->buildSelector( $action, $selected ); - $out .= "\n"; - } + $out .= "\n"; + $out .= $this->buildSelector( $action, $selected ); + $out .= "\n"; } $out .= "\n"; @@ -258,7 +246,6 @@ class ProtectionForm { if( $wgEnableCascadingProtection ) $out .= '' . $this->buildCascadeInput() . "\n"; - $out .= $this->buildRobotsInput(); $out .= $this->buildExpiryInput(); if( !$this->disabled ) { @@ -328,21 +315,6 @@ class ProtectionForm { return $ci; } - function buildRobotsInput() { - global $wgUser, $wgContLang; - $robotsallowed = $wgUser->isAllowed( 'editrobots' ) ? array() : array( 'disabled' => 'disabled' ); - $noindexset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'noindex' ) ) ? true : false; - $nofollowset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'nofollow' ) ) ? true : false; - $ret = ""; - $ret .= ''; - $ret .= ""; - $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-noindex' ), 'mwProtect-robots-noindex', 'mwProtect-robots-noindex', $noindexset, $robotsallowed ); - $ret .= $wgContLang->getDirMark(); - $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-nofollow' ), 'mwProtect-robots-nofollow', 'mwProtect-robots-nofollow', $nofollowset, $robotsallowed ); - $ret .= ""; - return $ret; - } - function buildExpiryInput() { $attribs = array( 'id' => 'expires' ) + $this->disabledAttrib; return '' diff --git a/includes/Title.php b/includes/Title.php index b875f855c0..8a21ab3954 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -940,9 +940,6 @@ class Title { if( $this->getNamespace() == NS_SPECIAL ) return true; - if ( $this->getRestrictions( 'robots' ) && $this->getRestrictions( 'robots' ) != '' ) - return true; - # Check regular protection levels if( $action == 'edit' || $action == '' ) { $r = $this->getRestrictions( 'edit' ); diff --git a/languages/messages/MessagesDe.php b/languages/messages/MessagesDe.php index f01d9631fd..933fd23985 100644 --- a/languages/messages/MessagesDe.php +++ b/languages/messages/MessagesDe.php @@ -1440,9 +1440,6 @@ Bitte gehen Sie zurück und versuchen den Vorgang erneut auszuführen.', 'protect-summary-cascade' => 'kaskadierend', 'protect-expiring' => 'bis $1 (UTC)', 'protect-cascade' => 'Kaskadierende Sperre – alle in diese Seite eingebundenen Vorlagen werden ebenfalls gesperrt.', -'protect-robotspolicy' => 'Anweisung für Suchroboter:', -'protect-robots-noindex' => 'nicht indizieren (noindex)', -'protect-robots-nofollow' => 'Links nicht folgen (nofollow)', 'restriction-type' => 'Schutzstatus', 'restriction-level' => 'Schutzhöhe', 'minimum-size' => 'Mindestgröße:', diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 6747ba6fd5..2966534054 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1839,9 +1839,6 @@ Here are the current settings for the page $1:', 'protect-summary-cascade' => 'cascading', 'protect-expiring' => 'expires $1 (UTC)', 'protect-cascade' => 'Protect pages included in this page (cascading protection)', -'protect-robotspolicy' => 'Robot policy:', -'protect-robots-noindex' => 'Do not index', -'protect-robots-nofollow' => 'Do not follow links', 'restriction-type' => 'Permission:', 'restriction-level' => 'Restriction level:', 'minimum-size' => 'Min size', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 4395e009c7..0707ba2bb9 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1182,9 +1182,6 @@ $wgMessageStructure = array( 'protect-summary-cascade', 'protect-expiring', 'protect-cascade', - 'protect-robotspolicy', - 'protect-robots-noindex', - 'protect-robots-nofollow', 'restriction-type', 'restriction-level', 'minimum-size', -- 2.20.1