r80406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80405‎ | r80406 | r80407 >
Date:21:59, 15 January 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(bug 26729) Categories that do not have a page, and have no members,
should return 404

Previously, a category returned 404, only if it had no content page,
had no members, and never had any members (aka there was no entry
in the category table for it).

As before, if you're editing the category page, its still considered a 200.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -44,14 +44,23 @@
4545
4646 /**
4747 * Don't return a 404 for categories in use.
 48+ * In use defined as: either the actual page exists
 49+ * or the category currently has members.
4850 */
4951 function hasViewableContent() {
5052 if ( parent::hasViewableContent() ) {
5153 return true;
5254 } else {
5355 $cat = Category::newFromTitle( $this->mTitle );
54 - return $cat->getId() != 0;
 56+ // If any of these are not 0, then has members
 57+ if ( $cat->getPageCount()
 58+ || $cat->getSubcatCount()
 59+ || $cat->getFileCount()
 60+ ) {
 61+ return true;
 62+ }
5563 }
 64+ return false;
5665 }
5766
5867 function openShowCategory() {
Index: trunk/phase3/RELEASE-NOTES
@@ -80,6 +80,8 @@
8181 * (bug 10158) Do not mention allowing others to contact you when the feature
8282 is disabled ($wgEnableUserEmail=false)
8383 * (bug 26733) Wrap initial table creation in transaction
 84+* (bug 26729) Category pages should return 404 if they do not exist and have no
 85+ members.
8486
8587 === API changes in 1.18 ===
8688 * (bug 26339) Throw warning when truncating an overlarge API result

Sign-offs

UserFlagDate
Reedyinspected21:37, 26 April 2011
Reedytested21:37, 26 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r86988MFT r80406reedy21:19, 26 April 2011
r86989MFT r80406reedy21:43, 26 April 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:10, 26 April 2011

Marking for merge to 1.17 -- this fix helps get spammy categories removed from Google search index & cache results.

Status & tagging log