views:

212

answers:

4

I've inherited a PHP application that has "versions" of pages (viewacct.php, viewacct2.php, viewacct_rcw.php, etc). I want to discover which of these pages are called from other pages in the application and which are not. Is there a tool available that will help with that?

+5  A: 

Using whatever tools you would like (Find/Grep/Sed on Linux, I use Visual Studio on windows), it is just a matter of crawling your source tree for references of the filenames in each file.

FlySwat
except that if some parts of the app are composing the filenames by concatenating strings, or from a database, etc, you're SOL. But this suggestion is probably as good as you're going to get. +1
rmeador
not in the source, in the disk-local mirror of the generated pages (fetched with wget or curl)
hop
+1  A: 

Similar to FlySwat's answer: any good text editor or IDE with multi-file search should be able to help you find the orphan pages. On Mac OS X I would suggest TextWrangler(free), TextMate($), or BBEdit($$). I've had good success with each of these tools, but your mileage may vary.

tallgreentree
A: 

If you wish to find out what pages are called by other pages, you need to look at where stuff is being called. Obviously in php code, you can only reference other files via includes or requires and the singular versions of those functions.

So if I were you I would grep your code for include and then require and attempt to make some kind of map showing what is calling what. Eventually you should end up with a pretty clear map of how the php files talk to each other. Then you will need to work out how the various points of the application talk to each other from there via HTML/AJAX etc.

Good luck. I have done it before, it takes a while, but you'll get there, just make sure you document what you find out.

navitronic
A: 

You may want to try out nWire for PHP.

nWire for PHP is an innovative Eclipse plugin (works with Eclipse PDT & Zend Studio 7) which accelerates PHP development by helping developers navigate through their code and better understand the architecture of their application. nWire offers unique tools for real time code visualization, navigation and search.

nWire analyzes all the components and associations in your project. While opening a file you can immediately see where (and if) it is being used.

zvikico