Commit 540994aea6ff584861bc1637dd1399b3dd8ae834
1 parent
2ac2253b
add code to save old versions
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1545 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
4 additions
and
5 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php
| ... | ... | @@ -60,15 +60,12 @@ if (checkSession()) { |
| 60 | 60 | // make sure the user actually selected a file first |
| 61 | 61 | if (strlen($_FILES['fFile']['name']) > 0) { |
| 62 | 62 | |
| 63 | - // backup the original document | |
| 64 | - $sBackupPath = $oDocument->getPath() . ".bk"; | |
| 63 | + // save the original document | |
| 64 | + $sBackupPath = $oDocument->getPath() . "-" . $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber(); | |
| 65 | 65 | copy($oDocument->getPath(), $sBackupPath); |
| 66 | 66 | |
| 67 | 67 | // update the document with the uploaded one |
| 68 | 68 | if (PhysicalDocumentManager::uploadPhysicalDocument($oDocument, $fFolderID, "", $_FILES['fFile']['tmp_name'])) { |
| 69 | - // remove the backup | |
| 70 | - unlink($sBackupPath); | |
| 71 | - | |
| 72 | 69 | // now update the database |
| 73 | 70 | // overwrite size |
| 74 | 71 | $oDocument->setFileSize($_FILES['fFile']['size']); |
| ... | ... | @@ -112,6 +109,8 @@ if (checkSession()) { |
| 112 | 109 | } else { |
| 113 | 110 | // reinstate the backup |
| 114 | 111 | copy($sBackupPath, $oDocument->getPath()); |
| 112 | + // remove the backup | |
| 113 | + unlink($sBackupPath); | |
| 115 | 114 | $oPatternCustom->setHtml(renderErrorPage("An error occurred while storing the new file on the filesystem")); |
| 116 | 115 | } |
| 117 | 116 | } else { | ... | ... |