/** * 备份数据库 * For MySQL */ public function backupHandle() { function_exists('set_time_limit') && set_time_limit(0); //防止备份数据过程超时 @ini_set("memory_limit", '-1'); if (!IS_POST) { $this->error("访问出错啦"); } $type = "手动自动备份"; $path = DB_Backup_PATH . "/CUSTOM_" . date("Ymd") . "_" . md5(rand(0, 255) . md5(rand(128, 200)) . rand(100, 768)); $tables = I('POST.table', array()); $System = new SystemEvent(); $res = $System->backupDB($type, $tables, $path); $this->array2Response($res); }
/** * 备份数据库 * For MySQL */ public function backupHandle() { if (!IS_POST) { $this->error("访问出错啦"); } $type = "手动自动备份"; $path = DB_Backup_PATH . "/CUSTOM_" . date("Ymd") . "_" . md5(rand(0, 255) . md5(rand(128, 200)) . rand(100, 768)); $tables = empty($_POST['table']) ? array() : $_POST['table']; $System = new \Common\Event\SystemEvent(); //$System->backupFile(); //test ok~ $res = $System->backupDB($type, $tables, $path); if ($res['status'] == 1) { $this->success($res['info'], $res['url']); } }