diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-03 23:23:36 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-03 23:23:36 +0200 |
| commit | cdc99846c94bacdd7a2a0681d77bac3de45c4f2a (patch) | |
| tree | 153dc4c866345a114c1279caecb5af555f7ff9fd /src | |
| parent | 61cb5ecf53731fbe3dbb632dbea059db88d672f1 (diff) | |
| download | phorkie-cdc99846c94bacdd7a2a0681d77bac3de45c4f2a.tar.gz phorkie-cdc99846c94bacdd7a2a0681d77bac3de45c4f2a.zip | |
deleting files works now
Diffstat (limited to 'src')
| -rw-r--r-- | src/phorkie/Repository/Post.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 828dbad..1b60752 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -44,6 +44,7 @@ class Repository_Post } $bNew = false; + $bDelete = false; if (!isset($orignalName) || $orignalName == '') { //new file $bNew = true; @@ -51,6 +52,8 @@ class Repository_Post //unknown file //FIXME: Show error message continue; + } else if (isset($arFile['delete']) && $arFile['delete'] == 1) { + $bDelete = true; } else if ($orignalName != $name) { //FIXME: what to do with overwrites? $vc->getCommand('mv') @@ -61,7 +64,12 @@ class Repository_Post } $file = $this->repo->getFileByName($name, false); - if ($bNew || $file->getContent() != $arFile['content']) { + if ($bDelete) { + $command = $vc->getCommand('rm') + ->addArgument($file->getFilename()) + ->execute(); + $bChanged = true; + } else if ($bNew || $file->getContent() != $arFile['content']) { file_put_contents($file->getPath(), $arFile['content']); $command = $vc->getCommand('add') ->addArgument($file->getFilename()) |
