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


PHP OC_User::getManager方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable on travis');
     }
     \OC_App::disable('files_sharing');
     \OC_App::disable('files_versions');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         \OC_User::deleteUser($userName);
         \OC_User::createUser($userName, $userName);
     }
     // main test user
     $userName = 'test';
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7);
     $params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName));
     $this->objectStorage = new ObjectStoreToTest($params);
     $params['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($params);
 }
开发者ID:Combustible,项目名称:core,代码行数:28,代码来源:swift.php

示例2: setUp

	protected function setUp(){
		parent::setUp();

		$this->backend = $this->getMock('\OC_User_Dummy');
		$manager = \OC_User::getManager();
		$manager->registerBackend($this->backend);
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:7,代码来源:user.php

示例3: getManager

 /**
  * @return \OC\Group\Manager
  */
 public static function getManager()
 {
     if (self::$manager) {
         return self::$manager;
     }
     self::$userManager = \OC_User::getManager();
     self::$manager = new \OC\Group\Manager(self::$userManager);
     return self::$manager;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:12,代码来源:group.php

示例4:

 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
OC_Util::checkSubAdminUser();
OC_App::setActiveNavigationEntry('core_users');
$userManager = \OC_User::getManager();
$groupManager = \OC_Group::getManager();
// Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME
$sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT;
if (\OC_App::isEnabled('user_ldap')) {
    $isLDAPUsed = $groupManager->isBackendUsed('\\OCA\\user_ldap\\GROUP_LDAP') || $groupManager->isBackendUsed('\\OCA\\user_ldap\\Group_Proxy');
    if ($isLDAPUsed) {
        // LDAP user count can be slow, so we sort by group name here
        $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;
    }
}
$config = \OC::$server->getConfig();
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
$groupsInfo->setSorting($sortGroupsBy);
list($adminGroup, $groups) = $groupsInfo->get();
开发者ID:nem0xff,项目名称:core,代码行数:31,代码来源:users.php

示例5: post_login

 public static function post_login($parameters)
 {
     // Do nothing if we're sharding and not on the master
     if (OCP\App::isEnabled('files_sharding') && !OCA\FilesSharding\Lib::isMaster()) {
         return true;
     }
     $uid = '';
     $userid = $parameters['uid'];
     $samlBackend = new OC_USER_SAML();
     $ocUserDatabase = new OC_User_Database();
     // Redirect regardless of whether the user has authenticated with SAML or not.
     // Since this is a post_login hook, he will have authenticated in some way and have a valid session.
     if ($ocUserDatabase->userExists($userid)) {
         // Set user attributes for sharding
         $display_name = \OCP\User::getDisplayName($userid);
         $email = \OCP\Config::getUserValue($userid, 'settings', 'email');
         $groups = \OC_Group::getUserGroups($userid);
         $quota = \OC_Preferences::getValue($userid, 'files', 'quota');
         OC_Util::teardownFS($userid);
         OC_Util::setupFS($userid);
         OC_Log::write('saml', 'Setting user attributes: ' . $userid . ":" . $display_name . ":" . $email . ":" . join($groups) . ":" . $quota, OC_Log::INFO);
         self::setAttributes($userid, $display_name, $email, $groups, $quota);
         self::user_redirect($userid);
     }
     if (!$samlBackend->auth->isAuthenticated()) {
         return false;
     }
     $attributes = $samlBackend->auth->getAttributes();
     //$email = "<pre>" . print_r($attributes, 1) . "</pre>";
     //$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     //error_log($email, 1, 'cbri@dtu.dk', $headers);
     $usernameFound = false;
     foreach ($samlBackend->usernameMapping as $usernameMapping) {
         if (array_key_exists($usernameMapping, $attributes) && !empty($attributes[$usernameMapping][0])) {
             $usernameFound = true;
             $uid = $attributes[$usernameMapping][0];
             OC_Log::write('saml', 'Authenticated user ' . $uid, OC_Log::INFO);
             break;
         }
     }
     if (!$usernameFound || $uid !== $userid) {
         return false;
     }
     $attrs = self::get_user_attributes($uid, $samlBackend);
     if (!$ocUserDatabase->userExists($uid)) {
         // If autocreate is not enabled - back off
         if (!$samlBackend->autocreate) {
             return false;
         }
         // Apparently it is necessary to clear the uid first, to be able to create the user in the DB
         $userManager = \OC_User::getManager();
         $userManager->delete($uid);
         // Reject invalid user names
         if (preg_match('/[^a-zA-Z0-9 _\\.@\\-]/', $uid)) {
             OC_Log::write('saml', 'Invalid username "' . $uid . '", allowed chars "a-zA-Z0-9" and "_.@-" ', OC_Log::DEBUG);
             return false;
         }
         $cookiedomain = OCP\App::isEnabled('files_sharding') ? OCA\FilesSharding\Lib::getCookieDomain() : null;
         // Reject users we don't allow to autocreate an account
         if (isset($uid) && trim($uid) != '' && !OC_User::userExists($uid) && !self::check_user_attributes($attributes)) {
             $failCookieName = 'saml_auth_fail';
             $userCookieName = 'saml_auth_fail_user';
             $expire = 0;
             //time()+60*60*24*30;
             $expired = time() - 3600;
             $path = '/';
             setcookie($failCookieName, "notallowed:" . $uid, $expire, $path, $cookiedomain, false, false);
             setcookie($userCookieName, $uid, $expire, $path, $cookiedomain, false, false);
             $spSource = 'default-sp';
             $auth = new SimpleSAML_Auth_Simple($spSource);
             OC_Log::write('saml', 'Rejected user "' . $uid, OC_Log::ERROR);
             if (OCP\App::isEnabled('files_sharding') && !OCA\FilesSharding\Lib::isMaster()) {
                 $auth->logout(!OCA\FilesSharding\Lib::getMasterURL());
             } else {
                 $auth->logout();
             }
             return false;
         }
         // Create new user
         $random_password = OC_Util::generateRandomBytes(20);
         OC_Log::write('saml', 'Creating new user: ' . $uid, OC_Log::WARN);
         OC_User::createUser($uid, $random_password);
         if (OC_User::userExists($uid)) {
             $userDir = '/' . $uid . '/files';
             \OC\Files\Filesystem::init($uid, $userDir);
             if ($samlBackend->updateUserData) {
                 self::update_user_data($uid, $samlBackend, $attrs, true);
                 if (OCP\App::isEnabled('files_sharding') && OCA\FilesSharding\Lib::isMaster()) {
                     $master_site = OCA\FilesSharding\Lib::dbGetSite(null);
                     $server_id = OCA\FilesSharding\Lib::dbChooseServerForUser($uid, $master_site, 0, null);
                     OC_Log::write('saml', 'Setting server for new user: ' . $master_site . ":" . $server_id, OC_Log::WARN);
                     OCA\FilesSharding\Lib::dbSetServerForUser($uid, $server_id, 0);
                 }
             }
             self::setAttributes($uid, $attrs['display_name'], $attrs['email'], $attrs['groups'], $attrs['quota']);
         }
     } else {
         if ($samlBackend->updateUserData) {
             self::update_user_data($uid, $samlBackend, $attrs, false);
         }
//.........这里部分代码省略.........
开发者ID:AARNet,项目名称:user_saml,代码行数:101,代码来源:hooks.php

示例6: byUsername

 /**
  * @param string $userName
  * @return integer
  */
 public function byUsername($userName)
 {
     $data = new Home(array('user' => \OC_User::getManager()->get($userName)));
     return KiloBytes::allocateUnits($data->getCache('files')->calculateFolderSize('files'))->units();
 }
开发者ID:arnovr,项目名称:owncloud-statistics,代码行数:9,代码来源:Usage.php

示例7: getStorageUsage

 /**
  * Retrieve storage usage username
  *
  * This method exists, because after vigorous trying, owncloud does not supply a proper way
  * to check somebody's used size
  *
  * @param string $userName
  * @return integer
  */
 public function getStorageUsage($userName)
 {
     $data = new \OC\Files\Storage\Home(array('user' => \OC_User::getManager()->get($userName)));
     return $data->getCache('files')->calculateFolderSize('files');
 }
开发者ID:xn--nding-jua,项目名称:ocusagecharts,代码行数:14,代码来源:storage.php

示例8: 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

示例9: run

 /**
  * Converts legacy home storage ids in the format
  * "local::/data/dir/path/userid/" to the new format "home::userid"
  */
 public function run()
 {
     // only run once
     if ($this->config->getAppValue('core', 'repairlegacystoragesdone') === 'yes') {
         return;
     }
     $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/');
     $dataDir = rtrim($dataDir, '/') . '/';
     $dataDirId = 'local::' . $dataDir;
     $count = 0;
     $hasWarnings = false;
     $this->connection->beginTransaction();
     // note: not doing a direct UPDATE with the REPLACE function
     // because regexp search/extract is needed and it is not guaranteed
     // to work on all database types
     $sql = 'SELECT `id`, `numeric_id` FROM `*PREFIX*storages`' . ' WHERE `id` LIKE ?' . ' ORDER BY `id`';
     $result = $this->connection->executeQuery($sql, array($dataDirId . '%'));
     while ($row = $result->fetch()) {
         $currentId = $row['id'];
         // one entry is the datadir itself
         if ($currentId === $dataDirId) {
             continue;
         }
         try {
             if ($this->fixLegacyStorage($currentId, (int) $row['numeric_id'])) {
                 $count++;
             }
         } catch (\OC\RepairException $e) {
             $hasWarnings = true;
             $this->emit('\\OC\\Repair', 'warning', array('Could not repair legacy storage ' . $currentId . ' automatically.'));
         }
     }
     // check for md5 ids, not in the format "prefix::"
     $sql = 'SELECT COUNT(*) AS "c" FROM `*PREFIX*storages`' . ' WHERE `id` NOT LIKE \'%::%\'';
     $result = $this->connection->executeQuery($sql);
     $row = $result->fetch();
     // find at least one to make sure it's worth
     // querying the user list
     if ((int) $row['c'] > 0) {
         $userManager = \OC_User::getManager();
         // use chunks to avoid caching too many users in memory
         $limit = 30;
         $offset = 0;
         do {
             // query the next page of users
             $results = $userManager->search('', $limit, $offset);
             $storageIds = array();
             $userIds = array();
             foreach ($results as $uid => $userObject) {
                 $storageId = $dataDirId . $uid . '/';
                 if (strlen($storageId) <= 64) {
                     // skip short storage ids as they were handled in the previous section
                     continue;
                 }
                 $storageIds[$uid] = $storageId;
             }
             if (count($storageIds) > 0) {
                 // update the storages of these users
                 foreach ($storageIds as $uid => $storageId) {
                     $numericId = \OC\Files\Cache\Storage::getNumericStorageId($storageId);
                     try {
                         if (!is_null($numericId) && $this->fixLegacyStorage($storageId, (int) $numericId)) {
                             $count++;
                         }
                     } catch (\OC\RepairException $e) {
                         $hasWarnings = true;
                         $this->emit('\\OC\\Repair', 'warning', array('Could not repair legacy storage ' . $storageId . ' automatically.'));
                     }
                 }
             }
             $offset += $limit;
         } while (count($results) >= $limit);
     }
     $this->emit('\\OC\\Repair', 'info', array('Updated ' . $count . ' legacy home storage ids'));
     $this->connection->commit();
     if ($hasWarnings) {
         $this->emit('\\OC\\Repair', 'warning', array('Some legacy storages could not be repaired. Please manually fix them then re-run ./occ maintenance:repair'));
     } else {
         // if all were done, no need to redo the repair during next upgrade
         $this->config->setAppValue('core', 'repairlegacystoragesdone', 'yes');
     }
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:86,代码来源:repairlegacystorages.php

示例10:

<?php

/**
 * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
$application->add(new OCA\Files\Command\Scan(OC_User::getManager()));
开发者ID:omusico,项目名称:isle-web-framework,代码行数:9,代码来源:register_command.php

示例11: testMultiBackend

 public function testMultiBackend()
 {
     $userBackend = new \Test\Util\User\Dummy();
     \OC_User::getManager()->registerBackend($userBackend);
     $backend1 = new OC_Group_Dummy();
     $backend2 = new OC_Group_Dummy();
     OC_Group::useBackend($backend1);
     OC_Group::useBackend($backend2);
     $group1 = $this->getUniqueID();
     $group2 = $this->getUniqueID();
     OC_Group::createGroup($group1);
     //groups should be added to the first registered backend
     $this->assertEquals(array($group1), $backend1->getGroups());
     $this->assertEquals(array(), $backend2->getGroups());
     $this->assertEquals(array($group1), OC_Group::getGroups());
     $this->assertTrue(OC_Group::groupExists($group1));
     $this->assertFalse(OC_Group::groupExists($group2));
     $backend1->createGroup($group2);
     $this->assertEquals(array($group1, $group2), OC_Group::getGroups());
     $this->assertTrue(OC_Group::groupExists($group1));
     $this->assertTrue(OC_Group::groupExists($group2));
     $user1 = $this->getUniqueID();
     $user2 = $this->getUniqueID();
     $userBackend->createUser($user1, '');
     $userBackend->createUser($user2, '');
     $this->assertFalse(OC_Group::inGroup($user1, $group1));
     $this->assertFalse(OC_Group::inGroup($user2, $group1));
     $this->assertTrue(OC_Group::addToGroup($user1, $group1));
     $this->assertTrue(OC_Group::inGroup($user1, $group1));
     $this->assertFalse(OC_Group::inGroup($user2, $group1));
     $this->assertFalse($backend2->inGroup($user1, $group1));
     OC_Group::addToGroup($user1, $group1);
     $this->assertEquals(array($user1), OC_Group::usersInGroup($group1));
     $this->assertEquals(array($group1), OC_Group::getUserGroups($user1));
     $this->assertEquals(array(), OC_Group::getUserGroups($user2));
     OC_Group::deleteGroup($group1);
     $this->assertEquals(array(), OC_Group::getUserGroups($user1));
     $this->assertEquals(array(), OC_Group::usersInGroup($group1));
     $this->assertFalse(OC_Group::inGroup($user1, $group1));
 }
开发者ID:evanjt,项目名称:core,代码行数:40,代码来源:group.php

示例12: 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

示例13: 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

示例14: 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

示例15: getStorageUsageFromCacheByUserName

 /**
  * Retrieve storage usage from cache by username
  *
  * This method exists, because after vigorous trying, owncloud does not supply a proper way
  * to check somebody's used size
  * @param string $userName
  * @return integer
  */
 private function getStorageUsageFromCacheByUserName($userName)
 {
     $data = new \OC\Files\Storage\Home(array('user' => \OC_User::getManager()->get($userName)));
     return $data->getCache('files')->calculateFolderSize('files');
     /*
     $sql = 'select SUM(`size`) as totalsize from oc_filecache WHERE `size` >= 0 AND path LIKE ?';
     $query = $this->db->prepareQuery($sql);
     $result = $query->execute(array($userName . '/files/%'));
     while($row = $result->fetch()) {
         if ( $row['totalsize'] > 0 )
         {
             return $row['totalsize'];
         }
     }
     */
     return 0;
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:25,代码来源:storageusagerepository.php


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