From: Leo Koppelkamm Date: Tue, 12 Jul 2011 16:53:46 +0000 (+0000) Subject: Bug 24254: Output JS var wgCategories on other actions than view as well. Bug 24254 X-Git-Tag: 1.31.0-rc.0~28908 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%7B%7B%20url_for%28%27vote%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=023dd383b9acbd8e74e2f7e2b9f3e8cfd1478563;p=lhc%2Fweb%2Fwiklou.git Bug 24254: Output JS var wgCategories on other actions than view as well. Bug 24254 --- 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; }