protected function fileExistsOrDirectoryisWritableTrait::fileExistsOrDirectoryIsWritable in Acquia Content Hub 8
Checks whether directory/file is writable.
2 calls to fileExistsOrDirectoryisWritableTrait::fileExistsOrDirectoryIsWritable()
- AcquiaContenthubAuditCommands::contenthubAuditSubscriber in acquia_contenthub_audit/
src/ Commands/ AcquiaContenthubAuditCommands.php - Checks imported entities and compares them to Content Hub.
- AcquiaContenthubAuditCommands::contenthubAuditSubscriberExecuteManifest in acquia_contenthub_audit/
src/ Commands/ AcquiaContenthubAuditCommands.php - Executes a Manifest file.
File
- acquia_contenthub_audit/
src/ fileExistsOrDirectoryisWritableTrait.php, line 15
Class
- fileExistsOrDirectoryisWritableTrait
- Trait for consistency in file checking.
Namespace
Drupal\acquia_contenthub_auditCode
protected function fileExistsOrDirectoryIsWritable(string $file_path) {
if (!file_exists($file_path) && !is_writable(dirname($file_path))) {
throw new \Exception(sprintf("The %s directory is not writable.", dirname($file_path)));
}
if (file_exists($file_path) && !is_writable($file_path)) {
throw new \Exception(sprintf("The %s file is not writable.", $file_path));
}
return TRUE;
}