From 18c2081be73e44e3cc5d48ed619bf76ec826a750 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Thu, 22 Nov 2012 13:47:59 +1300 Subject: [PATCH] ENHANCEMENT: deleting the old file when replacing, if document versioning is turned off --- code/DMSDocument.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/DMSDocument.php b/code/DMSDocument.php index 6b1c062..1d8c306 100755 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -444,6 +444,9 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { //version the existing file (copy it to a new "very specific" filename if (DMSDocument_versions::$enable_versions) { DMSDocument_versions::create_version($this); + } else { //otherwise delete the old document file + $oldPath = $this->getFullPath(); + if (file_exists($oldPath)) unlink($this->getFullPath()); } copy($fromPath, $toPath); //this will overwrite the existing file (if present)