Commit 7f70b9fb authored by Peter Ojo's avatar Peter Ojo

Set permissions for directories that need to be writable by server

parent 01c4c413
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
"ext-zip": "*", "ext-zip": "*",
"guzzlehttp/guzzle": "~4.0|~5.0|~6.0", "guzzlehttp/guzzle": "~4.0|~5.0|~6.0",
"symfony/console": "~2.3|~3.0", "symfony/console": "~2.3|~3.0",
"symfony/process": "~2.3|~3.0" "symfony/process": "~2.3|~3.0",
"symfony/filesystem": "^3.3"
}, },
"bin": [ "bin": [
"laravel" "laravel"
......
...@@ -6,11 +6,14 @@ use ZipArchive; ...@@ -6,11 +6,14 @@ use ZipArchive;
use RuntimeException; use RuntimeException;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
class NewCommand extends Command class NewCommand extends Command
{ {
...@@ -54,6 +57,7 @@ class NewCommand extends Command ...@@ -54,6 +57,7 @@ class NewCommand extends Command
$this->download($zipFile = $this->makeFilename(), $version) $this->download($zipFile = $this->makeFilename(), $version)
->extract($zipFile, $directory) ->extract($zipFile, $directory)
->prepareWritableDirectories($directory, $output)
->cleanUp($zipFile); ->cleanUp($zipFile);
$composer = $this->findComposer(); $composer = $this->findComposer();
...@@ -173,6 +177,26 @@ class NewCommand extends Command ...@@ -173,6 +177,26 @@ class NewCommand extends Command
return $this; return $this;
} }
/**
* Make sure the storage and bootstrap cache directories are writable
* @param string $appDirectory
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return $this
*/
protected function prepareWritableDirectories($appDirectory, OutputInterface $output)
{
$fs = new Filesystem();
try {
$fs->chmod($appDirectory . DIRECTORY_SEPARATOR . "bootstrap/cache", 0777, 0000, true);
$fs->chmod($appDirectory . DIRECTORY_SEPARATOR . "storage", 0777, 0000, true);
} catch (IOExceptionInterface $e) {
$output->writeln('<question>Verify that the storage and bootstrap/cache directories are writable.</question>');
}
return $this;
}
/** /**
* Get the version that should be downloaded. * Get the version that should be downloaded.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment