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


PHP Storage::exists方法代码示例

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


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

示例1: getHomeMountForUser

 /**
  * Get the cache mount for a user
  *
  * @param IUser $user
  * @param IStorageFactory $loader
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getHomeMountForUser(IUser $user, IStorageFactory $loader)
 {
     $arguments = ['user' => $user];
     if (\OC\Files\Cache\Storage::exists('local::' . $user->getHome() . '/')) {
         $arguments['legacy'] = true;
     }
     return new MountPoint('\\OC\\Files\\Storage\\Home', '/' . $user->getUID(), $arguments, $loader);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:LocalHomeMountProvider.php

示例2: initMountPoints

 /**
  * Initialize system and personal mount points for a user
  *
  * @param string $user
  * @throws \OC\User\NoUserException if the user is not available
  */
 public static function initMountPoints($user = '')
 {
     if ($user == '') {
         $user = \OC_User::getUser();
     }
     if ($user === null || $user === false || $user === '') {
         throw new \OC\User\NoUserException('Attempted to initialize mount points for null user and no user in session');
     }
     if (isset(self::$usersSetup[$user])) {
         return;
     }
     $root = \OC_User::getHome($user);
     $userManager = \OC::$server->getUserManager();
     $userObject = $userManager->get($user);
     if (is_null($userObject)) {
         \OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR);
         throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
     }
     self::$usersSetup[$user] = true;
     $homeStorage = \OC::$server->getConfig()->getSystemValue('objectstore');
     if (!empty($homeStorage)) {
         // sanity checks
         if (empty($homeStorage['class'])) {
             \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
         }
         if (!isset($homeStorage['arguments'])) {
             $homeStorage['arguments'] = array();
         }
         // instantiate object store implementation
         $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']);
         // mount with home object store implementation
         $homeStorage['class'] = '\\OC\\Files\\ObjectStore\\HomeObjectStoreStorage';
     } else {
         $homeStorage = array('class' => '\\OC\\Files\\Storage\\Home', 'arguments' => array());
     }
     $homeStorage['arguments']['user'] = $userObject;
     // check for legacy home id (<= 5.0.12)
     if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
         $homeStorage['arguments']['legacy'] = true;
     }
     $mount = new MountPoint($homeStorage['class'], '/' . $user, $homeStorage['arguments'], self::getLoader());
     self::getMountManager()->addMount($mount);
     $home = \OC\Files\Filesystem::getStorage($user);
     // Chance to mount for other storages
     /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
     $mountConfigManager = \OC::$server->getMountProviderCollection();
     if ($userObject) {
         $mounts = $mountConfigManager->getMountsForUser($userObject);
         array_walk($mounts, array(self::$mounts, 'addMount'));
         $mounts[] = $mount;
         $mountConfigManager->registerMounts($userObject, $mounts);
     }
     self::listenForNewMountProviders($mountConfigManager, $userManager);
     \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root));
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:61,代码来源:Filesystem.php

示例3: initMountPoints

 /**
  * Initialize system and personal mount points for a user
  *
  * @param string $user
  */
 public static function initMountPoints($user = '')
 {
     if ($user == '') {
         $user = \OC_User::getUser();
     }
     $parser = new \OC\ArrayParser();
     $root = \OC_User::getHome($user);
     $userObject = \OC_User::getManager()->get($user);
     if (is_null($userObject)) {
         \OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR);
         throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
     }
     $homeStorage = \OC_Config::getValue('objectstore');
     if (!empty($homeStorage)) {
         // sanity checks
         if (empty($homeStorage['class'])) {
             \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
         }
         if (!isset($homeStorage['arguments'])) {
             $homeStorage['arguments'] = array();
         }
         // instantiate object store implementation
         $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']);
         // mount with home object store implementation
         $homeStorage['class'] = '\\OC\\Files\\ObjectStore\\HomeObjectStoreStorage';
     } else {
         $homeStorage = array('class' => '\\OC\\Files\\Storage\\Home', 'arguments' => array());
     }
     $homeStorage['arguments']['user'] = $userObject;
     // check for legacy home id (<= 5.0.12)
     if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
         $homeStorage['arguments']['legacy'] = true;
     }
     self::mount($homeStorage['class'], $homeStorage['arguments'], $user);
     $home = \OC\Files\Filesystem::getStorage($user);
     self::mountCacheDir($user);
     // Chance to mount for other storages
     \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root));
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:44,代码来源:filesystem.php

示例4: initMountPoints

 /**
  * Initialize system and personal mount points for a user
  *
  * @param string $user
  */
 public static function initMountPoints($user = '')
 {
     if ($user == '') {
         $user = \OC_User::getUser();
     }
     if (isset(self::$usersSetup[$user])) {
         return;
     }
     self::$usersSetup[$user] = true;
     $root = \OC_User::getHome($user);
     $userObject = \OC_User::getManager()->get($user);
     if (!is_null($userObject)) {
         $homeStorage = \OC_Config::getValue('objectstore');
         if (!empty($homeStorage)) {
             // sanity checks
             if (empty($homeStorage['class'])) {
                 \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
             }
             if (!isset($homeStorage['arguments'])) {
                 $homeStorage['arguments'] = array();
             }
             // instantiate object store implementation
             $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']);
             // mount with home object store implementation
             $homeStorage['class'] = '\\OC\\Files\\ObjectStore\\HomeObjectStoreStorage';
         } else {
             $homeStorage = array('class' => '\\OC\\Files\\Storage\\Home', 'arguments' => array());
         }
         $homeStorage['arguments']['user'] = $userObject;
         // check for legacy home id (<= 5.0.12)
         if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
             $homeStorage['arguments']['legacy'] = true;
         }
         self::mount($homeStorage['class'], $homeStorage['arguments'], $user);
         $home = \OC\Files\Filesystem::getStorage($user);
     } else {
         self::mount('\\OC\\Files\\Storage\\Local', array('datadir' => $root), $user);
     }
     self::mountCacheDir($user);
     // Chance to mount for other storages
     if ($userObject) {
         $mountConfigManager = \OC::$server->getMountProviderCollection();
         $mounts = $mountConfigManager->getMountsForUser($userObject);
         array_walk($mounts, array(self::$mounts, 'addMount'));
     }
     \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root));
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:52,代码来源:filesystem.php

示例5: initMountPoints

 /**
  * Initialize system and personal mount points for a user
  *
  * @param string $user
  */
 public static function initMountPoints($user = '')
 {
     if ($user == '') {
         $user = \OC_User::getUser();
     }
     $parser = new \OC\ArrayParser();
     $root = \OC_User::getHome($user);
     $userObject = \OC_User::getManager()->get($user);
     if (!is_null($userObject)) {
         // check for legacy home id (<= 5.0.12)
         if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
             self::mount('\\OC\\Files\\Storage\\Home', array('user' => $userObject, 'legacy' => true), $user);
         } else {
             self::mount('\\OC\\Files\\Storage\\Home', array('user' => $userObject), $user);
         }
     } else {
         self::mount('\\OC\\Files\\Storage\\Local', array('datadir' => $root), $user);
     }
     // Chance to mount for other storages
     \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root));
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:26,代码来源:filesystem.php

示例6: initMountPoints

 /**
  * Initialize system and personal mount points for a user
  *
  * @param string $user
  */
 public static function initMountPoints($user = '')
 {
     if ($user == '') {
         $user = \OC_User::getUser();
     }
     $parser = new \OC\ArrayParser();
     $root = \OC_User::getHome($user);
     $userObject = \OC_User::getManager()->get($user);
     if (!is_null($userObject)) {
         // check for legacy home id (<= 5.0.12)
         if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
             self::mount('\\OC\\Files\\Storage\\Home', array('user' => $userObject, 'legacy' => true), $user);
         } else {
             self::mount('\\OC\\Files\\Storage\\Home', array('user' => $userObject), $user);
         }
     } else {
         self::mount('\\OC\\Files\\Storage\\Local', array('datadir' => $root), $user);
     }
     $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
     //move config file to it's new position
     if (is_file(\OC::$SERVERROOT . '/config/mount.json')) {
         rename(\OC::$SERVERROOT . '/config/mount.json', $datadir . '/mount.json');
     }
     // Load system mount points
     if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file($datadir . '/mount.json')) {
         if (is_file($datadir . '/mount.json')) {
             $mountConfig = json_decode(file_get_contents($datadir . '/mount.json'), true);
         } elseif (is_file(\OC::$SERVERROOT . '/config/mount.php')) {
             $mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php'));
         }
         if (isset($mountConfig['global'])) {
             foreach ($mountConfig['global'] as $mountPoint => $options) {
                 self::mount($options['class'], $options['options'], $mountPoint);
             }
         }
         if (isset($mountConfig['group'])) {
             foreach ($mountConfig['group'] as $group => $mounts) {
                 if (\OC_Group::inGroup($user, $group)) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($user, $mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($user, $option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
         if (isset($mountConfig['user'])) {
             foreach ($mountConfig['user'] as $mountUser => $mounts) {
                 if ($mountUser === 'all' or strtolower($mountUser) === strtolower($user)) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($user, $mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($user, $option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
     }
     // Load personal mount points
     if (is_file($root . '/mount.php') or is_file($root . '/mount.json')) {
         if (is_file($root . '/mount.json')) {
             $mountConfig = json_decode(file_get_contents($root . '/mount.json'), true);
         } elseif (is_file($root . '/mount.php')) {
             $mountConfig = $parser->parsePHP(file_get_contents($root . '/mount.php'));
         }
         if (isset($mountConfig['user'][$user])) {
             foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
                 self::mount($options['class'], $options['options'], $mountPoint);
             }
         }
     }
     // Chance to mount for other storages
     \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:83,代码来源:filesystem.php


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