PHP Class HM\BackUpWordPress\Backup_Engine

Base Backup Engine types should extend this class and call parent::__construct in there constructor. Defines base functionality shared across all types of backups
Show file Open project: humanmade/backupwordpress Class Usage Examples

Public Methods

Method Description
__construct ( )
error ( string $context, string $error ) Add an error to the errors array.
error_handler ( integer $type ) : boolean Hooked into set_error_handler to catch any PHP errors that happen during the backup process.
get_backup_filename ( ) : string Get the filename of the backup.
get_backup_filepath ( ) : string Get the full filepath to the backup file.
get_errors ( string | null $context = null ) : array Get the array of errors encountered during the backup process.
get_warnings ( string | null $context = null ) : array Get the array of warnings encountered during the backup process.
set_backup_filename ( string $filename ) Set the filename of the backup.
verify_backup ( ) : boolean Backup Engine Types should always implement the verify_backup method.
warning ( string $context, string $warning ) Add an warning to the errors warnings.

Method Details

__construct() public method

public __construct ( )

error() public method

An error is always treat as fatal and should only be used for unrecoverable issues with the backup process.
public error ( string $context, string $error )
$context string The context for the error.
$error string The error that was encountered.

error_handler() public method

PHP errors are always treat as warnings rather than errors.
public error_handler ( integer $type ) : boolean
$type integer The level of error raised.
return boolean Return false to pass the error back to PHP so it can be handled natively.

get_backup_filename() public method

Get the filename of the backup.
public get_backup_filename ( ) : string
return string The backup filename.

get_backup_filepath() public method

Get the full filepath to the backup file.
public get_backup_filepath ( ) : string
return string The backup filepath.

get_errors() public method

Get the array of errors encountered during the backup process.
public get_errors ( string | null $context = null ) : array
$context string | null The context for the error, usually the Backup Engine that encountered the error.
return array The array of errors.

get_warnings() public method

Get the array of warnings encountered during the backup process.
public get_warnings ( string | null $context = null ) : array
$context string | null The context for the warning, usually the Backup Engine that encountered the warning.
return array The array of warnings.

set_backup_filename() public method

Set the filename of the backup.
public set_backup_filename ( string $filename )
$filename string The backup filename.

verify_backup() abstract public method

Backup Engine Types should always implement the verify_backup method.
abstract public verify_backup ( ) : boolean
return boolean Whether the backup completed successfully or not.

warning() public method

A warning is always treat as non-fatal and should only be used for recoverable issues with the backup process.
public warning ( string $context, string $warning )
$context string The context for the warning.
$warning string The warning that was encountered.