Make the default robot policy a configurable option.
authorIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 6 Feb 2008 00:55:52 +0000 (00:55 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 6 Feb 2008 00:55:52 +0000 (00:55 +0000)
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.

RELEASE-NOTES
includes/Article.php
includes/DefaultSettings.php
includes/ImagePage.php
includes/SpecialSpecialpages.php

index a63aedd..37954e8 100644 (file)
@@ -155,6 +155,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (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 ===
 
index 69fc053..7197a32 100644 (file)
@@ -613,6 +613,7 @@ class Article {
                global $wgUser, $wgOut, $wgRequest, $wgContLang;
                global $wgEnableParserCache, $wgStylePath, $wgParser;
                global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
+               global $wgDefaultRobotPolicy;
                $sk = $wgUser->getSkin();
 
                wfProfileIn( __METHOD__ );
@@ -647,8 +648,7 @@ class Article {
                        # 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 1679c30..d9c7c26 100644 (file)
@@ -2484,9 +2484,16 @@ $wgNoFollowLinks = true;
  */
 $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 846f0d9..8336837 100644 (file)
@@ -69,7 +69,7 @@ class ImagePage extends Article {
                } 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 a893966..4ea956b 100644 (file)
@@ -12,7 +12,7 @@ function wfSpecialSpecialpages() {
 
        $wgMessageCache->loadAllMessages();
 
-       $wgOut->setRobotpolicy( 'index,nofollow' );
+       $wgOut->setRobotpolicy( 'noindex,nofollow' );  # Is this really needed?
        $sk = $wgUser->getSkin();
 
        /** Pages available to all */