本文整理匯總了PHP中KTUtil::copyFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP KTUtil::copyFile方法的具體用法?PHP KTUtil::copyFile怎麽用?PHP KTUtil::copyFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類KTUtil
的用法示例。
在下文中一共展示了KTUtil::copyFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renameDocument
/**
* 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('.');
}
示例2: copy
/**
* 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();
}