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


PHP Filesystem::getMountPoint方法代码示例

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


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

示例1: getMountPoint

 /**
  * get the mountpoint of the storage object for a path
  * ( note: because a storage is not always mounted inside the fakeroot, the
  * returned mountpoint is relative to the absolute root of the filesystem
  * and does not take the chroot into account )
  *
  * @param string $path
  * @return string
  */
 public function getMountPoint($path)
 {
     return Filesystem::getMountPoint($this->getAbsolutePath($path));
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:13,代码来源:view.php

示例2: getUnindexed

    /**
     * get the list of all unindexed files for the user
     *
     * @return array
     */
    public static function getUnindexed()
    {
        $files = array();
        $absoluteRoot = Filesystem::getView()->getAbsolutePath('/');
        $mounts = Filesystem::getMountPoints($absoluteRoot);
        $mount = Filesystem::getMountPoint($absoluteRoot);
        if (!in_array($mount, $mounts)) {
            $mounts[] = $mount;
        }
        $query = \OC_DB::prepare('
			SELECT `*PREFIX*filecache`.`fileid`
			FROM `*PREFIX*filecache`
			LEFT JOIN `*PREFIX*lucene_status`
			ON `*PREFIX*filecache`.`fileid` = `*PREFIX*lucene_status`.`fileid`
			WHERE `storage` = ?
			AND `status` IS NULL OR `status` = ?
		');
        foreach ($mounts as $mount) {
            if (is_string($mount)) {
                $storage = Filesystem::getStorage($mount);
            } else {
                if ($mount instanceof \OC\Files\Mount\Mount) {
                    $storage = $mount->getStorage();
                } else {
                    $storage = null;
                    Util::writeLog('search_lucene', 'expected string or instance of \\OC\\Files\\Mount\\Mount got ' . json_encode($mount), Util::DEBUG);
                }
            }
            //only index local files for now
            if ($storage instanceof \OC\Files\Storage\Local) {
                $cache = $storage->getCache();
                $numericId = $cache->getNumericStorageId();
                $result = $query->execute(array($numericId, 'N'));
                if (\OC_DB::isError($result)) {
                    Util::writeLog('search_lucene', 'failed to find unindexed files: ' . \OC_DB::getErrorMessage($result), Util::WARN);
                    return false;
                }
                while ($row = $result->fetchRow()) {
                    $files[] = $row['fileid'];
                }
            }
        }
        return $files;
    }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:49,代码来源:indexer.php

示例3: getUnindexed

    /**
     * get the list of all unindexed files for the user
     *
     * @return array
     */
    public function getUnindexed()
    {
        $files = array();
        //TODO use server api for mounts & root
        $absoluteRoot = Filesystem::getView()->getAbsolutePath('/');
        $mounts = Filesystem::getMountPoints($absoluteRoot);
        $mount = Filesystem::getMountPoint($absoluteRoot);
        if (!in_array($mount, $mounts)) {
            $mounts[] = $mount;
        }
        $query = $this->db->prepareQuery('
			SELECT `*PREFIX*filecache`.`fileid`
			FROM `*PREFIX*filecache`
			LEFT JOIN `' . $this->tableName . '`
			ON `*PREFIX*filecache`.`fileid` = `' . $this->tableName . '`.`fileid`
			WHERE `storage` = ?
			AND ( `status` IS NULL OR `status` = ? )
			AND `path` LIKE \'files/%\'
		');
        foreach ($mounts as $mount) {
            if (is_string($mount)) {
                $storage = Filesystem::getStorage($mount);
            } else {
                if ($mount instanceof Mount) {
                    $storage = $mount->getStorage();
                } else {
                    $storage = null;
                    $this->logger->debug('expected string or instance of \\OC\\Files\\Mount\\Mount got ' . json_encode($mount));
                }
            }
            //only index local files for now
            if ($storage->isLocal()) {
                $cache = $storage->getCache();
                $numericId = $cache->getNumericStorageId();
                $result = $query->execute(array($numericId, Status::STATUS_NEW));
                while ($row = $result->fetchRow()) {
                    $files[] = $row['fileid'];
                }
            }
        }
        return $files;
    }
开发者ID:ntvis,项目名称:search_lucene,代码行数:47,代码来源:statusmapper.php

示例4: testRegisterMountProviderAfterSetup

 public function testRegisterMountProviderAfterSetup()
 {
     \OC\Files\Filesystem::initMountPoints(self::TEST_FILESYSTEM_USER2);
     $this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/foo/bar'));
     $mount = new MountPoint(new Temporary([]), '/foo/bar');
     $mountProvider = new DummyMountProvider([self::TEST_FILESYSTEM_USER2 => [$mount]]);
     \OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
     $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::getMountPoint('/foo/bar'));
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:9,代码来源:FilesystemTest.php

示例5: searchCommon

 /**
  * @param string $query
  * @param string $method
  * @return FileInfo[]
  */
 private function searchCommon($query, $method)
 {
     $files = array();
     $rootLength = strlen($this->fakeRoot);
     $mountPoint = Filesystem::getMountPoint($this->fakeRoot);
     $storage = Filesystem::getStorage($mountPoint);
     if ($storage) {
         $cache = $storage->getCache('');
         $results = $cache->{$method}($query);
         foreach ($results as $result) {
             if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') {
                 $internalPath = $result['path'];
                 $path = $mountPoint . $result['path'];
                 $result['path'] = substr($mountPoint . $result['path'], $rootLength);
                 $files[] = new FileInfo($path, $storage, $internalPath, $result);
             }
         }
         $mountPoints = Filesystem::getMountPoints($this->fakeRoot);
         foreach ($mountPoints as $mountPoint) {
             $storage = Filesystem::getStorage($mountPoint);
             if ($storage) {
                 $cache = $storage->getCache('');
                 $relativeMountPoint = substr($mountPoint, $rootLength);
                 $results = $cache->{$method}($query);
                 if ($results) {
                     foreach ($results as $result) {
                         $internalPath = $result['path'];
                         $result['path'] = rtrim($relativeMountPoint . $result['path'], '/');
                         $path = rtrim($mountPoint . $internalPath, '/');
                         $files[] = new FileInfo($path, $storage, $internalPath, $result);
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:42,代码来源:view.php

示例6: testMountExternalCacheDir

 /**
  * Test that an external cache is mounted into
  * the user's home
  */
 public function testMountExternalCacheDir()
 {
     $userId = $this->getUniqueID('user_');
     $oldCachePath = \OC_Config::getValue('cache_path', '');
     // set cache path to temp dir
     $cachePath = \OC_Helper::tmpFolder() . '/extcache';
     \OC_Config::setValue('cache_path', $cachePath);
     \OC_User::createUser($userId, $userId);
     \OC\Files\Filesystem::initMountPoints($userId);
     $this->assertEquals('/' . $userId . '/cache/', \OC\Files\Filesystem::getMountPoint('/' . $userId . '/cache'));
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . $userId . '/cache');
     $this->assertTrue($storage->instanceOfStorage('\\OC\\Files\\Storage\\Local'));
     $this->assertEquals('', $internalPath);
     \OC_User::deleteUser($userId);
     \OC_Config::setValue('cache_path', $oldCachePath);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:20,代码来源:filesystem.php

示例7: getMountPoint

 /**
  * get the mountpoint of the storage object for a path
  * ( note: because a storage is not always mounted inside the fakeroot, the
  * returned mountpoint is relative to the absolute root of the filesystem
  * and doesn't take the chroot into account )
  *
  * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
  * @param string $path
  * @return string
  */
 public static function getMountPoint($path)
 {
     return \OC\Files\Filesystem::getMountPoint($path);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:14,代码来源:filesystem.php

示例8: array

    }
} else {
    $users = array(OC_User::getUser());
}
$eventSource = new OC_EventSource();
ScanListener::$eventSource = $eventSource;
ScanListener::$view = \OC\Files\Filesystem::getView();
OC_Hook::connect('\\OC\\Files\\Cache\\Scanner', 'scan_folder', 'ScanListener', 'folder');
OC_Hook::connect('\\OC\\Files\\Cache\\Scanner', 'scan_file', 'ScanListener', 'file');
foreach ($users as $user) {
    $eventSource->send('user', $user);
    OC_Util::tearDownFS();
    OC_Util::setupFS($user);
    $absolutePath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir);
    $mountPoints = \OC\Files\Filesystem::getMountPoints($absolutePath);
    $mountPoints[] = \OC\Files\Filesystem::getMountPoint($absolutePath);
    $mountPoints = array_reverse($mountPoints);
    //start with the mount point of $dir
    foreach ($mountPoints as $mountPoint) {
        $storage = \OC\Files\Filesystem::getStorage($mountPoint);
        if ($storage) {
            ScanListener::$mountPoints[$storage->getId()] = $mountPoint;
            $scanner = $storage->getScanner();
            if ($force) {
                $scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG);
            } else {
                $scanner->backgroundScan();
            }
        }
    }
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:scan.php


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