how to remove album stats query? how to remove album stats query?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

how to remove album stats query?

Started by jtothek3030, June 10, 2007, 07:07:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jtothek3030

Hi, I'm trying to get rid of all my unnecessary db queries because i'm exceeding my cpu quota with my server during peak traffic hours.  I've found some helpful posts but have been unable to find how to remove the album stats (ones that say X files, last added DATE).  I can remove the text output easily through language file or theme.php display but not the actual query itself.  I've tried commenting out one and/or both of the queries in index.php that look like this:

//This query will fetch album stats and keyword for the albums
    $sql = "SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword" .
            " FROM {$CONFIG['TABLE_ALBUMS']} AS a " .
            " LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON a.aid = p.aid AND p.approved =  'YES' ".
            "WHERE a.aid IN $album_set" . "GROUP BY a.aid";

but this causes the album thumbnails (i dont have categories) to not be displayed even though all the files are still located in that album.  Does anyone know how i can stop this query?
thanks eoraptor.com gallery

Nibbler

Specify the album thumbnail in album properties for each album instead of using the last uploaded image as the thumbnail.

jtothek3030

Quote from: Nibbler on June 10, 2007, 01:07:22 PM
Specify the album thumbnail in album properties for each album instead of using the last uploaded image as the thumbnail.

Hi Nibbler, thanks for the reply.  The album thumbnail was already set for each album (for example album-2 has thumbnail set as videos_engracados_17.jpg), however when i comment out the query with /* QUERY */ it removes the query (removing number of files and last added date), but also removes the album thumbnail.  When I then go into album properties, the thumbnail is still shown as selecting the same .jpg file  (i can change this to other jpg files or last added as well) but this photo does not show on the home page no matter which jpg file is selected.

so it seems that removing the album stats query as i have done it also removes the connection between thumbnail selected and displaying this thumbnail for the album on eoraptor.index.html 

I removed */ from query so my users dont see blank albums but can do again if this will help someone solve my problem

thanks

Nibbler

OK, you'll also need to change


$count = 0;


to


$count = 1;


Otherwise Coppermine thinks the album is empty. If the album actually is empty then you'll probably get a broken image, so don't have empty albums.

jtothek3030

Argg so complicated, think its a little beyond me.  I commented out this block
   /*$sql = "SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword" .
            " FROM {$CONFIG['TABLE_ALBUMS']} AS a " .
            " LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON a.aid = p.aid AND p.approved =  'YES' ".
            "WHERE a.aid IN $album_set" . "GROUP BY a.aid";*/

and changed the count to 1
            $count = 1;

there are two locations that have this code in index.php, I changed one and then the other and then both and the results are the same, there still are no thumbnails in album.  The other strange thing is that commenting the query out as i did above, gets rid of -

[28] => SELECT a.aid, count( p.pid ) AS pic_count, max( p.pid ) AS last_pid, max( p.ctime ) AS last_upload, a.keyword FROM cpg_albums AS a LEFT JOIN cpg_pictures AS p ON a.aid = p.aid AND p.approved = 'YES' WHERE a.aid IN (1, 2, 3, 4, 8, 10, 5, 6, 9)GROUP BY a.aid (0.002s)

but replaces it with -

[27] => SELECT a.aid, a.title, a.description, category, visibility, filepath, filename, url_prefix, pwidth, pheight FROM cpg_albums as a LEFT JOIN cpg_pictures as p ON a.thumb=p.pid WHERE category=0 ORDER BY a.pos LIMIT 0,9 (0.001s)

so that there are two of these queries instead of one of each.


Nibbler

Works as expected for me. If you can't work it out then you'll just need to leave the code alone.

jtothek3030

Quote from: Nibbler on June 10, 2007, 04:38:22 PM
Works as expected for me. If you can't work it out then you'll just need to leave the code alone.

Nibbler, did you comment out both query blocks with /**/ and change both count values to 1?  or only the first instance?
thanks

Nibbler

Only the first. The first is for the regular album list (albums in no category) and the second is for albums displayed within a category ('Show first level album thumbnails in categories' setting)