r86121 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86120‎ | r86121 | r86122 >
Date:17:23, 15 April 2011
Author:bawolff
Status:resolved (Comments)
Tags:
Comment:
(follow-up r86100) Make categorypage not die as much while transitioning between 1.16 -> 1.17 schema

Basically re-putting in the intent of r83544 per suggestion on CR of r86100
Modified paths:
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -347,7 +347,8 @@
348348 array( 'page', 'categorylinks', 'category' ),
349349 array( 'page_id', 'page_title', 'page_namespace', 'page_len',
350350 'page_is_redirect', 'cl_sortkey', 'cat_id', 'cat_title',
351 - 'cat_subcats', 'cat_pages', 'cat_files', 'cl_sortkey_prefix' ),
 351+ 'cat_subcats', 'cat_pages', 'cat_files',
 352+ 'cl_sortkey_prefix', 'cl_collation' ),
352353 array_merge( array( 'cl_to' => $this->title->getDBkey() ), $extraConds ),
353354 __METHOD__,
354355 array(
@@ -364,7 +365,14 @@
365366 $count = 0;
366367 foreach ( $res as $row ) {
367368 $title = Title::newFromRow( $row );
368 - $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
 369+ if ( !$row->cl_collation ) {
 370+ // Hack to make sure that while updating from 1.16 schema
 371+ // and db is inconsistent, that the sky doesn't fall.
 372+ // See r83544. Could perhaps be removed in a couple versions (?)
 373+ $humanSortkey = $row->cl_sortkey;
 374+ } else {
 375+ $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
 376+ }
369377
370378 if ( ++$count > $this->limit ) {
371379 # We've reached the one extra which shows that there

Sign-offs

UserFlagDate
Simetricalinspected22:36, 15 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r86142(follow-up r86121) Use strict comparision....bawolff21:53, 15 April 2011
r864641.17wmf1: MFT r85377, r85555, r85583, r86100, r86121, r86130, r86142, r86146,...catrope11:27, 20 April 2011
r864741.17: MFT r81731, r85377, r85547, r85555, r85583, r85803, r85881, r86100, r86...catrope13:22, 20 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83544Don't regenerate raw sortkeys in CategoryPage.php...simetrical20:49, 8 March 2011
r86100(bug 28540) revert r83544 - It really breaks things when using uca-default co...bawolff23:28, 14 April 2011

Comments

#Comment by Simetrical (talk | contribs)   21:47, 15 April 2011

This will fail if $row->cl_collation is '0'. Never evaluate a string as a boolean in PHP. Probably harmless here, but . . .

I don't think this can be removed anytime soon, because we want to support users upgrading from arbitrarily old versions of MediaWiki. Someday, sure, but not in just a year or so. Most users don't update that often.

#Comment by Bawolff (talk | contribs)   21:54, 15 April 2011

whoops. fixed that in r86142

Status & tagging log