本文整理汇总了PHP中OC\Files\Storage\Storage::file_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::file_exists方法的具体用法?PHP Storage::file_exists怎么用?PHP Storage::file_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Storage\Storage
的用法示例。
在下文中一共展示了Storage::file_exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanFolder
/**
* remove deleted files in $path from the cache
*
* @param string $path
*/
public function cleanFolder($path)
{
$cachedContent = $this->cache->getFolderContents($path);
foreach ($cachedContent as $entry) {
if (!$this->storage->file_exists($entry['path'])) {
$this->cache->remove($entry['path']);
}
}
}
示例2: stream_open
public function stream_open($path, $mode, $options, &$opened_path)
{
$this->loadContext('ocencryption');
$this->position = 0;
$this->cache = '';
$this->writeFlag = false;
$this->unencryptedBlockSize = $this->encryptionModule->getUnencryptedBlockSize($this->signed);
if ($mode === 'w' || $mode === 'w+' || $mode === 'wb' || $mode === 'wb+' || $mode === 'r+' || $mode === 'rb+') {
$this->readOnly = false;
} else {
$this->readOnly = true;
}
$sharePath = $this->fullPath;
if (!$this->storage->file_exists($this->internalPath)) {
$sharePath = dirname($sharePath);
}
$accessList = $this->file->getAccessList($sharePath);
$this->newHeader = $this->encryptionModule->begin($this->fullPath, $this->uid, $mode, $this->header, $accessList);
if ($mode === 'w' || $mode === 'w+' || $mode === 'wb' || $mode === 'wb+') {
// We're writing a new file so start write counter with 0 bytes
$this->unencryptedSize = 0;
$this->writeHeader();
$this->headerSize = $this->util->getHeaderSize();
$this->size = $this->headerSize;
} else {
$this->skipHeader();
}
return true;
}
示例3: getCacheEntry
/**
* Get file info from cache
*
* If the file is not in cached it will be scanned
* If the file has changed on storage the cache will be updated
*
* @param \OC\Files\Storage\Storage $storage
* @param string $internalPath
* @param string $relativePath
* @return array|bool
*/
private function getCacheEntry($storage, $internalPath, $relativePath)
{
$cache = $storage->getCache($internalPath);
$data = $cache->get($internalPath);
$watcher = $storage->getWatcher($internalPath);
try {
// if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
if (!$data || $data['size'] === -1) {
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
if (!$storage->file_exists($internalPath)) {
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
return false;
}
$scanner = $storage->getScanner($internalPath);
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
$data = $cache->get($internalPath);
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
} else {
if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) {
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
$watcher->update($internalPath, $data);
$storage->getPropagator()->propagateChange($internalPath, time());
$data = $cache->get($internalPath);
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
}
}
} catch (LockedException $e) {
// if the file is locked we just use the old cache info
}
return $data;
}
示例4: file_exists
/**
* see http://php.net/manual/en/function.file_exists.php
*
* @param string $path
* @return bool
*/
public function file_exists($path)
{
return $this->storage->file_exists($path);
}
示例5: file_assemble
/**
* Assembles the chunks into the file specified by the path.
* Also triggers the relevant hooks and proxies.
*
* @param \OC\Files\Storage\Storage $storage
* @param string $path target path relative to the storage
* @param string $absolutePath
* @return bool assembled file size or false if file could not be created
*
* @throws \OC\ServerNotAvailableException
*/
public function file_assemble($storage, $path, $absolutePath)
{
$data = '';
// use file_put_contents as method because that best matches what this function does
if (\OC\Files\Filesystem::isValidPath($path)) {
$exists = $storage->file_exists($path);
$run = true;
$hookPath = \OC\Files\Filesystem::getView()->getRelativePath($absolutePath);
if (!$exists) {
OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_create, array(\OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run));
}
OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_write, array(\OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run));
if (!$run) {
return false;
}
$target = $storage->fopen($path, 'w');
if ($target) {
$count = $this->assemble($target);
fclose($target);
if (!$exists) {
OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, array(\OC\Files\Filesystem::signal_param_path => $hookPath));
}
OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, array(\OC\Files\Filesystem::signal_param_path => $hookPath));
return $count > 0;
} else {
return false;
}
}
return false;
}