prevent notice on cli scripts
[phorkie.git] / src / phorkie / SetupCheck.php
index c4d365c7a79552166aea7e88413f44ef0087f821..32fb79e2d2ef94aba344d2a53d04b80ccb9c23b7 100644 (file)
@@ -46,6 +46,13 @@ class SetupCheck
 
     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));
@@ -133,8 +140,13 @@ class SetupCheck
     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);
         }
     }