Last modified: 2014-03-24 14:25:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59764, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57764 - Enable SpecialPage::setHeaders() to set a different robot policy besides "noindex,nofollow"
Enable SpecialPage::setHeaders() to set a different robot policy besides "noi...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
1.23.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-30 02:04 UTC by Nathan Larson
Modified: 2014-03-24 14:25 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Nathan Larson 2013-11-30 02:04:02 UTC
Sometimes it's desired that a special page be indexed or followed. E.g. some special pages have not just page metadata but actual content, such as a dictionary (e.g. http://childwiki.net/wiki/Special:Dictionary ), that does not exist in that particular format elsewhere on the wiki, and that the wiki owner might wish to have show up in search results.

Therefore, I propose to enable SpecialPage::setHeaders() to set a different robot policy besides "noindex,nofollow". I guess the best way to do this would be to add a $policy argument:

function setHeaders( $policy = "noindex,nofollow" ) {
       ...
       $out->setRobotPolicy( $policy );
       ...
}
Comment 1 Nathan Larson 2013-11-30 02:07:45 UTC
Another option, of course, would be for the function to override setHeaders(), but that involves more code duplication.
Comment 2 Gerrit Notification Bot 2013-11-30 06:45:45 UTC
Change 98255 had a related patch set uploaded by Parent5446:
Add $robotPolicy parameter to SpecialPage::setHeaders()

https://gerrit.wikimedia.org/r/98255
Comment 3 Gerrit Notification Bot 2013-12-02 19:32:45 UTC
Change 98255 merged by jenkins-bot:
Add $robotPolicy parameter to SpecialPage::setHeaders()

https://gerrit.wikimedia.org/r/98255
Comment 4 Bawolff (Brian Wolff) 2013-12-02 21:57:06 UTC
(In reply to comment #3)
> Change 98255 merged by jenkins-bot:
> Add $robotPolicy parameter to SpecialPage::setHeaders()
> 
> https://gerrit.wikimedia.org/r/98255

Was reverted, caused php warnings. See bug 57883
Comment 5 Kevin Israel (PleaseStand) 2013-12-02 22:05:13 UTC
Question: is there some reason you can't just call $this->getOutput()->setRobotPolicy( $robotPolicy ) after calling $this->setHeaders(), as Brian Wolff mentioned?

If not, this might be a WONTFIX...
Comment 6 Bawolff (Brian Wolff) 2013-12-02 22:08:00 UTC
(In reply to comment #5)
> Question: is there some reason you can't just call
> $this->getOutput()->setRobotPolicy( $robotPolicy ) after calling
> $this->setHeaders(), as Brian Wolff mentioned?
> 
> If not, this might be a WONTFIX...

Alternative fix for this would be to create a new method of SpecialPage, call it getRobotPolicy(), that returns the robot setting, which is called in the default implementation of setHeaders().

That would probably be a cleaner solution anyways than the previous fix.
Comment 7 Nathan Larson 2013-12-02 22:27:51 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Question: is there some reason you can't just call
> > $this->getOutput()->setRobotPolicy( $robotPolicy ) after calling
> > $this->setHeaders(), as Brian Wolff mentioned?
> > 
> > If not, this might be a WONTFIX...
> 
> Alternative fix for this would be to create a new method of SpecialPage, call
> it getRobotPolicy(), that returns the robot setting, which is called in the
> default implementation of setHeaders().
> 
> That would probably be a cleaner solution anyways than the previous fix.

Comments 5 and 6 both present workable solutions. I take it the latter has an advantage over the former?

So, I guess there should be also created an OutputPage::getIndexPolicy(), OutputPage::getFollowPolicy(), and an OutputPage::getRobotPolicy() that returns an array of the index and follow policies. SpecialPage::setRobotPolicy() then would look like:

public function getRobotPolicy() {
     return $this->getOutput()->getRobotPolicy();
}
Comment 8 Bawolff (Brian Wolff) 2013-12-02 22:33:00 UTC
I was more thinking that SpecialPage::setHeaders() becomes:

        function setHeaders() {
                $out = $this->getOutput();
                $out->setArticleRelated( false );
                $out->setRobotPolicy( $this->getRobotPolicy() );
                $out->setPageTitle( $this->getDescription() );
        }


and then a new method of SpecialPage

       function getRobotPolicy() {
              return "noindex,nofollow";
       }

and if people wanted to change what getRobotPolicy was, they would override in a subclass.
Comment 9 Gerrit Notification Bot 2014-03-10 09:18:06 UTC
Change 117832 had a related patch set uploaded by Siebrand:
Add getRobotPolicy()

https://gerrit.wikimedia.org/r/117832
Comment 10 Nathan Larson 2014-03-11 14:48:01 UTC
(In reply to Bawolff (Brian Wolff) from comment #8)
>        function getRobotPolicy() {

Brian, is there a reason getRobotPolicy() should be public? Addshore says it should be protected. Thanks.
Comment 11 Gerrit Notification Bot 2014-03-24 14:15:21 UTC
Change 117832 merged by jenkins-bot:
Add getRobotPolicy()

https://gerrit.wikimedia.org/r/117832

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links