You are here

protected function DrupalSiteArchiveSource::getFilesToBackup in Backup and Migrate 5.0.x

Get a list if files to be backed up from the given directory.

Do not include files that match the 'exclude_filepaths' setting.

@internal param $directory

Parameters

string $dir: The name of the directory to list.

Return value

array

Throws

\Drupal\backup_migrate\Core\Exception\BackupMigrateException

\Drupal\backup_migrate\Core\Exception\IgnorableException

Overrides FileDirectorySource::getFilesToBackup

File

src/Drupal/Source/DrupalSiteArchiveSource.php, line 46

Class

DrupalSiteArchiveSource
@package Drupal\backup_migrate\Drupal\Source

Namespace

Drupal\backup_migrate\Drupal\Source

Code

protected function getFilesToBackup($dir) {
  $files = [];

  // Add the database dump.
  // @todo realpath contains the wrong filename and the PEAR archiver cannot rename files.
  $db = $this
    ->getDbSource()
    ->exportToFile();
  $files['database.sql'] = $db
    ->realpath();

  // Add the manifest file.
  $manifest = $this
    ->getManifestFile();
  $files['MANIFEST.ini'] = $manifest
    ->realpath();

  // Get all the files in the site.
  foreach (parent::getFilesToBackup($dir) as $new => $real) {

    // Prepend 'docroot' onto the local path.
    $files['docroot/' . $new] = $real;
  }
  return $files;
}