Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
move composer scripts to Extensions module
Browse files Browse the repository at this point in the history
  • Loading branch information
craigh committed Mar 6, 2020
1 parent 0dbc4ac commit d53cc0f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Util/ZikulaRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function getErrorMessage(Requirement $requirement, $lineSize = 70): st

private function addZikulaPathRequirements(SymfonyRequirements $symfonyRequirements, array $parameters = []): void
{
$fileSystem = new Filesystem();
$projectDir = $parameters['kernel.project_dir'];
$symfonyRequirements->addRequirement(
is_writable($projectDir . '/config'),
Expand All @@ -70,8 +71,12 @@ private function addZikulaPathRequirements(SymfonyRequirements $symfonyRequireme
'config/dynamic/ directory must be writable',
'Change the permissions of "<strong>config/dynamic/</strong>" directory so that the web server can write into it.'
);
$dataDir = $projectDir . '/' . $parameters['datadir'];
if (!is_dir($dataDir)) {
$fileSystem->mkdir($dataDir);
}
$symfonyRequirements->addRequirement(
is_writable($projectDir . '/' . $parameters['datadir']),
is_writable($dataDir),
$parameters['datadir'] . '/ directory must be writable',
'Change the permissions of "<strong>' . $parameters['datadir'] . '</strong>" directory so that the web server can write into it.'
);
Expand All @@ -86,7 +91,6 @@ private function addZikulaPathRequirements(SymfonyRequirements $symfonyRequireme
$customEnvVarsPath = $projectDir . '/.env.local';
if (!file_exists($customEnvVarsPath)) {
// try to create the file
$fileSystem = new Filesystem();
try {
$fileSystem->touch($customEnvVarsPath);
} catch (IOExceptionInterface $exception) {
Expand All @@ -101,7 +105,6 @@ private function addZikulaPathRequirements(SymfonyRequirements $symfonyRequireme
$content = file_get_contents($customEnvVarsPath);
if (false === mb_strpos($content, 'DATABASE_URL')) {
// no database credentials are set yet
$fileSystem = new Filesystem();
try {
$fileSystem->dumpFile($customEnvVarsPath, 'Test');
$fileSystem->dumpFile($customEnvVarsPath, '');
Expand Down

0 comments on commit d53cc0f

Please sign in to comment.