PHP Class Services\Synchronize

ファイルを表示 Open project: doptor/doptor Class Usage Examples

Protected Properties

Property Type Description
$includes array What is backed up(can be database, modules, public directory)
$listener

Public Methods

Method Description
Unzip ( [type] $file, [type] $path ) Decompress a folder
Zip ( [type] $source, [type] $destination, $include_dir = true ) Compresses a folder
__construct ( $listener )
authorizeRemote ( Input $input ) : Guzzle\Service\Client Authorize the user on the remote server
backupDB ( string $current_time ) Create backup of the current database
backupModules ( string $current_time ) Backup all the modules installed
backupPublic ( string $current_time ) Backup the public folder
backupTables ( string $host, string $user, string $password, string $database, string $file_name, string $tables = '*' ) Generate a sql file of the current database
copyToRestore ( Input $input ) : string Copy the backup file received from the post data to the restore folder
dropTables ( ) Drop all the tables in the database
restore ( string $restore_file ) Restore the database and modules from the restore file
restoreDB ( string $restore_dir ) Restore the database from the restore folder
restoreModules ( string $restore_dir ) Restore all the modules
restorePublic ( string $restore_dir ) Restore public folder
saveBackupToDB ( $description = '' ) : Object Save the information of the created backup to database
startBackup ( $backup_db = true, $backup_modules = true, $backup_public = true )
startLocalToRemoteSync ( $input )
startRemoteToLocalSync ( $input )
syncFromRemote ( $current_time, $restore_file, $input )
syncToRemote ( string $current_time, [type] $backup_file, $input ) Send the backup file to remote server for synchronization

Protected Methods

Method Description
dbConnections ( )

Method Details

Unzip() public method

Decompress a folder
public Unzip ( [type] $file, [type] $path )
$file [type]
$path [type]

Zip() public method

Compresses a folder
public Zip ( [type] $source, [type] $destination, $include_dir = true )
$source [type]
$destination [type]

__construct() public method

public __construct ( $listener )

authorizeRemote() public method

Authorize the user on the remote server
public authorizeRemote ( Input $input ) : Guzzle\Service\Client
$input Input
return Guzzle\Service\Client

backupDB() public method

Create backup of the current database
public backupDB ( string $current_time )
$current_time string "Current time in string"

backupModules() public method

Backup all the modules installed
public backupModules ( string $current_time )
$current_time string "Current time in string"

backupPublic() public method

Backup the public folder
public backupPublic ( string $current_time )
$current_time string "Current time in string"

backupTables() public method

Generate a sql file of the current database
public backupTables ( string $host, string $user, string $password, string $database, string $file_name, string $tables = '*' )
$host string
$user string
$password string
$database string
$file_name string
$tables string

copyToRestore() public method

Copy the backup file received from the post data to the restore folder
public copyToRestore ( Input $input ) : string
$input Input "The post input data"
return string "Filename"

dbConnections() protected method

protected dbConnections ( )

dropTables() public method

Drop all the tables in the database
public dropTables ( )

restore() public method

Restore the database and modules from the restore file
public restore ( string $restore_file )
$restore_file string "The location of teh restore zip file"

restoreDB() public method

Restore the database from the restore folder
public restoreDB ( string $restore_dir )
$restore_dir string

restoreModules() public method

Restore all the modules
public restoreModules ( string $restore_dir )
$restore_dir string

restorePublic() public method

Restore public folder
public restorePublic ( string $restore_dir )
$restore_dir string

saveBackupToDB() public method

Save the information of the created backup to database
public saveBackupToDB ( $description = '' ) : Object
return Object

startBackup() public method

public startBackup ( $backup_db = true, $backup_modules = true, $backup_public = true )

startLocalToRemoteSync() public method

public startLocalToRemoteSync ( $input )

startRemoteToLocalSync() public method

public startRemoteToLocalSync ( $input )

syncFromRemote() public method

public syncFromRemote ( $current_time, $restore_file, $input )

syncToRemote() public method

Send the backup file to remote server for synchronization
public syncToRemote ( string $current_time, [type] $backup_file, $input )
$current_time string "Current time in string"
$backup_file [type]

Property Details

$includes protected_oe property

What is backed up(can be database, modules, public directory)
protected array $includes
return array

$listener protected_oe property

protected $listener