public function Local::ensure in Flysystem 8
Same name and namespace in other branches
- 7 src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::ensure()
- 3.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::ensure()
- 2.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::ensure()
- 3.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::ensure()
Checks the sanity of the filesystem.
If this is a local filesystem, .htaccess file should be in place.
Return value
array A list of error messages.
Overrides FlysystemPluginInterface::ensure
File
- src/
Flysystem/ Local.php, line 106
Class
- Local
- Drupal plugin for the "Local" Flysystem adapter.
Namespace
Drupal\flysystem\FlysystemCode
public function ensure($force = FALSE) {
if (!$this->rootExists) {
return [
[
'severity' => RfcLogLevel::ERROR,
'message' => 'The %root directory either does not exist or is not readable and attempts to create it have failed.',
'context' => [
'%root' => $this->root,
],
],
];
}
if (!$this
->writeHtaccess($force)) {
return [
[
'severity' => RfcLogLevel::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' => [
'%directory' => $this->root,
'@url' => 'https://www.drupal.org/SA-CORE-2013-003',
],
],
];
}
return [
[
'severity' => RfcLogLevel::INFO,
'message' => 'The directory %root exists and is readable.',
'context' => [
'%root' => $this->root,
],
],
];
}