From 540994aea6ff584861bc1637dd1399b3dd8ae834 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 13 Mar 2003 14:19:01 +0000 Subject: [PATCH] add code to save old versions --- presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php index a4e3e2a..70db3bd 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php @@ -60,15 +60,12 @@ if (checkSession()) { // make sure the user actually selected a file first if (strlen($_FILES['fFile']['name']) > 0) { - // backup the original document - $sBackupPath = $oDocument->getPath() . ".bk"; + // save the original document + $sBackupPath = $oDocument->getPath() . "-" . $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber(); copy($oDocument->getPath(), $sBackupPath); // update the document with the uploaded one if (PhysicalDocumentManager::uploadPhysicalDocument($oDocument, $fFolderID, "", $_FILES['fFile']['tmp_name'])) { - // remove the backup - unlink($sBackupPath); - // now update the database // overwrite size $oDocument->setFileSize($_FILES['fFile']['size']); @@ -112,6 +109,8 @@ if (checkSession()) { } else { // reinstate the backup copy($sBackupPath, $oDocument->getPath()); + // remove the backup + unlink($sBackupPath); $oPatternCustom->setHtml(renderErrorPage("An error occurred while storing the new file on the filesystem")); } } else { -- libgit2 0.21.4