本文整理汇总了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));
}
示例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();
}
示例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);
}
示例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));
}
示例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));
}
示例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');
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例13: __construct
public function __construct($arguments = null)
{
parent::__construct(array('datadir' => \OC_Helper::tmpFolder()));
}
示例14: setUp
public function setUp()
{
$this->tmpDir = \OC_Helper::tmpFolder();
$this->instance = new \OC\Files\Storage\CommonTest(array('datadir' => $this->tmpDir));
}
示例15: getStorageData
/**
* @return array
*/
private function getStorageData()
{
$dir = OC_Helper::tmpFolder();
$this->tmpDirs[] = $dir;
return array('datadir' => $dir);
}