You are here

public function Local::ensure in Flysystem 7

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

File

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

Class

Local
Drupal plugin for the "Local" Flysystem adapter.

Namespace

Drupal\flysystem\Flysystem

Code

public function ensure($force = FALSE) {
  if (!$this->root) {
    return array(
      array(
        'severity' => WATCHDOG_ERROR,
        'message' => 'The %root directory either does not exist or is not readable and attempts to create it have failed.',
        'context' => array(
          '%root' => $this->originalRoot,
        ),
      ),
    );
  }
  if ($this->publicPath !== FALSE || $this
    ->writeHtaccess($this->root, $force)) {
    return array();
  }
  return array(
    array(
      'severity' => WATCHDOG_ERROR,
      'message' => 'See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.',
      'context' => array(
        '%directory' => $this->root,
        '@url' => 'https://www.drupal.org/SA-CORE-2013-003',
      ),
    ),
  );
}