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. ;-)
fyi Titooy started on this track already: http://forum.coppermine-gallery.net/index.php?topic=18155.0
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.
<?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]'");
}
?>
Yes, pic_count and a few others are unused and are not in new installations as of 1.4.1
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.