if (!empty($httpUser)) {
run("{$sudo} chmod +a \"{$httpUser} allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
}
run("{$sudo} chmod +a \"`whoami` allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
} elseif (commandExist('setfacl')) {
if (!empty($httpUser)) {
run("{$sudo} setfacl -R -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
run("{$sudo} setfacl -dR -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
} else {
run("{$sudo} chmod 777 {$dirs}");
}
} else {
run("{$sudo} chmod 777 {$dirs}");
}
} catch (\RuntimeException $e) {
$formatter = \Deployer\Deployer::get()->getHelper('formatter');
$errorMessage = ["Unable to setup correct permissions for writable dirs. ", "You need co configure sudo's sudoers files to don't prompt for password,", "or setup correct permissions manually. "];
write($formatter->formatBlock($errorMessage, 'error', true));
throw $e;
}
}
})->desc('Make writable dirs');
/**
* Installing vendors tasks.
*/
task('deploy:vendors', function () {
if (commandExist('composer')) {
$composer = 'composer';
} else {
run("cd {{release_path}} && curl -sS https://getcomposer.org/installer | php");
$composer = 'php composer.phar';