1 backup.database.inc public BackupDatabase::postRestore(BackupFile &$file)

Change a file after restoration.

This step is usually used to delete up the decompressed backup file.

Parameters

BackupFile $file: The file containing the backup that was restored. This is explicitly passed by reference to allow it to be reassigned to a new file if needed.

Return value

void:

Overrides Backup::postRestore

File

core/includes/backup/backup.database.inc, line 309
Functions to handle the direct to/from database backup source.

Class

BackupDatabase
A destination type for saving to a database server.

Code

public function postRestore(BackupFile &$file) {
  parent::postRestore($file);

  // If a compressed copy of this backup exists, delete the uncompressed copy.
  if ($file->lastExtension() === 'sql') {
    $uncompressed_path = $file->filePath();
    $file->pushExtension('gz');
    if (file_exists($file->filepath())) {
      file_unmanaged_delete($uncompressed_path);
    }
    else {
      $file->popExtension();
    }
  }
}