Process/Php7.php
[Pman.Core] / Process / Php7.php
index 40bc09e..45f225d 100644 (file)
@@ -22,27 +22,40 @@ class Pman_Core_Process_Php7 extends Pman
             die("CLI only");
         }
     }
-
+    
     function get($base, $opts = array()) 
     {
-        $dir = array($this->rootDir);
-        $cls = array();
-        
-//        $this->scan($this->rootDir, 'Pman');
-        $this->scan($dir, $cls);
+        $this->scan();
     }
     
-    function scan($dir, $cls
+    function scan($route = array()
     {
+        $dir = $this->rootDir . "/" . implode("/", $route);
         
+        echo "Looking for {$dir}\n";
         
-        foreach (scandir(implode('/', $dir)) as $d) {
+        foreach (scandir($dir) as $d) {
             
             if (!strlen($d) || $d[0] == '.') {
                 continue;
             }
             
+            if (is_dir($d)) {
+                $this->scan(array_merge($route, array($d)));
+                continue;
+            }
+            
+            if (!preg_match('/\.php$/', $d)) {
+                continue;
+            }
             
+//            require_once implode('/', $route) . "/" . $d;
+            
+            try {
+                require_once implode('/', $route) . "/" . $d;
+            } catch (ErrorException $ex) {
+                echo "Unable to load configuration file.";
+            }
             
         }