diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 45 | ||||
-rw-r--r-- | lib/private/Files/Mount/LocalHomeMountProvider.php | 3 | ||||
-rw-r--r-- | lib/private/Files/Storage/Home.php | 11 | ||||
-rw-r--r-- | lib/private/Group/Backend.php | 15 | ||||
-rw-r--r-- | lib/private/Group/Group.php | 14 | ||||
-rw-r--r-- | lib/private/Group/Manager.php | 16 | ||||
-rw-r--r-- | lib/private/IntegrityCheck/Checker.php | 48 | ||||
-rw-r--r-- | lib/private/IntegrityCheck/Helpers/FileAccessHelper.php | 29 | ||||
-rw-r--r-- | lib/private/Memcache/Memcached.php | 2 | ||||
-rw-r--r-- | lib/private/Repair.php | 2 | ||||
-rw-r--r-- | lib/private/Repair/RepairLegacyStorages.php | 257 | ||||
-rw-r--r-- | lib/private/Server.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 8 | ||||
-rw-r--r-- | lib/private/legacy/user.php | 11 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 4 |
15 files changed, 152 insertions, 315 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 48792aa685b..1d0deada696 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -1,4 +1,5 @@ <?php + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -26,9 +27,11 @@ use Exception; use OC; use OC\App\AppManager; use OC_App; +use OCP\Activity\IManager; use OCP\AppFramework\QueryException; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\IConfig; +use OCP\ILogger; use OCP\ISession; use OCP\IUser; @@ -48,15 +51,26 @@ class Manager { /** @var IConfig */ private $config; + /** @var IManager */ + private $activityManager; + + /** @var ILogger */ + private $logger; + /** * @param AppManager $appManager * @param ISession $session * @param IConfig $config + * @param IManager $activityManager + * @param ILogger $logger */ - public function __construct(AppManager $appManager, ISession $session, IConfig $config) { + public function __construct(AppManager $appManager, ISession $session, IConfig $config, IManager $activityManager, + ILogger $logger) { $this->appManager = $appManager; $this->session = $session; $this->config = $config; + $this->activityManager = $activityManager; + $this->logger = $logger; } /** @@ -184,11 +198,40 @@ class Manager { } $this->session->remove(self::SESSION_UID_KEY); $this->session->remove(self::REMEMBER_LOGIN); + + $this->publishEvent($user, 'twofactor_success', [ + 'provider' => $provider->getDisplayName(), + ]); + } else { + $this->publishEvent($user, 'twofactor_failed', [ + 'provider' => $provider->getDisplayName(), + ]); } return $passed; } /** + * Push a 2fa event the user's activity stream + * + * @param IUser $user + * @param string $event + */ + private function publishEvent(IUser $user, $event, array $params) { + $activity = $this->activityManager->generateEvent(); + $activity->setApp('twofactor_generic') + ->setType('twofactor') + ->setAuthor($user->getUID()) + ->setAffectedUser($user->getUID()) + ->setSubject($event, $params); + try { + $this->activityManager->publish($activity); + } catch (Exception $e) { + $this->logger->warning('could not publish backup code creation activity', ['app' => 'twofactor_backupcodes']); + $this->logger->logException($e, ['app' => 'twofactor_backupcodes']); + } + } + + /** * Check if the currently logged in user needs to pass 2FA * * @param IUser $user the currently logged in user diff --git a/lib/private/Files/Mount/LocalHomeMountProvider.php b/lib/private/Files/Mount/LocalHomeMountProvider.php index 23bbfcd5ffa..9057f62995f 100644 --- a/lib/private/Files/Mount/LocalHomeMountProvider.php +++ b/lib/private/Files/Mount/LocalHomeMountProvider.php @@ -39,9 +39,6 @@ class LocalHomeMountProvider implements IHomeMountProvider { */ 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); } } diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index e5ba0f9dfe4..57b32349324 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -44,19 +44,12 @@ class Home extends Local implements \OCP\Files\IHomeStorage { /** * Construct a Home storage instance * @param array $arguments array with "user" containing the - * storage owner and "legacy" containing "true" if the storage is - * a legacy storage with "local::" URL instead of the new "home::" one. + * storage owner */ public function __construct($arguments) { $this->user = $arguments['user']; $datadir = $this->user->getHome(); - if (isset($arguments['legacy']) && $arguments['legacy']) { - // legacy home id (<= 5.0.12) - $this->id = 'local::' . $datadir . '/'; - } - else { - $this->id = 'home::' . $this->user->getUID(); - } + $this->id = 'home::' . $this->user->getUID(); parent::__construct(array('datadir' => $datadir)); } diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index 14c36d93422..1e8d62f5e42 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -31,23 +31,14 @@ abstract class Backend implements \OCP\GroupInterface { */ const NOT_IMPLEMENTED = -501; - /** - * actions that user backends can define - */ - const CREATE_GROUP = 0x00000001; - const DELETE_GROUP = 0x00000010; - const ADD_TO_GROUP = 0x00000100; - const REMOVE_FROM_GOUP = 0x00001000; - //OBSOLETE const GET_DISPLAYNAME = 0x00010000; - const COUNT_USERS = 0x00100000; - - protected $possibleActions = array( + protected $possibleActions = [ self::CREATE_GROUP => 'createGroup', self::DELETE_GROUP => 'deleteGroup', self::ADD_TO_GROUP => 'addToGroup', self::REMOVE_FROM_GOUP => 'removeFromGroup', self::COUNT_USERS => 'countUsersInGroup', - ); + self::GROUP_DETAILS => 'getGroupDetails', + ]; /** * Get all supported actions diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 9379d604c48..69dce215694 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -31,6 +31,9 @@ namespace OC\Group; use OCP\IGroup; class Group implements IGroup { + /** @var null|string */ + protected $displayName; + /** * @var string $id */ @@ -66,18 +69,27 @@ class Group implements IGroup { * @param \OC\Group\Backend[] $backends * @param \OC\User\Manager $userManager * @param \OC\Hooks\PublicEmitter $emitter + * @param string $displayName */ - public function __construct($gid, $backends, $userManager, $emitter = null) { + public function __construct($gid, $backends, $userManager, $emitter = null, $displayName = null) { $this->gid = $gid; $this->backends = $backends; $this->userManager = $userManager; $this->emitter = $emitter; + $this->displayName = $displayName; } public function getGID() { return $this->gid; } + public function getDisplayName() { + if (is_null($this->displayName)) { + return $this->gid; + } + return $this->displayName; + } + /** * get all users in the group * diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 31911138985..944598a8296 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -155,19 +155,29 @@ class Manager extends PublicEmitter implements IGroupManager { /** * @param string $gid + * @param string $displayName * @return \OCP\IGroup */ - protected function getGroupObject($gid) { + protected function getGroupObject($gid, $displayName = null) { $backends = array(); foreach ($this->backends as $backend) { - if ($backend->groupExists($gid)) { + if ($backend->implementsActions(\OC\Group\Backend::GROUP_DETAILS)) { + $groupData = $backend->getGroupDetails($gid); + if (is_array($groupData)) { + // take the display name from the first backend that has a non-null one + if (is_null($displayName) && isset($groupData['displayName'])) { + $displayName = $groupData['displayName']; + } + $backends[] = $backend; + } + } else if ($backend->groupExists($gid)) { $backends[] = $backend; } } if (count($backends) === 0) { return null; } - $this->cachedGroups[$gid] = new Group($gid, $backends, $this->userManager, $this); + $this->cachedGroups[$gid] = new Group($gid, $backends, $this->userManager, $this, $displayName); return $this->cachedGroups[$gid]; } diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index cba290e6aa7..419f989fa0f 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -267,16 +267,23 @@ class Checker { public function writeAppSignature($path, X509 $certificate, RSA $privateKey) { - if(!is_dir($path)) { - throw new \Exception('Directory does not exist.'); - } - $iterator = $this->getFolderIterator($path); - $hashes = $this->generateHashes($iterator, $path); - $signature = $this->createSignatureData($hashes, $certificate, $privateKey); - $this->fileAccessHelper->file_put_contents( - $path . '/appinfo/signature.json', + $appInfoDir = $path . '/appinfo'; + try { + $this->fileAccessHelper->assertDirectoryExists($appInfoDir); + + $iterator = $this->getFolderIterator($path); + $hashes = $this->generateHashes($iterator, $path); + $signature = $this->createSignatureData($hashes, $certificate, $privateKey); + $this->fileAccessHelper->file_put_contents( + $appInfoDir . '/signature.json', json_encode($signature, JSON_PRETTY_PRINT) - ); + ); + } catch (\Exception $e){ + if (!$this->fileAccessHelper->is_writable($appInfoDir)) { + throw new \Exception($appInfoDir . ' is not writable'); + } + throw $e; + } } /** @@ -285,17 +292,28 @@ class Checker { * @param X509 $certificate * @param RSA $rsa * @param string $path + * @throws \Exception */ public function writeCoreSignature(X509 $certificate, RSA $rsa, $path) { - $iterator = $this->getFolderIterator($path, $path); - $hashes = $this->generateHashes($iterator, $path); - $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); - $this->fileAccessHelper->file_put_contents( - $path . '/core/signature.json', + $coreDir = $path . '/core'; + try { + + $this->fileAccessHelper->assertDirectoryExists($coreDir); + $iterator = $this->getFolderIterator($path, $path); + $hashes = $this->generateHashes($iterator, $path); + $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); + $this->fileAccessHelper->file_put_contents( + $coreDir . '/signature.json', json_encode($signatureData, JSON_PRETTY_PRINT) - ); + ); + } catch (\Exception $e){ + if (!$this->fileAccessHelper->is_writable($coreDir)) { + throw new \Exception($coreDir . ' is not writable'); + } + throw $e; + } } /** diff --git a/lib/private/IntegrityCheck/Helpers/FileAccessHelper.php b/lib/private/IntegrityCheck/Helpers/FileAccessHelper.php index 9e2b76ce11a..a7e378c165e 100644 --- a/lib/private/IntegrityCheck/Helpers/FileAccessHelper.php +++ b/lib/private/IntegrityCheck/Helpers/FileAccessHelper.php @@ -53,10 +53,33 @@ class FileAccessHelper { * Wrapper around file_put_contents($filename, $data) * * @param string $filename - * @param $data - * @return int|false + * @param string $data + * @return int + * @throws \Exception */ public function file_put_contents($filename, $data) { - return file_put_contents($filename, $data); + $bytesWritten = @file_put_contents($filename, $data); + if ($bytesWritten === false || $bytesWritten !== strlen($data)){ + throw new \Exception('Failed to write into ' . $filename); + } + return $bytesWritten; + } + + /** + * @param string $path + * @return bool + */ + public function is_writable($path) { + return is_writable($path); + } + + /** + * @param string $path + * @throws \Exception + */ + public function assertDirectoryExists($path) { + if (!is_dir($path)) { + throw new \Exception('Directory ' . $path . ' does not exist.'); + } } } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index dbff6dc2ec2..bf07fd0e6e7 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -61,7 +61,7 @@ class Memcached extends Cache implements IMemcache { \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, // Enable Binary Protocol - \Memcached::OPT_BINARY_PROTOCOL => true, + //\Memcached::OPT_BINARY_PROTOCOL => true, ]; // by default enable igbinary serializer if available if (\Memcached::HAVE_IGBINARY) { diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 16236fd6bcc..f1bf586b49d 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -48,7 +48,6 @@ use OC\Repair\SqliteAutoincrement; use OC\Repair\DropOldTables; use OC\Repair\FillETags; use OC\Repair\InnoDB; -use OC\Repair\RepairLegacyStorages; use OC\Repair\RepairMimeTypes; use OC\Repair\SearchLuceneTables; use OC\Repair\UpdateOutdatedOcsIds; @@ -133,7 +132,6 @@ class Repair implements IOutput{ return [ new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), new RepairMimeTypes(\OC::$server->getConfig()), - new RepairLegacyStorages(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), new AssetCache(), new FillETags(\OC::$server->getDatabaseConnection()), new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), diff --git a/lib/private/Repair/RepairLegacyStorages.php b/lib/private/Repair/RepairLegacyStorages.php deleted file mode 100644 index 228bdb67fe8..00000000000 --- a/lib/private/Repair/RepairLegacyStorages.php +++ /dev/null @@ -1,257 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Aaron Wood <aaronjwood@gmail.com> - * @author Joas Schilling <coding@schilljs.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Vincent Petry <pvince81@owncloud.com> - * - * @license AGPL-3.0 - * - * 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/> - * - */ - -namespace OC\Repair; - -use OC\Files\Cache\Storage; -use OC\RepairException; -use OCP\Migration\IOutput; -use OCP\Migration\IRepairStep; - -class RepairLegacyStorages implements IRepairStep{ - /** - * @var \OCP\IConfig - */ - protected $config; - - /** - * @var \OCP\IDBConnection - */ - protected $connection; - - protected $findStorageInCacheStatement; - protected $renameStorageStatement; - - /** - * @param \OCP\IConfig $config - * @param \OCP\IDBConnection $connection - */ - public function __construct($config, $connection) { - $this->connection = $connection; - $this->config = $config; - - $this->findStorageInCacheStatement = $this->connection->prepare( - 'SELECT DISTINCT `storage` FROM `*PREFIX*filecache`' - . ' WHERE `storage` in (?, ?)' - ); - $this->renameStorageStatement = $this->connection->prepare( - 'UPDATE `*PREFIX*storages`' - . ' SET `id` = ?' - . ' WHERE `id` = ?' - ); - } - - public function getName() { - return 'Repair legacy storages'; - } - - /** - * Extracts the user id from a legacy storage id - * - * @param string $storageId legacy storage id in the - * format "local::/path/to/datadir/userid" - * @return string user id extracted from the storage id - */ - private function extractUserId($storageId) { - $storageId = rtrim($storageId, '/'); - $pos = strrpos($storageId, '/'); - return substr($storageId, $pos + 1); - } - - /** - * Fix the given legacy storage by renaming the old id - * to the new id. If the new id already exists, whichever - * storage that has data in the file cache will be used. - * If both have data, nothing will be done and false is - * returned. - * - * @param string $oldId old storage id - * @param int $oldNumericId old storage numeric id - * @param string $userId - * @return bool true if fixed, false otherwise - * @throws RepairException - */ - private function fixLegacyStorage($oldId, $oldNumericId, $userId = null) { - // check whether the new storage already exists - if (is_null($userId)) { - $userId = $this->extractUserId($oldId); - } - $newId = 'home::' . $userId; - - // check if target id already exists - $newNumericId = Storage::getNumericStorageId($newId); - if (!is_null($newNumericId)) { - $newNumericId = (int)$newNumericId; - // try and resolve the conflict - // check which one of "local::" or "home::" needs to be kept - $this->findStorageInCacheStatement->execute(array($oldNumericId, $newNumericId)); - $row1 = $this->findStorageInCacheStatement->fetch(); - $row2 = $this->findStorageInCacheStatement->fetch(); - $this->findStorageInCacheStatement->closeCursor(); - if ($row2 !== false) { - // two results means both storages have data, not auto-fixable - throw new RepairException( - 'Could not automatically fix legacy storage ' - . '"' . $oldId . '" => "' . $newId . '"' - . ' because they both have data.' - ); - } - if ($row1 === false || (int)$row1['storage'] === $oldNumericId) { - // old storage has data, then delete the empty new id - $toDelete = $newId; - } else if ((int)$row1['storage'] === $newNumericId) { - // new storage has data, then delete the empty old id - $toDelete = $oldId; - } else { - // unknown case, do not continue - return false; - } - - // delete storage including file cache - Storage::remove($toDelete); - - // if we deleted the old id, the new id will be used - // automatically - if ($toDelete === $oldId) { - // nothing more to do - return true; - } - } - - // rename old id to new id - $newId = Storage::adjustStorageId($newId); - $oldId = Storage::adjustStorageId($oldId); - $rowCount = $this->renameStorageStatement->execute(array($newId, $oldId)); - $this->renameStorageStatement->closeCursor(); - return ($rowCount === 1); - } - - /** - * Converts legacy home storage ids in the format - * "local::/data/dir/path/userid/" to the new format "home::userid" - */ - public function run(IOutput $out) { - // 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($this->connection->escapeLikeParameter($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 (RepairException $e) { - $hasWarnings = true; - $out->warning('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::$server->getUserManager(); - - // 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(); - 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 = Storage::getNumericStorageId($storageId); - try { - if (!is_null($numericId) && $this->fixLegacyStorage($storageId, (int)$numericId)) { - $count++; - } - } - catch (RepairException $e) { - $hasWarnings = true; - $out->warning('Could not repair legacy storage ' . $storageId . ' automatically.'); - } - } - } - $offset += $limit; - } while (count($results) >= $limit); - } - - $out->info('Updated ' . $count . ' legacy home storage ids'); - - $this->connection->commit(); - - Storage::getGlobalCache()->clearCache(); - - if ($hasWarnings) { - $out->warning('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'); - } - } -} diff --git a/lib/private/Server.php b/lib/private/Server.php index 969e5a25b9b..6f4d4f066e7 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -312,7 +312,7 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { - return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig()); + return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger()); }); $this->registerService('NavigationManager', function ($c) { diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index cd1d52c3bbf..6eab5e05a2f 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1055,8 +1055,10 @@ class Manager implements IManager { public function getShareByToken($token) { $share = null; try { - $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); - $share = $provider->getShareByToken($token); + if($this->shareApiAllowLinks()) { + $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); + $share = $provider->getShareByToken($token); + } } catch (ProviderException $e) { } catch (ShareNotFound $e) { } @@ -1072,7 +1074,7 @@ class Manager implements IManager { } } - // If it is not a link share try to fetch a federated share by token + // If it is not a link share try to fetch a mail share by token if ($share === null && $this->shareProviderExists(\OCP\Share::SHARE_TYPE_EMAIL)) { try { $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_EMAIL); diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index ed0d14a1ab9..0a52be7565d 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -125,9 +125,16 @@ class OC_User { * setup the configured backends in config.php */ public static function setupBackends() { - OC_App::loadApps(array('prelogin')); - $backends = \OC::$server->getSystemConfig()->getValue('user_backends', array()); + OC_App::loadApps(['prelogin']); + $backends = \OC::$server->getSystemConfig()->getValue('user_backends', []); + if (isset($backends['default']) && !$backends['default']) { + // clear default backends + self::clearBackends(); + } foreach ($backends as $i => $config) { + if (!is_array($config)) { + continue; + } $class = $config['class']; $arguments = $config['arguments']; if (class_exists($class)) { diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 55dc5ae7c15..d97ba37c4c0 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -1381,12 +1381,12 @@ class OC_Util { } /** - * A human readable string is generated based on version, channel and build number + * A human readable string is generated based on version and build number * * @return string */ public static function getHumanVersion() { - $version = OC_Util::getVersionString() . ' (' . OC_Util::getChannel() . ')'; + $version = OC_Util::getVersionString(); $build = OC_Util::getBuild(); if (!empty($build) and OC_Util::getChannel() === 'daily') { $version .= ' Build:' . $build; |