You are here

public function FileNamer::afterBackup in Backup and Migrate 8.4

Run on a backup. Name the backup file according to the configuration.

Parameters

\BackupMigrate\Core\File\BackupFileReadableInterface $file:

Return value

\BackupMigrate\Core\File\BackupFileReadableInterface

File

lib/backup_migrate_core/src/Filter/FileNamer.php, line 99

Class

FileNamer
Class FileNamer.

Namespace

BackupMigrate\Core\Filter

Code

public function afterBackup(BackupFileReadableInterface $file) {
  if (\Drupal::moduleHandler()
    ->moduleExists('token')) {
    $token = \Drupal::token();
    $name = $token
      ->replace($this
      ->confGet('filename'));
  }
  else {
    $name = $this
      ->confGet('filename');
  }
  if ($this
    ->confGet('timestamp')) {
    $name .= '-' . date($this
      ->confGet('timestamp_format'));
  }
  $file
    ->setName($name);
  return $file;
}