1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Differentiate between "no pygmetnize" and "nonworking pygmentize" during setup

Summary: Fixes T6210. The current messaging may be confusing if `pygmentize` is available but broken.

Test Plan: Faked the binary names and hit the errors, which seemed helpful.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6210

Differential Revision: https://secure.phabricator.com/D10626
This commit is contained in:
epriestley 2014-10-02 09:48:04 -07:00
parent 7018909447
commit 3c6781b177

View file

@ -7,8 +7,7 @@ final class PhabricatorSetupCheckPygment extends PhabricatorSetupCheck {
$pygment = PhabricatorEnv::getEnvConfig('pygments.enabled');
if ($pygment) {
list($err) = exec_manual('pygmentize -h');
if ($err) {
if (!Filesystem::binaryExists('pygmentize')) {
$summary = pht(
'You enabled pygments but the pygmentize script is not '.
'actually available, your $PATH is probably broken.');
@ -25,6 +24,28 @@ final class PhabricatorSetupCheckPygment extends PhabricatorSetupCheck {
->setMessage($message)
->addRelatedPhabricatorConfig('pygments.enabled')
->addPhabricatorConfig('environment.append-paths');
} else {
list($err) = exec_manual('pygmentize -h');
if ($err) {
$summary = pht(
'You have enabled pygments and the pygmentize script is '.
'available, but does not seem to work.');
$message = pht(
'Phabricator has %s available in $PATH, but the binary '.
'exited with an error code when run as %s. Check that it is '.
'installed correctly.',
phutil_tag('tt', array(), 'pygmentize'),
phutil_tag('tt', array(), 'pygmentize -h'));
$this
->newIssue('pygments.failed')
->setName(pht('pygmentize Not Working'))
->setSummary($summary)
->setMessage($message)
->addRelatedPhabricatorConfig('pygments.enabled')
->addPhabricatorConfig('environment.append-paths');
}
}
}
}