本文整理汇总了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');
}
示例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');
}
示例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()');
}
示例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']);
}
}
示例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'));
}
示例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());
}
示例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());
}
示例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);
}