r38003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38002‎ | r38003 | r38004 >
Date:17:40, 24 July 2008
Author:simetrical
Status:old
Tags:
Comment:
Implement $wgAllowUserRobotsControl to control whether the new __INDEX__ and __NOINDEX__ magic words work. False by default until this is thought out a little better: there are major possibilities for vandalism here.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -472,11 +472,15 @@
473473 * @param ParserOutput object &$parserOutput
474474 */
475475 public function addParserOutputNoText( &$parserOutput ) {
 476+ global $wgAllowUserRobotsControl;
 477+
476478 $this->mLanguageLinks += $parserOutput->getLanguageLinks();
477479 $this->addCategoryLinks( $parserOutput->getCategories() );
478480 $this->mNewSectionLink = $parserOutput->getNewSection();
479 - # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise?
480 - $this->setIndexPolicy( $parserOutput->getIndexPolicy() );
 481+ if( $wgAllowUserRobotsControl ) {
 482+ # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise?
 483+ $this->setIndexPolicy( $parserOutput->getIndexPolicy() );
 484+ }
481485 $this->addKeywords( $parserOutput );
482486 $this->mParseWarnings = $parserOutput->getWarnings();
483487 if ( $parserOutput->getCacheTime() == -1 ) {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2824,6 +2824,13 @@
28252825 $wgArticleRobotPolicies = array();
28262826
28272827 /**
 2828+ * Set to true to allow the __INDEX__ and __NOINDEX__ magic words to function.
 2829+ * These will allow users to control whether any page they can edit is indexed
 2830+ * by search engines.
 2831+ */
 2832+$wgAllowUserRobotsControl = false;
 2833+
 2834+/**
28282835 * Specifies the minimal length of a user password. If set to
28292836 * 0, empty passwords are allowed.
28302837 */
Index: trunk/phase3/RELEASE-NOTES
@@ -20,12 +20,13 @@
2121
2222 === Configuration changes in 1.14 ===
2323
24 -None yet
 24+* (bug 8068) $wgAllowUserRobotsControl (false by default) can enable new
 25+ __INDEX__ and __NOINDEX__ magic words, which allow user control of search en-
 26+ gine indexing on a per-article basis.
2527
2628 === New features in 1.14 ===
2729
28 -* (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search
29 -engine indexing on a per-article basis.
 30+None yet
3031
3132 === Bug fixes in 1.14 ===
3233

Status & tagging log