1

My first question is this. I thought the inclued tool would be useful to generate a file which contains information about how php-files are connected through include- and require-statements and it would especially be able to collect the necessary information just by parsing the code ... thing is I can't/don't want to execute the code to get the include-information. Though all example I found seem to require running the project.

Here http://php.net/manual/en/inclued.examples-implementation.php you'll find following example:

<?php
// File to store the inclued information
$fp = fopen('/tmp/wp.ser', 'w');
if ($fp) {
    $clue = inclued_get_data();
    if ($clue) {
        fwrite($fp, serialize($clue));
    }
    fclose($fp);
}
?>

But what is that supposed to do? As far as I understand 'inclued_get_data()' it's just going to get information about which files are included in that file - none - then serializes the containing data-structure and writes it to '/tmp/wp.ser'. What am I missing here?

Then again if you enable the inclued-extension like this in php.ini:

extension=inclued.so
inclued.enabled=1
inclued.dumpdir=/tmp

the inclued-extension is invoked on a request of a site and it logs all inclusions that have been executed - right?

Anyway, it seems like none of those two options help me finding out about all inclusions of a whole project. Right? And if that is correct, then do you know a way to that without having to write a parser?

deceze
  • 510,633
  • 85
  • 743
  • 889
Raffael
  • 19,547
  • 15
  • 82
  • 160
  • Changed your manual link to be to the international site and not Germany. – Treffynnon Apr 07 '11 at 13:35
  • 1
    @Treffy *Actually* changed the manual link to be to the international site and not Germany. ;) – deceze Apr 07 '11 at 13:40
  • @deceze I maybe tired, but I don't get it. Did I forget to press submit after editing it or something? – Treffynnon Apr 07 '11 at 13:44
  • could we please get back to busines ... – Raffael Apr 07 '11 at 13:51
  • @Treffy `` *And now you'll be agonizing over what exactly I did for the rest of your life... Muwahahaha!!* `` Or maybe you already figured it out from the edit history after a good night's sleep. – deceze Apr 08 '11 at 01:41

1 Answers1

1

My understanding of inclued (after using it several times) is that you will need to have it execute on live code, as opposed to just parsing.

This is required for two reasons:

  • that's how it works (it's attaching to those functions in the Zend core to monitor them)
  • that's how it's able to resolve conditional includes (the information it provides is true for the run on which it was executed). Without this it wouldn't be able to understand files loaded by an autoloader, or any sort of conditional processing (such as loading a controller in the average framework).
preinheimer
  • 3,712
  • 20
  • 34