private function createPath(OutputInterface $output, $which, $path, $mode)
{
$displayMode = decoct($mode);
$pathExists = is_dir($path);
if (!$path) {
$output->writeln('Creation of ' . $which . ' path skipped - no path provided');
return true;
}
if (!$pathExists) {
if (mkdir($path, $mode, true)) {
$output->writeln($which . ' path created "' . $path . '" with mode "' . $displayMode . '"');
return true;
} else {
$output->writeln('<error>' . $which . ' path "' . $path . '" could not be created.</error>');
return false;
}
}
$readable = is_readable($path);
$writable = is_writable($path);
if ($readable && $writable) {
$output->writeln('Creation of ' . $which . ' path "' . $path . '" skipped - path exists with correct permissions');
return true;
} elseif (!$readable && !$writable) {
$output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is neither readable nor writable</error>');
} elseif (!$readable) {
$output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not readable</error>');
} elseif (!$writable) {
$output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not writable</error>');
}
return false;
}