From: Greg Sabino Mullane Date: Wed, 19 Mar 2008 13:15:09 +0000 (+0000) Subject: Use $db->conditional() instead of non-standard IF(). Fixes bug 13430. X-Git-Tag: 1.31.0-rc.0~48980 X-Git-Url: https://git.cyclocoop.org/admin/%7B%7Blocalurl:Special:UserLogin%7D%7D?a=commitdiff_plain;h=d3a1c5c739965b58140df17cccb37b5c11c51c1f;p=lhc%2Fweb%2Fwiklou.git Use $db->conditional() instead of non-standard IF(). Fixes bug 13430. --- diff --git a/includes/Category.php b/includes/Category.php index 98c65a1d58..e924b5eeba 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -273,11 +273,13 @@ class Category extends CategoryListBase { ); } + $cond1 = $dbw->conditional( 'page_namespace='.NS_CATEGORY, 1, 'NULL' ); + $cond2 = $dbw->conditional( 'page_namespace='.NS_IMAGE, 1, 'NULL' ); $result = $dbw->selectRow( array( 'categorylinks', 'page' ), array( 'COUNT(*) AS pages', - 'COUNT(IF(page_namespace='.NS_CATEGORY.',1,NULL)) AS subcats', - 'COUNT(IF(page_namespace='.NS_IMAGE.',1,NULL)) AS files' + "COUNT($cond1) AS subcats", + "COUNT($cond2) AS files" ), array( 'cl_to' => $this->mNames[0], 'page_id = cl_from' ), __METHOD__,