Gossamer Forum
Home : Products : DBMan : Installation :

Deleting Old Records

Quote Reply
Deleting Old Records
Is there a way to search based on date or something that can put into the code to delete records that are say 30 or 60 days old. I tried to do a search using just the month letters but could not bring anything up.

Thanks
Venice
Quote Reply
Re: Deleting Old Records In reply to
You can make a little adjustment to db.cgi that will allow you to search for month names.

Look for sub query.

Scroll down a little bit until you see lines that start like this:

Code:
else {
$i = 0;
foreach $column (@db_cols) {
if ($in{$column} =~ /^\>(.+)$/) { ...
push (@search_gt_fields, $i);...
if ($in{$column} =~ /^\<(.+)$/) { ...
push (@search_lt_fields, $i);...
if ($in{$column} !~ /^\s*$/) {...
push(@search_fields, $i); $i++; next; }
if ($in{"$column-gt"} !~ /^\s*$/) { ...
push(@search_gt_fields, $i); }
if ($in{"$column-lt"} !~ /^\s*$/) {...
push(@search_lt_fields, $i); }
$i++;
}
}

(This is just the beginnings of the lines so you can orient yourself.)

In the third "if" statement, the one that starts with

Code:
if ($in{$column} !~ /^\s*$/) {

delete the following part -- just from this one, though!

Code:
($db_sort{$column} eq 'date') and (&date_to_unix($in{$column}) or return "Invalid date format: '$in{$column}'");

The line will end up looking like this:

Code:
if ($in{$column} !~ /^\s*$/) {
push(@search_fields, $i); $i++; next; }

Then you'll be able to enter "Jun" and get all the records that were added in June.


------------------
JPD





Quote Reply
Re: Deleting Old Records In reply to
Great. Actually I just added the what's new feature and it worked. LOL it must have taken that out of the statment already as it will do a search on just the month name.

I think I will give it a rest. I do want to add the password look up though and will tackle that latter as I tried once but could not get it to work. But I know so much more know thanks to this great forum.

Thanks
Venice
Quote Reply
Re: Deleting Old Records In reply to
Maybe you mean the 'auto_delete' mod from JPD, it alows you, to setup the script to automaticly delete the records that are ... days old, every time someone logs in.
Quote Reply
Re: Deleting Old Records In reply to
Hey great where can I get that? That would make life easier.

Thanks
Venice
Quote Reply
Re: Deleting Old Records In reply to
I wanted to shoot Mart when he posted that!!! Wink

You can do a search for "autodelete" on the forum and see what you can come up with. I did save the code and intend to create a mod for it when I get the time.

------------------
JPD





Quote Reply
Re: Deleting Old Records In reply to
OK, you can find all the details on
Code:
elsif ($in{'login'}) { # The user is trying to login.
Succes, its a great mod, thanks to JPD.

Quote Reply
Re: Deleting Old Records In reply to
No, Mart. It's just that I really didn't want to get into it again.

It's okay. You will be here to help!! Smile



------------------
JPD





Quote Reply
Re: Deleting Old Records In reply to
Sorry,
Did I do something wrong??
Don't understand...