Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Auto delete link within certain days

Quote Reply
Auto delete link within certain days
I noticed this sub routine in Build.pm, Link 2.X

sub build_reset_hits {
# ------------------------------------------------------------------
# Remove old hit and rate tracking information.
#
Links::init_date();
my $delete_by = GT::Date::date_get ( time() - 172800 ); # 2 days old
my $click_db = $DB->table ('ClickTrack');
$click_db->delete ( GT::SQL::Condition->new ( 'Created', '<', $delete_by ));
}

I changed to this:

sub build_reset_hits {
# ------------------------------------------------------------------
# Remove old hit and rate tracking information.
#
Links::init_date();
my $delete_by = GT::Date::date_get ( time() - 172800 ); # 2 days old
my $link_db = $DB->table ('Links');
$link_db->delete ( GT::SQL::Condition->new ( 'Created', '<', $delete_by ));
}



So when I do a build it will remove old links. I also made a new table "Created" and in Add.cgi use NOW to generate the timestamp.

I did everything right but when i build change, it won't delete the link with old timestamp. Please help.
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
I'm not sure if this is called in the main build process. It looks like it may be an extra routine in the codes, to accommidate for one of GT's plugins.

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!
Quote Reply
Re: [Andy] Auto delete link within certain days In reply to
Isn't this sub called during the build process? Resetting hits and counter?
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Yeah, its this line that is confusing me;

$link_db->delete ( GT::SQL::Condition->new ( 'Created', '<', $delete_by ));

That, would lead me to think that the building process deletes any links in the lsql_Links table, where the Created date is less than $delete_by ... which to me, doesn't make sense Unsure

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!
Quote Reply
Re: [Andy] Auto delete link within certain days In reply to
First I create a: Created column in Links

Then edit Add.cgi and make Created = NOW() time. (somewhat like the timestamp.)

I check the link, it shows the 14 digit timestamp.

I want to delete ANY link that is older than 2 days or whatever day by changing the "172800". I tested with "time() - 1" second to instant delete but it does not working.

Links::init_date();
my $delete_by = GT::Date::date_get ( time() - 172800 ); # 2 days old
my $link_db = $DB->table ('Links');
$link_db->delete ( GT::SQL::Condition->new ( 'Created', '<', $delete_by ));
}

Last edited by:

mrcry11: Mar 11, 2003, 9:30 AM
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
I don't recommend you to do such modification directly into the core code, since you will lose the ability to do upgrades when new Links SQL versions are released!
I strongly recommend to write own plugin or buy an existing plugin for that task.

Otherwise yes, the build_reset_hits is called at each build, but this function has other goals, and using it also for link expiration, deletion, is a serious design problem.
The build_reset_hits function is used for double hit protection of jump or rate features, and may not modified to handle link deletion.

You are free to do what you want, but you should be aware of these facts...

I suggest you to look around already existing plugins.
Andy has a cheap expiration plugin released (named as: Expire_Links plugin),
as well I'm working on an expensive plugin named as: Advanced Link Expirator plugin (ALE) (the linked thread contains development news of my plugin).

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 12, 2003, 1:34 PM
Quote Reply
Re: [webmaster33] Auto delete link within certain days In reply to
Thanks for th info.

I noticed it made for "deleting old clicktrack id's" but based on the coding, how come i make it so I can delete link id's instead? just curious

I'm telling it to use Links DB and select any links that is order then TODAY - 10 seconds.
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Hey webmaster33, sorry if this is bothering you, but just like to mention that you advertise, talk about, and recommend your so call Links Xtended, Advanced Link Expirator plugin (ALE) for years now.. lol the funniest thing is that so far, it's all talk and no product :) i think maybe you should finish your product first then start rambling and having big news on it!!!!
Quote Reply
Re: [xpert] Auto delete link within certain days In reply to
1) I my previous post I listed (IMHO correctly) all products which are currently available or are under development, including the Andy's Expire_Links plugin. I also mentioned that my ALE plugin is still under development. So what's your problem?
IMHO I listed all products fairly.

2)
Quote:
Advanced Link Expirator plugin (ALE) for years now
Haha Smile Do you feel you got older by years since you work with LSQL?
At least don't tell untrue things.
I started the work on Advanced Link Expirator plugin on Sep 2, 2002. This was about 6 months ago. You can't say years... XLD was started around Jul 16 (about 9 months ago), 2002. XAMD was started around Aug 6, 2002 (about 7 months ago).
So you can NOT say years in any case!

The XAMD and XLD plugin features are finished since a long time, all works already, but I did not create an installer for them.
What I still have to do: I need to create installer for them, move the user options from registry to user area, create the documentation, full recheck the codes before release, because I know much more about LSQL than 9 months ago, and do code cleanup. I don't plan to do that in near future.

What I have to do in near future:
1) First correct a bug found in DirName converter plugin,
2) release a new plugin I'm just working on,
3) After that, ALE development will be finished.
4) XAMD & XLD will be not released in the near future, because I will have not time for support them & do bugs fixes if needed.
3 plugins are good enough to have them supported in the near future...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Auto delete link within certain days In reply to
I think his point is valid - I've mentioned the same in the past. You do make a lot of posts regarding your plugins, whether they be new threads or replies to people linking to your threads and advertising your plugins, but as of yet there is nothing to show for it.

I realise the length of time it takes to make a substantial plugin as a plugin author myself, but I (and seemingly others who may intend on using your plugins) may have appreciated an original post to outline the features of your new plugin and then perhaps occasional updates relating to development rather than lots of posts everywhere linking to all your different threads which can be confusing for everyone.

Quote:
1) First correct a bug found in DirName converter plugin,

Plus the other 10 I listed :)
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Well the change you started was not bad. It needs to use Links table.
However the Condition was not good, since Links table has no Created field.

Also if you do these replacements in build_reset_hits function, you lose the double hit protection.
Code duplication would help a bit, but as I said all of that is NOT recommended.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Paul] Auto delete link within certain days In reply to
Quote:
Plus the other 10 I listed :)
I will post my comments soon, about your 10 comments

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Auto delete link within certain days In reply to
You didn't fully read my post, "First I create a: Created column in Links"

This column is identical to the Timestmp column with the same value.
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Quote:
You didn't fully read my post, "First I create a: Created column in Links"
True Smile
Now I did fully read it. In first post you wrote: new table "Created".
You really meant table, or just column?

Quote:
This column is identical to the Timestmp column with the same value.
Could you make clean which Timestmp column did you mean?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 13, 2003, 11:41 AM
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Have you tried it with build all instead of build changed?
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
Have you double checked what date_get is returning?....it sounds like it returning a date, which obviously can't be compared to a timestamp.
Quote Reply
Re: [Paul] Auto delete link within certain days In reply to
If the column format is really timestamp, not DATETIME.
It's still not clear for me.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 13, 2003, 4:14 PM
Quote Reply
Re: [webmaster33] Auto delete link within certain days In reply to
I tried Build ALL or Build Changes, doesn't work.

To make it clear:

Columm added: "Created" - same value as "Timestmp" column.

In Add.pm added this line:

$input->{Created} = \"NOW()";

I tested it and showed the 14 number timestamp. I believe I did everything right. But when build it won't delete.
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
In that case Paul is right, the date format is different from the one you need.
After
Links::init_date();
you need to set the date format using GT::Date::date_format (but check the GT::Date docs for correct name & syntax).

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Paul] Auto delete link within certain days In reply to
The time that get generated is identical to the timestmp time.
Quote Reply
Re: [mrcry11] Auto delete link within certain days In reply to
I can't see why it's not working, if the previous sub worked, since they both seem to be performing the same function on different tables. But you could try putting the date format into the date_get to see whether it makes any difference - I have had to do this when working on the Clicktrack table.

my $delete_by = GT::Date::date_get ( time() - 172800, '%yyyy%%mm%%dd%%HH%%MM%%ss%' );