Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3332,25 +3332,39 @@ |
3333 | 3333 | } |
3334 | 3334 | if ( isset( $this->mDoubleUnderscores['hiddencat'] ) && $this->mTitle->getNamespace() == NS_CATEGORY ) { |
3335 | 3335 | $this->mOutput->setProperty( 'hiddencat', 'y' ); |
3336 | | - |
3337 | | - $containerCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( 'hidden-category-category' ) ); |
3338 | | - if ( $containerCategory ) { |
3339 | | - $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() ); |
3340 | | - } else { |
3341 | | - wfDebug( __METHOD__.": [[MediaWiki:hidden-category-category]] is not a valid title!\n" ); |
3342 | | - } |
| 3336 | + $this->addTrackingCategory( 'hidden-category-category' ); |
3343 | 3337 | } |
3344 | 3338 | # (bug 8068) Allow control over whether robots index a page. |
3345 | 3339 | # |
3346 | 3340 | # FIXME (bug 14899): __INDEX__ always overrides __NOINDEX__ here! This |
3347 | 3341 | # is not desirable, the last one on the page should win. |
3348 | | - if( isset( $this->mDoubleUnderscores['noindex'] ) ) { |
| 3342 | + if( isset( $this->mDoubleUnderscores['noindex'] ) && $this->mTitle->canUseNoindex() ) { |
3349 | 3343 | $this->mOutput->setIndexPolicy( 'noindex' ); |
3350 | | - } elseif( isset( $this->mDoubleUnderscores['index'] ) ) { |
| 3344 | + $this->addTrackingCategory( 'noindex-category' ); |
| 3345 | + } |
| 3346 | + if( isset( $this->mDoubleUnderscores['index'] ) && $this->mTitle->canUseNoindex() ){ |
3351 | 3347 | $this->mOutput->setIndexPolicy( 'index' ); |
| 3348 | + $this->addTrackingCategory( 'index-category' ); |
3352 | 3349 | } |
3353 | 3350 | wfProfileOut( __METHOD__ ); |
3354 | 3351 | return $text; |
| 3352 | + } |
| 3353 | + |
| 3354 | + /** |
| 3355 | + * Add a tracking category, getting the title from a system message, |
| 3356 | + * or print a debug message if the title is invalid. |
| 3357 | + * @param $msg String message key |
| 3358 | + * @return Bool whether the addition was successful |
| 3359 | + */ |
| 3360 | + protected function addTrackingCategory( $msg ){ |
| 3361 | + $containerCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( $msg ) ); |
| 3362 | + if ( $containerCategory ) { |
| 3363 | + $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() ); |
| 3364 | + return true; |
| 3365 | + } else { |
| 3366 | + wfDebug( __METHOD__.": [[MediaWiki:$msg]] is not a valid title!\n" ); |
| 3367 | + return false; |
| 3368 | + } |
3355 | 3369 | } |
3356 | 3370 | |
3357 | 3371 | /** |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -735,6 +735,8 @@ |
736 | 736 | 'category-file-count' => '{{PLURAL:$2|This category contains only the following file.|The following {{PLURAL:$1|file is|$1 files are}} in this category, out of $2 total.}}', |
737 | 737 | 'category-file-count-limited' => 'The following {{PLURAL:$1|file is|$1 files are}} in the current category.', |
738 | 738 | 'listingcontinuesabbrev' => 'cont.', |
| 739 | +'index-category' => 'Indexed pages', |
| 740 | +'noindex-category' => 'Noindexed pages', |
739 | 741 | |
740 | 742 | 'linkprefix' => '/^(.*?)([a-zA-Z\\x80-\\xff]+)$/sD', # only translate this message to other languages if you have to change it |
741 | 743 | 'mainpagetext' => "<big>'''MediaWiki has been successfully installed.'''</big>", |
Index: trunk/phase3/languages/messages/MessagesQqq.php |
— | — | @@ -236,6 +236,8 @@ |
237 | 237 | * $1: number of files shown', |
238 | 238 | 'listingcontinuesabbrev' => 'Shown in contiuation of each first letter group. |
239 | 239 | See http://test.wikipedia.org/wiki/Category:Test_ko?uselang={{SUBPAGENAME}}, for example.', |
| 240 | +'index-category' => 'Name of the category where pages with the <nowiki>__INDEX__</nowiki> behaviour switch are listed', |
| 241 | +'noindex-category' => 'Name of the category where pages with the <nowiki>__NOINDEX__</nowiki> behaviour switch are listed', |
240 | 242 | |
241 | 243 | 'linkprefix' => '{{optional}}', |
242 | 244 | 'mainpagetext' => 'Along with {{msg|mainpagedocfooter}}, the text you will see on the Main Page when your wiki is installed.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -238,6 +238,7 @@ |
239 | 239 | * A new permission, 'root', is created. Analogous to root users on Unix systems, |
240 | 240 | the root permission effectively grants all other permissions on a wiki. Useful |
241 | 241 | for debugging and administration. |
| 242 | +* (bug 16979) Tracking categories for __INDEX__ and __NOINDEX__ |
242 | 243 | |
243 | 244 | === Bug fixes in 1.16 === |
244 | 245 | |
Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -141,6 +141,8 @@ |
142 | 142 | 'category-file-count', |
143 | 143 | 'category-file-count-limited', |
144 | 144 | 'listingcontinuesabbrev', |
| 145 | + 'index-category', |
| 146 | + 'noindex-category', |
145 | 147 | ), |
146 | 148 | 'mainpage' => array( |
147 | 149 | 'linkprefix', |