UpdateDatabase/VerifyVariable.php
authorEdward <edward@roojs.com>
Wed, 3 Oct 2018 03:36:14 +0000 (11:36 +0800)
committerEdward <edward@roojs.com>
Wed, 3 Oct 2018 03:36:14 +0000 (11:36 +0800)
UpdateDatabase/VerifyVariable.php [new file with mode: 0644]

diff --git a/UpdateDatabase/VerifyVariable.php b/UpdateDatabase/VerifyVariable.php
new file mode 100644 (file)
index 0000000..2aa49fe
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Core_UpdateDatabase_VerifyVariable extends Pman
+{
+    static $cli_opts = array(
+
+    );
+    
+    function getAuth()
+    {
+        if ($_SERVER['HTTP_HOST'] == 'localhost') {
+            return true;
+        }
+        
+        $this->getAuthUser();
+        
+        if(empty($this->authUser)) {
+            return false;
+        }
+        
+        return true;
+    }
+    
+    function get($base, $opts = array())
+    {
+        $requirements = array();
+        
+        $ff = HTML_FlexyFramework::get();
+        
+        foreach($this->modulesList() as $m) {
+            
+            $fd = $ff->rootDir. "/Pman/$m/UpdateDatabase.php";
+            
+            if (!file_exists($fd)) {
+                continue;
+            }
+            
+            require_once $fd;
+            $cls = new ReflectionClass('Pman_'. $m . '_UpdateDatabase');
+            $props = $cls->getDefaultProperties();
+            
+            if(!empty($props['required_extensions'])) {
+                $extensions = array_merge($extensions, $props['required_extensions']);
+            }
+        }
+        
+        $error = '';
+        
+        foreach ($extensions as $e){
+            
+            if(extension_loaded($e)) {
+                continue;
+            }
+            
+            $error .= "$e\n";
+        }
+        
+        if(!empty($error)) {
+            $this->jerr($error);
+        }
+        
+        $this->jok("DONE");
+        
+    }
+}
\ No newline at end of file