示例#1
0
 function upload_recover()
 {
     $upfile_path = Tiny::getPath("uploads");
     $upfile = new UploadFile('sqlfile', $upfile_path, '100m', '.sql');
     $upfile->save();
     $info = $upfile->getInfo();
     $msg = array("error", "恢复失败!");
     if ($info[0]['status'] == 1) {
         $file_path = $upfile_path . $info[0]['path'];
         $backup = new Backup();
         $sqls = $backup->parseSql($file_path);
         if ($backup->install($sqls)) {
             Log::op($this->manager['id'], '恢复数据库', '管理员【' . $this->manager['name'] . '】,通过上传文件的方式,恢复了数据库。');
             $msg = array("success", "恢复成功!");
             unlink($file_path);
         }
     }
     $this->msg = $msg;
     $this->redirect("back_list", false);
 }