Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php |
— | — | @@ -84,18 +84,26 @@ |
85 | 85 | */ |
86 | 86 | static function getOnlyExplicitlyShownCategories() { |
87 | 87 | $shown_cats = array(); |
| 88 | + |
88 | 89 | $dbr = wfGetDB( DB_SLAVE ); |
89 | | - extract( $dbr->tableNames( 'page', 'page_props' ) ); |
90 | | - $cat_ns = NS_CATEGORY; |
91 | | - $sql = "SELECT p.page_title FROM $page p JOIN $page_props pp ON p.page_id = pp.pp_page WHERE p.page_namespace = $cat_ns AND pp.pp_propname = 'showindrilldown' AND pp.pp_value = 'y'"; |
92 | | - $res = $dbr->query( $sql ); |
| 90 | + $res = $dbr->select( |
| 91 | + array( 'p' => 'page', 'pp' => 'page_props' ), |
| 92 | + 'p.page_title', |
| 93 | + array( |
| 94 | + 'p.page_namespace' => NS_CATEGORY, |
| 95 | + 'pp.pp_propname' => 'showindrilldown', |
| 96 | + 'pp.pp_value' => 'y' |
| 97 | + ), |
| 98 | + 'SDUtils::getOnlyExplicitlyShownCategories', |
| 99 | + array( 'ORDER BY' => 'p.page_title' ), |
| 100 | + array( 'pp' => array( 'JOIN', 'p.page_id = pp.pp_page' ) ) |
| 101 | + ); |
93 | 102 | |
94 | 103 | while ( $row = $dbr->fetchRow( $res ) ) { |
95 | 104 | $shown_cats[] = str_replace( '_', ' ', $row[0] ); |
96 | 105 | } |
97 | 106 | $dbr->freeResult( $res ); |
98 | 107 | |
99 | | - sort( $shown_cats ); |
100 | 108 | return $shown_cats; |
101 | 109 | } |
102 | 110 | |