@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 46 lines 1.4 kB view raw
1<?php 2 3final class PhabricatorImagemagickSetupCheck extends PhabricatorSetupCheck { 4 5 public function getDefaultGroup() { 6 return self::GROUP_OTHER; 7 } 8 9 /** 10 * Get the name of the ImageMagick binary. Since ImageMagick version 7, the 11 * "magick" command is replacing the old "convert" command. 12 * 13 * @return string|null 14 */ 15 public function getImageMagickBinaryName() { 16 if (Filesystem::binaryExists('magick')) { 17 return 'magick'; 18 } else if (Filesystem::binaryExists('convert')) { 19 return 'convert'; 20 } else { 21 return null; 22 } 23 } 24 25 protected function executeChecks() { 26 $imagemagick = PhabricatorEnv::getEnvConfig('files.enable-imagemagick'); 27 if ($imagemagick && $this->getImageMagickBinaryName() === null) { 28 $message = pht( 29 "You have enabled Imagemagick in your config, but the '%s' or '%s' ". 30 "binary is not in the webserver's %s. Disable imagemagick ". 31 "or make it available to the webserver.", 32 'magick', 33 'convert', 34 '$PATH'); 35 36 $this->newIssue('files.enable-imagemagick') 37 ->setName(pht( 38 "'%s' or '%s' binary not found or Imagemagick is not installed.", 39 'magick', 40 'convert')) 41 ->setMessage($message) 42 ->addRelatedPhabricatorConfig('files.enable-imagemagick') 43 ->addPhabricatorConfig('environment.append-paths'); 44 } 45 } 46}