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


PHP Folder::newFolder方法代碼示例

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


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

示例1: testUpdateFileTags

 public function testUpdateFileTags()
 {
     $tag1 = 'tag1';
     $tag2 = 'tag2';
     $subdir = $this->root->newFolder('subdir');
     $testFile = $subdir->newFile('test.txt');
     $testFile->putContent('test contents');
     $fileId = $testFile->getId();
     // set tags
     $this->tagService->updateFileTags('subdir/test.txt', array($tag1, $tag2));
     $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag1));
     $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2));
     // remove tag
     $result = $this->tagService->updateFileTags('subdir/test.txt', array($tag2));
     $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1));
     $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2));
     // clear tags
     $result = $this->tagService->updateFileTags('subdir/test.txt', array());
     $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1));
     $this->assertEquals(array(), $this->tagger->getIdsForTag($tag2));
     // non-existing file
     $caught = false;
     try {
         $this->tagService->updateFileTags('subdir/unexist.txt', array($tag1));
     } catch (\OCP\Files\NotFoundException $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
     $subdir->delete();
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:30,代碼來源:tagservice.php

示例2: copyr

	/**
	 * copies a directory recursively by using streams
	 *
	 * @param string $source
	 * @param \OCP\Files\Folder $target
	 * @return void
	 */
	public static function copyr($source, \OCP\Files\Folder $target) {
		$dir = opendir($source);
		while (false !== ($file = readdir($dir))) {
			if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
				if (is_dir($source . '/' . $file)) {
					$child = $target->newFolder($file);
					self::copyr($source . '/' . $file, $child);
				} else {
					$child = $target->newFile($file);
					stream_copy_to_stream(fopen($source . '/' . $file,'r'), $child->fopen('w'));
				}
			}
		}
		closedir($dir);
	}
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:22,代碼來源:util.php

示例3: getOrCreateSubFolder

 /**
  * @param \OCP\Files\Folder $parent
  * @param string $folderName
  * @return \OCP\Files\Folder
  * @throws SetUpException
  */
 private function getOrCreateSubFolder(Folder $parent, $folderName)
 {
     if ($parent->nodeExists($folderName)) {
         return $parent->get($folderName);
     } else {
         return $parent->newFolder($folderName);
     }
 }
開發者ID:ntvis,項目名稱:search_lucene,代碼行數:14,代碼來源:files.php

示例4: createStructure

 /**
  * Creates the folder structure and adds test images
  *
  * This could be refined by adding tests to make sure we have access to the files
  *
  * @param Folder $baseFolder
  * @param array <string|int,string|array> $structure
  */
 private function createStructure($baseFolder, $structure)
 {
     foreach ($structure as $key => $value) {
         if (is_array($value)) {
             $subFolder = $baseFolder->newFolder($key);
             if ($key === $this->sharedFolderName) {
                 $this->sharedFolder = $subFolder;
             }
             if (!empty($value)) {
                 $this->createStructure($subFolder, $value);
             }
         } else {
             $file = $this->addFile($baseFolder, $value, $value);
             if ($value === $this->sharedFileName) {
                 $this->sharedFile = $file;
             }
         }
     }
 }
開發者ID:enoch85,項目名稱:owncloud-testserver,代碼行數:27,代碼來源:DataSetup.php


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