Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Refresh Hits

Quote Reply
Refresh Hits
I have searched through all of the forums. I can't seem to find what I'm looking for. Is there an easy way to just reset the hits to 0 monthly?

Quote Reply
Re: Refresh Hits In reply to
You'd have to write a standalone script that should be executed via Crontab.

You'd have to use the following SQL statement to reset the Hits column:

Code:

UPDATE Links
SET Hits = '0';


Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
You'll have to excuse my ignorace but I'm in not means a programmer. I don't understand the following comment: You'd have to write a standalone script that should be executed via Crontab.

Where would I put this script......and when would it take place....on a build...and then would I remove the script so that it would not reset the links everytime I build.

Quote Reply
Re: Refresh Hits In reply to
No..."standalone" means that it would not be integrated into your BUILD script or ANY other Links SQL script.

By running it through crontab (which you can set to run on the first day of the month), you can automatically update your HITS in the Links table on a monthly basis.

For more info on Crontab, search the web (like through google.com) for Crontab.

Also, there is a well-written tutorial on creating crontab jobs in this site's Resources section! (Search for cron).
Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
Thanks....we've created 2 files......1. is sql statement as you suggested. 2. is the crontab file which looks like: 0 0 1 * * /file location/resethits.cfg .....

My next question is what file location and where would this script reside.

Quote Reply
Re: Refresh Hits In reply to
Uh...you need to actual WRITE perl codes based on the LINKS SQL codes found in other scripts to actually make the SQL statement work! Like I already stated in my first post! I ONLY provided you the SQL statement that you will need to integrate into the STANDALONE script!

SO......

1) Write the script...actually take time to understand the inner logic of LINKS SQL. I ain't gonna do it for ya. Wink

2) Put the script in a non-web folder if you have one OR put it in a PASSWORD protected FOLDER. Then reference the appropriate location/path in the cron configurations. ALSO, you should make the script a C G I script NOT a CFG (configuration) script.

Got it?

Best of luck resolving this issue! Wink

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
At the end of each month, you can just go to the Database page in the Admin, then go to the SQL Monitor, and enter the query:

UPDATE Links
SET Hits = '0'

and press the Execute Query button, and that will reset the Hits to zero.

--Rover





Quote Reply
Re: Refresh Hits In reply to
Too labor intensive if you ask me...better to automate the process...

And I already provided the necessary SQL statment. Tongue

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
THANKS for the easy version.......Tried that also......I ran that exactly as you said and it stated that it effected the files however hits are still listed. We do not host this site in-house would that have any effect?

Quote Reply
Re: Refresh Hits In reply to
Uh...you need to re-build your directory after making changes in the database!

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
I did to a complete rebuild....still did not work.

Quote Reply
Re: Refresh Hits In reply to
It could be that your Links table has a prefix and actually isn't named 'Links'. To check this go to the Setup in Admin and select the SQL Server and check if there is anything listed in the Table Prefix. For example it might have a prefix like: Links_

If there is a table prefix such as Links_ you would need to enter the SQL query in the SQL monitor as:

UPDATE Links_Links
SET Hits = '0'

That should work then I think. I realize that doing this once a month is more labor intensive than setting up a program to do it automatically, but once you get the SQL query language down, it is easy and takes about one minute per month or about 12 minutes a year.

--Rover

Quote Reply
Re: Refresh Hits In reply to
It's not the time spent that is the only issue, but remembering to do this on a monthly basis, which if you offer something like polls or other types of features that are dependent on reseting the HITS in a timely monthly manner, then forgetting to do it even a few days into a month will pose a lot problems for users of that site.

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Refresh Hits In reply to
Good point Eliot, and I was just responding to gmoney's notes that he was looking for an EASY way to just reset the hits to zero each month, and that he was by no means a programmer.

That's also why I provided some explanation of accessing the SQL monitor eventhough you had provided the SQL query language. Some people are just starting out and it can sometimes be helpful to spell things out. When I first started with Links SQL, I sure appreciated that kind of thing. I know these things are painfully obvious to someone as advanced as you are in programming and Links SQL, but some of us aren't at that level yet.

Also, there is no need to rebuild to see if the hits have been affected. You can just go to the database part of the admin, and search for a Link to see if the hits have been reset. A rebuild would only be necessary to make the changes in Hits on the static web pages, if the Hits are included on those pages.

--Rover

Quote Reply
Re: Refresh Hits In reply to
THANK YOU THANK YOU THANK YOU......THATS IT....IT WORKS......REALLY APPRECIATE IT......!!!!!!!

Quote Reply
Re: Refresh Hits In reply to
Uh...the user was looking and verifying the HITS being reset via his directory pages, which is WHY I recommended re-building to see the change...and YOU DO have to RE-BUILD in order to see changes in the directory (NON-ADMIN PAGES)!

GOT IT!

Regards,

Eliot Lee Wink
http://anthrotech.com/