示例#1
0
 public function restore($file)
 {
     $folder = $this->getFilePath($this);
     if (file_exists($file)) {
         Zipper::unzip($file, $folder);
         $db = new dbMaster();
         //$backup=[];
         if (file_exists($folder . "db.json")) {
             $backup = \yii\helpers\Json::decode(file_get_contents($folder . "db.json"));
             $db->newRestore($backup, Yii::$app->db->tablePrefix);
         }
     } else {
         throw new \Exception('The backup file does not exist.');
     }
 }