fix: working directory in update function

fixes a path problem mentioned in issue #3528
pull/4147/head
iwitz 2019-02-12 15:30:51 +01:00 committed by GitHub
parent e880b6a458
commit 917e8d245c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -4315,17 +4315,18 @@ class Server extends AppModel
public function update($status)
{
$final = '';
$workingDirectoryPrefix = 'cd $(git rev-parse --show-toplevel) && ';
$cleanup_commands = array(
// (>^-^)> [hacky]
'git checkout app/composer.json 2>&1'
$workingDirectoryPrefix . 'git checkout app/composer.json 2>&1'
);
foreach ($cleanup_commands as $cleanup_command) {
$final .= $cleanup_command . "\n\n";
exec($cleanup_command, $output);
$final .= implode("\n", $output) . "\n\n";
}
$command1 = 'git pull origin ' . $status['branch'] . ' 2>&1';
$command2 = 'git submodule update --init --recursive 2>&1';
$command1 = $workingDirectoryPrefix . 'git pull origin ' . $status['branch'] . ' 2>&1';
$command2 = $workingDirectoryPrefix . 'git submodule update --init --recursive 2>&1';
$final .= $command1 . "\n\n";
exec($command1, $output);
$final .= implode("\n", $output) . "\n\n=================================\n\n";