From: Daniel Kinzler Date: Tue, 1 Jul 2008 20:49:23 +0000 (+0000) Subject: allow Category objects for empty categories X-Git-Tag: 1.31.0-rc.0~46822 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=c9f49d84763e303af97da7664d29a8bcacae1280;p=lhc%2Fweb%2Fwiklou.git allow Category objects for empty categories --- diff --git a/includes/Category.php b/includes/Category.php index 43864914e4..45d2afa2e4 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -46,7 +46,18 @@ class Category { ); if( !$row ) { # Okay, there were no contents. Nothing to initialize. - return false; + if ( $this->mTitle ) { + # If there is a title object but no record in the category table, treat this as an empty category + $this->mID = false; + $this->mName = $this->mTitle->getDBKey(); + $this->mPages = 0; + $this->mSubcats = 0; + $this->mFiles = 0; + + return true; + } else { + return false; # Fail + } } $this->mID = $row->cat_id; $this->mName = $row->cat_title;