class SetupCheck
{
protected $deps = array(
- 'pear.php.net/VersionControl_Git' => 'VersionControl_Git',
- 'pear.twig-project.org/Twig' => 'Twig_Autoloader',
- 'pear.php.net/Date_HumanDiff' => 'Date_HumanDiff',
- 'pear.php.net/HTTP_Request2' => 'HTTP_Request2',
- 'pear.php.net/OpenID' => 'OpenID',
- 'pear.php.net/Pager' => 'Pager',
- 'pear.php.net/Services_Libravatar' => 'Services_Libravatar',
- 'pear2.php.net/PEAR2_Services_Linkback' => '\\PEAR2\\Services\\Linkback\\Client',
- 'zustellzentrum.cweiske.de/MIME_Type_PlainDetect' => 'MIME_Type_PlainDetect',
+ 'pear/versionControl_git' => 'VersionControl_Git',
+ 'twig/twig' => 'Twig_Autoloader',
+ 'pear/date_humanDiff' => 'Date_HumanDiff',
+ 'pear/http_request2' => 'HTTP_Request2',
+ 'pear/openid' => 'OpenID',
+ 'pear/pager' => 'Pager',
+ 'pear/services_libravatar' => 'Services_Libravatar',
+ 'pear2/services_linkback' => '\\PEAR2\\Services\\Linkback\\Client',
+ 'cweiske/mime_type_plaindetect' => 'MIME_Type_PlainDetect',
);
protected $writableDirs;
{
$cfg = $GLOBALS['phorkie']['cfg'];
$this->writableDirs = array(
- 'gitdir' => $cfg['gitdir'],
- 'workdir' => $cfg['workdir'],
+ 'gitdir' => Tools::foldPath($cfg['gitdir']),
+ 'workdir' => Tools::foldPath($cfg['workdir']),
+ 'cachedir' => Tools::foldPath($cfg['cachedir']),
);
$this->elasticsearch = $cfg['elasticsearch'];
}
public function checkConfigFiles()
{
+ if (!isset($GLOBALS['phorkie']['cfgfiles'])
+ || count($GLOBALS['phorkie']['cfgfiles']) == 0
+ ) {
+ $this->info('No config files registered');
+ return;
+ }
+
foreach ($GLOBALS['phorkie']['cfgfiles'] as $file => $loaded) {
if ($loaded) {
$this->ok('Loaded config file: ' . Tools::foldPath($file));
{
foreach ($this->deps as $package => $class) {
if (!class_exists($class, true)) {
- $this->fail('PEAR package not installed: ' . $package);
+ $this->fail('Composer package not installed: ' . $package);
}
}
- if (!class_exists('geshi', true)) {
+ if (!class_exists('GeSHi', true)) {
$geshi = stream_resolve_include_path(
$GLOBALS['phorkie']['cfg']['geshi']
);
if ($retval !== 0) {
$this->fail('Running git executable failed.');
}
- if (!preg_match('#^git version ([0-9.]+(rc[0-9]+)?)$#', $line, $matches)) {
+ if (!preg_match('#^git version ([0-9.]+(rc[0-9]+)?)(?: \(Apple Git-\d+\))?$#', $line, $matches)) {
$this->fail('git version output format unexpected: ' . $line);
+ return;
}
if (version_compare($matches[1], '1.7.5') < 0) {
$this->fail(
public function checkMimeTypeDetection()
{
$rp = new Repository_Post();
- if ($rp->getType('<?php echo "foo"; ?>') != 'php') {
- $this->fail('MIME type detection fails');
+ $type = $rp->getType('<?php echo "foo"; ?>', true);
+ if ($type != 'php') {
+ $msg = 'MIME type detection fails';
+ if ($type instanceof \PEAR_Error) {
+ $msg .= '. Error: ' . $type->getMessage();
+ }
+ $this->fail($msg);
}
}