forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: robert9 on May 31, 2005, 06:47:08 pm

Title: pic_count is unused ?
Post by: robert9 on May 31, 2005, 06:47:08 pm
Maybe it is my bad english that i cant find something about the field pic-count in table cpg_albums; it seems this field is not used? So why it is here?
I will take a look inside the code now; maybe find something to improve. ;-)
Title: Re: Seriously. Don't use count anymore if you want your product to be stable.
Post by: nol33t on May 31, 2005, 06:55:24 pm
fyi Titooy started on this track already: http://forum.coppermine-gallery.net/index.php?topic=18155.0
Title: pic_count in cpg_albums
Post by: robert9 on May 31, 2005, 07:09:19 pm
For my installation it seems there is a field pic_count in table cpg_albums that is not used; beacuse i integrate vb and some other cms, i need the number of pics in a field, so i have not to count it every time i need this number. For this i write this little cron-job for vb to count the pics one time a week.
Save it to a file in include/cron; go to vb admin; add a new cron_job with the filename.


Code: [Select]
<?php
// Count pics from cpg_pictures for pic_count in cpg_albums

error_reporting(E_ALL & ~E_NOTICE);

if (!
is_object($DB_site))
{
exit;
}

$aus=$DB_site->query("SELECT aid from cpg_albums ORDER BY aid DESC");
        while ( 
$au=$DB_site->fetch_array($aus) ) {
            echo 
"work on album"$au[aid]. " ... ";
            
                
$galcnt $DB_site->query_first("SELECT COUNT(*) AS du
                                                FROM cpg_pictures
                                                WHERE aid = '
$au[aid]'");
                
$anzahl $galcnt['du'];
                echo 
"Anzahl: " $anzahl "<br />";
  
           
$DB_site->query("UPDATE cpg_albums set pic_count = '$anzahl' where aid = '$au[aid]'");
        }
?>
Title: Re: pic_count is unused ?
Post by: Nibbler on May 31, 2005, 07:21:06 pm
Yes, pic_count and a few others are unused and are not in new installations as of 1.4.1
Title: Re: pic_count is unused ?
Post by: Joachim Müller on June 01, 2005, 09:00:45 am
merged the two threads made by robert9 that deal with the same thing into this one (see above postings). Please don't double-post in the future.