DataObjects/Core_notify.php
[Pman.Core] / UpdateDatabase.php
index 0c13a24..b2bbfda 100644 (file)
@@ -45,7 +45,7 @@ class Pman_Core_UpdateDatabase extends Pman
             'default' => '',
             'min' => 1,
             'max' => 1,
-        ),
+        )
         
     );
     
@@ -80,22 +80,7 @@ class Pman_Core_UpdateDatabase extends Pman
             
             $persons = json_decode(file_get_contents($opt['source']),true);
             
-            DB_DataObject::factory('person')->importFromArray(HTML_Flexyframework::get()->page, $persons, $opt['prefix']);
-            die("DONE! \n");
-        }
-        
-        if($args == 'Account'){
-            if(empty($opt['source'])){
-                die("Missing Source directory for account json files! Try -f [JSON file path] \n");
-            }
-            
-            if (!file_exists($opt['source'])) {
-                die("can not found account json file : {$opt['source']} \n");
-            }
-
-            $accounts = json_decode(file_get_contents($opt['source']),true);
-            
-            DB_DataObject::factory('accnt')->importFromArray($accounts);
+            DB_DataObject::factory('person')->importFromArray($this, $persons, $opt['prefix']);
             die("DONE! \n");
         }
         
@@ -103,8 +88,8 @@ class Pman_Core_UpdateDatabase extends Pman
             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");
             }
-            print_r($opt['name']);exit;
-            DB_DataObject::factory('companies')->initCompanies(HTML_Flexyframework::get()->page, $opt['name'], $opt['comptype']);
+            
+            DB_DataObject::factory('companies')->initCompanies($this, $opt['name'], $opt['comptype']);
             
             die("DONE! \n");
         }
@@ -359,8 +344,12 @@ class Pman_Core_UpdateDatabase extends Pman
     
     function runUpdateModulesData()
     {
-        $this->updateData();
-        $modules = $this->modulesList();
+        // runs core...
+        $this->updateData(); 
+        $modules = array_reverse($this->modulesList());
+        
+        // move 'project' one to the end...
+        
         foreach ($modules as $module){
             $file = $this->rootDir. "/Pman/$module/UpdateDatabase.php";
             if($module == 'Core' || !file_exists($file)){