1 #!/usr/bin/php -q
2 <?php
3 /*
4 /*
5 * This code is part of GOsa (https://gosa.gonicus.de)
6 * Copyright (C) 2003 Cajus Pollmeier
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 /* This file builds a list of used php_functions in all files matching $pattern
24 * (walks recursively through current directory but skips dirs matching $skip_dirs).
25 *
26 * 1. builds an array of filenames
27 * 2. get contents from files
28 * 2. fetches user defined functions using content
29 * 3. fetches functions calls using content
30 * 4. checks function calls for matching known functions
31 */
33 include('include/functions_test.inc');
35 // Build Array of called functions
36 $array= test_defined_functions('./');
38 // Write List to file
39 $file= 'include/functions_list.inc';
41 // If file does not exist, create it
42 if(!file_exists($file)) {
43 touch($file);
44 }
46 // Write Array to file
47 if(is_writable($file)) {
48 // Open filehandle
49 $fh= fopen($file,'w');
50 if($fh != null) {
51 fwrite($fh,"<?php\n".var_export($array,true)."\n?>");
52 }
53 }
54 ?>