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


PHP OC_Filesystem::createStorage方法代码示例

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


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

示例1: setupFS

 public static function setupFS($user = "", $root = "files")
 {
     // configure the initial filesystem based on the configuration
     if (self::$fsSetup) {
         //setting up the filesystem twice can only lead to trouble
         return false;
     }
     $CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     $CONFIG_BACKUPDIRECTORY = OC_Config::getValue("backupdirectory", OC::$SERVERROOT . "/backup");
     // Create root dir
     if (!is_dir($CONFIG_DATADIRECTORY_ROOT)) {
         $success = @mkdir($CONFIG_DATADIRECTORY_ROOT);
         if (!$success) {
             $tmpl = new OC_Template('', 'error', 'guest');
             $tmpl->assign('errors', array(1 => array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY_ROOT . ")", 'hint' => "You can usually fix this by setting the owner of '" . OC::$SERVERROOT . "' to the user that the web server uses (" . OC_Util::checkWebserverUser() . ")")));
             $tmpl->printPage();
             exit;
         }
     }
     // If we are not forced to load a specific user we load the one that is logged in
     if ($user == "" && OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
     }
     if ($user != "") {
         //if we aren't logged in, there is no use to set up the filesystem
         //first set up the local "root" storage and the backupstorage if needed
         $rootStorage = OC_Filesystem::createStorage('local', array('datadir' => $CONFIG_DATADIRECTORY_ROOT));
         // 			if( OC_Config::getValue( "enablebackup", false )){
         // 				// This creates the Directorys recursively
         // 				if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){
         // 					mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true );
         // 				}
         // 				$backupStorage=OC_Filesystem::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY));
         // 				$backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage));
         // 				$rootStorage->addObserver($backup);
         // 			}
         OC_Filesystem::mount($rootStorage, '/');
         // TODO add this storage provider in a proper way
         $sharedStorage = OC_Filesystem::createStorage('shared', array('datadir' => '/' . OC_User::getUser() . '/files/Shared'));
         OC_Filesystem::mount($sharedStorage, '/' . OC_User::getUser() . '/files/Shared/');
         OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT . "/{$user}/{$root}";
         if (!is_dir(OC::$CONFIG_DATADIRECTORY)) {
             mkdir(OC::$CONFIG_DATADIRECTORY, 0755, true);
         }
         // TODO: find a cool way for doing this
         // 			//set up the other storages according to the system settings
         // 			foreach($CONFIG_FILESYSTEM as $storageConfig){
         // 				if(OC_Filesystem::hasStorageType($storageConfig['type'])){
         // 					$arguments=$storageConfig;
         // 					unset($arguments['type']);
         // 					unset($arguments['mountpoint']);
         // 					$storage=OC_Filesystem::createStorage($storageConfig['type'],$arguments);
         // 					if($storage){
         // 						OC_Filesystem::mount($storage,$storageConfig['mountpoint']);
         // 					}
         // 				}
         // 			}
         //jail the user into his "home" directory
         OC_Filesystem::chroot("/{$user}/{$root}");
         $quotaProxy = new OC_FileProxy_Quota();
         OC_FileProxy::register($quotaProxy);
         self::$fsSetup = true;
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:64,代码来源:owncloud_lib_util.php

示例2: getStorage

 /**
  * get the storage object for a path
  * @param string path
  * @return OC_Filestorage
  */
 public static function getStorage($path)
 {
     $mountpoint = self::getMountPoint($path);
     if ($mountpoint) {
         if (!isset(OC_Filesystem::$storages[$mountpoint])) {
             $mount = OC_Filesystem::$mounts[$mountpoint];
             OC_Filesystem::$storages[$mountpoint] = OC_Filesystem::createStorage($mount['class'], $mount['arguments']);
         }
         return OC_Filesystem::$storages[$mountpoint];
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:16,代码来源:filesystem.php

示例3: getStorage

 /**
  * get the storage object for a path
  * @param string path
  * @return OC_Filestorage
  */
 public static function getStorage($path)
 {
     $user = ltrim(substr($path, 0, strpos($path, '/', 1)), '/');
     // check mount points if file was shared from a different user
     if ($user != OC_User::getUser() && !self::mountPointsLoaded($user)) {
         OC_Util::loadUserMountPoints($user);
         self::loadSystemMountPoints($user);
         self::$loadedUsers[] = $user;
     }
     $mountpoint = self::getMountPoint($path);
     if ($mountpoint) {
         if (!isset(OC_Filesystem::$storages[$mountpoint])) {
             $mount = OC_Filesystem::$mounts[$mountpoint];
             OC_Filesystem::$storages[$mountpoint] = OC_Filesystem::createStorage($mount['class'], $mount['arguments']);
         }
         return OC_Filesystem::$storages[$mountpoint];
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:23,代码来源:filesystem.php


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