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


PHP View::is_file方法代码示例

本文整理汇总了PHP中OC\Files\View::is_file方法的典型用法代码示例。如果您正苦于以下问题:PHP View::is_file方法的具体用法?PHP View::is_file怎么用?PHP View::is_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\View的用法示例。


在下文中一共展示了View::is_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copy

 /**
  * Copies a file or directory.
  *
  * This method must work recursively and delete the destination
  * if it exists
  *
  * @param string $source
  * @param string $destination
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @return void
  */
 public function copy($source, $destination)
 {
     if (!$this->fileView) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
     }
     try {
         if ($this->fileView->is_file($source)) {
             $this->fileView->copy($source, $destination);
         } else {
             $this->fileView->mkdir($destination);
             $dh = $this->fileView->opendir($source);
             if (is_resource($dh)) {
                 while (($subNode = readdir($dh)) !== false) {
                     if ($subNode == '.' || $subNode == '..') {
                         continue;
                     }
                     $this->copy($source . '/' . $subNode, $destination . '/' . $subNode);
                 }
             }
         }
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
     }
     list($destinationDir, ) = \Sabre\DAV\URLUtil::splitPath($destination);
     $this->markDirty($destinationDir);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:37,代码来源:objecttree.php

示例2: findEncFiles

 /**
  * Find all files and their encryption status within a directory
  * @param string $directory The path of the parent directory to search
  * @param bool $found the founded files if called again
  * @return array keys: plain, encrypted, broken
  * @note $directory needs to be a path relative to OC data dir. e.g.
  *       /admin/files NOT /backup OR /home/www/oc/data/admin/files
  */
 public function findEncFiles($directory, &$found = false)
 {
     // Disable proxy - we don't want files to be decrypted before
     // we handle them
     \OC_FileProxy::$enabled = false;
     if ($found === false) {
         $found = array('plain' => array(), 'encrypted' => array(), 'broken' => array());
     }
     if ($this->view->is_dir($directory) && ($handle = $this->view->opendir($directory))) {
         if (is_resource($handle)) {
             while (false !== ($file = readdir($handle))) {
                 if ($file !== "." && $file !== "..") {
                     // skip stray part files
                     if (Helper::isPartialFilePath($file)) {
                         continue;
                     }
                     $filePath = $directory . '/' . $this->view->getRelativePath('/' . $file);
                     $relPath = Helper::stripUserFilesPath($filePath);
                     // If the path is a directory, search
                     // its contents
                     if ($this->view->is_dir($filePath)) {
                         $this->findEncFiles($filePath, $found);
                         // If the path is a file, determine
                         // its encryption status
                     } elseif ($this->view->is_file($filePath)) {
                         // Disable proxies again, some-
                         // where they got re-enabled :/
                         \OC_FileProxy::$enabled = false;
                         $isEncryptedPath = $this->isEncryptedPath($filePath);
                         // If the file is encrypted
                         // NOTE: If the userId is
                         // empty or not set, file will
                         // detected as plain
                         // NOTE: This is inefficient;
                         // scanning every file like this
                         // will eat server resources :(
                         if ($isEncryptedPath) {
                             $fileKey = Keymanager::getFileKey($this->view, $this, $relPath);
                             $shareKey = Keymanager::getShareKey($this->view, $this->userId, $this, $relPath);
                             // if file is encrypted but now file key is available, throw exception
                             if ($fileKey === false || $shareKey === false) {
                                 \OCP\Util::writeLog('encryption library', 'No keys available to decrypt the file: ' . $filePath, \OCP\Util::ERROR);
                                 $found['broken'][] = array('name' => $file, 'path' => $filePath);
                             } else {
                                 $found['encrypted'][] = array('name' => $file, 'path' => $filePath);
                             }
                             // If the file is not encrypted
                         } else {
                             $found['plain'][] = array('name' => $file, 'path' => $relPath);
                         }
                     }
                 }
             }
         }
     }
     \OC_FileProxy::$enabled = true;
     return $found;
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:66,代码来源:util.php

示例3: validate

 /**
  * Check if genesis is valid
  * @param \OC\Files\View $view 
  * @param string $path relative to the view
  * @throws \Exception
  */
 protected function validate($view, $path)
 {
     if (!$view->file_exists($path)) {
         throw new \Exception('Document not found ' . $path);
     }
     if (!$view->is_file($path)) {
         throw new \Exception('Object ' . $path . ' is not a file.');
     }
     //TODO check if it is a valid odt
 }
开发者ID:owncloud,项目名称:richdocuments,代码行数:16,代码来源:genesis.php

示例4: is_file

 public static function is_file($path)
 {
     return self::$defaultInstance->is_file($path);
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:4,代码来源:Filesystem.php


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