当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::tmpFolder方法代码示例

本文整理汇总了PHP中OCP\Files::tmpFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::tmpFolder方法的具体用法?PHP Files::tmpFolder怎么用?PHP Files::tmpFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Files的用法示例。


在下文中一共展示了Files::tmpFolder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convertLocal

 /**
  * convert via openOffice hosted on the same server
  * @param string $input
  * @param string $targetFilter
  * @param string $targetExtension
  * @return string
  */
 protected static function convertLocal($input, $targetFilter, $targetExtension)
 {
     $infile = \OCP\Files::tmpFile();
     $outdir = \OCP\Files::tmpFolder();
     $cmd = Helper::findOpenOffice();
     $params = ' --headless --convert-to ' . $targetFilter . ' --outdir ' . escapeshellarg($outdir) . ' --writer ' . escapeshellarg($infile) . ' -env:UserInstallation=file://' . escapeshellarg(get_temp_dir() . '/owncloud-' . \OC_Util::getInstanceId() . '/');
     file_put_contents($infile, $input);
     shell_exec($cmd . $params);
     $output = file_get_contents($outdir . '/' . basename($infile) . '.' . $targetExtension);
     return $output;
 }
开发者ID:Ebimedia,项目名称:owncloud,代码行数:18,代码来源:converter.php

示例2: testConversion

 public static function testConversion()
 {
     $targetFilter = 'odt:writer8';
     $targetExtension = 'odt';
     $input = file_get_contents(dirname(__DIR__) . self::TEST_DOC_PATH);
     $infile = \OCP\Files::tmpFile();
     $outdir = \OCP\Files::tmpFolder();
     $outfile = $outdir . '/' . basename($infile) . '.' . $targetExtension;
     $cmd = Helper::findOpenOffice();
     $params = ' --headless --convert-to ' . escapeshellarg($targetFilter) . ' --outdir ' . escapeshellarg($outdir) . ' --writer ' . escapeshellarg($infile) . ' -env:UserInstallation=file://' . escapeshellarg(get_temp_dir() . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' 2>&1';
     file_put_contents($infile, $input);
     $result = shell_exec($cmd . $params);
     $exists = file_exists($outfile);
     if (!$exists) {
         Helper::warnLog('Conversion test failed. Raw output:' . $result);
         return false;
     } else {
         unlink($outfile);
     }
     return true;
 }
开发者ID:Ebimedia,项目名称:owncloud,代码行数:21,代码来源:config.php

示例3: remove

 /**
  * remove a file or folder from the archive
  *
  * @param string $path
  * @return bool
  */
 function remove($path)
 {
     if (!$this->fileExists($path)) {
         return false;
     }
     $this->fileList = false;
     $this->cachedHeaders = false;
     //no proper way to delete, extract entire archive, delete file and remake archive
     $tmp = \OCP\Files::tmpFolder();
     $this->tar->extract($tmp);
     \OCP\Files::rmdirr($tmp . $path);
     $this->tar = null;
     unlink($this->path);
     $this->reopen();
     $this->tar->createModify(array($tmp), '', $tmp);
     return true;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:23,代码来源:TAR.php

示例4: testCheckDataDirectoryValidity

 public function testCheckDataDirectoryValidity()
 {
     $dataDir = \OCP\Files::tmpFolder();
     touch($dataDir . '/.ocdata');
     $errors = \OC_Util::checkDataDirectoryValidity($dataDir);
     $this->assertEmpty($errors);
     \OCP\Files::rmdirr($dataDir);
     $dataDir = \OCP\Files::tmpFolder();
     // no touch
     $errors = \OC_Util::checkDataDirectoryValidity($dataDir);
     $this->assertNotEmpty($errors);
     \OCP\Files::rmdirr($dataDir);
     if (!\OC_Util::runningOnWindows()) {
         $errors = \OC_Util::checkDataDirectoryValidity('relative/path');
         $this->assertNotEmpty($errors);
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:17,代码来源:UtilTest.php

示例5: testExtract

 public function testExtract()
 {
     $dir = \OC::$SERVERROOT . '/tests/data';
     $this->instance = $this->getExisting();
     $tmpDir = \OCP\Files::tmpFolder();
     $this->instance->extract($tmpDir);
     $this->assertEquals(true, file_exists($tmpDir . 'lorem.txt'));
     $this->assertEquals(true, file_exists($tmpDir . 'dir/lorem.txt'));
     $this->assertEquals(true, file_exists($tmpDir . 'logo-wide.png'));
     $this->assertEquals(file_get_contents($dir . '/lorem.txt'), file_get_contents($tmpDir . 'lorem.txt'));
     \OCP\Files::rmdirr($tmpDir);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:12,代码来源:TestBase.php


注:本文中的OCP\Files::tmpFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。