From a2ed8062cc994f121f0237da992e61d3af3a8ee1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 12 Jul 2011 17:21:15 +0000 Subject: [PATCH] Revert r91973 " Bug 24254: Output JS var wgCategories on other actions than view as well" 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 | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 78900ffc0d..82d082a339 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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; } -- 2.20.1