You are here

public function Local::__construct in Flysystem 7

Same name and namespace in other branches
  1. 8 src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::__construct()
  2. 3.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::__construct()
  3. 2.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::__construct()
  4. 3.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::__construct()

Constructs a Local object.

Parameters

string $public_filepath: The path to the public files directory.

string $root: The of the adapter's filesystem.

bool $is_public: (optional) Whether this is a public file system. Defaults to false.

int $directory_permission: (optional) The permissions to create directories with.

File

src/Flysystem/Local.php, line 66
Contains \Drupal\flysystem\Flysystem\Local.

Class

Local
Drupal plugin for the "Local" Flysystem adapter.

Namespace

Drupal\flysystem\Flysystem

Code

public function __construct($public_filepath, $root, $is_public = FALSE, $directory_permission = 0775) {
  $this->originalRoot = $root;
  $this->directoryPerm = $directory_permission;

  // ensureDirectory() sets the created flag.
  if (!($this->root = $this
    ->ensureDirectory($root))) {
    return;
  }
  if ($is_public) {
    $this->publicPath = $this
      ->pathIsPublic($public_filepath, $this->root);
  }

  // If the directory was recently created, write the .htaccess file.
  if ($this->created && $this->publicPath === FALSE) {
    $this
      ->writeHtaccess($this->root);
  }
}