Running a function by default on each script call
Posted: Tue Sep 27, 2011 7:45 am
We have a SVN repository with a lot of PHP4 code, all of that needs to be brought up to PHP 5.3 standards and moved on to a PHP 5.3 server. This is being tested with CodeSniffer and changed but at the same time it has been asked that the repository, containing over 600 scripts, across several servers, is checked for what is used and what is not. The best idea I have for this is writing a function which is placed in to a DB connection manager class we have (which a good portion of the scripts use) that inserts in to a table each time it runs. Then after 30 days that table is checked and compared against a script list and any scripts which don't appear in the table are dismissed.
To achieve this I don't want to have to edit each file and place the function call within that script. I'm hoping there is something out there that will help me get this done with more ease, running a function by default on each script call, if that's possible?
If you have any other suggestions for tracking which scripts are used then please feel free to let me know your ideas.
Most of the scripts are cronned which would suggest that comparing the crontab against the server list would solve this but we have shell scripts which are executed via crontab and the shell script executes several PHP scripts.
I should add that the servers we use are FreeBSD servers.
It's all a bit of a mess on a legacy codebase that is over 10 years old.
Any suggestions appreciated.
To achieve this I don't want to have to edit each file and place the function call within that script. I'm hoping there is something out there that will help me get this done with more ease, running a function by default on each script call, if that's possible?
If you have any other suggestions for tracking which scripts are used then please feel free to let me know your ideas.
Most of the scripts are cronned which would suggest that comparing the crontab against the server list would solve this but we have shell scripts which are executed via crontab and the shell script executes several PHP scripts.
I should add that the servers we use are FreeBSD servers.
It's all a bit of a mess on a legacy codebase that is over 10 years old.
Any suggestions appreciated.