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