| 1 backup.database.inc | public BackupDatabase::restore(BackupFile $file) | 
Restore a backup from a file.
Parameters
BackupFile $file: A BackupFile instance, used to read from the file handle.
Return value
boolean: TRUE if the restore was successful, FALSE on failure.
Overrides Backup::restore
File
- core/includes/ backup/ backup.database.inc, line 275 
- Functions to handle the direct to/from database backup source.
Class
- BackupDatabase
- A destination type for saving to a database server.
Code
public function restore(BackupFile $file) {
  $lines_executed = 0;
  // Open the file using the file wrapper.
  if ($file->extension() !== $this->getFileTypeId()) {
    $this->log('Unable to restore from file %file because a %type file can\'t be restored to this database.', 
    array(
      '%file' => $file->filepath(),
      '%type' => $file->extension(),
    ), 
    Backup::LOG_ERROR
    );
  }
  else {
    // Restore the database.
    $lines_executed = $this->restoreDatabaseFromFile($file);
    if ($this->settings['verbose']) {
      $this->log('@count SQL commands executed.', array('@count' => $lines_executed), self::LOG_INFO);
    }
  }
  // Pull any logged messages out of the file and up to this class.
  $file_log = $file->getLog();
  foreach ($file_log as $log) {
    call_user_func_array($this->log, $log);
  }
  $file->clearLog();
  return $lines_executed;
}
