当前位置: 首页>>代码示例>>PHP>>正文


PHP Storage::file_exists方法代码示例

本文整理汇总了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']);
         }
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:14,代码来源:watcher.php

示例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;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:29,代码来源:Encryption.php

示例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;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:42,代码来源:View.php

示例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);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:Wrapper.php

示例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;
 }
开发者ID:gvde,项目名称:core,代码行数:41,代码来源:filechunking.php


注:本文中的OC\Files\Storage\Storage::file_exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。