Skip to content

Commit

Permalink
Fixed regression with selfupgrade command, preventing to get a status…
Browse files Browse the repository at this point in the history
… about the current version when symbolically linked.

Using proper Installer methods to check for symbolical link folder.
  • Loading branch information
w00fz committed Aug 18, 2016
1 parent c1ac1ad commit d660bae
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions system/src/Grav/Console/Gpm/SelfupgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ protected function serve()
$remote = $this->upgrader->getRemoteVersion();
$release = strftime('%c', strtotime($this->upgrader->getReleaseDate()));

if ($this->isGravSymlinked()) {
$this->output->writeln("<red>ATTENTION:</red> Grav is symlinked, cannot upgrade, aborting...");
exit;
}

if (!$this->upgrader->meetsRequirements()) {
$this->output->writeln("<red>ATTENTION:</red>");
$this->output->writeln(" Grav has increased the minimum PHP requirement.");
Expand All @@ -120,6 +115,14 @@ protected function serve()
exit;
}

Installer::isValidDestination(GRAV_ROOT . '/system');
if (Installer::IS_LINK === Installer::lastErrorCode()) {
$this->output->writeln("<red>ATTENTION:</red> Grav is symlinked, cannot upgrade, aborting...");
$this->output->writeln('');
$this->output->writeln("You are currently running a symbolically linked Grav v" . $local . ". Latest available is v". $remote . ".");
exit;
}

// not used but preloaded just in case!
new ArrayInput([]);

Expand Down Expand Up @@ -256,9 +259,4 @@ public function formatBytes($size, $precision = 2)

return round(pow(1024, $base - floor($base)), $precision) . $suffixes[(int)floor($base)];
}

private function isGravSymlinked()
{
return (is_link(GRAV_ROOT . '/system'));
}
}

0 comments on commit d660bae

Please sign in to comment.