Fix scripts to allow pathname with space (#13027)

This commit is contained in:
Sean
2021-07-15 11:00:21 +08:00
committed by GitHub
parent fd9328af55
commit 1a97559816
4 changed files with 8 additions and 8 deletions

View File

@@ -113,7 +113,7 @@ class FilePermissionsException extends \Exception implements UpgradeableExceptio
} }
// always print chwon/setfacl/chmod commands // always print chwon/setfacl/chmod commands
$commands[] = "sudo chown -R $user:$group $install_dir"; $commands[] = "sudo chown -R $user:$group '$install_dir'";
$commands[] = 'sudo setfacl -d -m g::rwx ' . implode(' ', $dirs); $commands[] = 'sudo setfacl -d -m g::rwx ' . implode(' ', $dirs);
$commands[] = 'sudo chmod -R ug=rwX ' . implode(' ', $dirs); $commands[] = 'sudo chmod -R ug=rwX ' . implode(' ', $dirs);

View File

@@ -52,7 +52,7 @@ class Dependencies extends BaseValidation
return; return;
} }
$composer_output = trim(shell_exec($validator->getBaseDir() . '/scripts/composer_wrapper.php --version')); $composer_output = trim(shell_exec("'" . $validator->getBaseDir() . "/scripts/composer_wrapper.php' --version"));
$found = preg_match( $found = preg_match(
'/Composer.*(\d+\.\d+\.\d+(-RC\d*|-beta\d?|-alpha\d+)?)/', '/Composer.*(\d+\.\d+\.\d+(-RC\d*|-beta\d?|-alpha\d+)?)/',
$composer_output, $composer_output,
@@ -67,7 +67,7 @@ class Dependencies extends BaseValidation
$validator->ok('Composer Version: ' . $matches[1]); $validator->ok('Composer Version: ' . $matches[1]);
} }
$dep_check = shell_exec($validator->getBaseDir() . '/scripts/composer_wrapper.php install --no-dev --dry-run'); $dep_check = shell_exec("'" . $validator->getBaseDir() . "/scripts/composer_wrapper.php' install --no-dev --dry-run");
preg_match_all('/Installing ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_missing); preg_match_all('/Installing ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_missing);
if (! empty($dep_missing[0])) { if (! empty($dep_missing[0])) {
$result = ValidationResult::fail('Missing dependencies!', $validator->getBaseDir() . '/scripts/composer_wrapper.php install --no-dev'); $result = ValidationResult::fail('Missing dependencies!', $validator->getBaseDir() . '/scripts/composer_wrapper.php install --no-dev');

View File

@@ -278,7 +278,7 @@ main () {
if [[ -z "$arg" ]]; then if [[ -z "$arg" ]]; then
up=$(php daily.php -f update >&2; echo $?) up=$(php daily.php -f update >&2; echo $?)
if [[ "$up" == "0" ]]; then if [[ "$up" == "0" ]]; then
${DAILY_SCRIPT} no-code-update "${DAILY_SCRIPT}" no-code-update
set_notifiable_result update 1 # make sure there are no update notifications if update is disabled set_notifiable_result update 1 # make sure there are no update notifications if update is disabled
exit exit
fi fi
@@ -333,14 +333,14 @@ main () {
fi fi
# Call ourself again in case above pull changed or added something to daily.sh # Call ourself again in case above pull changed or added something to daily.sh
${DAILY_SCRIPT} post-pull "${old_ver}" "${new_ver}" "${DAILY_SCRIPT}" post-pull "${old_ver}" "${new_ver}"
else else
case $arg in case $arg in
no-code-update) no-code-update)
# Updates of the code are disabled, just check for schema updates # Updates of the code are disabled, just check for schema updates
# and clean up the db. # and clean up the db.
status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php' status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'
status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup" status_run 'Cleaning up DB' "'$DAILY_SCRIPT' cleanup"
;; ;;
post-pull) post-pull)
# re-check dependencies after pull with the new code # re-check dependencies after pull with the new code

View File

@@ -53,7 +53,7 @@ if (php_sapi_name() == 'cli' && isset($_SERVER['TERM'])) {
} }
if (is_file($install_dir . '/composer.phar')) { if (is_file($install_dir . '/composer.phar')) {
$exec = PHP_BINDIR . '/php ' . $install_dir . '/composer.phar'; $exec = PHP_BINDIR . "/php '" . $install_dir . "/composer.phar'";
// If older than 1 week, try update // If older than 1 week, try update
if (time() - filemtime($install_dir . '/composer.phar') > 60 * 60 * 24 * 7) { if (time() - filemtime($install_dir . '/composer.phar') > 60 * 60 * 24 * 7) {
@@ -80,7 +80,7 @@ if (is_file($install_dir . '/composer.phar')) {
} elseif (@hash_file('SHA384', $dest) === $good_sha) { } elseif (@hash_file('SHA384', $dest) === $good_sha) {
// Installer verified // Installer verified
shell_exec(PHP_BINDIR . "/php $dest"); shell_exec(PHP_BINDIR . "/php $dest");
$exec = PHP_BINDIR . "/php $install_dir/composer.phar"; $exec = PHP_BINDIR . "/php '$install_dir/composer.phar'";
} else { } else {
echo "Error: Corrupted download, signature doesn't match for $installer_url\n"; echo "Error: Corrupted download, signature doesn't match for $installer_url\n";
} }