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


PHP OC_Filesystem::getStorage方法代码示例

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


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

示例1: getFreeSpace

 /**
  * get the free space in the path's owner home folder
  * @param path
  * @return int
  */
 private function getFreeSpace($path)
 {
     $storage = OC_Filesystem::getStorage($path);
     $owner = $storage->getOwner($path);
     $totalSpace = $this->getQuota($owner);
     if ($totalSpace == -1) {
         return -1;
     }
     $rootInfo = OC_FileCache::get('', "/" . $owner . "/files");
     // TODO Remove after merge of share_api
     if (OC_FileCache::inCache('/Shared', "/" . $owner . "/files")) {
         $sharedInfo = OC_FileCache::get('/Shared', "/" . $owner . "/files");
     } else {
         $sharedInfo = null;
     }
     $usedSpace = isset($rootInfo['size']) ? $rootInfo['size'] : 0;
     $usedSpace = isset($sharedInfo['size']) ? $usedSpace - $sharedInfo['size'] : $usedSpace;
     return $totalSpace - $usedSpace;
 }
开发者ID:ryanshoover,项目名称:core,代码行数:24,代码来源:quota.php

示例2: getStorage

 /**
  * get the storage object for a path
  * @param string path
  * @return OC_Filestorage
  */
 public function getStorage($path)
 {
     if (!isset($this->storage_cache[$path])) {
         $this->storage_cache[$path] = OC_Filesystem::getStorage($this->getAbsolutePath($path));
     }
     return $this->storage_cache[$path];
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:12,代码来源:filesystemview.php

示例3: touch

 public function touch($path, $mtime = null)
 {
     if ($source = $this->getSourcePath($path)) {
         $storage = OC_Filesystem::getStorage($source);
         return $storage->touch($this->getInternalPath($source), $mtime);
     }
     return false;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:8,代码来源:sharedstorage.php

示例4: get

 /**
  * return the content of a file or return a zip file containning multiply files
  *
  * @param dir  $dir
  * @param file $file ; seperated list of files to download
  * @param boolean $only_header ; boolean to only send header of the request
  */
 public static function get($dir, $files, $only_header = false)
 {
     $xsendfile = false;
     if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
         $xsendfile = true;
     }
     if (strpos($files, ';')) {
         $files = explode(';', $files);
     }
     if (is_array($files)) {
         self::validateZipDownload($dir, $files);
         $executionTime = intval(ini_get('max_execution_time'));
         set_time_limit(0);
         $zip = new ZipArchive();
         if ($xsendfile) {
             $filename = OC_Helper::tmpFileNoClean('.zip');
         } else {
             $filename = OC_Helper::tmpFile('.zip');
         }
         if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             exit("cannot open <{$filename}>\n");
         }
         foreach ($files as $file) {
             $file = $dir . '/' . $file;
             if (OC_Filesystem::is_file($file)) {
                 $tmpFile = OC_Filesystem::toTmpFile($file);
                 self::$tmpFiles[] = $tmpFile;
                 $zip->addFile($tmpFile, basename($file));
             } elseif (OC_Filesystem::is_dir($file)) {
                 self::zipAddDir($file, $zip);
             }
         }
         $zip->close();
         set_time_limit($executionTime);
     } elseif (OC_Filesystem::is_dir($dir . '/' . $files)) {
         self::validateZipDownload($dir, $files);
         $executionTime = intval(ini_get('max_execution_time'));
         set_time_limit(0);
         $zip = new ZipArchive();
         if ($xsendfile) {
             $filename = OC_Helper::tmpFileNoClean('.zip');
         } else {
             $filename = OC_Helper::tmpFile('.zip');
         }
         if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             exit("cannot open <{$filename}>\n");
         }
         $file = $dir . '/' . $files;
         self::zipAddDir($file, $zip);
         $zip->close();
         set_time_limit($executionTime);
     } else {
         $zip = false;
         $filename = $dir . '/' . $files;
     }
     OC_Util::obEnd();
     if ($zip or OC_Filesystem::is_readable($filename)) {
         header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
         header('Content-Transfer-Encoding: binary');
         OC_Response::disableCaching();
         if ($zip) {
             ini_set('zlib.output_compression', 'off');
             header('Content-Type: application/zip');
             header('Content-Length: ' . filesize($filename));
             self::addSendfileHeader($filename);
         } else {
             header('Content-Type: ' . OC_Filesystem::getMimeType($filename));
             $storage = OC_Filesystem::getStorage($filename);
             if ($storage instanceof OC_Filestorage_Local) {
                 self::addSendfileHeader(OC_Filesystem::getLocalFile($filename));
             }
         }
     } elseif ($zip or !OC_Filesystem::file_exists($filename)) {
         header("HTTP/1.0 404 Not Found");
         $tmpl = new OC_Template('', '404', 'guest');
         $tmpl->assign('file', $filename);
         $tmpl->printPage();
     } else {
         header("HTTP/1.0 403 Forbidden");
         die('403 Forbidden');
     }
     if ($only_header) {
         if (!$zip) {
             header("Content-Length: " . OC_Filesystem::filesize($filename));
         }
         return;
     }
     if ($zip) {
         $handle = fopen($filename, 'r');
         if ($handle) {
             $chunkSize = 8 * 1024;
             // 1 MB chunks
             while (!feof($handle)) {
//.........这里部分代码省略.........
开发者ID:ryanshoover,项目名称:core,代码行数:101,代码来源:files.php

示例5: getStorage

 /**
  * get the storage object for a path
  * @param string path
  * @return OC_Filestorage
  */
 public function getStorage($path)
 {
     return OC_Filesystem::getStorage($this->getAbsolutePath($path));
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:9,代码来源:filesystemview.php

示例6: getLocalFile

 public function getLocalFile($path)
 {
     $source = $this->getSource($path);
     if ($source) {
         $storage = OC_Filesystem::getStorage($source);
         return $storage->getLocalFile($this->getInternalPath($source));
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:8,代码来源:owncloud_apps_files_sharing_sharedstorage.php


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