From 8c7541da3b12d4727743ed1d3447f6ac6c3b6846 Mon Sep 17 00:00:00 2001 From: tisane Date: Fri, 29 Nov 2013 21:34:10 -0500 Subject: [PATCH] Add $robotPolicy parameter to SpecialPage::setHeaders() Also fix docs for OutputPage::setRobotPolicy() Bug: 57764 Change-Id: I8b780ca349a2f5d18e857ed707f682d19be0054c --- includes/OutputPage.php | 9 ++++++--- includes/SpecialPage.php | 12 +++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a0d7e30c97..eae5dfd20c 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -774,9 +774,12 @@ class OutputPage extends ContextSource { /** * Set the robot policy for the page: * - * @param string $policy the literal string to output as the contents of - * the meta tag. Will be parsed according to the spec and output in - * standardized form. + * @param string|array $policy string such as "noindex,nofollow" or an array in this + * format: + * array( + * 'index' => 'noindex' // or 'index' + * 'follow' => 'nofollow' // or 'follow' + * ) * @return null */ public function setRobotPolicy( $policy ) { diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index f70a6dc192..2f0e5e9d97 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -640,11 +640,17 @@ class SpecialPage { /** * Sets headers - this should be called from the execute() method of all derived classes! - */ - function setHeaders() { + * @param string|array $robotPolicy string such as "noindex,nofollow" or an array in this + * format: + * array( + * 'index' => 'noindex' // or 'index' + * 'follow' => 'nofollow' // or 'follow' + * ) + */ + function setHeaders( $robotPolicy = "noindex,nofollow" ) { $out = $this->getOutput(); $out->setArticleRelated( false ); - $out->setRobotPolicy( "noindex,nofollow" ); + $out->setRobotPolicy( $robotPolicy ); $out->setPageTitle( $this->getDescription() ); } -- 2.20.1