roopurt18 Posted November 7, 2006 Share Posted November 7, 2006 My current project is something I've inherited from other developers. One of my ongoing goals is to clean up a lot of the old code and I've made pretty good progress on that front. However, there are a large number of .php files just floating around that I'm not even sure are being used and others that I know are being used but would like to phase out. To that end I'm looking for a solution to determine which files are still in use by the site.I've thought about adding a small routine that I can call at the top of each file which would insert a record into a DB table with path information about the file, the name of the file, and the date it was accessed on. If the record already exists for that file I'd just update the timestamp for the record; in other words, just one record per file. I figure after a couple months of recorded data here I can go back and look at which files are good candidates to remove from the webhost.Would this be the best way to go about doing this? Or is there an easier method or reporting tool that I can use? I have shell access to the web server, which is running FreeBSD 4.11.Thanks in advance! Quote Link to comment Share on other sites More sharing options...
trq Posted November 7, 2006 Share Posted November 7, 2006 [quote]I have shell access to the web server, which is running FreeBSD 4.11.[/quote]Check the logs. Quote Link to comment Share on other sites More sharing options...
bqallover Posted November 7, 2006 Share Posted November 7, 2006 [quote author=thorpe link=topic=114193.msg464563#msg464563 date=1162939794][quote]I have shell access to the web server, which is running FreeBSD 4.11.[/quote]Check the logs.[/quote]Do you mean the web server logs? If so, then 'include'd files don't appear, at least not in my logs with 1&1. Or are you referring to some kind of filesystem-level access logs? I imagine you could hack up a shell/PHP/whatever script to report on and analyse the 'last accessed' property of files in the project directory, maybe as a cron job?I think the 'DB-access-log' idea is a great one, in the absence of a (to me at least) unknown shell tool that would do this. I can't think of anything, which isn't to say it doesn't exist. I'd be very interested to hear how you get on with this. :) Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted November 8, 2006 Author Share Posted November 8, 2006 Thorpe, as bqallover mentioned most webserver logs don't include included files; so unless you are speaking of something else I'm not sure that'd help.Also, I'm not sure how much outside my own personal directory on the server I can browse and look at as I've never really tried. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.