mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-09-28 20:29:04 +02:00
ENHANCEMENT: deleting the old file when replacing, if document versioning is turned off
This commit is contained in:
parent
408fd88d9e
commit
18c2081be7
@ -444,6 +444,9 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
//version the existing file (copy it to a new "very specific" filename
|
//version the existing file (copy it to a new "very specific" filename
|
||||||
if (DMSDocument_versions::$enable_versions) {
|
if (DMSDocument_versions::$enable_versions) {
|
||||||
DMSDocument_versions::create_version($this);
|
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)
|
copy($fromPath, $toPath); //this will overwrite the existing file (if present)
|
||||||
|
Loading…
Reference in New Issue
Block a user