-
- if ( $wgExperimentalCategorySort ) {
- # Now add all subcategories and files. TODO: rewrite to be sane
- # (this is basically a proof-of-concept, e.g., no pagination here).
- $subcatsRes = $dbr->select(
- $tables, $fields,
- $conds + array( 'cl_type' => 'subcat' ),
- __METHOD__, $opts, $joins
- );
-
- foreach ( $subcatsRes as $row ) {
- $title = Title::newFromRow( $row );
-
- if ( $title->getNamespace() == NS_CATEGORY ) {
- $cat = Category::newFromRow( $row, $title );
- $this->addSubcategoryObject( $cat, $row->cl_sortkey, $row->page_len );
- } else {
- # Will handle this sanely in final code
- throw new MWException( 'Debug: cl_type = subcat but not category' );
- }
- }
-
- $filesRes = $dbr->select(
- $tables, $fields,
- $conds + array( 'cl_type' => 'file' ),
- __METHOD__, $opts, $joins
- );
-
- foreach ( $filesRes as $row ) {
- $title = Title::newFromRow( $row );
-
- if ( $this->showGallery && $title->getNamespace() == NS_FILE ) {
- $this->addImage( $title, $row->cl_sortkey, $row->page_len, $row->page_is_redirect );
- } else {
- # More temporary debugging
- throw new MWException( 'Debug: cl_type = file but not file' );
- }
- }
- }