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         set_error_handler(function ($errno, $errstr, $errfile, $errline ){
29 //            throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
30             echo "{$errno}\n";
31         });
32         
33         $this->scan();
34     }
35     
36     function scan($route = array()) 
37     {
38         $dir = $this->rootDir . "/" . implode("/", $route);
39         
40         echo "Looking for {$dir}\n";
41         
42         foreach (scandir($dir) as $d) {
43             
44             if (!strlen($d) || $d[0] == '.') {
45                 continue;
46             }
47             
48             if (is_dir($d)) {
49                 $this->scan(array_merge($route, array($d)));
50                 continue;
51             }
52             
53             if (!preg_match('/\.php$/', $d)) {
54                 continue;
55             }
56             
57 //            require_once implode('/', $route) . "/" . $d;
58             
59             try {
60                 require_once implode('/', $route) . "/" . $d;
61             } catch (ErrorException $ex) {
62                 echo "Unable to load configuration file.";
63             }
64             
65         }
66         
67     }
68
69 //    function scan($p, $pr, $path = false) 
70 //    {
71 //        $full_path = array($p, $pr);
72 //        $class_path = array();
73 //        if ($path !== false) {
74 //            $full_path = array_merge($full_path, $path);
75 //            $class_path = array_merge($class_path, $path);
76 //        }
77 //        //print_r("CHKDIR:    ". implode('/', $full_path)."\n");
78 //
79 //        foreach (scandir(implode('/', $full_path)) as $d) {
80 //
81 //            if (!strlen($d) || $d[0] == '.') {
82 //                continue;
83 //            }
84 //            $chk = $full_path;
85 //            $chk[] = $d;
86 //
87 //            $clp = $class_path;
88 //
89 //
90 //
91 //            //print_r("CHK:          " . implode('/', $chk)."\n");
92 //            // is it a file.. and .PHP...
93 //            if (!is_dir(implode('/', $chk))) {
94 //                if (!preg_match('/\.php$/', $d)) {
95 //                    continue;
96 //                }
97 //                $clp[] = preg_replace('/\.php$/', '', $d);
98 //
99 //                //print_r("CLP:          " . implode('/', $clp)."\n");
100 //                require_once "Pman/" . implode('/', $clp) . '.php';
101 //                continue;
102 //            }
103 //            $clp[] = $d;
104 //            // otherwise recurse...
105 //            //print_r("RECURSE:        " . implode('/', $clp)."\n");
106 //
107 //            $this->scan($p, $pr, $clp);
108 //        }
109 //    }
110
111     function output() 
112     {
113         die("DONE");
114     }
115
116 }