allow creating directories with new file names
authorChristian Weiske <cweiske@cweiske.de>
Wed, 13 Nov 2013 20:18:28 +0000 (21:18 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 13 Nov 2013 20:18:28 +0000 (21:18 +0100)
src/phorkie/Repository/Post.php

index 226c2d8f65d7a1133fbfdf0df032822c8b9169a1..39798b57608d36ac1b1ab8fa5cd4604e8dc4322b 100644 (file)
@@ -116,6 +116,10 @@ class Repository_Post
                     && $file->getContent() != $arFile['content']
                 )
             ) {
                     && $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())
                 file_put_contents($file->getFullPath(), $arFile['content']);
                 $command = $vc->getCommand('add')
                     ->addArgument($file->getFilename())