source: trunk/junk/dep-check @ 1184

Revision 852, 1.9 KB checked in by cdleonard@…, 4 years ago (diff)

svn:eol-style native in trunk. Also svn:executable on all scripts

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3
4require_once(dirname($argv[0]) . "/utilities.php");
5
6if (read_bool("Rebuild dep-check.db?", false)) {
7    system(IA_ROOT_DIR . "scripts/dep-rebuild");
8}
9
10// read dependencies db
11$exports = array();
12$dep_buffer = file_get_contents(IA_ROOT_DIR."scripts/dep-check.db");
13foreach (preg_split("/[\n\r]+/", $dep_buffer, -1, PREG_SPLIT_NO_EMPTY) as $line) {
14    if (!($line = trim($line))) {
15        continue;
16    }
17
18    list($ident, $fname) = split("\t", $line);
19
20    if (!isset($exports[$fname])) {
21        $exports[$fname] = array();
22    }
23
24    $exports[$fname][] = $ident;
25}
26
27//log_print_r($exports);
28
29// some modules are bound to be included anywhere so we skip them for checking
30unset($exports['config.php']);
31unset($exports['common/common.php']);
32unset($exports['common/log.php']);
33unset($exports['common/security.php']);
34unset($exports['www/config.php']);
35unset($exports['www/utilities.php']);
36unset($exports['www/url.php']);
37unset($exports['www/index.php']);
38unset($exports['www/identity.php']);
39unset($exports['www/views/utilities.php']);
40unset($exports['eval/utilities.php']);
41unset($exports['eval/config.php']);
42unset($exports['scripts/utilities.php']);
43
44// some hacks
45$exports['common/db/db.php'] = $exports['common/db/db.php']
46                               + $exports['common/db/db_mysql.php'];
47unset($exports['common/db/db_mysql.php']);
48
49// grep for all identifiers
50// this will take forever
51foreach ($exports as $module => $idents) {
52    // log_print_r("Processing $module");
53    foreach ($idents as $ident) {
54        // do grep
55        $fd = popen(IA_ROOT_DIR."scripts/_dcgrep {$ident} {$module} ".IA_ROOT_DIR, "r");
56        log_assert($fd);
57        $buffer = fread($fd, 500*1024);
58        pclose($fd);
59
60        // print
61        if ($buffer) {
62            log_print("(possible) error calling {$ident} ({$module}) from these files:\n"
63                      .$buffer);
64        }
65    }
66}
67
68?>
Note: See TracBrowser for help on using the repository browser.