You are here

public function TempFileAdapter::__construct in Backup and Migrate 8.4

Construct a manager.

Parameters

string $dir A file path or stream URL for the temp directory:

string $prefix A string prefix to add to each created file.:

1 call to TempFileAdapter::__construct()
DrupalTempFileAdapter::__construct in src/File/DrupalTempFileAdapter.php
Construct a manager.
1 method overrides TempFileAdapter::__construct()
DrupalTempFileAdapter::__construct in src/File/DrupalTempFileAdapter.php
Construct a manager.

File

lib/backup_migrate_core/src/File/TempFileAdapter.php, line 39

Class

TempFileAdapter
Provides a very basic temp file manager which assumes read/write access to a local temp directory.

Namespace

BackupMigrate\Core\File

Code

public function __construct($dir, $prefix = 'bam') {

  // Add a trailing slash if needed.
  if (substr($dir, -1) !== '/') {
    $dir .= '/';
  }
  $this->dir = $dir;
  $this->prefix = $prefix;
  $this->tempfiles = [];

  // @TODO: check that temp direcory is writeable or throw an exception.
}