(originally published in the Possibilities ezine)
As many of our readers know, Bontrager switched hosting companies recently, moving to Site5.
It was a good move. We like it here. Something we noticed, however, are many files we're uncertain whether or not are still needed.
We do a lot of development, a lot of testing, and sometimes we neglect to remove the test files. This has been going on for 8 years.
The possibly orphan files were brought to our attention when we moved our sites to the new hosting company. Are the files adrift with no purpose or do we need them?
To answer that question, we put some JavaScript into each of the orphan files. The JavaScript launches a CGI script that logs it's use.
If an orphan doesn't show up on the log after a reasonable amount of time, it can be removed from the server. With many thousands of files on our server, removing these reduces clutter.
I'll show you how to do it.
Note: This can be done only with files of text, ie web pages and files that might be included in web pages. Image files can't be tagged this way.
Here is the Perl script. Install it on your server with any file name that makes sense to you. The example JavaScript assumes "logger.cgi", but you may use any legal name.
The above Perl script prints the date and time according to the server and then prints any information sent to it by the JavaScript. The log file is tab-delimited so most popular desktop spreadsheet programs can import it.
You'll notice the Perl script allows you to specify the log file name. Also, the place where the date formating occurs is marked in case you want to change it.
The JavaScript (see below) needs to be pasted into each orphan file you want to monitor.
It has a place where you specify the URL of the above Perl script. And it also has a place where you can identify the individual orphan file the JavaScript is pasted into.
The JavaScript sends your identity information about the orphan file to the logging script, along with the URL of the web page where the file was used at.
This provides more than just a heads up for you. If the file was included in a web page, you also know the URL of the web page it was included in.
The identification of files that do not show up in the logs after a reasonable period of time can be considered orphans.
Will Bontrager
Copyright 2006 Bontrager Connection, LLC
Please, tell me what you think about this article. I promise the page will not reload...it’s quick and easy
(find out HOW this is done HERE)
|
|
Intuitive website design, enhancements, functionality for websites, site management and web site promotion, RSS, ROR, SEO
|
~ Blog-Etiquette ~