Services\Synchronize::startBackup PHP Method

startBackup() public method

public startBackup ( $backup_db = true, $backup_modules = true, $backup_public = true )
    public function startBackup($backup_db = true, $backup_modules = true, $backup_public = true)
    {
        $backup_dir = backup_path() . "/backup/";
        if ($backup_db) {
            $this->includes[] = 'Database';
            $this->backupDB($this->listener->current_time);
        }
        if ($backup_modules) {
            $this->includes[] = 'Modules';
            $this->backupModules($this->listener->current_time);
        }
        if ($backup_public) {
            $this->includes[] = 'Public';
            $this->backupPublic($this->listener->current_time);
        }
        $this->Zip($backup_dir, $this->listener->backup_file);
        File::deleteDirectory($backup_dir);
    }

Usage Example

Exemplo n.º 1
0
 public function postBackup()
 {
     $this->current_time = date("Y-m-d-H-i-s");
     $this->backup_dir = backup_path() . "/backup/";
     $this->backup_file = backup_path() . "/backup_{$this->current_time}.zip";
     $this->restore_file = restore_path() . "/backup_{$this->current_time}.zip";
     $synchronizer = new Synchronize($this);
     $synchronizer->startBackup();
     return Response::download($this->backup_file, "backup_{$this->current_time}.zip");
 }