Is there a ready solution for building a tree of file dependencies?

0 like 0 dislike
I would like to receive(json,ini, associative array,xml, whatever) the tree of include files(something like that).

The problem can be solved in three ways:
  • 1. overload of standard designs
  • 2. some magic parameters in the debugger(xdebug cake, but the complete information about dependencies between files does not)
  • 3. grep-th and the creation of alternatives(like ov_include and fishing source via debug_backtrace)
  • 4. by force of will and eyes to go through all the files

The first option requires the intervention of the interpreter and the work on the updated patch as new versions of php.
The second is unknown to me. In any case, Xdebug config:

xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "D:\\server\\profiling\\"
xdebug.trace_output_name = %t.%s.%H
xdebug.collect_params 1
xdebug.collect_return 1
xdebug.collect_vars 1
xdebug.default_enable 1
xdebug.show_mem_delta 1
php_flag xdebug.auto_trace 1
xdebug.trace_format 1

Third cool and probably the easiest, but from the performance point of view, stern(created a static list array inside the function that checks whether we are not trying to get stuck or to include an existing file, process backtrace, record the results) when a lot of files.
Fourth, for larger projects will not work.

Now a Junior recruit, and documentation for the engine is ready for a third. Want the plotter to print a scheme of work every page so that the guys don't have to guess where and what.
by | 32 views

4 Answers

0 like 0 dislike
0 like 0 dislike
> Xdebug would be a great option, but no utility is working with its output file does not contain a functional surveillance include
So I propose to implement it yourself, the more the format is simple and looks like all the logic will be reduced to tracking "fn=require_once::..." (cfn)
fl=ips_kernel/classDbMysql.php fn=require_once::ips_kernel/classDbMysql.php 1 91512 cfn=php::define calls=1 0 0 25 4 cfn=php::class_exists calls=1 0 0 30 5 cfn=php::dirname calls=1 0 0 32 1 cfn=require_once::ips_kernel/classDb.php calls=1 0 0 32 36 cfn=php::extension_loaded calls=1 0 0 1066 1 cfn=php::defined calls=1 0 0 1066 5 cfn=php::dirname calls=1 0 0 1068 1 cfn=require::ips_kernel/classDbMysqliClient.php calls=1 0 0 1068 79 

ips_kernel/classDbMysql.php -> ips_kernel/classDb.php -> ips_kernel/classDbMysqliClient.php 

BUT, the tree will be valid only for the current script (i.e. may depend on Rin. parameters), this can be solved with a script that will skarmlivanii xdebug-file and the output will be a tree for him.
0 like 0 dislike
5) Use the output file of xdebug — it has all the information and parse it, in my opinion, easier (
0 like 0 dislike
And pry into the code of the interpreter that's doing the include, not possible? Perhaps there is already a solution described
110,608 questions
257,187 answers
40,796 users