UpdateDatabase.php
authorAlan Knowles <alan@roojs.com>
Fri, 15 Nov 2013 06:18:08 +0000 (14:18 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 15 Nov 2013 06:18:08 +0000 (14:18 +0800)
UpdateDatabase.php

index ecb94d9..e66d33c 100644 (file)
@@ -504,7 +504,21 @@ class Pman_Core_UpdateDatabase extends Pman
         }
                 
     }
-    
+    function jsonImportFromArray($opts)
+    {
+        foreach($this->opts as $o=>$v) {
+            if (!preg_match('/^json-/', $o) || empty($v)) {
+                continue;
+            }
+            $type = str_replace('_', '-', substr($o,6));
+            $data= json_decode(file_get_contents($file),true);
+            DB_DataObject::factory($type)->importFromArray($data);
+            
+        }
+        
+        
+        
+    }
     
     function runUpdateModulesData()
     {