From d3a1c5c739965b58140df17cccb37b5c11c51c1f Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Wed, 19 Mar 2008 13:15:09 +0000 Subject: [PATCH] Use $db->conditional() instead of non-standard IF(). Fixes bug 13430. --- includes/Category.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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__, -- 2.20.1