2013-02-08 18:14:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorSetupCheckImagemagick extends PhabricatorSetupCheck {
|
|
|
|
|
|
|
|
protected function executeChecks() {
|
|
|
|
$imagemagick = PhabricatorEnv::getEnvConfig('files.enable-imagemagick');
|
|
|
|
if ($imagemagick) {
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
if (!Filesystem::binaryExists('convert')) {
|
2013-02-08 18:14:28 +01:00
|
|
|
$message = pht(
|
Add setup checks for the availability of 'which' and 'diff' binaries
Summary:
Spent an hour or two helping a user figure this out. Make sure I never do that again.
If the webserver is configured with an empty or bogus PATH, binaries like 'which' and 'diff' (and 'git', and 'svn', etc.) may not be available. In most cases, this is fine, because we get an error like "sh: whatever-command not found", which is obvious to diagnose.
In the case of 'diff', we don't get this, because 'diff' is expected to exit with a nonzero code for differing files -- so we interpret the "sh: whatever-command not found" as "files differ" and then try to parse the empty output.
Explicitly check for 'which' (on Windows, 'where') and 'diff' during setup (I plan to refine the behavior around 'git', 'svn' and 'hg' at some point, but this is less pressing since the errors are trivial to support).
Test Plan: Faked failures on all modes, verified setup warnings look reasonable.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6008
2013-05-23 23:42:07 +02:00
|
|
|
'You have enabled Imagemagick in your config, but the \'convert\' '.
|
|
|
|
'binary is not in the webserver\'s $PATH. Disable imagemagick '.
|
|
|
|
'or make it available to the webserver.');
|
2013-02-08 18:14:28 +01:00
|
|
|
|
|
|
|
$this->newIssue('files.enable-imagemagick')
|
|
|
|
->setName(pht(
|
|
|
|
"'convert' binary not found or Imagemagick is not installed."))
|
|
|
|
->setMessage($message)
|
2013-04-10 22:10:52 +02:00
|
|
|
->addRelatedPhabricatorConfig('files.enable-imagemagick')
|
2013-02-08 18:14:28 +01:00
|
|
|
->addPhabricatorConfig('environment.append-paths');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|