From 023dd383b9acbd8e74e2f7e2b9f3e8cfd1478563 Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Tue, 12 Jul 2011 16:53:46 +0000 Subject: [PATCH] Bug 24254: Output JS var wgCategories on other actions than view as well. Bug 24254 --- includes/OutputPage.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 82d082a339..78900ffc0d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1168,6 +1168,21 @@ 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