From: Aryeh Gregor Date: Thu, 24 Jul 2008 17:40:16 +0000 (+0000) Subject: Implement $wgAllowUserRobotsControl to control whether the new __INDEX__ and __NOINDE... X-Git-Tag: 1.31.0-rc.0~46388 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=dfee92b5e874d73a60629f6a90faaba5baa7ad63;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5f831d3399..841c37eba6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -20,12 +20,13 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === Configuration changes in 1.14 === -None yet +* (bug 8068) $wgAllowUserRobotsControl (false by default) can enable new + __INDEX__ and __NOINDEX__ magic words, which allow user control of search en- + gine indexing on a per-article basis. === New features in 1.14 === -* (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search -engine indexing on a per-article basis. +None yet === Bug fixes in 1.14 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ba04ba56d5..3cbc409f31 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2823,6 +2823,13 @@ $wgNamespaceRobotPolicies = array(); */ $wgArticleRobotPolicies = array(); +/** + * Set to true to allow the __INDEX__ and __NOINDEX__ magic words to function. + * These will allow users to control whether any page they can edit is indexed + * by search engines. + */ +$wgAllowUserRobotsControl = false; + /** * Specifies the minimal length of a user password. If set to * 0, empty passwords are allowed. diff --git a/includes/OutputPage.php b/includes/OutputPage.php index baacbfd7de..7fc00adbed 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -472,11 +472,15 @@ class OutputPage { * @param ParserOutput object &$parserOutput */ public function addParserOutputNoText( &$parserOutput ) { + global $wgAllowUserRobotsControl; + $this->mLanguageLinks += $parserOutput->getLanguageLinks(); $this->addCategoryLinks( $parserOutput->getCategories() ); $this->mNewSectionLink = $parserOutput->getNewSection(); - # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise? - $this->setIndexPolicy( $parserOutput->getIndexPolicy() ); + if( $wgAllowUserRobotsControl ) { + # FIXME: This probably overrides $wgArticleRobotPolicies, is that wise? + $this->setIndexPolicy( $parserOutput->getIndexPolicy() ); + } $this->addKeywords( $parserOutput ); $this->mParseWarnings = $parserOutput->getWarnings(); if ( $parserOutput->getCacheTime() == -1 ) {