I inherited a large, complex PHP application at my work. The application source folder contains many hundreds of files, many of which have obviously been created as backups for actual files used by the application. However, I have sometimes seen in code where in include statement will reference a file named something I thought looked like a backup. Thus I am looking for a way to identify all the files used by this application without having to try to understand every file from the entry point of the application down.
I found and tried the PHP get_included_files() method but unfortunately it did not work well because it only seems to return an array of files that are in the current call stack where this application has much code where conditional logic is used to determine if a PHP file is included or not.
Ideally, I am looking for a software utility that will build a list of files starting at an PHP file (entry point) and include every file referenced by every include(), include_once(), require(), require_once() statement. Of course, there are areas in this application where lines are commented out such as
//include 'somefolder/somefile.php'
and preferably the tool would ignore such lines in code.
If I could get a list of every folder/file referenced in this application, I would then move all the files NOT found in the list to some other folder like may_not_be_used so I would still have if something breaks but otherwise, I would know which files I need to work with. I am needing to focus on the files that ARE used to convert them to a newer version of PHP and thus don't want to waste time converting files that are never used.
Thanks in advance for any help you can offer!