[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/config/check/ -> PhabricatorSetupCheckPygment.php (source)

   1  <?php
   2  
   3  final class PhabricatorSetupCheckPygment extends PhabricatorSetupCheck {
   4  
   5    protected function executeChecks() {
   6  
   7      $pygment = PhabricatorEnv::getEnvConfig('pygments.enabled');
   8  
   9      if ($pygment) {
  10        if (!Filesystem::binaryExists('pygmentize')) {
  11          $summary = pht(
  12            'You enabled pygments but the pygmentize script is not '.
  13            'actually available, your $PATH is probably broken.');
  14  
  15          $message = pht(
  16            'The environmental variable $PATH does not contain '.
  17            'pygmentize. You have enabled pygments, which requires '.
  18            'pygmentize to be available in your $PATH variable.');
  19  
  20          $this
  21            ->newIssue('pygments.enabled')
  22            ->setName(pht('pygmentize Not Found'))
  23            ->setSummary($summary)
  24            ->setMessage($message)
  25            ->addRelatedPhabricatorConfig('pygments.enabled')
  26            ->addPhabricatorConfig('environment.append-paths');
  27        } else {
  28          list($err) = exec_manual('pygmentize -h');
  29          if ($err) {
  30            $summary = pht(
  31              'You have enabled pygments and the pygmentize script is '.
  32              'available, but does not seem to work.');
  33  
  34            $message = pht(
  35              'Phabricator has %s available in $PATH, but the binary '.
  36              'exited with an error code when run as %s. Check that it is '.
  37              'installed correctly.',
  38              phutil_tag('tt', array(), 'pygmentize'),
  39              phutil_tag('tt', array(), 'pygmentize -h'));
  40  
  41            $this
  42              ->newIssue('pygments.failed')
  43              ->setName(pht('pygmentize Not Working'))
  44              ->setSummary($summary)
  45              ->setMessage($message)
  46              ->addRelatedPhabricatorConfig('pygments.enabled')
  47              ->addPhabricatorConfig('environment.append-paths');
  48          }
  49        }
  50      }
  51    }
  52  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1