Ejemplo n.º 1
0
/**
 * Run HM Backup
 *
 * @return null
 */
function hmbkp_do_backup()
{
    // Make sure it's possible to do a backup
    if (!hmbkp_possible()) {
        return;
    }
    // Clean up any mess left by a previous backup
    hmbkp_cleanup();
    HM_Backup::get_instance()->backup();
    hmbkp_set_status(__('Removing old backups', 'hmbkp'));
    // Delete any old backup files
    hmbkp_delete_old_backups();
    if (file_exists(hmbkp_path() . '/.backup_running')) {
        unlink(hmbkp_path() . '/.backup_running');
    }
    if (file_exists(HM_Backup::get_instance()->archive_filepath())) {
        $file = hmbkp_path() . '/.backup_complete';
        if (!($handle = @fopen($file, 'w'))) {
            return;
        }
        fwrite($handle, HM_Backup::get_instance()->archive_filename());
        fclose($handle);
    }
    hmbkp_email_backup();
}
Ejemplo n.º 2
0
/**
 * Set the backup status to archiving
 *
 * @return null
 */
function hmbkp_set_status_archiving()
{
    hmbkp_set_status(__('Creating zip archive', 'hmbkp'));
}