Beispiel #1
0
 public function drop()
 {
     if (\System\File::check($p = BASE_DIR . $this->get_path())) {
         unlink($p);
     }
     return parent::drop();
 }
Beispiel #2
0
 public function cmd_dump(array $params = array())
 {
     \System\Init::full();
     $file = array_shift($params);
     if ($this->json) {
         \System\Loader::load_all();
         $models = \System\Model\Database::get_all_children();
         $data = array();
         \Helper\Cli::do_over($models, function ($key, $model, &$data) {
             $objects = $model::get_all()->fetch();
             if (any($objects)) {
                 $data[$model] = \System\Template::to_json($objects, false);
             }
         }, null, $data, !is_null($file));
         if ($file) {
             \System\Json::put($file, $data);
         } else {
             echo json_encode($data);
         }
     } else {
         $cmd = self::assemble_mysql_command("mysqldump", true);
         if ($file) {
             shell_exec("mkdir -m775 -p " . dirname($file));
             $cmd .= " > " . $file;
         }
         passthru($cmd);
     }
 }