Merge "Function for "pretty timestamps" that are human readable and understandable."
[lhc/web/wiklou.git] / includes / Category.php
index 7987069..ffd7bb8 100644 (file)
@@ -44,6 +44,7 @@ class Category {
 
        /**
         * Set up all member variables using a database query.
+        * @throws MWException
         * @return bool True on success, false on failure.
         */
        protected function initialize() {
@@ -297,13 +298,13 @@ class Category {
                        'IGNORE'
                );
 
-               $cond1 = $dbw->conditional( 'page_namespace=' . NS_CATEGORY, 1, 'NULL' );
-               $cond2 = $dbw->conditional( 'page_namespace=' . NS_FILE, 1, 'NULL' );
+               $cond1 = $dbw->conditional( array( 'page_namespace' => NS_CATEGORY ), 1, 'NULL' );
+               $cond2 = $dbw->conditional( array( 'page_namespace' => NS_FILE ), 1, 'NULL' );
                $result = $dbw->selectRow(
                        array( 'categorylinks', 'page' ),
-                       array( 'COUNT(*) AS pages',
-                                  "COUNT($cond1) AS subcats",
-                                  "COUNT($cond2) AS files"
+                       array( 'pages' => 'COUNT(*)',
+                                  'subcats' => "COUNT($cond1)",
+                                  'files' => "COUNT($cond2)"
                        ),
                        array( 'cl_to' => $this->mName, 'page_id = cl_from' ),
                        __METHOD__,