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.

This commit is contained in:
Aryeh Gregor 2008-07-24 17:40:16 +00:00
parent 41d44725c7
commit dfee92b5e8
3 changed files with 17 additions and 5 deletions

View file

@ -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 ===

View file

@ -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.

View file

@ -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 ) {