summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/App/Platform.php2
-rw-r--r--lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php1
-rw-r--r--lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php1
-rw-r--r--lib/private/Collaboration/Collaborators/GroupPlugin.php2
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php11
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php2
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php2
-rw-r--r--lib/private/DB/MigrationService.php2
-rw-r--r--lib/private/DB/SchemaWrapper.php1
-rw-r--r--lib/private/Files/Config/UserMountCache.php1
-rw-r--r--lib/private/Files/Mount/ObjectHomeMountProvider.php3
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php2
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php3
-rw-r--r--lib/private/Files/ObjectStore/Swift.php17
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php4
-rw-r--r--lib/private/Installer.php5
-rw-r--r--lib/private/Repair.php2
-rw-r--r--lib/private/Share/Share.php11
-rw-r--r--lib/private/Share20/DefaultShareProvider.php1
-rw-r--r--lib/private/User/Session.php1
20 files changed, 35 insertions, 39 deletions
diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php
index fe4d7ff48f7..efe01d291d7 100644
--- a/lib/private/App/Platform.php
+++ b/lib/private/App/Platform.php
@@ -61,7 +61,7 @@ class Platform {
*/
public function getOcVersion() {
$v = \OCP\Util::getVersion();
- return join('.', $v);
+ return implode('.', $v);
}
/**
diff --git a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
index 79359b142ac..e09dfdfcb87 100644
--- a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
@@ -26,7 +26,6 @@ namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Security\Bruteforce\Throttler;
-use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\IRequest;
diff --git a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
index c3b5a844ed5..dca761bdfc0 100644
--- a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
@@ -27,7 +27,6 @@ namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Security\RateLimiting\Exception\RateLimitExceededException;
use OC\Security\RateLimiting\Limiter;
-use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Middleware;
diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php
index b147d2d7b58..7eee042076e 100644
--- a/lib/private/Collaboration/Collaborators/GroupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php
@@ -59,7 +59,7 @@ class GroupPlugin implements ISearchPlugin {
$groups = $this->groupManager->search($search, $limit, $offset);
$groupIds = array_map(function (IGroup $group) { return $group->getGID(); }, $groups);
- if (!$this->shareeEnumeration || sizeof($groups) < $limit) {
+ if (!$this->shareeEnumeration || count($groups) < $limit) {
$hasMoreResults = true;
}
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index 2e946c4a872..2d85ff334bc 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -28,9 +28,11 @@ use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\Contacts\IManager;
+use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager;
use OCP\IConfig;
use OCP\IGroupManager;
+use OCP\IUser;
use OCP\IUserSession;
use OCP\Share;
@@ -112,7 +114,7 @@ class MailPlugin implements ISearchPlugin {
continue;
}
- if (!$searchResult->hasResult($userType, $cloud->getUser())) {
+ if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
$singleResult = [[
'label' => $contact['FN'] . " ($emailAddress)",
'value' => [
@@ -133,7 +135,7 @@ class MailPlugin implements ISearchPlugin {
continue;
}
- if (!$searchResult->hasResult($userType, $cloud->getUser())) {
+ if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
$singleResult = [[
'label' => $contact['FN'] . " ($emailAddress)",
'value' => [
@@ -189,4 +191,9 @@ class MailPlugin implements ISearchPlugin {
return true;
}
+
+ public function isCurrentUser(ICloudId $cloud): bool {
+ $currentUser = $this->userSession->getUser();
+ return $currentUser instanceof IUser ? $currentUser->getUID() === $cloud->getUser() : false;
+ }
}
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index d2639249d56..62f76876031 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -85,7 +85,7 @@ class UserPlugin implements ISearchPlugin {
$this->takeOutCurrentUser($users);
- if (!$this->shareeEnumeration || sizeof($users) < $limit) {
+ if (!$this->shareeEnumeration || count($users) < $limit) {
$hasMoreResults = true;
}
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 43600470e1f..73319151d6e 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -27,14 +27,12 @@
namespace OC\Contacts\ContactsMenu;
-use OC\Share\Share;
use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\IManager;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
-use OCP\IUserSession;
use OCP\Contacts\ContactsMenu\IContactsStore;
class ContactsStore implements IContactsStore {
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 29f717b886c..77ac23fe5d2 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -31,8 +31,6 @@ use OCP\AppFramework\QueryException;
use OCP\IDBConnection;
use OCP\Migration\IMigrationStep;
use OCP\Migration\IOutput;
-use Doctrine\DBAL\Schema\Column;
-use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
class MigrationService {
diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php
index 4f05b7b00ef..35aae082699 100644
--- a/lib/private/DB/SchemaWrapper.php
+++ b/lib/private/DB/SchemaWrapper.php
@@ -23,7 +23,6 @@
namespace OC\DB;
-use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Schema;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 384e6e5e457..cc655018f8d 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -25,7 +25,6 @@
namespace OC\Files\Config;
-use OC\DB\QueryBuilder\Literal;
use OCA\Files_Sharing\SharedMount;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Config\ICachedMountFileInfo;
diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php
index 440a8bc4608..9c09c0737c8 100644
--- a/lib/private/Files/Mount/ObjectHomeMountProvider.php
+++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php
@@ -84,10 +84,11 @@ class ObjectHomeMountProvider implements IHomeMountProvider {
if (!isset($config['arguments'])) {
$config['arguments'] = [];
}
- $config['arguments']['user'] = $user;
// instantiate object store implementation
$config['arguments']['objectstore'] = new $config['class']($config['arguments']);
+ $config['arguments']['user'] = $user;
+
return $config;
}
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 094a2915730..45c22a81a7b 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -369,7 +369,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
'app' => 'objectstore',
'message' => 'Could not create object for ' . $path,
]);
- return false;
+ throw $ex;
}
}
return true;
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index defeda4c21a..280a8efa81c 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -23,10 +23,7 @@
namespace OC\Files\ObjectStore;
-use Aws\Exception\MultipartUploadException;
-use Aws\S3\MultipartUploader;
use Aws\S3\S3Client;
-use Psr\Http\Message\StreamInterface;
const S3_UPLOAD_PART_SIZE = 524288000; // 500MB
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index 70bc4ed8438..a3cba488f5f 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -26,6 +26,7 @@
namespace OC\Files\ObjectStore;
use Guzzle\Http\Exception\ClientErrorResponseException;
+use Guzzle\Http\Exception\CurlException;
use Icewind\Streams\RetryWrapper;
use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\StorageAuthException;
@@ -87,6 +88,9 @@ class Swift implements IObjectStore {
$this->params = $params;
}
+ /**
+ * @suppress PhanNonClassMethodCall
+ */
protected function init() {
if ($this->container) {
return;
@@ -117,6 +121,10 @@ class Swift implements IObjectStore {
/** @var Catalog $catalog */
$catalog = $this->client->getCatalog();
+ if (count($catalog->getItems()) === 0) {
+ throw new StorageAuthException('Keystone did not provide a valid catalog, verify the credentials');
+ }
+
if (isset($this->params['serviceName'])) {
$serviceName = $this->params['serviceName'];
} else {
@@ -153,6 +161,13 @@ class Swift implements IObjectStore {
} else {
throw $ex;
}
+ } catch (CurlException $e) {
+ if ($e->getErrorNo() === 7) {
+ $host = $e->getCurlHandle()->getUrl()->getHost() . ':' . $e->getCurlHandle()->getUrl()->getPort();
+ \OC::$server->getLogger()->error("Can't connect to object storage server at $host");
+ throw new StorageNotAvailableException("Can't connect to object storage server at $host", StorageNotAvailableException::STATUS_ERROR, $e);
+ }
+ throw $e;
}
}
@@ -176,7 +191,7 @@ class Swift implements IObjectStore {
$itemClass = new \stdClass();
$itemClass->name = $item['name'];
$itemClass->endpoints = array_map(function (array $endpoint) {
- return (object) $endpoint;
+ return (object)$endpoint;
}, $item['endpoints']);
$itemClass->type = $item['type'];
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index e40a4830953..b65db054055 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -351,9 +351,7 @@ class Encryption extends Wrapper {
// need to stream copy file by file in case we copy between a encrypted
// and a unencrypted storage
$this->unlink($path2);
- $result = $this->copyFromStorage($this, $path1, $path2);
-
- return $result;
+ return $this->copyFromStorage($this, $path1, $path2);
}
/**
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index ad2dcb60f20..f382a923401 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -36,17 +36,12 @@
namespace OC;
use Doctrine\DBAL\Exception\TableExistsException;
-use OC\App\AppManager;
use OC\App\AppStore\Bundles\Bundle;
use OC\App\AppStore\Fetcher\AppFetcher;
-use OC\App\CodeChecker\CodeChecker;
-use OC\App\CodeChecker\EmptyCheck;
-use OC\App\CodeChecker\PrivateCheck;
use OC\Archive\TAR;
use OC_App;
use OC_DB;
use OC_Helper;
-use OCP\App\IAppManager;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index d787a1c802b..a257ef061e7 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -30,8 +30,6 @@
namespace OC;
-use OC\App\AppStore\Bundles\BundleFetcher;
-use OC\Files\AppData\Factory;
use OC\Repair\CleanTags;
use OC\Repair\ClearFrontendCaches;
use OC\Repair\Collation;
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 9507eaf5c1f..e6056679c1c 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -39,12 +39,7 @@
namespace OC\Share;
-use OC\Files\Filesystem;
use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\ILogger;
-use OCP\IUserManager;
-use OCP\IUserSession;
-use OCP\IDBConnection;
use OCP\IConfig;
use OCP\Util;
@@ -1038,7 +1033,7 @@ class Share extends Constants {
} else {
$itemTypes = $collectionTypes;
}
- $placeholders = join(',', array_fill(0, count($itemTypes), '?'));
+ $placeholders = implode(',', array_fill(0, count($itemTypes), '?'));
$where = ' WHERE `item_type` IN ('.$placeholders.'))';
$queryArgs = $itemTypes;
} else {
@@ -1064,7 +1059,7 @@ class Share extends Constants {
$groups = \OC::$server->getGroupManager()->getUserGroupIds($user);
}
if (!empty($groups)) {
- $placeholders = join(',', array_fill(0, count($groups), '?'));
+ $placeholders = implode(',', array_fill(0, count($groups), '?'));
$where .= ' OR (`share_type` = ? AND `share_with` IN ('.$placeholders.')) ';
$queryArgs[] = self::SHARE_TYPE_GROUP;
$queryArgs = array_merge($queryArgs, $groups);
@@ -1129,7 +1124,7 @@ class Share extends Constants {
}
$queryArgs[] = $item;
if ($includeCollections && $collectionTypes && !in_array('folder', $collectionTypes)) {
- $placeholders = join(',', array_fill(0, count($collectionTypes), '?'));
+ $placeholders = implode(',', array_fill(0, count($collectionTypes), '?'));
$where .= ' OR `item_type` IN ('.$placeholders.'))';
$queryArgs = array_merge($queryArgs, $collectionTypes);
}
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index b9ab7a46873..3c56b24707c 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -30,7 +30,6 @@
namespace OC\Share20;
use OC\Files\Cache\Cache;
-use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Share\IShareProvider;
use OC\Share20\Exception\InvalidShare;
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index c2b58c37cdb..4ac8888cee1 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -55,7 +55,6 @@ use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUser;
-use OCP\IUserManager;
use OCP\IUserSession;
use OCP\Lockdown\ILockdownManager;
use OCP\Security\ISecureRandom;