function closeShowCategory() {
global $wgOut, $wgRequest;
+ // Use these as defaults for back compat --catrope
+ $oldFrom = $wgRequest->getVal( 'from' );
+ $oldUntil = $wgRequest->getVal( 'until' );
+
$from = $until = array();
foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
- $from[$type] = $wgRequest->getVal( "{$type}from" );
- $until[$type] = $wgRequest->getVal( "{$type}until" );
+ $from[$type] = $wgRequest->getVal( "{$type}from", $oldFrom );
+ $until[$type] = $wgRequest->getVal( "{$type}until", $oldUntil );
}
$viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $wgRequest->getValues() );
* else use sortkey...
*
* @param Title $title
- * @param string $sortkey
+ * @param string $sortkey The human-readable sortkey (before transforming to icu or whatever).
*/
function getSubcategorySortChar( $title, $sortkey ) {
global $wgContLang;
array( 'page', 'categorylinks', 'category' ),
array( 'page_id', 'page_title', 'page_namespace', 'page_len',
'page_is_redirect', 'cl_sortkey', 'cat_id', 'cat_title',
- 'cat_subcats', 'cat_pages', 'cat_files', 'cl_sortkey_prefix' ),
- array( 'cl_to' => $this->title->getDBkey() ) + $extraConds,
+ 'cat_subcats', 'cat_pages', 'cat_files',
+ 'cl_sortkey_prefix', 'cl_collation' ),
+ array_merge( array( 'cl_to' => $this->title->getDBkey() ), $extraConds ),
__METHOD__,
array(
'USE INDEX' => array( 'categorylinks' => 'cl_sortkey' ),
$count = 0;
foreach ( $res as $row ) {
$title = Title::newFromRow( $row );
- $rawSortkey = $row->cl_sortkey;
+ if ( $row->cl_collation === '' ) {
+ // Hack to make sure that while updating from 1.16 schema
+ // and db is inconsistent, that the sky doesn't fall.
+ // See r83544. Could perhaps be removed in a couple decades...
+ $humanSortkey = $row->cl_sortkey;
+ } else {
+ $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
+ }
if ( ++$count > $this->limit ) {
# We've reached the one extra which shows that there
# are additional pages to be had. Stop here...
- $this->nextPage[$type] = $rawSortkey;
+ $this->nextPage[$type] = $humanSortkey;
break;
}
if ( $title->getNamespace() == NS_CATEGORY ) {
$cat = Category::newFromRow( $row, $title );
- $this->addSubcategoryObject( $cat, $rawSortkey, $row->page_len );
+ $this->addSubcategoryObject( $cat, $humanSortkey, $row->page_len );
} elseif ( $title->getNamespace() == NS_FILE ) {
- $this->addImage( $title, $rawSortkey, $row->page_len, $row->page_is_redirect );
+ $this->addImage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
} else {
- $this->addPage( $title, $rawSortkey, $row->page_len, $row->page_is_redirect );
+ $this->addPage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
}
}
}