r72457 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72456‎ | r72457 | r72458 >
Date:21:16, 5 September 2010
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
Update Collection and intersection for new schema

Not tested -- confirmation from someone that these changes work would be
appreciated. FlaggedRevs looks to use cl_sortkey somehow, but I don't
understand how, so if someone else could help out with that, that would
be nice. Does it need to be updated, and if so, how?
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.body.php
@@ -672,10 +672,10 @@
673673 }
674674 $db = wfGetDB( DB_SLAVE );
675675 $tables = array( 'page', 'categorylinks' );
676 - $fields = array( 'cl_from', 'cl_sortkey', 'page_namespace', 'page_title' );
 676+ $fields = array( 'page_namespace', 'page_title' );
677677 $options = array(
678678 'USE INDEX' => 'cl_sortkey',
679 - 'ORDER BY' => 'cl_sortkey',
 679+ 'ORDER BY' => 'cl_type, cl_sortkey',
680680 'LIMIT' => $limit + 1,
681681 );
682682 $where = array(
Index: trunk/extensions/intersection/DynamicPageList.php
@@ -499,7 +499,7 @@
500500 $sSqlSort = 'page_id'; # Since they're never reused and increasing
501501 break;
502502 case 'categorysortkey':
503 - $sSqlSort = 'c1.cl_sortkey';
 503+ $sSqlSort = "c1.cl_type $sSqlOrder, c1.cl_sortkey";
504504 break;
505505 case 'popularity':
506506 $sSqlSort = 'page_counter';

Follow-up revisions

RevisionCommit summaryAuthorDate
r81671Back out the changes which depend on the categorylinks schema change, so that...tstarling00:57, 8 February 2011

Comments

#Comment by Bawolff (talk | contribs)   18:07, 6 September 2010

>Not tested -- confirmation from someone that these changes work would be appreciated...

Tested the changes to DynamicPageList/intersection, seem to work fine. It does (obviously) change the behaviour when you're listing stuff from a category that has both normal pages and images or subcategories. However, based on how the extension is used, I don't think that really matters. There might be other changes that could be made to the extension to make it more efficient with the new schema, for example when making it return only images...

#Comment by Simetrical (talk | contribs)   18:20, 6 September 2010

Thanks for testing. It seemed from reading the code that it used LIMIT/OFFSET (urk), so I'd think it would still work okay, although of course changing the order that things are returned in. Likewise, Collection seems to return only up to a fixed number, it doesn't do things like WHERE cl_sortkey <= 'foo' that might require rearchitecting.

#Comment by Simetrical (talk | contribs)   19:25, 6 September 2010

Filed bug 25084 on FlaggedRevs, BTW.

Status & tagging log