- if ($bNew || $file->getContent() != $arFile['content']) {
- file_put_contents($file->getPath(), $arFile['content']);
+ if ($bDelete) {
+ $command = $vc->getCommand('rm')
+ ->addArgument($file->getFilename())
+ ->execute();
+ $bCommit = true;
+ } else if ($bUpload) {
+ move_uploaded_file(
+ $_FILES['files']['tmp_name'][$num]['upload'],
+ $file->getFullPath()
+ );
+ $command = $vc->getCommand('add')
+ ->addArgument($file->getFilename())
+ ->execute();
+ $bCommit = true;
+ } else if ($bNew
+ || (isset($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']);