}
- function importFromArray($db, $file)
+ function jsonImportFromArray($opts)
{
- $data= json_decode(file_get_contents($file),true);
- DB_DataObject::factory('$db')->importFromArray($this);
+ 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);
+
+ }
+
+
+
}
$this->opts = $opt;
require_once 'Pman/Core/UpdateDatabase.php';
- foreach($this->opts as $o=>$v) {
- if (!preg_match('/^json-/', $o) || empty($v)) {
- continue;
- }
- $type = str_replace('_', '-', substr($o,6));
- $this->importFromArray($type, $v);
- }