ENHANCEMENT: deleting the old file when replacing, if document versioning is turned off

This commit is contained in:
Julian Seidenberg 2012-11-22 13:47:59 +13:00
parent 408fd88d9e
commit 18c2081be7
1 changed files with 3 additions and 0 deletions

View File

@ -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)