UpdateDatabase.php
authorAlan Knowles <alan@roojs.com>
Mon, 11 Nov 2013 09:07:04 +0000 (17:07 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 11 Nov 2013 09:07:04 +0000 (17:07 +0800)
UpdateDatabase.php

index 636f5b4..399c838 100644 (file)
@@ -57,6 +57,8 @@ class Pman_Core_UpdateDatabase extends Pman
         
     );
     
+    var $cli_options = false;
+    
     var $cli = false;
     function getAuth() {
         
@@ -78,6 +80,9 @@ class Pman_Core_UpdateDatabase extends Pman
      
     function get($args, $opt)
     {
+        
+        $this->cli_options = $opt;
+        
         if($args == 'Person'){
             if(empty($opt['source']) || empty($opt['prefix'])){
                 die("Missing Source directory for person json files or prefix for the passwrod! Try -f [JSON file path] -p [prefix] \n");
@@ -92,6 +97,8 @@ class Pman_Core_UpdateDatabase extends Pman
             die("DONE! \n");
         }
         
+        
+        
         if($args == 'Company'){
             if(empty($opt['name']) || empty($opt['comptype'])){
                 die("Missing company name or type! Try --name=[the name of company] -- comptype=[the type of company] \n");
@@ -226,6 +233,17 @@ class Pman_Core_UpdateDatabase extends Pman
        
         foreach($ar as $m) {
             
+            // if init has been called
+            // look in pgsql.ini
+            if (!empty($this->cli_options['init'])) {
+                $this->importpgsqldir($dburl, $this->rootDir. "/Pman/$m/pgsql.init");
+                $this->importpgsqldir($dburl, $this->rootDir. "/Pman/$m/pgsql.initdata", );
+            
+                
+            }
+            
+            
+            
             $fd = $this->rootDir. "/Pman/$m/DataObjects";
             
             $this->importpgsqldir($dburl, $fd);