本文整理汇总了PHP中OC_FileChunking::getCurrentSize方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_FileChunking::getCurrentSize方法的具体用法?PHP OC_FileChunking::getCurrentSize怎么用?PHP OC_FileChunking::getCurrentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_FileChunking
的用法示例。
在下文中一共展示了OC_FileChunking::getCurrentSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkQuota
/**
* This method is called before any HTTP method and validates there is enough free space to store the file
*
* @param string $method
* @throws Sabre_DAV_Exception
* @return bool
*/
public function checkQuota($uri, $data = null)
{
$length = $this->getLength();
if ($length) {
if (substr($uri, 0, 1) !== '/') {
$uri = '/' . $uri;
}
list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
$req = $this->server->httpRequest;
if ($req->getHeader('OC-Chunked')) {
$info = OC_FileChunking::decodeName($newName);
$chunkHandler = new OC_FileChunking($info);
// substract the already uploaded size to see whether
// there is still enough space for the remaining chunks
$length -= $chunkHandler->getCurrentSize();
}
$freeSpace = $this->getFreeSpace($parentUri);
if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) {
if (isset($chunkHandler)) {
$chunkHandler->cleanup();
}
throw new Sabre_DAV_Exception_InsufficientStorage();
}
}
return true;
}