Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: how to remove album stats query?  (Read 5766 times)

0 Members and 1 Guest are viewing this topic.

jtothek3030

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
how to remove album stats query?
« on: June 10, 2007, 07:07:20 am »

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
Logged

Nibbler

  • Guest
Re: how to remove album stats query?
« Reply #1 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.
Logged

jtothek3030

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: how to remove album stats query?
« Reply #2 on: June 10, 2007, 02:53:58 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
Logged

Nibbler

  • Guest
Re: how to remove album stats query?
« Reply #3 on: June 10, 2007, 03:35:20 pm »

OK, you'll also need to change

Code: [Select]
$count = 0;

to

Code: [Select]
$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.
Logged

jtothek3030

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: how to remove album stats query?
« Reply #4 on: June 10, 2007, 04:08:28 pm »

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.

Logged

Nibbler

  • Guest
Re: how to remove album stats query?
« Reply #5 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.
Logged

jtothek3030

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: how to remove album stats query?
« Reply #6 on: June 10, 2007, 04:51:17 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
Logged

Nibbler

  • Guest
Re: how to remove album stats query?
« Reply #7 on: June 10, 2007, 06:19:29 pm »

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)
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.