forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: Stramm on July 02, 2005, 09:07:41 am

Title: Archive
Post by: Stramm on July 02, 2005, 09:07:41 am
Hi, I'd like to suggest an archive feature for 1.5
It should be able to rotate out MySQL data from the cpg_picture table to an archive table after a certain amount of time using cron etc.
This would help to keep the main table clean and fast to process. A link to the archive could be placed eg below each album. Browsing the archive's using the same routines than the main image gallery.
Title: Re: Archive
Post by: donnoman on July 02, 2005, 09:41:10 am
You could code this without cron.

create your archive  table, create a config table entry like 'last_archive'

create code in your init.inc.php

if $config['last_archive'] is < today then run archive()

function archive runs the sql select into query and then delete from, then updates last_archive to todays date.

Thats pretty much it.

It will run once a day at some point, then not try to run again until the next day, and you only waste one "if" test, and the entire config table gets loaded in init anyway, so its not like you had to do an extra sql query to find out when it ran last..

coding user access to the archive is going to be the same with/without cron.

hth