Add public folder for plugins

This commit is contained in:
Romain Neutron
2013-07-02 17:35:31 +02:00
parent d3a40c8b38
commit fed9422103
12 changed files with 78 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ class PluginValidator
{
$this->ensureComposer($directory);
$this->ensureManifest($directory);
$this->ensureDir($directory . DIRECTORY_SEPARATOR . 'public');
$manifest = $directory . DIRECTORY_SEPARATOR . 'manifest.json';
$data = @json_decode(@file_get_contents($manifest));
@@ -58,6 +59,13 @@ class PluginValidator
$this->ensureFile($composer);
}
private function ensureDir($dir)
{
if (!file_exists($dir) || !is_dir($dir) || !is_readable($dir)) {
throw new PluginValidationException(sprintf('Missing mandatory directory %s', $dir));
}
}
private function ensureFile($file)
{
if (!file_exists($file) || !is_file($file) || !is_readable($file)) {