Hi,
Totally untested, but *should* work =)
Make a new script, in your /admin folder. Call it something like delete_old.cgi. Put the following in it;
use strict;
use lib '/full/path/to/your/admin';
use GT::Base;
use Links qw/$CFG $IN $DB/;
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use GT::Date;
local $SIG{__DIE__} = \&Links::fatal;
Links::init('/full/path/to/your/admin');
Links::init_user();
my $days_diff = 365;
my $current = GT::Date::date_get();
my $date_to_del_from = GT::Date::date_sub($current,$days_diff);
for (my $i = 0; $i < 7; $i++) {
my $date_to_del = GT::Date::date_sub($date_to_del_from,$i);
print "DELETING Link with Add_Date on $date_to_del \n":
#$DB->table('Links')->delete( { Add_Date => $date_to_del } ) || die $GT::SQL::error;
}
BE SURE TO EDIT THE "/full/path/to/your/admin" part, so it reflects you admin folder ;))
Then, run via SSH/Telnet, with;
cd /path/to/your/admin
perl delete_old.cgi
You'll notice, that I've commented out this line;
#$DB->table('Links')->delete( { Add_Date => $date_to_del } ) || die $GT::SQL::error;
Once you are happy its getting the dates you want to delete, then you can uncomment this, and they should then get deleted the next time you run it =)
Hope that helps
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Totally untested, but *should* work =)
Make a new script, in your /admin folder. Call it something like delete_old.cgi. Put the following in it;
Code:
#!/usr/bin/perl -w use strict;
use lib '/full/path/to/your/admin';
use GT::Base;
use Links qw/$CFG $IN $DB/;
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use GT::Date;
local $SIG{__DIE__} = \&Links::fatal;
Links::init('/full/path/to/your/admin');
Links::init_user();
my $days_diff = 365;
my $current = GT::Date::date_get();
my $date_to_del_from = GT::Date::date_sub($current,$days_diff);
for (my $i = 0; $i < 7; $i++) {
my $date_to_del = GT::Date::date_sub($date_to_del_from,$i);
print "DELETING Link with Add_Date on $date_to_del \n":
#$DB->table('Links')->delete( { Add_Date => $date_to_del } ) || die $GT::SQL::error;
}
BE SURE TO EDIT THE "/full/path/to/your/admin" part, so it reflects you admin folder ;))
Then, run via SSH/Telnet, with;
cd /path/to/your/admin
perl delete_old.cgi
You'll notice, that I've commented out this line;
#$DB->table('Links')->delete( { Add_Date => $date_to_del } ) || die $GT::SQL::error;
Once you are happy its getting the dates you want to delete, then you can uncomment this, and they should then get deleted the next time you run it =)
Hope that helps
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!