You are here

protected function DrupalSiteArchiveSource::getFilesToBackup in Backup and Migrate 8.4

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

\BackupMigrate\Core\Exception\BackupMigrateException

\BackupMigrate\Core\Exception\IgnorableException

Overrides FileDirectorySource::getFilesToBackup

File

src/Source/DrupalSiteArchiveSource.php, line 51

Class

DrupalSiteArchiveSource
Class DrupalSiteArchiveSource.

Namespace

BackupMigrate\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;
}