From cdc99846c94bacdd7a2a0681d77bac3de45c4f2a Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 3 Apr 2012 23:23:36 +0200 Subject: deleting files works now --- src/phorkie/Repository/Post.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') 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()) -- cgit v1.2.3