There's also
http://www.php.net/manual/en/function.get-included-files.php which can
give you some of the information.

You can run this in a ZF application at the end of the bootstrap script
(for testing, not in production):

  Zend_Debug::dump(get_included_files());

This gives you most of the information of what files are needed.
However, it doesn't give you files that are loaded conditionally, for
example lazy-loaded exception classes that didn't get loaded on the
current request because no exception occurred.

Regards,
Bill Karwin

> -----Original Message-----
> From: Jack Sleight [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 16, 2007 10:08 AM
> To: Markus Wolff
> Cc: fw-general
> Subject: Re: [fw-general] Partial bundling and dependencies
> 
> Ah OK, fair enough. Well I don't know if it helps you at all 
> but this is a modified version of a function I wrote to scan 
> through the ZF library classes for something else. It will 
> return an array of all the classes, and the files they have 
> require_once lines for. Not as convenient as what your 
> proposing, and you may even have something better already, 
> but here it is in case it helps:
> 
> <?php
> function scan($path, $trail = null)
> {
>     $files = array();
>     $ignore = array('.', '..');
>     $dh = opendir($path);
>     while (false !== ($file = readdir($dh))) {
>         if (!in_array($file, $ignore)) {
>             if(is_dir($path . '/' . $file)) {
>                 $files = array_merge($files, scan($path . '/' 
> . $file, $trail . '/' . $file));
>             } elseif(preg_match('/\.php$/i', $file)) {
>                 $content = file_get_contents($path . '/' . $file);
>                 preg_match_all('/require_once 
> \'([^\']+)\';/i', $content, $matches);
>                 $files[$trail . '/' . $file] = $matches[1];
>             }
>         }
>     }
>     closedir($dh);
>     return $files;   
> }
> $files = scan('E:\ZendFramework\1.0.0\library');
> var_dump($files);
> --
> Jack
> 

Reply via email to