MediaWiki r30602 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r30601‎ | r30602 (on ViewVC)‎ | r30603 >
Date:00:55, 6 February 2008
Author:vyznev
Status:old (Comments)
Tags:
Comment:
Make the default robot policy a configurable option.

Also replace some odd hardcoded robot policies (for Special:Specialpages and for nonexistent images) with 'noindex,nofollow', which seems more
appropriate at least for the latter. I'm not quite sure _why_ Special:Specialpages was marked as 'index,nofollow' before; it's been that way since
r1284. It might be safe to just leave it at the default setting, but I don't really think it makes much difference either way.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php	(revision 30601)
+++ trunk/phase3/includes/Article.php	(revision 30602)
@@ -613,6 +613,7 @@
 		global $wgUser, $wgOut, $wgRequest, $wgContLang;
 		global $wgEnableParserCache, $wgStylePath, $wgParser;
 		global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
+		global $wgDefaultRobotPolicy;
 		$sk = $wgUser->getSkin();
 
 		wfProfileIn( __METHOD__ );
@@ -647,8 +648,7 @@
 			# Honour customised robot policies for this namespace
 			$policy = $wgNamespaceRobotPolicies[$ns];
 		} else {
-			# Default to encourage indexing and following links
-			$policy = 'index,follow';
+			$policy = $wgDefaultRobotPolicy;
 		}
 		$wgOut->setRobotPolicy( $policy );
 
Index: trunk/phase3/includes/ImagePage.php
===================================================================
--- trunk/phase3/includes/ImagePage.php	(revision 30601)
+++ trunk/phase3/includes/ImagePage.php	(revision 30602)
@@ -69,7 +69,7 @@
 		} else {
 			# Just need to set the right headers
 			$wgOut->setArticleFlag( true );
-			$wgOut->setRobotpolicy( 'index,follow' );
+			$wgOut->setRobotpolicy( 'noindex,nofollow' );
 			$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 			$this->viewUpdates();
 		}
Index: trunk/phase3/includes/SpecialSpecialpages.php
===================================================================
--- trunk/phase3/includes/SpecialSpecialpages.php	(revision 30601)
+++ trunk/phase3/includes/SpecialSpecialpages.php	(revision 30602)
@@ -12,7 +12,7 @@
 
 	$wgMessageCache->loadAllMessages();
 
-	$wgOut->setRobotpolicy( 'index,nofollow' );
+	$wgOut->setRobotpolicy( 'noindex,nofollow' );  # Is this really needed?
 	$sk = $wgUser->getSkin();
 
 	/** Pages available to all */
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 30601)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 30602)
@@ -2485,8 +2485,15 @@
 $wgNoFollowNsExceptions = array();
 
 /**
+ * Default robot policy.
+ * The default policy is to encourage indexing and following of links.
+ * It may be overridden on a per-namespace and/or per-page basis.
+ */
+$wgDefaultRobotPolicy = 'index,follow';
+
+/**
  * Robot policies per namespaces.
- * The default policy is 'index,follow', the array is made of namespace
+ * The default policy is given above, the array is made of namespace
  * constants as defined in includes/Defines.php
  * Example:
  *   $wgNamespaceRobotPolicies = array( NS_TALK => 'noindex' );
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 30601)
+++ trunk/phase3/RELEASE-NOTES	(revision 30602)
@@ -155,6 +155,8 @@
 * (bug 10365) Localization of Special:Version
 * When installing using Postgres, the Pl/Pgsql language is now checked for 
   and installed when at the superuser level.
+* The default robot policy for the entire wiki is now configurable via the
+  $wgDefaultRobotPolicy setting.
 
 === Bug fixes in 1.12 ===
 

Follow-up revisions

Rev.Commit summaryAuthorDate
r47838Fix regression from r30602. 'noindex,nofollow' was being applied when local p...demon20:10, 26 February 2009

Comments

#Comment by Brion VIBBER (Talk | contribs)   19:54, 18 February 2009

Regression? This causes image pages to no longer be indexed or followed when there's not local page text.

#Comment by ^demon (Talk | contribs)   22:32, 3 March 2009

Should be resolved in r47838.

Status & tagging log

  • 15:24, 12 September 2011 Meno25 (Talk | contribs) changed the status of r30602 [removed: resolved added: old]
  • 21:13, 19 April 2009 ^demon (Talk | contribs) changed the status of r30602 [removed: fixme added: resolved]
  • 19:54, 18 February 2009 Brion VIBBER (Talk | contribs) changed the status of r30602 [removed: ok added: fixme]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox