public function StaticGenerator::prepareStaticDirectory in Tome 8
Prepares the static directory for a fresh export.
Return value
bool TRUE on success, FALSE on failure.
Overrides StaticGeneratorInterface::prepareStaticDirectory
File
- modules/
tome_static/ src/ StaticGenerator.php, line 247
Class
- StaticGenerator
- Handles static site generation.
Namespace
Drupal\tome_staticCode
public function prepareStaticDirectory() {
$directory = $this
->getStaticDirectory();
if ($this->cache
->isCacheEmpty()) {
if (file_exists($directory)) {
try {
$this->fileSystem
->deleteRecursive($directory);
} catch (FileException $e) {
return FALSE;
}
}
}
try {
$this->fileSystem
->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
} catch (FileException $e) {
return FALSE;
}
return TRUE;
}