Process/Php7.php
[Pman.Core] / Process / Php7.php
1 <?php
2
3 /**
4  *
5  * PHP7 produces all sorts of pointless warnings... this attempts to just include all the files,
6  * so that you can view them..??
7  *
8  * would be nice to write the code to fix them.
9  *
10  */
11 require_once 'Pman.php';
12
13 class Pman_Core_Process_Php7 extends Pman 
14 {
15
16     static $cli_desc = "Tests for PHP compatibilty, by including files...";
17     static $cli_opts = array();
18
19     function getAuth() 
20     {
21         if (empty($this->bootLoader->cli)) {
22             die("CLI only");
23         }
24     }
25     
26     function get($base, $opts = array()) 
27     {
28         $this->scan();
29     }
30     
31     function scan($route = array()) 
32     {
33         $dir = $this->rootDir . "/" . implode("/", $route);
34         
35         echo "Looking for {$dir}\n";
36         
37         foreach (scandir($dir) as $d) {
38             
39             if (!strlen($d) || $d[0] == '.') {
40                 continue;
41             }
42             
43             if (is_dir($d)) {
44                 $this->scan(array_merge($route, array($d)));
45                 continue;
46             }
47             
48             if (!preg_match('/\.php$/', $d)) {
49                 continue;
50             }
51             
52 //            require_once implode('/', $route) . "/" . $d;
53             
54             try {
55                 require_once implode('/', $route) . "/" . $d;
56             } catch (ErrorException $ex) {
57                 echo "Unable to load configuration file.";
58             }
59             
60         }
61         
62     }
63
64 //    function scan($p, $pr, $path = false) 
65 //    {
66 //        $full_path = array($p, $pr);
67 //        $class_path = array();
68 //        if ($path !== false) {
69 //            $full_path = array_merge($full_path, $path);
70 //            $class_path = array_merge($class_path, $path);
71 //        }
72 //        //print_r("CHKDIR:    ". implode('/', $full_path)."\n");
73 //
74 //        foreach (scandir(implode('/', $full_path)) as $d) {
75 //
76 //            if (!strlen($d) || $d[0] == '.') {
77 //                continue;
78 //            }
79 //            $chk = $full_path;
80 //            $chk[] = $d;
81 //
82 //            $clp = $class_path;
83 //
84 //
85 //
86 //            //print_r("CHK:          " . implode('/', $chk)."\n");
87 //            // is it a file.. and .PHP...
88 //            if (!is_dir(implode('/', $chk))) {
89 //                if (!preg_match('/\.php$/', $d)) {
90 //                    continue;
91 //                }
92 //                $clp[] = preg_replace('/\.php$/', '', $d);
93 //
94 //                //print_r("CLP:          " . implode('/', $clp)."\n");
95 //                require_once "Pman/" . implode('/', $clp) . '.php';
96 //                continue;
97 //            }
98 //            $clp[] = $d;
99 //            // otherwise recurse...
100 //            //print_r("RECURSE:        " . implode('/', $clp)."\n");
101 //
102 //            $this->scan($p, $pr, $clp);
103 //        }
104 //    }
105
106     function output() 
107     {
108         die("DONE");
109     }
110
111 }