當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。