]>
Commit | Line | Data |
---|---|---|
e7daca0a ER |
1 | #!/usr/bin/php |
2 | <?php | |
3 | /** | |
4 | * Get the Compatibility info for an entire folder (recursive) | |
5 | * | |
6 | */ | |
7 | ||
8 | require_once 'PHP/CompatInfo.php'; | |
9 | ||
10 | $info = new PHP_CompatInfo('null'); | |
11 | ||
12 | $folder = $argv[1]; | |
13 | $options = array( | |
14 | 'file_ext' => array('php'), | |
15 | ); | |
16 | ||
17 | $res = $info->parseData($folder); | |
18 | if (version_compare($res['version'], '5.0.0', 'ge')) { | |
19 | $epoch = 4; | |
20 | // produce dependencies only for php5 | |
21 | $compat = false; | |
22 | // session has always been compiled in | |
23 | // date, spl are internal for php | |
24 | $staticmods = array('session', 'date', 'spl'); | |
25 | } else { | |
26 | $epoch = 3; | |
27 | // produce dependencies where php4/php5 both are ok | |
28 | $compat = true; | |
29 | // session has always been compiled in | |
30 | $staticmods = array('session'); | |
31 | } | |
32 | echo "Requires:\tphp-common >= ", $epoch, ":", $res['version'], "\n"; | |
33 | ||
34 | # process extensions | |
35 | foreach ($res['extensions'] as $ext) { | |
36 | if (in_array($ext, $staticmods)) { | |
37 | continue; | |
38 | } | |
39 | ||
40 | if ($compat) { | |
41 | echo "Requires:\tphp(", $ext, ")\n"; | |
42 | } else { | |
43 | echo "Requires:\tphp-", $ext, "\n"; | |
44 | } | |
45 | } |