warn about remote fork config in setup and help
[phorkie.git] / src / phorkie / Repository / Post.php
index 226c2d8f65d7a1133fbfdf0df032822c8b9169a1..fbfea4bcb74c3bbf081f16b5e054abcafa9455fd 100644 (file)
@@ -116,6 +116,10 @@ class Repository_Post
                     && $file->getContent() != $arFile['content']
                 )
             ) {
+                $dir = dirname($file->getFullPath());
+                if (!is_dir($dir)) {
+                    mkdir($dir, 0777, true);
+                }
                 file_put_contents($file->getFullPath(), $arFile['content']);
                 $command = $vc->getCommand('add')
                     ->addArgument($file->getFilename())
@@ -224,11 +228,11 @@ class Repository_Post
         return $prefix . $num;
     }
 
-    protected function getType($content)
+    public function getType($content)
     {
         $tmp = tempnam(sys_get_temp_dir(), 'phorkie-autodetect-');
         file_put_contents($tmp, $content);
-        $type = \MIME_Type_PlainDetect::autoDetect($tmp);
+        $type = Tool_MIME_Type_PlainDetect::autoDetect($tmp);
         unlink($tmp);
 
         return $this->findExtForType($type);