2017 © Pedro Peláez
 

project tp5-databackup

THINKPHP5

image

kocor/tp5-databackup

THINKPHP5

  • Wednesday, February 28, 2018
  • by kocor
  • Repository
  • 0 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

tp5_databackup

THINKPHP5 数据库备份还原, (*1)

初始化

$this->config = [ 'path' => RUNTIME_PATH.'/Backup/',//数据库备份路径 'part' => 20971520,//20M 数据库备份卷大小 'compress' => 1,//数据库备份文件是否启用压缩 0不压缩 1 压缩 'level' => 9 //数据库备份文件压缩级别 1普通 4 一般 9最高 ];, (*2)

数据库表列表

$backup = new BackupModel($this->config); $tableList = $backup->dataList();, (*3)

备份

$backup = new BackupModel($this->config); foreach ($tableList as $key => $value) { $start= $backup->backup($value, 0); if($start !== 0){ bleak; } }, (*4)

还原

$backup = new BackupModel($this->config); $file = ['name' => date('Ymd-His',$time), 'part' => ($part)]; $backup->setFile($file)->import($compress);, (*5)

删除

$time = Request::instance()->param('time/s'); $backup = new BackupModel($this->config); $tableList = $backup->delFile($time);, (*6)

下载

$backup = new BackupModel($this->config); $tableList = $backup->downloadFile($time,$part);, (*7)

The Versions

28/02 2018

dev-master

9999999-dev

THINKPHP5

  Sources   Download

MIT

by Avatar kocor