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


PHP Filesystem::initMountManager方法代码示例

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


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

示例1: setupFS

 /**
  * Can be set up
  *
  * @param string $user
  * @return boolean
  * @description configure the initial filesystem based on the configuration
  */
 public static function setupFS($user = '')
 {
     //setting up the filesystem twice can only lead to trouble
     if (self::$fsSetup) {
         return false;
     }
     \OC::$server->getEventLogger()->start('setup_fs', 'Setup filesystem');
     // 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();
     }
     // load all filesystem apps before, so no setup-hook gets lost
     OC_App::loadApps(array('filesystem'));
     // the filesystem will finish when $user is not empty,
     // mark fs setup here to avoid doing the setup from loading
     // OC_Filesystem
     if ($user != '') {
         self::$fsSetup = true;
     }
     \OC\Files\Filesystem::initMountManager();
     \OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
         if ($storage->instanceOfStorage('\\OC\\Files\\Storage\\Common')) {
             /** @var \OC\Files\Storage\Common $storage */
             $storage->setMountOptions($mount->getOptions());
         }
         return $storage;
     });
     // install storage availability wrapper, before most other wrappers
     \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
         if (!$storage->isLocal()) {
             return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
         }
         return $storage;
     });
     \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
         // set up quota for home storages, even for other users
         // which can happen when using sharing
         /**
          * @var \OC\Files\Storage\Storage $storage
          */
         if ($storage->instanceOfStorage('\\OC\\Files\\Storage\\Home') || $storage->instanceOfStorage('\\OC\\Files\\ObjectStore\\HomeObjectStoreStorage')) {
             /** @var \OC\Files\Storage\Home $storage */
             if (is_object($storage->getUser())) {
                 $user = $storage->getUser()->getUID();
                 $quota = OC_Util::getUserQuota($user);
                 if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
                     return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
                 }
             }
         }
         return $storage;
     });
     OC_Hook::emit('OC_Filesystem', 'preSetup', array('user' => $user));
     //check if we are using an object storage
     $objectStore = OC_Config::getValue('objectstore');
     if (isset($objectStore)) {
         self::initObjectStoreRootFS($objectStore);
     } else {
         self::initLocalStorageRootFS();
     }
     if ($user != '' && !OCP\User::userExists($user)) {
         \OC::$server->getEventLogger()->end('setup_fs');
         return false;
     }
     //if we aren't logged in, there is no use to set up the filesystem
     if ($user != "") {
         $userDir = '/' . $user . '/files';
         //jail the user into his "home" directory
         \OC\Files\Filesystem::init($user, $userDir);
         OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
     }
     \OC::$server->getEventLogger()->end('setup_fs');
     return true;
 }
开发者ID:reverserob,项目名称:core,代码行数:81,代码来源:util.php


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