當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filesystem::clearMounts方法代碼示例

本文整理匯總了PHP中OC\Files\Filesystem::clearMounts方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filesystem::clearMounts方法的具體用法?PHP Filesystem::clearMounts怎麽用?PHP Filesystem::clearMounts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC\Files\Filesystem的用法示例。


在下文中一共展示了Filesystem::clearMounts方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: tearDown

 public function tearDown()
 {
     foreach ($this->storages as $storage) {
         $storage->getCache()->clear();
     }
     \OC\Files\Filesystem::clearMounts();
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:7,代碼來源:integration.php

示例3: 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

示例4: setUp

	protected function setUp() {
		parent::setUp();

		$this->storage = new \OC\Files\Storage\Temporary(array());
		$textData = "dummy file data\n";
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
		$this->storage->mkdir('folder');
		$this->storage->file_put_contents('foo.txt', $textData);
		$this->storage->file_put_contents('foo.png', $imgData);
		$this->storage->file_put_contents('folder/bar.txt', $textData);
		$this->storage->file_put_contents('folder/bar2.txt', $textData);

		$this->scanner = $this->storage->getScanner();
		$this->scanner->scan('');
		$this->cache = $this->storage->getCache();

		if (!self::$user) {
			self::$user = $this->getUniqueID();
		}

		\OC_User::createUser(self::$user, 'password');
		$this->loginAsUser(self::$user);

		Filesystem::init(self::$user, '/' . self::$user . '/files');

		Filesystem::clearMounts();
		Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');

		\OC_Hook::clear('OC_Filesystem');
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:30,代碼來源:updaterlegacy.php

示例5: setUp

 public function setUp()
 {
     // remember files_encryption state
     $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
     // we want to tests with the encryption app disabled
     \OC_App::disable('files_encryption');
     $this->storage = new \OC\Files\Storage\Temporary(array());
     $textData = "dummy file data\n";
     $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
     $this->storage->mkdir('folder');
     $this->storage->file_put_contents('foo.txt', $textData);
     $this->storage->file_put_contents('foo.png', $imgData);
     $this->storage->file_put_contents('folder/bar.txt', $textData);
     $this->storage->file_put_contents('folder/bar2.txt', $textData);
     $this->scanner = $this->storage->getScanner();
     $this->scanner->scan('');
     $this->cache = $this->storage->getCache();
     \OC\Files\Filesystem::tearDown();
     if (!self::$user) {
         self::$user = uniqid();
     }
     \OC_User::createUser(self::$user, 'password');
     \OC_User::setUserId(self::$user);
     \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files');
     Filesystem::clearMounts();
     Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');
     \OC_Hook::clear('OC_Filesystem');
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:28,代碼來源:updater.php

示例6: 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

示例7: 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

示例8: 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

示例9: setUp

 public function setUp()
 {
     $this->user = 'user_' . uniqid();
     \OC_User::createUser($this->user, $this->user);
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId($this->user);
     \OC\Files\Filesystem::init($this->user, '/' . $this->user . '/files');
     \OC\Files\Filesystem::clearMounts();
     $this->storageMock = null;
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:10,代碼來源:helperstorage.php

示例10: tearDown

 protected function tearDown()
 {
     foreach ($this->tmpDirs as $dir) {
         \OC_Helper::rmdirr($dir);
     }
     \OC\Files\Filesystem::clearMounts();
     \OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
     \OC_User::setUserId('');
     parent::tearDown();
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:10,代碼來源:filesystem.php

示例11: setUp

 public function setUp()
 {
     \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');
     \OC\Files\Filesystem::clearMounts();
     $this->tempStorage = null;
 }
開發者ID:Combustible,項目名稱:core,代碼行數:11,代碼來源:view.php

示例12: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->user = $this->getUniqueID('user_');
     \OC::$server->getUserManager()->createUser($this->user, $this->user);
     $this->storage = \OC\Files\Filesystem::getStorage('/');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId($this->user);
     \OC\Files\Filesystem::init($this->user, '/' . $this->user . '/files');
     \OC\Files\Filesystem::clearMounts();
     $this->storageMock = null;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:12,代碼來源:HelperStorageTest.php

示例13: 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

示例14: 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'));
     unlink('oc:///foo.txt');
     $this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///'));
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:16,代碼來源:streamwrappers.php

示例15: setUp

 public function setUp()
 {
     \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');
     \OC\Files\Filesystem::clearMounts();
     $textData = "sample file\n";
     $this->storage = new \OC\Files\Storage\Temporary(array());
     $this->storage->file_put_contents(self::TEST_CLEAN_FILENAME, $textData);
     $this->storage->file_put_contents(self::TEST_INFECTED_FILENAME, $textData);
     \OC\Files\Filesystem::mount($this->storage, array(), '/');
     $this->config['av_mode'] = \OCP\Config::getAppValue('files_antivirus', 'av_mode', null);
     $this->config['av_path'] = \OCP\Config::getAppValue('files_antivirus', 'av_path', null);
     \OCP\Config::setAppValue('files_antivirus', 'av_mode', 'executable');
     \OCP\Config::setAppValue('files_antivirus', 'av_path', __DIR__ . '/avir.sh');
 }
開發者ID:anolisti,項目名稱:apps,代碼行數:19,代碼來源:scannerTest.php


注:本文中的OC\Files\Filesystem::clearMounts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。