Index: trunk/phase3/includes/Article.php |
— | — | @@ -736,12 +736,15 @@ |
737 | 737 | function view() { |
738 | 738 | global $wgUser, $wgOut, $wgRequest, $wgContLang; |
739 | 739 | global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser; |
740 | | - global $wgUseTrackbacks; |
| 740 | + global $wgUseTrackbacks, $wgNamespaceRobotPolicies; |
741 | 741 | $sk = $wgUser->getSkin(); |
742 | 742 | |
743 | 743 | $fname = 'Article::view'; |
744 | 744 | wfProfileIn( $fname ); |
| 745 | + |
745 | 746 | $parserCache =& ParserCache::singleton(); |
| 747 | + $ns = $this->mTitle->getNamespace(); # shortcut |
| 748 | + |
746 | 749 | # Get variables from query string |
747 | 750 | $oldid = $this->getOldID(); |
748 | 751 | |
— | — | @@ -757,7 +760,13 @@ |
758 | 761 | $rdfrom = $wgRequest->getVal( 'rdfrom' ); |
759 | 762 | |
760 | 763 | $wgOut->setArticleFlag( true ); |
761 | | - $wgOut->setRobotpolicy( 'index,follow' ); |
| 764 | + if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) { |
| 765 | + $policy = $wgNamespaceRobotPolicies[$ns]; |
| 766 | + } else { |
| 767 | + $policy = 'index,follow'; |
| 768 | + } |
| 769 | + $wgOut->setRobotpolicy( $policy ); |
| 770 | + |
762 | 771 | # If we got diff and oldid in the query, we want to see a |
763 | 772 | # diff page instead of the article. |
764 | 773 | |
— | — | @@ -884,7 +893,7 @@ |
885 | 894 | # wrap user css and user js in pre and don't parse |
886 | 895 | # XXX: use $this->mTitle->usCssJsSubpage() when php is fixed/ a workaround is found |
887 | 896 | if ( |
888 | | - $this->mTitle->getNamespace() == NS_USER && |
| 897 | + $ns == NS_USER && |
889 | 898 | preg_match('/\\/[\\w]+\\.(css|js)$/', $this->mTitle->getDBkey()) |
890 | 899 | ) { |
891 | 900 | $wgOut->addWikiText( wfMsg('clearyourcache')); |
— | — | @@ -932,7 +941,7 @@ |
933 | 942 | } |
934 | 943 | |
935 | 944 | # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page |
936 | | - if( $this->mTitle->getNamespace() == NS_USER_TALK && |
| 945 | + if( $ns == NS_USER_TALK && |
937 | 946 | User::isIP( $this->mTitle->getText() ) ) { |
938 | 947 | $wgOut->addWikiText( wfMsg('anontalkpagetext') ); |
939 | 948 | } |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1844,6 +1844,12 @@ |
1845 | 1845 | $wgNoFollowNsExceptions = array(); |
1846 | 1846 | |
1847 | 1847 | /** |
| 1848 | + * Robot policies for namespaces |
| 1849 | + * e.g. $wgNamespaceRobotPolicies = array( NS_TALK => 'noindex' ); |
| 1850 | + */ |
| 1851 | +$wgNamespaceRobotPolicies = array(); |
| 1852 | + |
| 1853 | +/** |
1848 | 1854 | * Specifies the minimal length of a user password. If set to |
1849 | 1855 | * 0, empty passwords are allowed. |
1850 | 1856 | */ |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -420,6 +420,8 @@ |
421 | 421 | * (bug 6170) Update for Kashubian translation (csb) |
422 | 422 | * (bug 6191) Update to Indonesian translation (id) #18 |
423 | 423 | * (bug 6114) Update to Walloon localization (wa) |
| 424 | +* Added $wgNamespaceRobotPolicies to allow customisation of robot policies on a |
| 425 | + per-namespace basis. |
424 | 426 | |
425 | 427 | == Compatibility == |
426 | 428 | |