Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorBinariesSetupCheck.php
Show All 9 Lines | protected function executeChecks() { | ||||
if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
$bin_name = 'where'; | $bin_name = 'where'; | ||||
} else { | } else { | ||||
$bin_name = 'which'; | $bin_name = 'which'; | ||||
} | } | ||||
if (!Filesystem::binaryExists($bin_name)) { | if (!Filesystem::binaryExists($bin_name)) { | ||||
$message = pht( | $message = pht( | ||||
"Without '%s', Phabricator can not test for the availability ". | "Without '%s', %s can not test for the availability ". | ||||
"of other binaries.", | "of other binaries.", | ||||
$bin_name); | $bin_name, | ||||
PhabricatorPlatformSite::getName()); | |||||
$this->raiseWarning($bin_name, $message); | $this->raiseWarning($bin_name, $message); | ||||
// We need to return here if we can't find the 'which' / 'where' binary | // We need to return here if we can't find the 'which' / 'where' binary | ||||
// because the other tests won't be valid. | // because the other tests won't be valid. | ||||
return; | return; | ||||
} | } | ||||
if (!Filesystem::binaryExists('diff')) { | if (!Filesystem::binaryExists('diff')) { | ||||
$message = pht( | $message = pht( | ||||
"Without '%s', Phabricator will not be able to generate or render ". | "Without '%s', %s will not be able to generate or render ". | ||||
"diffs in multiple applications.", | "diffs in multiple applications.", | ||||
'diff'); | 'diff', | ||||
PhabricatorPlatformSite::getName()); | |||||
$this->raiseWarning('diff', $message); | $this->raiseWarning('diff', $message); | ||||
} else { | } else { | ||||
$tmp_a = new TempFile(); | $tmp_a = new TempFile(); | ||||
$tmp_b = new TempFile(); | $tmp_b = new TempFile(); | ||||
$tmp_c = new TempFile(); | $tmp_c = new TempFile(); | ||||
Filesystem::writeFile($tmp_a, 'A'); | Filesystem::writeFile($tmp_a, 'A'); | ||||
Filesystem::writeFile($tmp_b, 'A'); | Filesystem::writeFile($tmp_b, 'A'); | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { | ||||
} | } | ||||
private function raiseWarning($bin, $message) { | private function raiseWarning($bin, $message) { | ||||
if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
$preamble = pht( | $preamble = pht( | ||||
"The '%s' binary could not be found. Set the webserver's %s ". | "The '%s' binary could not be found. Set the webserver's %s ". | ||||
"environmental variable to include the directory where it resides, or ". | "environmental variable to include the directory where it resides, or ". | ||||
"add that directory to '%s' in the Phabricator configuration.", | "add that directory to '%s' in the %s configuration.", | ||||
$bin, | $bin, | ||||
'PATH', | 'PATH', | ||||
'environment.append-paths'); | 'environment.append-paths', | ||||
PhabricatorPlatformSite::getName()); | |||||
} else { | } else { | ||||
$preamble = pht( | $preamble = pht( | ||||
"The '%s' binary could not be found. Symlink it into '%s', or set the ". | "The '%s' binary could not be found. Symlink it into '%s', or set the ". | ||||
"webserver's %s environmental variable to include the directory where ". | "webserver's %s environmental variable to include the directory where ". | ||||
"it resides, or add that directory to '%s' in the Phabricator ". | "it resides, or add that directory to '%s' in the %s ". | ||||
"configuration.", | "configuration.", | ||||
$bin, | $bin, | ||||
'phabricator/support/bin/', | 'phabricator/support/bin/', | ||||
'PATH', | 'PATH', | ||||
'environment.append-paths'); | 'environment.append-paths', | ||||
PhabricatorPlatformSite::getName()); | |||||
} | } | ||||
$this->newIssue('bin.'.$bin) | $this->newIssue('bin.'.$bin) | ||||
->setShortName(pht("'%s' Missing", $bin)) | ->setShortName(pht("'%s' Missing", $bin)) | ||||
->setName(pht("Missing '%s' Binary", $bin)) | ->setName(pht("Missing '%s' Binary", $bin)) | ||||
->setSummary( | ->setSummary( | ||||
pht("The '%s' binary could not be located or executed.", $bin)) | pht("The '%s' binary could not be located or executed.", $bin)) | ||||
->setMessage($preamble.' '.$message) | ->setMessage($preamble.' '.$message) | ||||
->addPhabricatorConfig('environment.append-paths'); | ->addPhabricatorConfig('environment.append-paths'); | ||||
} | } | ||||
private function raiseUnknownVersionWarning($binary) { | private function raiseUnknownVersionWarning($binary) { | ||||
$summary = pht( | $summary = pht( | ||||
'Unable to determine the version number of "%s".', | 'Unable to determine the version number of "%s".', | ||||
$binary); | $binary); | ||||
$message = pht( | $message = pht( | ||||
'Unable to determine the version number of "%s". Usually, this means '. | 'Unable to determine the version number of "%s". Usually, this means '. | ||||
'the program changed its version format string recently and Phabricator '. | 'the program changed its version format string recently and %s '. | ||||
'does not know how to parse the new one yet, but might indicate that '. | 'does not know how to parse the new one yet, but might indicate that '. | ||||
'you have a very old (or broken) binary.'. | 'you have a very old (or broken) binary.'. | ||||
"\n\n". | "\n\n". | ||||
'Because we can not determine the version number, checks against '. | 'Because we can not determine the version number, checks against '. | ||||
'minimum and known-bad versions will be skipped, so we might fail '. | 'minimum and known-bad versions will be skipped, so we might fail '. | ||||
'to detect an incompatible binary.'. | 'to detect an incompatible binary.'. | ||||
"\n\n". | "\n\n". | ||||
'You may be able to resolve this issue by updating Phabricator, since '. | 'You may be able to resolve this issue by updating %s, since '. | ||||
'a newer version of Phabricator is likely to be able to parse the '. | 'a newer version of %s is likely to be able to parse the '. | ||||
'newer version string.'. | 'newer version string.'. | ||||
"\n\n". | "\n\n". | ||||
'If updating Phabricator does not fix this, you can report the issue '. | 'If updating %s does not fix this, you can report the issue '. | ||||
'to the upstream so we can adjust the parser.'. | 'to the upstream so we can adjust the parser.'. | ||||
"\n\n". | "\n\n". | ||||
'If you are confident you have a recent version of "%s" installed and '. | 'If you are confident you have a recent version of "%s" installed and '. | ||||
'working correctly, it is usually safe to ignore this warning.', | 'working correctly, it is usually safe to ignore this warning.', | ||||
$binary, | $binary, | ||||
PhabricatorPlatformSite::getName(), | |||||
PhabricatorPlatformSite::getName(), | |||||
PhabricatorPlatformSite::getName(), | |||||
PhabricatorPlatformSite::getName(), | |||||
$binary); | $binary); | ||||
$this->newIssue('bin.'.$binary.'.unknown-version') | $this->newIssue('bin.'.$binary.'.unknown-version') | ||||
->setShortName(pht("Unknown '%s' Version", $binary)) | ->setShortName(pht("Unknown '%s' Version", $binary)) | ||||
->setName(pht("Unknown '%s' Version", $binary)) | ->setName(pht("Unknown '%s' Version", $binary)) | ||||
->setSummary($summary) | ->setSummary($summary) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->addLink( | ->addLink( | ||||
Show All 35 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0