Commit c6abc7c13c8d09be4063e762cdf0ddcfd652e4da
1 parent
75077fca
Use KTUtil::moveFile in moveDocument - still needs to use storage_path
properly... git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3622 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
23 additions
and
22 deletions
lib/storage/ondiskpathstoragemanager.inc.php
| ... | ... | @@ -150,31 +150,32 @@ class KTOnDiskPathStorageManager extends KTStorageManager { |
| 150 | 150 | $sQuery = "SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id = ? AND transaction_id = ?";/*ok*/ |
| 151 | 151 | $aParams = array($oDocument->getID(), CHECKOUT); |
| 152 | 152 | $result = $sql->query(array($sQuery, $aParams)); |
| 153 | - if ($result) { | |
| 154 | - while ($sql->next_record()) { | |
| 155 | - $sVersion = $sql->f("version"); | |
| 156 | - if ($sVersion <> $oDocument->getVersion()) { | |
| 157 | - $sSourcePath = $sCurrentPath . "-" . $sVersion; | |
| 158 | - $sDestinationPath = $sDestinationFolderPath . "-" . $sVersion; | |
| 159 | - // move it to the new folder | |
| 160 | - $default->log->info("PhysicalDocumentManager::moveDocument moving $sSourcePath to $sDestinationPath"); | |
| 161 | - if (!PhysicalDocumentManager::move($sSourcePath, $sDestinationPath)) { | |
| 162 | - // FIXME: can't bail now since we don't have transactions- so we doggedly continue deleting and logging errors | |
| 163 | - $default->log->error("PhysicalDocumentManager::moveDocument error moving $sSourcePath to $sDestinationPath; documentID=" . $oDocument->getID() . "; folderID=" . $oFolder->getID()); | |
| 164 | - } | |
| 165 | - } | |
| 166 | - } | |
| 167 | - } else { | |
| 168 | - $default->log->error("PhysicalDocumentManager::moveDocument error looking up document versions, id=" . $oDocument->getID()); | |
| 153 | + if (!$result) { | |
| 154 | + $default->log->error("KTOnDiskPathStorageManager->moveDocument error looking up document versions, id=" . $oDocument->getID()); | |
| 169 | 155 | } |
| 170 | 156 | |
| 157 | + while ($sql->next_record()) { | |
| 158 | + $sVersion = $sql->f("version"); | |
| 159 | + if ($sVersion <> $oDocument->getVersion()) { | |
| 160 | + $sSourcePath = $sCurrentPath . "-" . $sVersion; | |
| 161 | + $sDestinationPath = $sDestinationFolderPath . "-" . $sVersion; | |
| 162 | + // move it to the new folder | |
| 163 | + $default->log->info("KTOnDiskPathStorageManager->moveDocument moving $sSourcePath to $sDestinationPath"); | |
| 164 | + $res = KTUtil::moveFile($sSourcePath, $sDestinationPath); | |
| 165 | + if (PEAR::isError($res)) { | |
| 166 | + // FIXME: can't bail now since we don't have transactions- so we doggedly continue deleting and logging errors | |
| 167 | + $default->log->error("KTOnDiskPathStorageManager->moveDocument error moving $sSourcePath to $sDestinationPath; documentID=" . $oDocument->getID() . "; folderID=" . $oFolder->getID()); | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } | |
| 171 | + | |
| 171 | 172 | // now move the current version |
| 172 | - if (PhysicalDocumentManager::move($sCurrentPath, $sDestinationFolderPath)) { | |
| 173 | - return true; | |
| 174 | - } else { | |
| 175 | - $default->log->error("PhysicalDocumentManager::moveDocument couldn't move $sCurrentPath to $sDestinationFolderPath, documentID=" . $oDocument->getID()); | |
| 176 | - return false; | |
| 177 | - } | |
| 173 | + $res = KTUtil::moveFile($sCurrentPath, $sDestinationFolderPath); | |
| 174 | + if (PEAR::isError($res)) { | |
| 175 | + $default->log->error("KTOnDiskPathStorageManager->moveDocument couldn't move $sCurrentPath to $sDestinationFolderPath, documentID=" . $oDocument->getID()); | |
| 176 | + return $res; | |
| 177 | + } | |
| 178 | + return true; | |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | 181 | /** | ... | ... |