当前位置: 首页>>代码示例>>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;未经允许,请勿转载。