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


PHP OC_Helper::tmpFolder方法代碼示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->tmpDir = \OC_Helper::tmpFolder() . 'dir.123' . DIRECTORY_SEPARATOR;
     mkdir($this->tmpDir);
     $this->instance = new \OC\Files\Storage\MappedLocal(array('datadir' => $this->tmpDir));
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:7,代碼來源:mappedlocalwithdotteddatadir.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->user = new DummyUser('foo', \OC_Helper::tmpFolder());
     $this->storage = new \OC\Files\Storage\Home(array('user' => $this->user));
     $this->cache = $this->storage->getCache();
 }
開發者ID:evanjt,項目名稱:core,代碼行數:7,代碼來源:homecache.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->datadir = \OC_Helper::tmpFolder();
     file_put_contents($this->datadir . '/.ocdata', '');
     \OC::$server->getSession()->set('checkServer_succeeded', false);
 }
開發者ID:evanjt,項目名稱:core,代碼行數:7,代碼來源:utilcheckserver.php

示例4: setUp

 public function setUp()
 {
     $this->tmpDir = \OC_Helper::tmpFolder();
     $this->userId = uniqid('user_');
     $this->user = new DummyUser($this->userId, $this->tmpDir);
     $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user));
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:7,代碼來源:home.php

示例5: setUp

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

		$this->tmpDir = \OC_Helper::tmpFolder();
		$storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
		$this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000));
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:7,代碼來源:quota.php

示例6: setUp

 function setUp()
 {
     $this->randomTmpDir = \OC_Helper::tmpFolder();
     $this->configFile = $this->randomTmpDir . 'testconfig.php';
     file_put_contents($this->configFile, self::TESTCONTENT);
     $this->config = new OC\Config($this->randomTmpDir, 'testconfig.php');
 }
開發者ID:Romua1d,項目名稱:core,代碼行數:7,代碼來源:config.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->tmpDir = \OC_Helper::tmpFolder();
     $this->userId = $this->getUniqueID('user_');
     $this->user = new DummyUser($this->userId, $this->tmpDir);
     $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user));
 }
開發者ID:evanjt,項目名稱:core,代碼行數:8,代碼來源:home.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear('OC_Filesystem', 'setup');
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
     \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
     $this->datadir = \OC_Config::getValue('datadirectory');
     $this->tmpDir = \OC_Helper::tmpFolder();
     \OC_Config::setValue('datadirectory', $this->tmpDir);
     $this->userBackend = new \OC_User_Dummy();
     \OC_User::useBackend($this->userBackend);
 }
開發者ID:adolfo2103,項目名稱:hcloudfilem,代碼行數:13,代碼來源:etagtest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear('OC_Filesystem', 'setup');
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
     \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
     $this->datadir = \OC_Config::getValue('datadirectory');
     $this->tmpDir = \OC_Helper::tmpFolder();
     \OC_Config::setValue('datadirectory', $this->tmpDir);
     $this->userBackend = new \Test\Util\User\Dummy();
     \OC_User::useBackend($this->userBackend);
 }
開發者ID:DaubaKao,項目名稱:owncloud-core,代碼行數:14,代碼來源:etagtest.php

示例10: addFolder

 /**
  * add an empty folder to the archive
  *
  * @param string $path
  * @return bool
  */
 function addFolder($path)
 {
     $tmpBase = OC_Helper::tmpFolder();
     if (substr($path, -1, 1) != '/') {
         $path .= '/';
     }
     if ($this->fileExists($path)) {
         return false;
     }
     $parts = explode('/', $path);
     $folder = $tmpBase;
     foreach ($parts as $part) {
         $folder .= '/' . $part;
         if (!is_dir($folder)) {
             mkdir($folder);
         }
     }
     $result = $this->tar->addModify(array($tmpBase . $path), '', $tmpBase);
     rmdir($tmpBase . $path);
     $this->fileList = false;
     $this->cachedHeaders = false;
     return $result;
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:29,代碼來源:tar.php

示例11: xtestLongPath

 public function xtestLongPath()
 {
     $storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::mount($storage, array(), '/');
     $rootView = new \OC\Files\View('');
     $longPath = '';
     $ds = DIRECTORY_SEPARATOR;
     /*
      * 4096 is the maximum path length in file_cache.path in *nix
      * 1024 is the max path length in mac
      * 228 is the max path length in windows
      */
     $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789';
     $tmpdirLength = strlen(\OC_Helper::tmpFolder());
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('[Windows] ');
         $depth = (260 - $tmpdirLength) / 57;
     } elseif (\OC_Util::runningOnMac()) {
         $depth = (1024 - $tmpdirLength) / 57;
     } else {
         $depth = (4000 - $tmpdirLength) / 57;
     }
     foreach (range(0, $depth - 1) as $i) {
         $longPath .= $ds . $folderName;
         $result = $rootView->mkdir($longPath);
         $this->assertTrue($result, "mkdir failed on {$i} - path length: " . strlen($longPath));
         $result = $rootView->file_put_contents($longPath . "{$ds}test.txt", 'lorem');
         $this->assertEquals(5, $result, "file_put_contents failed on {$i}");
         $this->assertTrue($rootView->file_exists($longPath));
         $this->assertTrue($rootView->file_exists($longPath . "{$ds}test.txt"));
     }
     $cache = $storage->getCache();
     $scanner = $storage->getScanner();
     $scanner->scan('');
     $longPath = $folderName;
     foreach (range(0, $depth - 1) as $i) {
         $cachedFolder = $cache->get($longPath);
         $this->assertTrue(is_array($cachedFolder), "No cache entry for folder at {$i}");
         $this->assertEquals($folderName, $cachedFolder['name'], "Wrong cache entry for folder at {$i}");
         $cachedFile = $cache->get($longPath . '/test.txt');
         $this->assertTrue(is_array($cachedFile), "No cache entry for file at {$i}");
         $this->assertEquals('test.txt', $cachedFile['name'], "Wrong cache entry for file at {$i}");
         $longPath .= $ds . $folderName;
     }
 }
開發者ID:riso,項目名稱:owncloud-core,代碼行數:45,代碼來源:view.php

示例12: downloadApp

 /**
  * @param array $data
  * @return array
  * @throws Exception
  */
 public static function downloadApp($data = array())
 {
     $l = \OC::$server->getL10N('lib');
     if (!isset($data['source'])) {
         throw new \Exception($l->t("No source specified when installing app"));
     }
     //download the file if necessary
     if ($data['source'] == 'http') {
         $pathInfo = pathinfo($data['href']);
         $path = OC_Helper::tmpFile('.' . $pathInfo['extension']);
         if (!isset($data['href'])) {
             throw new \Exception($l->t("No href specified when installing app from http"));
         }
         copy($data['href'], $path);
     } else {
         if (!isset($data['path'])) {
             throw new \Exception($l->t("No path specified when installing app from local file"));
         }
         $path = $data['path'];
     }
     //detect the archive type
     $mime = OC_Helper::getMimeType($path);
     if ($mime !== 'application/zip' && $mime !== 'application/x-gzip') {
         throw new \Exception($l->t("Archives of type %s are not supported", array($mime)));
     }
     //extract the archive in a temporary folder
     $extractDir = OC_Helper::tmpFolder();
     OC_Helper::rmdirr($extractDir);
     mkdir($extractDir);
     if ($archive = OC_Archive::open($path)) {
         $archive->extract($extractDir);
     } else {
         OC_Helper::rmdirr($extractDir);
         if ($data['source'] == 'http') {
             unlink($path);
         }
         throw new \Exception($l->t("Failed to open archive when installing app"));
     }
     return array($extractDir, $path);
 }
開發者ID:riso,項目名稱:owncloud-core,代碼行數:45,代碼來源:installer.php

示例13: __construct

 public function __construct($arguments = null)
 {
     parent::__construct(array('datadir' => \OC_Helper::tmpFolder()));
 }
開發者ID:loulancn,項目名稱:core,代碼行數:4,代碼來源:temporary.php

示例14: setUp

 public function setUp()
 {
     $this->tmpDir = \OC_Helper::tmpFolder();
     $this->instance = new \OC\Files\Storage\CommonTest(array('datadir' => $this->tmpDir));
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:5,代碼來源:commontest.php

示例15: getStorageData

 /**
  * @return array
  */
 private function getStorageData()
 {
     $dir = OC_Helper::tmpFolder();
     $this->tmpDirs[] = $dir;
     return array('datadir' => $dir);
 }
開發者ID:ryanshoover,項目名稱:core,代碼行數:9,代碼來源:filesystem.php


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