forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Colliope on December 05, 2008, 04:54:27 pm

Title: [Solved]: Number of Categories in statistics is wrong
Post by: Colliope on December 05, 2008, 04:54:27 pm
I've just noticed that the number of categories shown in the statistics on my main page is wrong.
It says there are 21 categories but I've only got 3 categories (no subcategories in them).
Perhap this number includes categories that have been deleted?
Is it possible to correct this number?

Thanks,
C

Title: Re: Number of Categories in statistics is wrong
Post by: Nibbler on December 05, 2008, 04:58:13 pm
Post a link to your gallery.
Title: Re: Number of Categories in statistics is wrong
Post by: Colliope on December 06, 2008, 02:14:04 pm
keangenes.com/cpg143
User: TestUser
PW: Temp123

After I created this TestUser account, the number of categories showing increased to 22.
Title: Re: Number of Categories in statistics is wrong
Post by: Fabricio Ferrero on December 06, 2008, 02:28:31 pm
Upgrade! If the problems persist, come back and post again.

Upgrade it's not optional but mandadory!
Title: Re: Number of Categories in statistics is wrong
Post by: Colliope on December 07, 2008, 05:46:10 pm
Sigh. If I can't get any help here without updating I guess I have no choice but to deal with the hassle.
Title: Re: Number of Categories in statistics is wrong
Post by: Fabricio Ferrero on December 07, 2008, 06:57:58 pm
You are running too many version behind, more than 10. So, it's so probably when you update you're issue goes away. ;)
Title: Re: Number of Categories in statistics is wrong
Post by: Hein Traag on December 07, 2008, 07:19:49 pm
Sigh all you want but there is no support on versions older then the current stable one. So please do so and report back with your findings.
Title: Re: Number of Categories in statistics is wrong
Post by: Αndré on December 10, 2008, 03:38:24 pm
I had a look at the code on Colliope's website. This "problem" is caused by a mod, which counts the categories and the number of users:
Code: [Select]
        if ($CONFIG["user_gal_as_root"]) {
          $result = cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1");
          $nbEnr = mysql_fetch_array($result);
          $totalCats = $nbEnr[0];
          $result = cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_USERS']} WHERE 1");
          $nbEnr = mysql_fetch_array($result);
          $totalUsers = $nbEnr[0];
          $cat_count = $totalCats - $HIDE_USER_CAT - 1 + $totalUsers;
          mysql_free_result($result);
        } else {
          $sql = "SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1";
          $result = cpg_db_query($sql);
          $nbEnr = mysql_fetch_array($result);
          $cat_count = $nbEnr[0] - $HIDE_USER_CAT;
          mysql_free_result($result);
        }

FYI: It seems that this mod (user_gal_as_root) displays the user galleries like public root categories. That's why the calculation of the categorie statistics was modded.

I corrected the issue. Solved!