// called to ensure options are correct.
// before any data is imported / started..
- function checkOpts()
+ function checkOpts($opts)
{
- $core_opts = HTML_FlexyFramework::get()->page->opts;
- if (!empty($core_opts['init']) && empty($core_opts['base'])) {
+ $opts = HTML_FlexyFramework::get()->page->opts;
+ if (!empty($opts['init']) && empty($opts['base'])) {
die("--base=XXX must be set when using --init ");
}
}
-
+ function loadFromFile($db, $file)
+ {
+ if (!file_exists($file)) {
+ die("can not found account json file :$file \n");
+ }
+
+ $accounts = json_decode(file_get_contents($opt['source']),true);
+
+ DB_DataObject::factory('accnt')->importFromArray($this, $accounts);
+
+ die("DONE! \n");
+ }
+ }
function get($k = '',$opt)
{
continue;
}
$type = str_replace('_', '-', substr($o,6));
- $this->loadFromFile,$
+ $this->loadFromFile($type, $v);
}