Revert r91973 " Bug 24254: Output JS var wgCategories on other actions than view...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 12 Jul 2011 17:21:15 +0000 (17:21 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 12 Jul 2011 17:21:15 +0000 (17:21 +0000)
This code just looks really wrong -- it seems to be stuffing things into OutputPage::getCategories() which seems clearly designed to only return a set of categories that have been previously set by something else; rather than a lazy loader it also seems to fetch them every time. Nor does it even check if the article exists before loading from the DB -- and in general it looks like it doesn't really fit in with other code. It also only lists itself as altering wgCategories, but it's changing what's in the OutputPage itself so this may affect other things.

includes/OutputPage.php

index 78900ff..82d082a 100644 (file)
@@ -1168,21 +1168,6 @@ class OutputPage {
         * @return Array of strings
         */
        public function getCategories() {
-               // mCategories will only be filled if we're coming from the parser
-               if ($this->getRequest()->getVal('action') != 'view') {
-                       $categories = array();
-                       $dbr = wfGetDB( DB_SLAVE );
-                       $res = $dbr->select(
-                               'categorylinks',
-                               array( 'cl_to' ),
-                               'cl_from='. $this->getTitle()->getArticleId(),
-                               __METHOD__
-                       );
-                       foreach( $res as $row ) {
-                               $categories[] = $row->cl_to;
-                       }
-                       $this->mCategories = $categories;
-               }
                return $this->mCategories;
        }