Wednesday 26 October 2011

Is there a way to automaticly record changes made to a website?

I am currently making a site for my job, its a spanish translation to the one they already have. My boss wants it to always be up-to-date and almost in sync to the original. I dont want to search for the changes on 100 pages and the other web designers incharge of the english site dont want to type it in a %26quot;change log%26quot;. So therefor I need an automatic way to know if anything has changed in any of the sites. Any suggestions?



I have FTP access to the english site, so if there is a script or program that needs to write the change log in the original site, there is no problem with that.
Is there a way to automaticly record changes made to a website?
The easiest thing would be to compare the file modification dates of the English page and its Spanish counterpart.



For example, if you know that the Spanish index.html page you made on May 1, 2007 at 3:40 p.m. was an exact copy of the English index.html page available at that time, then if the English index.html page ever has a modification or creation date after May 1, 2007 at 3:40 p.m., then you know the English page, in all likelihood, is no longer the same as the Spanish page.



You can check file mod dates through any of the popular scripting languages: PHP, ASP.NET, JSP, etc. For example, in PHP, you'd do something like this:



$en =%26quot;en/index.html%26quot;;

$sp = %26quot;sp/index.html%26quot;;

$entime = time();

$sptime = $entime;



if(file_exists($en) {

$entime = filectime($en);

}



if(file_exists($sp) {

$entime = filectime($sp);

}



if($sp %26lt; $en) {

echo %26quot;English file [$en] has been modified since last Spanish file [$sp] update!%26quot;;

}



You could even write a simple dll / executable that could check this for you once a day and send you an e-mail of all changed page URLs.



Finally, it makes a lot of sense, if you are going to have mutli-language content, to change your site to pull text and other language-sensitive information from a DB. Then, you just need to track when there needs to be a change of Spanish from English via the DB; you could track that with a simple trigger.
Is there a way to automaticly record changes made to a website?
if you have FTP access, you should be able to view the date that the page was modified. the easiest way to notice if something has been changed is to check for that on a daily basis.