r14559 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14558‎ | r14559 | r14560 >
Date:00:25, 4 June 2006
Author:tstarling
Status:old
Tags:
Comment:
Added $wgNamespaceRobotPolicies to allow customisation of robot policies on a per-namespace basis.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -736,12 +736,15 @@
737737 function view() {
738738 global $wgUser, $wgOut, $wgRequest, $wgContLang;
739739 global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
740 - global $wgUseTrackbacks;
 740+ global $wgUseTrackbacks, $wgNamespaceRobotPolicies;
741741 $sk = $wgUser->getSkin();
742742
743743 $fname = 'Article::view';
744744 wfProfileIn( $fname );
 745+
745746 $parserCache =& ParserCache::singleton();
 747+ $ns = $this->mTitle->getNamespace(); # shortcut
 748+
746749 # Get variables from query string
747750 $oldid = $this->getOldID();
748751
@@ -757,7 +760,13 @@
758761 $rdfrom = $wgRequest->getVal( 'rdfrom' );
759762
760763 $wgOut->setArticleFlag( true );
761 - $wgOut->setRobotpolicy( 'index,follow' );
 764+ if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
 765+ $policy = $wgNamespaceRobotPolicies[$ns];
 766+ } else {
 767+ $policy = 'index,follow';
 768+ }
 769+ $wgOut->setRobotpolicy( $policy );
 770+
762771 # If we got diff and oldid in the query, we want to see a
763772 # diff page instead of the article.
764773
@@ -884,7 +893,7 @@
885894 # wrap user css and user js in pre and don't parse
886895 # XXX: use $this->mTitle->usCssJsSubpage() when php is fixed/ a workaround is found
887896 if (
888 - $this->mTitle->getNamespace() == NS_USER &&
 897+ $ns == NS_USER &&
889898 preg_match('/\\/[\\w]+\\.(css|js)$/', $this->mTitle->getDBkey())
890899 ) {
891900 $wgOut->addWikiText( wfMsg('clearyourcache'));
@@ -932,7 +941,7 @@
933942 }
934943
935944 # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
936 - if( $this->mTitle->getNamespace() == NS_USER_TALK &&
 945+ if( $ns == NS_USER_TALK &&
937946 User::isIP( $this->mTitle->getText() ) ) {
938947 $wgOut->addWikiText( wfMsg('anontalkpagetext') );
939948 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1844,6 +1844,12 @@
18451845 $wgNoFollowNsExceptions = array();
18461846
18471847 /**
 1848+ * Robot policies for namespaces
 1849+ * e.g. $wgNamespaceRobotPolicies = array( NS_TALK => 'noindex' );
 1850+ */
 1851+$wgNamespaceRobotPolicies = array();
 1852+
 1853+/**
18481854 * Specifies the minimal length of a user password. If set to
18491855 * 0, empty passwords are allowed.
18501856 */
Index: trunk/phase3/RELEASE-NOTES
@@ -420,6 +420,8 @@
421421 * (bug 6170) Update for Kashubian translation (csb)
422422 * (bug 6191) Update to Indonesian translation (id) #18
423423 * (bug 6114) Update to Walloon localization (wa)
 424+* Added $wgNamespaceRobotPolicies to allow customisation of robot policies on a
 425+ per-namespace basis.
424426
425427 == Compatibility ==
426428

Status & tagging log