本文整理汇总了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();
}