/**
  * Perform any storage changes necessary to account for a renamed
  * document object.
  * someone else _must_ call the update on $oDocument
  */
 function renameDocument(&$oDocument, $oOldContentVersion, $sNewFilename)
 {
     // we get the Folder object
     $oVersion =& $oDocument->_oDocumentContentVersion;
     $oConfig =& KTConfig::getSingleton();
     $sDocumentRoot = $oConfig->get('urls/documentRoot');
     $sOldPath = sprintf("%s/%s-%s", Folder::generateFolderPath($oDocument->getFolderID()), $oOldContentVersion->getId(), $oOldContentVersion->getFileName());
     $sNewPath = sprintf("%s/%s-%s", Folder::generateFolderPath($oDocument->getFolderID()), $oDocument->_oDocumentContentVersion->getId(), $sNewFilename);
     $sFullOldPath = sprintf("%s/%s", $sDocumentRoot, $sOldPath);
     $sFullNewPath = sprintf("%s/%s", $sDocumentRoot, $sNewPath);
     $res = KTUtil::copyFile($sFullOldPath, $sFullNewPath);
     if (PEAR::isError($res)) {
         return $res;
     }
     $oVersion->setStoragePath($sNewPath);
     // someone else _must_ call the update.
     return true;
     // RES ?= PEAR::raiseError('.');
 }
 /**
  * Perform any storage changes necessary to account for a copied
  * document object.
  */
 function copy($oSrcDocument, &$oNewDocument)
 {
     // we get the Folder object
     $oVersion = $oNewDocument->_oDocumentContentVersion;
     $oConfig =& KTConfig::getSingleton();
     $sDocumentRoot = $oConfig->get('urls/documentRoot');
     $sNewPath = $this->generateStoragePath($oNewDocument);
     $sFullOldPath = sprintf("%s/%s", $sDocumentRoot, $this->getPath($oSrcDocument));
     $sFullNewPath = sprintf("%s/%s", $sDocumentRoot, $sNewPath);
     $res = KTUtil::copyFile($sFullOldPath, $sFullNewPath);
     if (PEAR::isError($res)) {
         return $res;
     }
     $oVersion->setStoragePath($sNewPath);
     $oVersion->update();
 }