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


PHP Filesystem::mount方法代码示例

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


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

示例1: setUp

 /**
  * Make sure your configuration file doesn't contain any additional providers
  */
 protected function setUp()
 {
     parent::setUp();
     $userManager = \OC::$server->getUserManager();
     $userManager->clearBackends();
     $backend = new \Test\Util\User\Dummy();
     $userManager->registerBackend($backend);
     $backend->createUser(self::TEST_PREVIEW_USER1, self::TEST_PREVIEW_USER1);
     $this->loginAsUser(self::TEST_PREVIEW_USER1);
     $storage = new \OC\Files\Storage\Temporary([]);
     \OC\Files\Filesystem::mount($storage, [], '/' . self::TEST_PREVIEW_USER1 . '/');
     $this->rootView = new \OC\Files\View('');
     $this->rootView->mkdir('/' . self::TEST_PREVIEW_USER1);
     $this->rootView->mkdir('/' . self::TEST_PREVIEW_USER1 . '/files');
     // We simulate the max dimension set in the config
     \OC::$server->getConfig()->setSystemValue('preview_max_x', $this->configMaxWidth);
     \OC::$server->getConfig()->setSystemValue('preview_max_y', $this->configMaxHeight);
     // Used to test upscaling
     $this->maxScaleFactor = 2;
     \OC::$server->getConfig()->setSystemValue('preview_max_scale_factor', $this->maxScaleFactor);
     // We need to enable the providers we're going to use in the tests
     $providers = ['OC\\Preview\\JPEG', 'OC\\Preview\\PNG', 'OC\\Preview\\GIF', 'OC\\Preview\\TXT', 'OC\\Preview\\Postscript'];
     \OC::$server->getConfig()->setSystemValue('enabledPreviewProviders', $providers);
     // Sample is 1680x1050 JPEG
     $this->prepareSample('testimage.jpg', 1680, 1050);
     // Sample is 2400x1707 EPS
     $this->prepareSample('testimage.eps', 2400, 1707);
     // Sample is 1200x450 PNG
     $this->prepareSample('testimage-wide.png', 1200, 450);
     // Sample is 64x64 GIF
     $this->prepareSample('testimage.gif', 64, 64);
 }
开发者ID:The-Website-Nursery,项目名称:core,代码行数:35,代码来源:preview.php

示例2: setUp

 public function setUp()
 {
     //clear all proxies and hooks so we can do clean testing
     \OC_FileProxy::clearProxies();
     \OC_Hook::clear('OC_Filesystem');
     //disabled atm
     //enable only the encryption hook if needed
     //if(OC_App::isEnabled('files_encryption')) {
     //	OC_FileProxy::register(new OC_FileProxy_Encryption());
     //}
     //set up temporary storage
     \OC\Files\Filesystem::clearMounts();
     $storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::mount($storage, array(), '/');
     $datadir = str_replace('local::', '', $storage->getId());
     $this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT . '/data/cache');
     \OC_Config::setValue('cachedirectory', $datadir);
     \OC_User::clearBackends();
     \OC_User::useBackend(new \OC_User_Dummy());
     //login
     \OC_User::createUser('test', 'test');
     $this->user = \OC_User::getUser();
     \OC_User::setUserId('test');
     //set up the users dir
     $rootView = new \OC\Files\View('');
     $rootView->mkdir('/test');
     $this->instance = new \OC\Cache\File();
 }
开发者ID:Romua1d,项目名称:core,代码行数:28,代码来源:file.php

示例3: initMountPointsHook

 /**
  * Hook that mounts the given user's visible mount points
  * @param array $data
  */
 public static function initMountPointsHook($data)
 {
     $mountPoints = self::getAbsoluteMountPoints($data['user']);
     foreach ($mountPoints as $mountPoint => $options) {
         \OC\Files\Filesystem::mount($options['class'], $options['options'], $mountPoint);
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:11,代码来源:config.php

示例4: testOC

 public function testOC()
 {
     \OC\Files\Filesystem::clearMounts();
     $storage = new \OC\Files\Storage\Temporary(array());
     $storage->file_put_contents('foo.txt', 'asd');
     \OC\Files\Filesystem::mount($storage, array(), '/');
     $this->assertTrue(file_exists('oc:///foo.txt'));
     $this->assertEquals('asd', file_get_contents('oc:///foo.txt'));
     $this->assertEquals(array('.', '..', 'foo.txt'), scandir('oc:///'));
     file_put_contents('oc:///bar.txt', 'qwerty');
     $this->assertEquals('qwerty', $storage->file_get_contents('bar.txt'));
     $this->assertEquals(array('.', '..', 'bar.txt', 'foo.txt'), scandir('oc:///'));
     $this->assertEquals('qwerty', file_get_contents('oc:///bar.txt'));
     $fh = fopen('oc:///bar.txt', 'rb');
     $this->assertSame(0, ftell($fh));
     $content = fread($fh, 4);
     $this->assertSame(4, ftell($fh));
     $this->assertSame('qwer', $content);
     $content = fread($fh, 1);
     $this->assertSame(5, ftell($fh));
     $this->assertSame(0, fseek($fh, 0));
     $this->assertSame(0, ftell($fh));
     unlink('oc:///foo.txt');
     $this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///'));
 }
开发者ID:Romua1d,项目名称:core,代码行数:25,代码来源:streamwrappers.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->user = $this->getUniqueID();
     $storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::mount($storage, array(), '/' . $this->user . '/');
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:7,代码来源:avatar.php

示例6: setUp

 public function setUp()
 {
     $storage = new Temporary(array());
     $root = '/' . uniqid();
     Filesystem::mount($storage, array(), $root);
     $this->view = new View($root);
     $this->propagator = new \OC\Files\Cache\ChangePropagator($this->view);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:8,代码来源:changepropagator.php

示例7: tearDown

 protected function tearDown()
 {
     $result = \OC_User::deleteUser(self::$user);
     $this->assertTrue($result);
     \OC\Files\Filesystem::tearDown();
     \OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
     parent::tearDown();
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:8,代码来源:ajax_rename.php

示例8: tearDown

 protected function tearDown()
 {
     \OC_Config::setValue('datadirectory', $this->datadir);
     \OC_User::setUserId($this->uid);
     \OC_Util::setupFS($this->uid);
     \OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
     parent::tearDown();
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:8,代码来源:etagtest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     $storage = new Temporary(array());
     $root = $this->getUniqueID('/');
     Filesystem::mount($storage, array(), $root);
     $this->view = new View($root);
     $this->propagator = new \OC\Files\Cache\ChangePropagator($this->view);
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:9,代码来源:changepropagator.php

示例10: tearDown

 protected function tearDown()
 {
     \OC_User::setUserId($this->user);
     \OC_Config::setValue('cachedirectory', $this->datadir);
     // Restore the original mount point
     \OC\Files\Filesystem::clearMounts();
     \OC\Files\Filesystem::mount($this->storage, array(), '/');
     parent::tearDown();
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:9,代码来源:usercache.php

示例11: setUp

 public function setUp()
 {
     $this->storage = new Temporary(array());
     Filesystem::clearMounts();
     Filesystem::mount($this->storage, array(), '/');
     $this->view = new View('');
     $this->updater = new \OC\Files\Cache\Updater($this->view);
     $this->cache = $this->storage->getCache();
 }
开发者ID:Combustible,项目名称:core,代码行数:9,代码来源:updater.php

示例12: tearDown

 protected function tearDown()
 {
     foreach ($this->storages as $storage) {
         $storage->getCache()->clear();
     }
     \OC\Files\Filesystem::clearMounts();
     \OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
     parent::tearDown();
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:9,代码来源:integration.php

示例13: setupFS

 /**
  * @brief Can be set up
  * @param string $user
  * @return boolean
  * @description configure the initial filesystem based on the configuration
  */
 public static function setupFS($user = '')
 {
     //setting up the filesystem twice can only lead to trouble
     if (self::$fsSetup) {
         return false;
     }
     // If we are not forced to load a specific user we load the one that is logged in
     if ($user == "" && OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
     }
     // load all filesystem apps before, so no setup-hook gets lost
     if (!isset($RUNTIME_NOAPPS) || !$RUNTIME_NOAPPS) {
         OC_App::loadApps(array('filesystem'));
     }
     // the filesystem will finish when $user is not empty,
     // mark fs setup here to avoid doing the setup from loading
     // OC_Filesystem
     if ($user != '') {
         self::$fsSetup = true;
     }
     $configDataDirectory = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     //first set up the local "root" storage
     \OC\Files\Filesystem::initMounts();
     if (!self::$rootMounted) {
         \OC\Files\Filesystem::mount('\\OC\\Files\\Storage\\Local', array('datadir' => $configDataDirectory), '/');
         self::$rootMounted = true;
     }
     //if we aren't logged in, there is no use to set up the filesystem
     if ($user != "") {
         \OC\Files\Filesystem::addStorageWrapper(function ($mountPoint, $storage) {
             // set up quota for home storages, even for other users
             // which can happen when using sharing
             if ($storage instanceof \OC\Files\Storage\Home) {
                 $user = $storage->getUser()->getUID();
                 $quota = OC_Util::getUserQuota($user);
                 if ($quota !== \OC\Files\SPACE_UNLIMITED) {
                     return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota));
                 }
             }
             return $storage;
         });
         $userDir = '/' . $user . '/files';
         $userRoot = OC_User::getHome($user);
         $userDirectory = $userRoot . '/files';
         if (!is_dir($userDirectory)) {
             mkdir($userDirectory, 0755, true);
             OC_Util::copySkeleton($userDirectory);
         }
         //jail the user into his "home" directory
         \OC\Files\Filesystem::init($user, $userDir);
         $fileOperationProxy = new OC_FileProxy_FileOperations();
         OC_FileProxy::register($fileOperationProxy);
         OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
     }
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:62,代码来源:util.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->loginAsUser();
     $this->storage = new Temporary(array());
     Filesystem::mount($this->storage, array(), '/');
     $this->view = new View('');
     $this->updater = new \OC\Files\Cache\Updater($this->view);
     $this->cache = $this->storage->getCache();
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:10,代码来源:updater.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     \OC_User::clearBackends();
     \OC_User::useBackend(new \OC_User_Dummy());
     \OC\Files\Filesystem::clearMounts();
     //login
     \OC_User::createUser('test', 'test');
     \OC::$server->getSession()->set('user_id', 'test');
     $this->storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::init('test', '');
     \OC\Files\Filesystem::clearMounts();
     \OC\Files\Filesystem::mount($this->storage, array(), '/');
     \OC\Files\Filesystem::file_put_contents('file1', self::CONTENT);
     $this->config->method('getAvChunkSize')->willReturn('1024');
 }
开发者ID:amin-hedayati,项目名称:files_antivirus,代码行数:16,代码来源:itemtest.php


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