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


PHP Storage::mkdir方法代码示例

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


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

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

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

示例3: testBackgroundScan

 function testBackgroundScan()
 {
     $this->fillTestFolders();
     $this->storage->mkdir('folder2');
     $this->storage->file_put_contents('folder2/bar.txt', 'foobar');
     $this->assertEquals([], $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW), 'Asserting that no error occurred while scan(SCAN_SHALLOW)');
     $this->scanner->backgroundScan();
     $this->assertTrue(true, 'Asserting that no error occurred while backgroundScan()');
 }
开发者ID:evanjt,项目名称:core,代码行数:9,代码来源:noopscanner.php

示例4: testMoveFolderCrossStorage

	public function testMoveFolderCrossStorage() {
		$storage2 = new Temporary(array());
		$cache2 = $storage2->getCache();
		Filesystem::mount($storage2, array(), '/bar');
		$this->storage->mkdir('foo');
		$this->storage->mkdir('foo/bar');
		$this->storage->file_put_contents('foo/foo.txt', 'qwerty');
		$this->storage->file_put_contents('foo/bar.txt', 'foo');
		$this->storage->file_put_contents('foo/bar/bar.txt', 'qwertyuiop');

		$this->storage->getScanner()->scan('');

		$this->assertTrue($this->cache->inCache('foo'));
		$this->assertTrue($this->cache->inCache('foo/foo.txt'));
		$this->assertTrue($this->cache->inCache('foo/bar.txt'));
		$this->assertTrue($this->cache->inCache('foo/bar'));
		$this->assertTrue($this->cache->inCache('foo/bar/bar.txt'));
		$cached = [];
		$cached[] = $this->cache->get('foo');
		$cached[] = $this->cache->get('foo/foo.txt');
		$cached[] = $this->cache->get('foo/bar.txt');
		$cached[] = $this->cache->get('foo/bar');
		$cached[] = $this->cache->get('foo/bar/bar.txt');

		// add extension to trigger the possible mimetype change
		$this->view->rename('/foo', '/bar/foo.b');

		$this->assertFalse($this->cache->inCache('foo'));
		$this->assertFalse($this->cache->inCache('foo/foo.txt'));
		$this->assertFalse($this->cache->inCache('foo/bar.txt'));
		$this->assertFalse($this->cache->inCache('foo/bar'));
		$this->assertFalse($this->cache->inCache('foo/bar/bar.txt'));
		$this->assertTrue($cache2->inCache('foo.b'));
		$this->assertTrue($cache2->inCache('foo.b/foo.txt'));
		$this->assertTrue($cache2->inCache('foo.b/bar.txt'));
		$this->assertTrue($cache2->inCache('foo.b/bar'));
		$this->assertTrue($cache2->inCache('foo.b/bar/bar.txt'));

		$cachedTarget = [];
		$cachedTarget[] = $cache2->get('foo.b');
		$cachedTarget[] = $cache2->get('foo.b/foo.txt');
		$cachedTarget[] = $cache2->get('foo.b/bar.txt');
		$cachedTarget[] = $cache2->get('foo.b/bar');
		$cachedTarget[] = $cache2->get('foo.b/bar/bar.txt');

		foreach ($cached as $i => $old) {
			$new = $cachedTarget[$i];
			$this->assertEquals($old['mtime'], $new['mtime']);
			$this->assertEquals($old['size'], $new['size']);
			$this->assertEquals($old['etag'], $new['etag']);
			$this->assertEquals($old['fileid'], $new['fileid']);
			$this->assertEquals($old['mimetype'], $new['mimetype']);
		}
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:54,代码来源:updater.php

示例5: testSearchByTagTree

 /**
  * Test searching by tag for multiple sections of the tree
  */
 function testSearchByTagTree()
 {
     $userId = \OC::$server->getUserSession()->getUser()->getUId();
     $this->sharedStorage->mkdir('subdir/emptydir');
     $this->sharedStorage->mkdir('subdir/emptydir2');
     $this->ownerStorage->getScanner()->scan('');
     $allIds = array($this->sharedCache->get('')['fileid'], $this->sharedCache->get('bar.txt')['fileid'], $this->sharedCache->get('subdir/another too.txt')['fileid'], $this->sharedCache->get('subdir/not a text file.xml')['fileid'], $this->sharedCache->get('subdir/another.txt')['fileid'], $this->sharedCache->get('subdir/emptydir')['fileid'], $this->sharedCache->get('subdir/emptydir2')['fileid']);
     $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
     foreach ($allIds as $id) {
         $tagManager->tagAs($id, 'tag1');
     }
     $results = $this->sharedStorage->getCache()->searchByTag('tag1', $userId);
     $check = array(array('name' => 'shareddir', 'path' => ''), array('name' => 'bar.txt', 'path' => 'bar.txt'), array('name' => 'another.txt', 'path' => 'subdir/another.txt'), array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), array('name' => 'emptydir', 'path' => 'subdir/emptydir'), array('name' => 'emptydir2', 'path' => 'subdir/emptydir2'), array('name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'));
     $this->verifyFiles($check, $results);
     $tagManager->delete(array('tag1'));
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:19,代码来源:cache.php

示例6: testBackgroundScan

 function testBackgroundScan()
 {
     $this->fillTestFolders();
     $this->storage->mkdir('folder2');
     $this->storage->file_put_contents('folder2/bar.txt', 'foobar');
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
     $this->assertFalse($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder/2bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertEquals(-1, $cachedData['size']);
     $this->scanner->backgroundScan();
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertnotEquals(-1, $cachedData['size']);
     $this->assertFalse($this->cache->getIncomplete());
 }
开发者ID:0x17de,项目名称:core,代码行数:17,代码来源:scanner.php

示例7: testBackgroundScanOnlyRecurseIncomplete

 function testBackgroundScanOnlyRecurseIncomplete()
 {
     $this->fillTestFolders();
     $this->storage->mkdir('folder2');
     $this->storage->file_put_contents('folder2/bar.txt', 'foobar');
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
     $this->assertFalse($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder/2bar.txt'));
     $this->assertFalse($this->cache->inCache('folder2/bar.txt'));
     $this->cache->put('folder2', ['size' => 1]);
     // mark as complete
     $cachedData = $this->cache->get('');
     $this->assertEquals(-1, $cachedData['size']);
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE_INCOMPLETE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE);
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder2/bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertNotEquals(-1, $cachedData['size']);
     $this->assertFalse($this->cache->getIncomplete());
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:21,代码来源:ScannerTest.php

示例8: mkdir

 /**
  * see http://php.net/manual/en/function.mkdir.php
  *
  * @param string $path
  * @return bool
  */
 public function mkdir($path)
 {
     return $this->storage->mkdir($path);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:Wrapper.php


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