Index: branches/category-redirects/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -79,17 +79,17 @@ |
80 | 80 | { |
81 | 81 | $this->addOption('USE INDEX', 'cl_timestamp'); |
82 | 82 | // cl_timestamp will be added by addWhereRange() later |
83 | | - $this->addOption('ORDER BY', 'cl_inline'); |
| 83 | + $this->addOption('ORDER BY', 'cl_target'); |
84 | 84 | } |
85 | 85 | else |
86 | 86 | { |
87 | 87 | $dir = ($params['dir'] == 'desc' ? ' DESC' : ''); |
88 | | - $this->addOption('USE INDEX', 'cl_sortkey_inline'); |
89 | | - $this->addOption('ORDER BY', 'cl_inline, cl_sortkey' . $dir . ', cl_from' . $dir); |
| 88 | + $this->addOption('USE INDEX', 'cl_sortkey_target'); |
| 89 | + $this->addOption('ORDER BY', 'cl_target, cl_sortkey' . $dir . ', cl_from' . $dir); |
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->addWhere('cl_from=page_id'); |
93 | | - $this->addWhere('cat_id=cl_inline'); |
| 93 | + $this->addWhere('cat_id=cl_target'); |
94 | 94 | $this->setContinuation($params['continue'], $params['dir']); |
95 | 95 | $this->addWhereFld('cat_title', $categoryTitle->getDBkey()); |
96 | 96 | $this->addWhereFld('page_namespace', $params['namespace']); |
Index: branches/category-redirects/includes/HTMLCacheUpdate.php |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | case 'imagelinks': |
124 | 124 | return array( 'il_to' => $this->mTitle->getDBkey() ); |
125 | 125 | case 'categorylinks': |
126 | | - return array( 'cat_title' => $this->mTitle->getDBkey(), 'cat_id=cl_inline' ); |
| 126 | + return array( 'cat_title' => $this->mTitle->getDBkey(), 'cat_id=cl_target' ); |
127 | 127 | } |
128 | 128 | throw new MWException( 'Invalid table type in ' . __CLASS__ ); |
129 | 129 | } |
Index: branches/category-redirects/includes/Namespace.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | */ |
55 | 55 | public static function isMovable( $index ) { |
56 | 56 | global $wgAllowImageMoving; |
57 | | - return !( $index < NS_MAIN || ($index == NS_IMAGE && !$wgAllowImageMoving) || $index == NS_CATEGORY ); |
| 57 | + return !( $index < NS_MAIN || ($index == NS_IMAGE && !$wgAllowImageMoving) ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
Index: branches/category-redirects/includes/specials/SpecialUnusedcategories.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | {$NScat} as namespace, page_title as title, page_title as value |
29 | 29 | FROM $page |
30 | 30 | INNER JOIN $category ON cat_title=page_title |
31 | | - LEFT JOIN $categorylinks ON cl_inline=cat_id |
| 31 | + LEFT JOIN $categorylinks ON cl_target=cat_id |
32 | 32 | WHERE cl_from IS NULL |
33 | 33 | AND page_namespace = {$NScat} |
34 | 34 | AND page_is_redirect = 0"; |
Index: branches/category-redirects/includes/specials/SpecialExport.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | list( $page, $categorylinks, $cat ) = $dbr->tableNamesN( 'page', 'categorylinks', 'category' ); |
33 | 33 | $sql = "SELECT page_namespace, page_title FROM $page" . |
34 | 34 | "JOIN $categorylinks ON page_id=cl_from " . |
35 | | - "JOIN $cat ON cl_inline=cat_id " . |
| 35 | + "JOIN $cat ON cl_target=cat_id " . |
36 | 36 | "WHERE cat_title = " . $dbr->addQuotes( $name ); |
37 | 37 | |
38 | 38 | $pages = array(); |
Index: branches/category-redirects/includes/specials/SpecialWantedcategories.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | FROM $categorylinks, $category |
43 | 43 | LEFT JOIN $page ON cat_title = page_title AND page_namespace = ". NS_CATEGORY ." |
44 | 44 | WHERE page_title IS NULL |
45 | | - AND cat_id=cl_inline |
| 45 | + AND cat_id=cl_target |
46 | 46 | GROUP BY 1,2,3 |
47 | 47 | "; |
48 | 48 | } |
Index: branches/category-redirects/includes/specials/SpecialMostlinkedcategories.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | cat_title as title, |
33 | 33 | COUNT(*) as value |
34 | 34 | FROM $categorylinks, $category |
35 | | - WHERE cat_id=cl_inline |
| 35 | + WHERE cat_id=cl_target |
36 | 36 | GROUP BY 1,2,3 |
37 | 37 | "; |
38 | 38 | } |
Index: branches/category-redirects/includes/specials/SpecialRecentchangeslinked.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | $tables[] = 'category'; |
71 | 71 | $conds['cat_title'] = $title->getDBkey(); |
72 | 72 | $join_conds['categorylinks'] = array( 'LEFT JOIN', 'cl_from=rc_cur_id' ); |
73 | | - $join_conds['category'] = array( 'INNER JOIN', 'cat_id=cl_inline'); |
| 73 | + $join_conds['category'] = array( 'INNER JOIN', 'cat_id=cl_target'); |
74 | 74 | } else { |
75 | 75 | if( $showlinkedto ) { |
76 | 76 | if( $title->getNamespace() == NS_TEMPLATE ){ |
Index: branches/category-redirects/includes/Category.php |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | /** Name of the category, normalized to DB-key form */ |
13 | 13 | private $mName = null; |
14 | 14 | private $mID = null; |
| 15 | + private $mRedir = null; |
15 | 16 | /** Category page title */ |
16 | 17 | private $mTitle = null; |
17 | 18 | /** Counts of membership (cat_pages, cat_subcats, cat_files) */ |
— | — | @@ -39,7 +40,7 @@ |
40 | 41 | $dbr = wfGetDB( DB_SLAVE ); |
41 | 42 | $row = $dbr->selectRow( |
42 | 43 | 'category', |
43 | | - array( 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', |
| 44 | + array( 'cat_id', 'cat_title', 'cat_redir', 'cat_pages', 'cat_subcats', |
44 | 45 | 'cat_files' ), |
45 | 46 | $where, |
46 | 47 | __METHOD__ |
— | — | @@ -49,6 +50,7 @@ |
50 | 51 | if ( $this->mTitle ) { |
51 | 52 | # If there is a title object but no record in the category table, treat this as an empty category |
52 | 53 | $this->mID = false; |
| 54 | + $this->mRedir = false; |
53 | 55 | $this->mName = $this->mTitle->getDBKey(); |
54 | 56 | $this->mPages = 0; |
55 | 57 | $this->mSubcats = 0; |
— | — | @@ -60,6 +62,7 @@ |
61 | 63 | } |
62 | 64 | } |
63 | 65 | $this->mID = $row->cat_id; |
| 66 | + $this->mRedir = $row->cat_redir; |
64 | 67 | $this->mName = $row->cat_title; |
65 | 68 | $this->mPages = $row->cat_pages; |
66 | 69 | $this->mSubcats = $row->cat_subcats; |
— | — | @@ -151,13 +154,15 @@ |
152 | 155 | $cat->mName = $title->getDBKey(); # if we have a title object, fetch the category name from there |
153 | 156 | } |
154 | 157 | |
155 | | - $cat->mID = false; |
| 158 | + $cat->mID = false; |
| 159 | + $cat->mRedir = false; |
156 | 160 | $cat->mSubcats = 0; |
157 | 161 | $cat->mPages = 0; |
158 | 162 | $cat->mFiles = 0; |
159 | 163 | } else { |
160 | 164 | $cat->mName = $row->cat_title; |
161 | 165 | $cat->mID = $row->cat_id; |
| 166 | + $cat->mRedir = $row->cat_redir; |
162 | 167 | $cat->mSubcats = $row->cat_subcats; |
163 | 168 | $cat->mPages = $row->cat_pages; |
164 | 169 | $cat->mFiles = $row->cat_files; |
— | — | @@ -170,6 +175,8 @@ |
171 | 176 | public function getName() { return $this->getX( 'mName' ); } |
172 | 177 | /** @return mixed Category ID, or false on failure */ |
173 | 178 | public function getID() { return $this->getX( 'mID' ); } |
| 179 | + /** @return mixed Category redirect ID (may be null), or false on failure */ |
| 180 | + public function getRedir() { return $this->getX( 'mRedir' ); } |
174 | 181 | /** @return mixed Total number of member pages, or false on failure */ |
175 | 182 | public function getPageCount() { return $this->getX( 'mPages' ); } |
176 | 183 | /** @return mixed Number of subcategories, or false on failure */ |
— | — | @@ -234,7 +241,7 @@ |
235 | 242 | "COUNT($cond1) AS subcats", |
236 | 243 | "COUNT($cond2) AS files" |
237 | 244 | ), |
238 | | - array( 'cl_inline' => $this->mID, 'page_id = cl_from' ), |
| 245 | + array( 'cl_target' => $this->mID, 'page_id = cl_from' ), |
239 | 246 | __METHOD__, |
240 | 247 | 'LOCK IN SHARE MODE' |
241 | 248 | ); |
Index: branches/category-redirects/includes/Categoryfinder.php |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | $res = $this->dbr->select( |
142 | 142 | /* FROM */ array( 'categorylinks', 'category' ), |
143 | 143 | /* SELECT */ array( 'cl_from', 'cat_title' ), |
144 | | - /* WHERE */ array( 'cl_from' => $this->next, 'cl_inline=cat_id' ), |
| 144 | + /* WHERE */ array( 'cl_from' => $this->next, 'cl_target=cat_id' ), |
145 | 145 | $fname."-1" |
146 | 146 | ); |
147 | 147 | while ( $o = $this->dbr->fetchObject( $res ) ) { |
Index: branches/category-redirects/includes/CategoryPage.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | |
21 | 21 | if ( isset( $diff ) && $diffOnly ) |
22 | 22 | return Article::view(); |
| 23 | + |
23 | 24 | |
24 | 25 | if(!wfRunHooks('CategoryPageView', array(&$this))) return; |
25 | 26 | |
— | — | @@ -224,12 +225,12 @@ |
225 | 226 | $res = $dbr->select( |
226 | 227 | array( 'page', 'categorylinks', 'category' ), |
227 | 228 | array( 'page_title', 'page_namespace', 'page_len', 'page_is_redirect', 'cl_sortkey', |
228 | | - 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ), |
| 229 | + 'cat_id', 'cat_redir', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ), |
229 | 230 | array( $pageCondition, |
230 | | - 'cl_inline' => $this->cat->getID() ), |
| 231 | + 'cl_target' => $this->cat->getID() ), |
231 | 232 | __METHOD__, |
232 | 233 | array( 'ORDER BY' => $this->flip ? 'cl_sortkey DESC' : 'cl_sortkey', |
233 | | - 'USE INDEX' => array( 'categorylinks' => 'cl_sortkey_inline' ), |
| 234 | + 'USE INDEX' => array( 'categorylinks' => 'cl_sortkey_target' ), |
234 | 235 | 'LIMIT' => $this->limit + 1 ), |
235 | 236 | array( 'categorylinks' => array( 'INNER JOIN', 'cl_from = page_id' ), |
236 | 237 | 'category' => array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY ) ) ); |
— | — | @@ -248,7 +249,10 @@ |
249 | 250 | |
250 | 251 | if( $title->getNamespace() == NS_CATEGORY ) { |
251 | 252 | $cat = Category::newFromRow( $x, $title ); |
252 | | - $this->addSubcategoryObject( $cat, $x->cl_sortkey, $x->page_len ); |
| 253 | + if ( $cat->getRedir() == null ) { |
| 254 | + # Show only non-redirects |
| 255 | + $this->addSubcategoryObject( $cat, $x->cl_sortkey, $x->page_len ); |
| 256 | + } |
253 | 257 | } elseif( $this->showGallery && $title->getNamespace() == NS_IMAGE ) { |
254 | 258 | $this->addImage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect ); |
255 | 259 | } else { |
Index: branches/category-redirects/includes/Article.php |
— | — | @@ -3302,7 +3302,7 @@ |
3303 | 3303 | $res = $dbr->select( array( 'categorylinks', 'category', 'page_props', 'page' ), |
3304 | 3304 | array( 'cat_title' ), |
3305 | 3305 | array( 'cl_from' => $id, 'pp_page=page_id', 'pp_propname' => 'hiddencat', |
3306 | | - 'page_namespace' => NS_CATEGORY, 'page_title=cat_title', 'cat_id=cl_inline'), |
| 3306 | + 'page_namespace' => NS_CATEGORY, 'page_title=cat_title', 'cat_id=cl_target'), |
3307 | 3307 | 'Article:getHiddenCategories' ); |
3308 | 3308 | if ( false !== $res ) { |
3309 | 3309 | if ( $dbr->numRows( $res ) ) { |