summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rw-r--r--lib/composer/composer/autoload_classmap.php20
-rw-r--r--lib/composer/composer/autoload_static.php20
-rw-r--r--lib/l10n/ca.js36
-rw-r--r--lib/l10n/ca.json36
-rw-r--r--lib/l10n/cs.js4
-rw-r--r--lib/l10n/cs.json4
-rw-r--r--lib/l10n/es.js18
-rw-r--r--lib/l10n/es.json18
-rw-r--r--lib/l10n/es_MX.js3
-rw-r--r--lib/l10n/es_MX.json3
-rw-r--r--lib/l10n/fi.js5
-rw-r--r--lib/l10n/fi.json5
-rw-r--r--lib/l10n/hu.js5
-rw-r--r--lib/l10n/hu.json5
-rw-r--r--lib/l10n/nb.js4
-rw-r--r--lib/l10n/nb.json4
-rw-r--r--lib/l10n/nl.js12
-rw-r--r--lib/l10n/nl.json12
-rw-r--r--lib/l10n/sk.js7
-rw-r--r--lib/l10n/sk.json7
-rw-r--r--lib/private/AllConfig.php4
-rw-r--r--lib/private/App/AppManager.php17
-rw-r--r--lib/private/App/AppStore/Fetcher/AppFetcher.php4
-rw-r--r--lib/private/App/AppStore/Fetcher/Fetcher.php2
-rw-r--r--lib/private/App/CodeChecker/DeprecationCheck.php9
-rw-r--r--lib/private/AppFramework/App.php7
-rw-r--r--lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php46
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php7
-rw-r--r--lib/private/AppHelper.php48
-rw-r--r--lib/private/Archive/TAR.php8
-rw-r--r--lib/private/Archive/ZIP.php2
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php35
-rw-r--r--lib/private/Config.php2
-rw-r--r--lib/private/DB/Connection.php2
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php28
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php6
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php4
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php4
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php78
-rw-r--r--lib/private/Encryption/Manager.php9
-rw-r--r--lib/private/Encryption/Util.php8
-rw-r--r--lib/private/Files/Node/File.php6
-rw-r--r--lib/private/Files/Node/Folder.php21
-rw-r--r--lib/private/Files/Node/HookConnector.php7
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php24
-rw-r--r--lib/private/Files/ObjectStore/Swift.php15
-rw-r--r--lib/private/Files/ObjectStore/SwiftFactory.php36
-rw-r--r--lib/private/Files/Storage/Flysystem.php2
-rw-r--r--lib/private/Group/Database.php91
-rw-r--r--lib/private/Group/Manager.php11
-rw-r--r--lib/private/Group/MetaData.php2
-rw-r--r--lib/private/HTTPHelper.php120
-rw-r--r--lib/private/Installer.php21
-rw-r--r--lib/private/Mail/Attachment.php9
-rw-r--r--lib/private/Mail/EMailTemplate.php35
-rw-r--r--lib/private/Mail/Mailer.php21
-rw-r--r--lib/private/Mail/Message.php45
-rw-r--r--lib/private/Memcache/Factory.php4
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicy.php47
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicyManager.php11
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php5
-rw-r--r--lib/private/Security/CSRF/CsrfToken.php11
-rw-r--r--lib/private/Security/CSRF/CsrfTokenGenerator.php3
-rw-r--r--lib/private/Security/CSRF/CsrfTokenManager.php9
-rw-r--r--lib/private/Security/CSRF/TokenStorage/SessionStorage.php7
-rw-r--r--lib/private/Security/IdentityProof/Key.php7
-rw-r--r--lib/private/Security/IdentityProof/Manager.php11
-rw-r--r--lib/private/Security/IdentityProof/Signer.php5
-rw-r--r--lib/private/Server.php37
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php2
-rw-r--r--lib/private/Share/Share.php46
-rw-r--r--lib/private/SubAdmin.php19
-rw-r--r--lib/private/Tags.php43
-rw-r--r--lib/private/Template/JSCombiner.php22
-rw-r--r--lib/private/Template/SCSSCacher.php39
-rw-r--r--lib/private/TemplateLayout.php8
-rw-r--r--lib/private/Updater.php4
-rw-r--r--lib/private/Updater/VersionCheck.php1
-rw-r--r--lib/private/User/Database.php123
-rw-r--r--lib/private/legacy/api.php277
-rw-r--r--lib/private/legacy/app.php40
-rw-r--r--lib/private/legacy/defaults.php9
-rw-r--r--lib/private/legacy/eventsource.php4
-rw-r--r--lib/private/legacy/group/backend.php56
-rw-r--r--lib/private/legacy/json.php45
-rw-r--r--lib/private/legacy/response.php124
-rw-r--r--lib/private/legacy/user.php21
-rw-r--r--lib/private/legacy/util.php23
-rw-r--r--lib/public/App/IAppManager.php4
-rw-r--r--lib/public/AppFramework/App.php16
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvider.php16
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php3
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorException.php1
-rw-r--r--lib/public/BackgroundJob.php7
-rw-r--r--lib/public/Contacts.php185
-rw-r--r--lib/public/DB.php147
-rw-r--r--lib/public/DB/QueryBuilder/IExpressionBuilder.php8
-rw-r--r--lib/public/DB/QueryBuilder/IFunctionBuilder.php9
-rw-r--r--lib/public/DB/QueryBuilder/IQueryBuilder.php38
-rw-r--r--lib/public/Files.php32
-rw-r--r--lib/public/Files/File.php2
-rw-r--r--lib/public/Files/Folder.php3
-rw-r--r--lib/public/Files/GenericFileException.php33
-rw-r--r--lib/public/ICacheFactory.php8
-rw-r--r--lib/public/IHelper.php50
-rw-r--r--lib/public/IServerContainer.php18
-rw-r--r--lib/public/JSON.php209
-rw-r--r--lib/public/Mail/IAttachment.php13
-rw-r--r--lib/public/Mail/IEMailTemplate.php25
-rw-r--r--lib/public/Mail/IMailer.php13
-rw-r--r--lib/public/Mail/IMessage.php29
-rw-r--r--lib/public/Response.php140
-rw-r--r--lib/public/Share.php10
-rw-r--r--lib/public/User.php51
-rw-r--r--lib/public/User/Backend/ABackend.php72
-rw-r--r--lib/public/User/Backend/ICheckPasswordBackend.php39
-rw-r--r--lib/public/User/Backend/ICountUsersBackend.php38
-rw-r--r--lib/public/User/Backend/ICreateUserBackend.php40
-rw-r--r--lib/public/User/Backend/IGetDisplayNameBackend.php39
-rw-r--r--lib/public/User/Backend/IGetHomeBackend.php39
-rw-r--r--lib/public/User/Backend/IProvideAvatarBackend.php39
-rw-r--r--lib/public/User/Backend/ISetDisplayNameBackend.php40
-rw-r--r--lib/public/User/Backend/ISetPasswordBackend.php40
-rw-r--r--lib/public/UserInterface.php1
-rw-r--r--lib/public/Util.php140
126 files changed, 1377 insertions, 2315 deletions
diff --git a/lib/base.php b/lib/base.php
index c5eabe1910a..8af674e7ee8 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -426,7 +426,7 @@ class OC {
// if session can't be started break with http 500 error
} catch (Exception $e) {
- \OCP\Util::logException('base', $e);
+ \OC::$server->getLogger()->logException($e, ['app' => 'base']);
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
OC_Template::printExceptionErrorPage($e);
@@ -944,12 +944,12 @@ class OC {
&& $request->getMethod() === 'POST'
&& ((array)$request->getParam('appid')) !== ''
) {
- \OCP\JSON::callCheck();
- \OCP\JSON::checkAdminUser();
+ \OC_JSON::callCheck();
+ \OC_JSON::checkAdminUser();
$appIds = (array)$request->getParam('appid');
foreach($appIds as $appId) {
$appId = \OC_App::cleanAppId($appId);
- \OC_App::disable($appId);
+ \OC::$server->getAppManager()->disableApp($appId);
}
\OC_JSON::success();
exit();
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 68be5e2d595..320113612d6 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -91,7 +91,6 @@ return array(
'OCP\\Comments\\NotFoundException' => $baseDir . '/lib/public/Comments/NotFoundException.php',
'OCP\\Console\\ConsoleEvent' => $baseDir . '/lib/public/Console/ConsoleEvent.php',
'OCP\\Constants' => $baseDir . '/lib/public/Constants.php',
- 'OCP\\Contacts' => $baseDir . '/lib/public/Contacts.php',
'OCP\\Contacts\\ContactsMenu\\IAction' => $baseDir . '/lib/public/Contacts/ContactsMenu/IAction.php',
'OCP\\Contacts\\ContactsMenu\\IActionFactory' => $baseDir . '/lib/public/Contacts/ContactsMenu/IActionFactory.php',
'OCP\\Contacts\\ContactsMenu\\IContactsStore' => $baseDir . '/lib/public/Contacts/ContactsMenu/IContactsStore.php',
@@ -99,7 +98,6 @@ return array(
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => $baseDir . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => $baseDir . '/lib/public/Contacts/ContactsMenu/IProvider.php',
'OCP\\Contacts\\IManager' => $baseDir . '/lib/public/Contacts/IManager.php',
- 'OCP\\DB' => $baseDir . '/lib/public/DB.php',
'OCP\\DB\\ISchemaWrapper' => $baseDir . '/lib/public/DB/ISchemaWrapper.php',
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => $baseDir . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => $baseDir . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
@@ -141,6 +139,7 @@ return array(
'OCP\\Files\\FileNameTooLongException' => $baseDir . '/lib/public/Files/FileNameTooLongException.php',
'OCP\\Files\\Folder' => $baseDir . '/lib/public/Files/Folder.php',
'OCP\\Files\\ForbiddenException' => $baseDir . '/lib/public/Files/ForbiddenException.php',
+ 'OCP\\Files\\GenericFileException' => $baseDir . '/lib/public/Files/GenericFileException.php',
'OCP\\Files\\IAppData' => $baseDir . '/lib/public/Files/IAppData.php',
'OCP\\Files\\IHomeStorage' => $baseDir . '/lib/public/Files/IHomeStorage.php',
'OCP\\Files\\IMimeTypeDetector' => $baseDir . '/lib/public/Files/IMimeTypeDetector.php',
@@ -203,7 +202,6 @@ return array(
'OCP\\IEventSource' => $baseDir . '/lib/public/IEventSource.php',
'OCP\\IGroup' => $baseDir . '/lib/public/IGroup.php',
'OCP\\IGroupManager' => $baseDir . '/lib/public/IGroupManager.php',
- 'OCP\\IHelper' => $baseDir . '/lib/public/IHelper.php',
'OCP\\IImage' => $baseDir . '/lib/public/IImage.php',
'OCP\\IL10N' => $baseDir . '/lib/public/IL10N.php',
'OCP\\ILogger' => $baseDir . '/lib/public/ILogger.php',
@@ -224,7 +222,6 @@ return array(
'OCP\\IUserManager' => $baseDir . '/lib/public/IUserManager.php',
'OCP\\IUserSession' => $baseDir . '/lib/public/IUserSession.php',
'OCP\\Image' => $baseDir . '/lib/public/Image.php',
- 'OCP\\JSON' => $baseDir . '/lib/public/JSON.php',
'OCP\\L10N\\IFactory' => $baseDir . '/lib/public/L10N/IFactory.php',
'OCP\\LDAP\\IDeletionFlagSupport' => $baseDir . '/lib/public/LDAP/IDeletionFlagSupport.php',
'OCP\\LDAP\\ILDAPProvider' => $baseDir . '/lib/public/LDAP/ILDAPProvider.php',
@@ -257,7 +254,6 @@ return array(
'OCP\\Remote\\IInstance' => $baseDir . '/lib/public/Remote/IInstance.php',
'OCP\\Remote\\IInstanceFactory' => $baseDir . '/lib/public/Remote/IInstanceFactory.php',
'OCP\\Remote\\IUser' => $baseDir . '/lib/public/Remote/IUser.php',
- 'OCP\\Response' => $baseDir . '/lib/public/Response.php',
'OCP\\RichObjectStrings\\Definitions' => $baseDir . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IValidator' => $baseDir . '/lib/public/RichObjectStrings/IValidator.php',
'OCP\\RichObjectStrings\\InvalidObjectExeption' => $baseDir . '/lib/public/RichObjectStrings/InvalidObjectExeption.php',
@@ -305,6 +301,15 @@ return array(
'OCP\\Template' => $baseDir . '/lib/public/Template.php',
'OCP\\User' => $baseDir . '/lib/public/User.php',
'OCP\\UserInterface' => $baseDir . '/lib/public/UserInterface.php',
+ 'OCP\\User\\Backend\\ABackend' => $baseDir . '/lib/public/User/Backend/ABackend.php',
+ 'OCP\\User\\Backend\\ICheckPasswordBackend' => $baseDir . '/lib/public/User/Backend/ICheckPasswordBackend.php',
+ 'OCP\\User\\Backend\\ICountUsersBackend' => $baseDir . '/lib/public/User/Backend/ICountUsersBackend.php',
+ 'OCP\\User\\Backend\\ICreateUserBackend' => $baseDir . '/lib/public/User/Backend/ICreateUserBackend.php',
+ 'OCP\\User\\Backend\\IGetDisplayNameBackend' => $baseDir . '/lib/public/User/Backend/IGetDisplayNameBackend.php',
+ 'OCP\\User\\Backend\\IGetHomeBackend' => $baseDir . '/lib/public/User/Backend/IGetHomeBackend.php',
+ 'OCP\\User\\Backend\\IProvideAvatarBackend' => $baseDir . '/lib/public/User/Backend/IProvideAvatarBackend.php',
+ 'OCP\\User\\Backend\\ISetDisplayNameBackend' => $baseDir . '/lib/public/User/Backend/ISetDisplayNameBackend.php',
+ 'OCP\\User\\Backend\\ISetPasswordBackend' => $baseDir . '/lib/public/User/Backend/ISetPasswordBackend.php',
'OCP\\Util' => $baseDir . '/lib/public/Util.php',
'OCP\\WorkflowEngine\\ICheck' => $baseDir . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IManager' => $baseDir . '/lib/public/WorkflowEngine/IManager.php',
@@ -349,7 +354,6 @@ return array(
'OC\\AppFramework\\Utility\\ControllerMethodReflector' => $baseDir . '/lib/private/AppFramework/Utility/ControllerMethodReflector.php',
'OC\\AppFramework\\Utility\\SimpleContainer' => $baseDir . '/lib/private/AppFramework/Utility/SimpleContainer.php',
'OC\\AppFramework\\Utility\\TimeFactory' => $baseDir . '/lib/private/AppFramework/Utility/TimeFactory.php',
- 'OC\\AppHelper' => $baseDir . '/lib/private/AppHelper.php',
'OC\\App\\AppManager' => $baseDir . '/lib/private/App/AppManager.php',
'OC\\App\\AppStore\\Bundles\\Bundle' => $baseDir . '/lib/private/App/AppStore/Bundles/Bundle.php',
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => $baseDir . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
@@ -518,6 +522,7 @@ return array(
'OC\\Core\\Command\\User\\Setting' => $baseDir . '/core/Command/User/Setting.php',
'OC\\Core\\Controller\\AutoCompleteController' => $baseDir . '/core/Controller/AutoCompleteController.php',
'OC\\Core\\Controller\\AvatarController' => $baseDir . '/core/Controller/AvatarController.php',
+ 'OC\\Core\\Controller\\CSRFTokenController' => $baseDir . '/core/Controller/CSRFTokenController.php',
'OC\\Core\\Controller\\ClientFlowLoginController' => $baseDir . '/core/Controller/ClientFlowLoginController.php',
'OC\\Core\\Controller\\ContactsMenuController' => $baseDir . '/core/Controller/ContactsMenuController.php',
'OC\\Core\\Controller\\CssController' => $baseDir . '/core/Controller/CssController.php',
@@ -528,6 +533,7 @@ return array(
'OC\\Core\\Controller\\OCJSController' => $baseDir . '/core/Controller/OCJSController.php',
'OC\\Core\\Controller\\OCSController' => $baseDir . '/core/Controller/OCSController.php',
'OC\\Core\\Controller\\PreviewController' => $baseDir . '/core/Controller/PreviewController.php',
+ 'OC\\Core\\Controller\\SearchController' => $baseDir . '/core/Controller/SearchController.php',
'OC\\Core\\Controller\\SetupController' => $baseDir . '/core/Controller/SetupController.php',
'OC\\Core\\Controller\\TwoFactorChallengeController' => $baseDir . '/core/Controller/TwoFactorChallengeController.php',
'OC\\Core\\Controller\\UserController' => $baseDir . '/core/Controller/UserController.php',
@@ -696,7 +702,6 @@ return array(
'OC\\Group\\Group' => $baseDir . '/lib/private/Group/Group.php',
'OC\\Group\\Manager' => $baseDir . '/lib/private/Group/Manager.php',
'OC\\Group\\MetaData' => $baseDir . '/lib/private/Group/MetaData.php',
- 'OC\\HTTPHelper' => $baseDir . '/lib/private/HTTPHelper.php',
'OC\\HintException' => $baseDir . '/lib/private/HintException.php',
'OC\\Hooks\\BasicEmitter' => $baseDir . '/lib/private/Hooks/BasicEmitter.php',
'OC\\Hooks\\Emitter' => $baseDir . '/lib/private/Hooks/Emitter.php',
@@ -883,7 +888,6 @@ return array(
'OC\\Settings\\Controller\\ChangePasswordController' => $baseDir . '/settings/Controller/ChangePasswordController.php',
'OC\\Settings\\Controller\\CheckSetupController' => $baseDir . '/settings/Controller/CheckSetupController.php',
'OC\\Settings\\Controller\\CommonSettingsTrait' => $baseDir . '/settings/Controller/CommonSettingsTrait.php',
- 'OC\\Settings\\Controller\\EncryptionController' => $baseDir . '/settings/Controller/EncryptionController.php',
'OC\\Settings\\Controller\\GroupsController' => $baseDir . '/settings/Controller/GroupsController.php',
'OC\\Settings\\Controller\\LogSettingsController' => $baseDir . '/settings/Controller/LogSettingsController.php',
'OC\\Settings\\Controller\\MailSettingsController' => $baseDir . '/settings/Controller/MailSettingsController.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 81f21f31c21..ee94cd3ee81 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -121,7 +121,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Comments\\NotFoundException' => __DIR__ . '/../../..' . '/lib/public/Comments/NotFoundException.php',
'OCP\\Console\\ConsoleEvent' => __DIR__ . '/../../..' . '/lib/public/Console/ConsoleEvent.php',
'OCP\\Constants' => __DIR__ . '/../../..' . '/lib/public/Constants.php',
- 'OCP\\Contacts' => __DIR__ . '/../../..' . '/lib/public/Contacts.php',
'OCP\\Contacts\\ContactsMenu\\IAction' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IAction.php',
'OCP\\Contacts\\ContactsMenu\\IActionFactory' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IActionFactory.php',
'OCP\\Contacts\\ContactsMenu\\IContactsStore' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IContactsStore.php',
@@ -129,7 +128,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IProvider.php',
'OCP\\Contacts\\IManager' => __DIR__ . '/../../..' . '/lib/public/Contacts/IManager.php',
- 'OCP\\DB' => __DIR__ . '/../../..' . '/lib/public/DB.php',
'OCP\\DB\\ISchemaWrapper' => __DIR__ . '/../../..' . '/lib/public/DB/ISchemaWrapper.php',
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
@@ -171,6 +169,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Files\\FileNameTooLongException' => __DIR__ . '/../../..' . '/lib/public/Files/FileNameTooLongException.php',
'OCP\\Files\\Folder' => __DIR__ . '/../../..' . '/lib/public/Files/Folder.php',
'OCP\\Files\\ForbiddenException' => __DIR__ . '/../../..' . '/lib/public/Files/ForbiddenException.php',
+ 'OCP\\Files\\GenericFileException' => __DIR__ . '/../../..' . '/lib/public/Files/GenericFileException.php',
'OCP\\Files\\IAppData' => __DIR__ . '/../../..' . '/lib/public/Files/IAppData.php',
'OCP\\Files\\IHomeStorage' => __DIR__ . '/../../..' . '/lib/public/Files/IHomeStorage.php',
'OCP\\Files\\IMimeTypeDetector' => __DIR__ . '/../../..' . '/lib/public/Files/IMimeTypeDetector.php',
@@ -233,7 +232,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\IEventSource' => __DIR__ . '/../../..' . '/lib/public/IEventSource.php',
'OCP\\IGroup' => __DIR__ . '/../../..' . '/lib/public/IGroup.php',
'OCP\\IGroupManager' => __DIR__ . '/../../..' . '/lib/public/IGroupManager.php',
- 'OCP\\IHelper' => __DIR__ . '/../../..' . '/lib/public/IHelper.php',
'OCP\\IImage' => __DIR__ . '/../../..' . '/lib/public/IImage.php',
'OCP\\IL10N' => __DIR__ . '/../../..' . '/lib/public/IL10N.php',
'OCP\\ILogger' => __DIR__ . '/../../..' . '/lib/public/ILogger.php',
@@ -254,7 +252,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\IUserManager' => __DIR__ . '/../../..' . '/lib/public/IUserManager.php',
'OCP\\IUserSession' => __DIR__ . '/../../..' . '/lib/public/IUserSession.php',
'OCP\\Image' => __DIR__ . '/../../..' . '/lib/public/Image.php',
- 'OCP\\JSON' => __DIR__ . '/../../..' . '/lib/public/JSON.php',
'OCP\\L10N\\IFactory' => __DIR__ . '/../../..' . '/lib/public/L10N/IFactory.php',
'OCP\\LDAP\\IDeletionFlagSupport' => __DIR__ . '/../../..' . '/lib/public/LDAP/IDeletionFlagSupport.php',
'OCP\\LDAP\\ILDAPProvider' => __DIR__ . '/../../..' . '/lib/public/LDAP/ILDAPProvider.php',
@@ -287,7 +284,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Remote\\IInstance' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstance.php',
'OCP\\Remote\\IInstanceFactory' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstanceFactory.php',
'OCP\\Remote\\IUser' => __DIR__ . '/../../..' . '/lib/public/Remote/IUser.php',
- 'OCP\\Response' => __DIR__ . '/../../..' . '/lib/public/Response.php',
'OCP\\RichObjectStrings\\Definitions' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IValidator' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/IValidator.php',
'OCP\\RichObjectStrings\\InvalidObjectExeption' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/InvalidObjectExeption.php',
@@ -335,6 +331,15 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Template' => __DIR__ . '/../../..' . '/lib/public/Template.php',
'OCP\\User' => __DIR__ . '/../../..' . '/lib/public/User.php',
'OCP\\UserInterface' => __DIR__ . '/../../..' . '/lib/public/UserInterface.php',
+ 'OCP\\User\\Backend\\ABackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ABackend.php',
+ 'OCP\\User\\Backend\\ICheckPasswordBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ICheckPasswordBackend.php',
+ 'OCP\\User\\Backend\\ICountUsersBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ICountUsersBackend.php',
+ 'OCP\\User\\Backend\\ICreateUserBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ICreateUserBackend.php',
+ 'OCP\\User\\Backend\\IGetDisplayNameBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/IGetDisplayNameBackend.php',
+ 'OCP\\User\\Backend\\IGetHomeBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/IGetHomeBackend.php',
+ 'OCP\\User\\Backend\\IProvideAvatarBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/IProvideAvatarBackend.php',
+ 'OCP\\User\\Backend\\ISetDisplayNameBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ISetDisplayNameBackend.php',
+ 'OCP\\User\\Backend\\ISetPasswordBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ISetPasswordBackend.php',
'OCP\\Util' => __DIR__ . '/../../..' . '/lib/public/Util.php',
'OCP\\WorkflowEngine\\ICheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IManager' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IManager.php',
@@ -379,7 +384,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\AppFramework\\Utility\\ControllerMethodReflector' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Utility/ControllerMethodReflector.php',
'OC\\AppFramework\\Utility\\SimpleContainer' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Utility/SimpleContainer.php',
'OC\\AppFramework\\Utility\\TimeFactory' => __DIR__ . '/../../..' . '/lib/private/AppFramework/Utility/TimeFactory.php',
- 'OC\\AppHelper' => __DIR__ . '/../../..' . '/lib/private/AppHelper.php',
'OC\\App\\AppManager' => __DIR__ . '/../../..' . '/lib/private/App/AppManager.php',
'OC\\App\\AppStore\\Bundles\\Bundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/Bundle.php',
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
@@ -548,6 +552,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Core\\Command\\User\\Setting' => __DIR__ . '/../../..' . '/core/Command/User/Setting.php',
'OC\\Core\\Controller\\AutoCompleteController' => __DIR__ . '/../../..' . '/core/Controller/AutoCompleteController.php',
'OC\\Core\\Controller\\AvatarController' => __DIR__ . '/../../..' . '/core/Controller/AvatarController.php',
+ 'OC\\Core\\Controller\\CSRFTokenController' => __DIR__ . '/../../..' . '/core/Controller/CSRFTokenController.php',
'OC\\Core\\Controller\\ClientFlowLoginController' => __DIR__ . '/../../..' . '/core/Controller/ClientFlowLoginController.php',
'OC\\Core\\Controller\\ContactsMenuController' => __DIR__ . '/../../..' . '/core/Controller/ContactsMenuController.php',
'OC\\Core\\Controller\\CssController' => __DIR__ . '/../../..' . '/core/Controller/CssController.php',
@@ -558,6 +563,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Core\\Controller\\OCJSController' => __DIR__ . '/../../..' . '/core/Controller/OCJSController.php',
'OC\\Core\\Controller\\OCSController' => __DIR__ . '/../../..' . '/core/Controller/OCSController.php',
'OC\\Core\\Controller\\PreviewController' => __DIR__ . '/../../..' . '/core/Controller/PreviewController.php',
+ 'OC\\Core\\Controller\\SearchController' => __DIR__ . '/../../..' . '/core/Controller/SearchController.php',
'OC\\Core\\Controller\\SetupController' => __DIR__ . '/../../..' . '/core/Controller/SetupController.php',
'OC\\Core\\Controller\\TwoFactorChallengeController' => __DIR__ . '/../../..' . '/core/Controller/TwoFactorChallengeController.php',
'OC\\Core\\Controller\\UserController' => __DIR__ . '/../../..' . '/core/Controller/UserController.php',
@@ -726,7 +732,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Group\\Group' => __DIR__ . '/../../..' . '/lib/private/Group/Group.php',
'OC\\Group\\Manager' => __DIR__ . '/../../..' . '/lib/private/Group/Manager.php',
'OC\\Group\\MetaData' => __DIR__ . '/../../..' . '/lib/private/Group/MetaData.php',
- 'OC\\HTTPHelper' => __DIR__ . '/../../..' . '/lib/private/HTTPHelper.php',
'OC\\HintException' => __DIR__ . '/../../..' . '/lib/private/HintException.php',
'OC\\Hooks\\BasicEmitter' => __DIR__ . '/../../..' . '/lib/private/Hooks/BasicEmitter.php',
'OC\\Hooks\\Emitter' => __DIR__ . '/../../..' . '/lib/private/Hooks/Emitter.php',
@@ -913,7 +918,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Settings\\Controller\\ChangePasswordController' => __DIR__ . '/../../..' . '/settings/Controller/ChangePasswordController.php',
'OC\\Settings\\Controller\\CheckSetupController' => __DIR__ . '/../../..' . '/settings/Controller/CheckSetupController.php',
'OC\\Settings\\Controller\\CommonSettingsTrait' => __DIR__ . '/../../..' . '/settings/Controller/CommonSettingsTrait.php',
- 'OC\\Settings\\Controller\\EncryptionController' => __DIR__ . '/../../..' . '/settings/Controller/EncryptionController.php',
'OC\\Settings\\Controller\\GroupsController' => __DIR__ . '/../../..' . '/settings/Controller/GroupsController.php',
'OC\\Settings\\Controller\\LogSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/LogSettingsController.php',
'OC\\Settings\\Controller\\MailSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/MailSettingsController.php',
diff --git a/lib/l10n/ca.js b/lib/l10n/ca.js
index 567911aa4d3..e47de1f81a5 100644
--- a/lib/l10n/ca.js
+++ b/lib/l10n/ca.js
@@ -10,36 +10,68 @@ OC.L10N.register(
"%1$s, %2$s and %3$s" : "%1$s, %2$s i %3$s",
"%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s i %4$s",
"%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s i %5$s",
+ "Education Edition" : "Edició educativa",
+ "Enterprise bundle" : "Paquet empresarial",
+ "Groupware bundle" : "Paquet de treball en grup",
+ "Social sharing bundle" : "Paquet social",
"PHP %s or higher is required." : "Es requereix PHP %s o superior.",
+ "PHP with a version lower than %s is required." : "Es requereix php amb versió menor a %s.",
"%sbit or higher PHP required." : "Es requereix PHP %s o superior.",
+ "Following databases are supported: %s" : "Es suporten les següents bases de dades: %s",
+ "The command line tool %s could not be found" : "No s'ha pogut trobar l'eina per intèrpret de comandes %s",
"Server version %s or higher is required." : "Es requereix una versió de servidor %s o superior",
"Server version %s or lower is required." : "Es requereix una versió de servidor %s o inferior",
"Unknown filetype" : "Tipus de fitxer desconegut",
"Invalid image" : "Imatge no vàlida",
"Avatar image is not square" : "La imatge de perfil no és quadrada",
"today" : "avui",
+ "tomorrow" : "demà",
"yesterday" : "ahir",
+ "_in %n day_::_in %n days_" : ["d'aquí %n dia","d'aquí %n dies"],
"_%n day ago_::_%n days ago_" : ["fa %n dia","fa %n dies"],
+ "next month" : "mes següent",
"last month" : "el mes passat",
+ "_in %n month_::_in %n months_" : ["d'aquí %n mesos","d'aquí %n mesos"],
"_%n month ago_::_%n months ago_" : ["fa %n mes","fa %n mesos"],
+ "next year" : "any següent",
"last year" : "l'any passat",
+ "_in %n year_::_in %n years_" : ["d'aquí %n any","d'aquí %n anys"],
"_%n year ago_::_%n years ago_" : ["fa %n any","fa %n anys"],
+ "_in %n hour_::_in %n hours_" : ["d'aquí %n hora","d'aquí %n hores"],
"_%n hour ago_::_%n hours ago_" : ["fa %n hora","fa %n hores"],
+ "_in %n minute_::_in %n minutes_" : ["d'aquí %n minut","d'aquí %n minuts"],
"_%n minute ago_::_%n minutes ago_" : ["fa %n minut","fa %n minuts"],
+ "in a few seconds" : "en uns segons",
"seconds ago" : "segons enrere",
+ "File name is a reserved word" : "El nom de fitxer és una paraula reservada",
"File name contains at least one invalid character" : "El nom del fitxer conté al menys un caràcter invàlid",
"File name is too long" : "el nom del fitxer es massa gran",
+ "Dot files are not allowed" : "No estan permesos fitxers amb punt",
+ "Empty filename is not allowed" : "Mo estan permesos noms buits",
"Help" : "Ajuda",
"Apps" : "Aplicacions",
+ "Settings" : "Preferències",
+ "Log out" : "Surt",
"Users" : "Usuaris",
"Unknown user" : "Usuari desconegut",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Crea",
+ "Change" : "Modifica",
+ "Delete" : "Esborra",
+ "Share" : "Comparteix",
+ "Basic settings" : "Configuració bàsica",
"Sharing" : "Compartir",
+ "Security" : "Seguretat",
"Encryption" : "Xifrat",
"Additional settings" : "Configuració adicional",
"Tips & tricks" : "Consells i trucs",
+ "Personal info" : "Informació personal",
+ "Unlimited" : "Il·limitat",
"__language_name__" : "Català",
+ "Verifying" : "Verificant",
+ "Verifying …" : "Verificant ...",
+ "Verify" : "Verifica",
"%s enter the database username and name." : "%s escriviu el nom d'usuari i el nom de la base de dades.",
"%s enter the database username." : "%s escriviu el nom d'usuari de la base de dades.",
"%s enter the database name." : "%s escriviu el nom de la base de dades.",
@@ -124,6 +156,7 @@ OC.L10N.register(
"A valid username must be provided" : "Heu de facilitar un nom d'usuari vàlid",
"A valid password must be provided" : "Heu de facilitar una contrasenya vàlida",
"The username is already being used" : "El nom d'usuari ja està en ús",
+ "Could not create user" : "No s'ha pogut crear l'usuari",
"User disabled" : "Usuari desactivat",
"Login canceled by app" : "Accés cancel·lat per l'App",
"a safe home for all your data" : "un lloc segur per a les teves dades",
@@ -144,6 +177,7 @@ OC.L10N.register(
"PostgreSQL >= 9 required" : "Es requereix PostgreSQL >= 9",
"Please upgrade your database version" : "Actualitzeu la versió de la base de dades",
"Please change the permissions to 0770 so that the directory cannot be listed by other users." : "Canvieu els permisos a 0770 per tal que la carpeta no es pugui llistar per altres usuaris.",
- "Could not obtain lock type %d on \"%s\"." : "No s'ha pogut obtenir un bloqueig tipus %d a \"%s\"."
+ "Could not obtain lock type %d on \"%s\"." : "No s'ha pogut obtenir un bloqueig tipus %d a \"%s\".",
+ "Personal" : "Personal"
},
"nplurals=2; plural=(n != 1);");
diff --git a/lib/l10n/ca.json b/lib/l10n/ca.json
index 66b1dc74385..69efeef3988 100644
--- a/lib/l10n/ca.json
+++ b/lib/l10n/ca.json
@@ -8,36 +8,68 @@
"%1$s, %2$s and %3$s" : "%1$s, %2$s i %3$s",
"%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s i %4$s",
"%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s i %5$s",
+ "Education Edition" : "Edició educativa",
+ "Enterprise bundle" : "Paquet empresarial",
+ "Groupware bundle" : "Paquet de treball en grup",
+ "Social sharing bundle" : "Paquet social",
"PHP %s or higher is required." : "Es requereix PHP %s o superior.",
+ "PHP with a version lower than %s is required." : "Es requereix php amb versió menor a %s.",
"%sbit or higher PHP required." : "Es requereix PHP %s o superior.",
+ "Following databases are supported: %s" : "Es suporten les següents bases de dades: %s",
+ "The command line tool %s could not be found" : "No s'ha pogut trobar l'eina per intèrpret de comandes %s",
"Server version %s or higher is required." : "Es requereix una versió de servidor %s o superior",
"Server version %s or lower is required." : "Es requereix una versió de servidor %s o inferior",
"Unknown filetype" : "Tipus de fitxer desconegut",
"Invalid image" : "Imatge no vàlida",
"Avatar image is not square" : "La imatge de perfil no és quadrada",
"today" : "avui",
+ "tomorrow" : "demà",
"yesterday" : "ahir",
+ "_in %n day_::_in %n days_" : ["d'aquí %n dia","d'aquí %n dies"],
"_%n day ago_::_%n days ago_" : ["fa %n dia","fa %n dies"],
+ "next month" : "mes següent",
"last month" : "el mes passat",
+ "_in %n month_::_in %n months_" : ["d'aquí %n mesos","d'aquí %n mesos"],
"_%n month ago_::_%n months ago_" : ["fa %n mes","fa %n mesos"],
+ "next year" : "any següent",
"last year" : "l'any passat",
+ "_in %n year_::_in %n years_" : ["d'aquí %n any","d'aquí %n anys"],
"_%n year ago_::_%n years ago_" : ["fa %n any","fa %n anys"],
+ "_in %n hour_::_in %n hours_" : ["d'aquí %n hora","d'aquí %n hores"],
"_%n hour ago_::_%n hours ago_" : ["fa %n hora","fa %n hores"],
+ "_in %n minute_::_in %n minutes_" : ["d'aquí %n minut","d'aquí %n minuts"],
"_%n minute ago_::_%n minutes ago_" : ["fa %n minut","fa %n minuts"],
+ "in a few seconds" : "en uns segons",
"seconds ago" : "segons enrere",
+ "File name is a reserved word" : "El nom de fitxer és una paraula reservada",
"File name contains at least one invalid character" : "El nom del fitxer conté al menys un caràcter invàlid",
"File name is too long" : "el nom del fitxer es massa gran",
+ "Dot files are not allowed" : "No estan permesos fitxers amb punt",
+ "Empty filename is not allowed" : "Mo estan permesos noms buits",
"Help" : "Ajuda",
"Apps" : "Aplicacions",
+ "Settings" : "Preferències",
+ "Log out" : "Surt",
"Users" : "Usuaris",
"Unknown user" : "Usuari desconegut",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Crea",
+ "Change" : "Modifica",
+ "Delete" : "Esborra",
+ "Share" : "Comparteix",
+ "Basic settings" : "Configuració bàsica",
"Sharing" : "Compartir",
+ "Security" : "Seguretat",
"Encryption" : "Xifrat",
"Additional settings" : "Configuració adicional",
"Tips & tricks" : "Consells i trucs",
+ "Personal info" : "Informació personal",
+ "Unlimited" : "Il·limitat",
"__language_name__" : "Català",
+ "Verifying" : "Verificant",
+ "Verifying …" : "Verificant ...",
+ "Verify" : "Verifica",
"%s enter the database username and name." : "%s escriviu el nom d'usuari i el nom de la base de dades.",
"%s enter the database username." : "%s escriviu el nom d'usuari de la base de dades.",
"%s enter the database name." : "%s escriviu el nom de la base de dades.",
@@ -122,6 +154,7 @@
"A valid username must be provided" : "Heu de facilitar un nom d'usuari vàlid",
"A valid password must be provided" : "Heu de facilitar una contrasenya vàlida",
"The username is already being used" : "El nom d'usuari ja està en ús",
+ "Could not create user" : "No s'ha pogut crear l'usuari",
"User disabled" : "Usuari desactivat",
"Login canceled by app" : "Accés cancel·lat per l'App",
"a safe home for all your data" : "un lloc segur per a les teves dades",
@@ -142,6 +175,7 @@
"PostgreSQL >= 9 required" : "Es requereix PostgreSQL >= 9",
"Please upgrade your database version" : "Actualitzeu la versió de la base de dades",
"Please change the permissions to 0770 so that the directory cannot be listed by other users." : "Canvieu els permisos a 0770 per tal que la carpeta no es pugui llistar per altres usuaris.",
- "Could not obtain lock type %d on \"%s\"." : "No s'ha pogut obtenir un bloqueig tipus %d a \"%s\"."
+ "Could not obtain lock type %d on \"%s\"." : "No s'ha pogut obtenir un bloqueig tipus %d a \"%s\".",
+ "Personal" : "Personal"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/lib/l10n/cs.js b/lib/l10n/cs.js
index 2b83480976a..575b12e59c8 100644
--- a/lib/l10n/cs.js
+++ b/lib/l10n/cs.js
@@ -66,6 +66,10 @@ OC.L10N.register(
"Unknown user" : "Neznámý uživatel",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Vytvořit",
+ "Change" : "Změnit",
+ "Delete" : "Smazat",
+ "Share" : "Sdílet",
"Basic settings" : "Základní nastavení",
"Sharing" : "Sdílení",
"Security" : "Zabezpečení",
diff --git a/lib/l10n/cs.json b/lib/l10n/cs.json
index cd002244802..c5a613123f9 100644
--- a/lib/l10n/cs.json
+++ b/lib/l10n/cs.json
@@ -64,6 +64,10 @@
"Unknown user" : "Neznámý uživatel",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Vytvořit",
+ "Change" : "Změnit",
+ "Delete" : "Smazat",
+ "Share" : "Sdílet",
"Basic settings" : "Základní nastavení",
"Sharing" : "Sdílení",
"Security" : "Zabezpečení",
diff --git a/lib/l10n/es.js b/lib/l10n/es.js
index 1a50381de6c..cbf3493d563 100644
--- a/lib/l10n/es.js
+++ b/lib/l10n/es.js
@@ -62,7 +62,7 @@ OC.L10N.register(
"Help" : "Ayuda",
"Apps" : "Aplicaciones",
"Settings" : "Configuración",
- "Log out" : "Desconectar",
+ "Log out" : "Cerrar sesión",
"Users" : "Usuarios",
"Unknown user" : "Usuario desconocido",
"APCu" : "APCu",
@@ -103,15 +103,15 @@ OC.L10N.register(
"Sharing %s failed, because the backend does not allow shares from type %i" : "No se pudo compartir %s porque el repositorio no permite recursos compartidos del tipo %i",
"Sharing %s failed, because the file does not exist" : "No se pudo compartir %s porque el archivo no existe",
"You are not allowed to share %s" : "Usted no está autorizado para compartir %s",
- "Sharing %s failed, because you can not share with yourself" : "Se falló al compartir %s, porque no puedes compartir contigo mismo",
+ "Sharing %s failed, because you can not share with yourself" : "Fallo al compartir %s, porque no puedes compartir contigo mismo",
"Sharing %s failed, because the user %s does not exist" : "Se ha fallado al compartir %s, ya que el usuario %s no existe",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Se ha fallado al compartir %s, ya que el usuario %s no es miembro de ningún grupo del que %s sea miembro",
- "Sharing %s failed, because this item is already shared with %s" : "Se falló al compartir %s, ya que este elemento ya está compartido con %s",
- "Sharing %s failed, because this item is already shared with user %s" : "Compartiendo %s falló, porque este objeto ya se comparte con el usuario %s",
- "Sharing %s failed, because the group %s does not exist" : "Se falló al compartir %s, ya que el grupo %s no existe",
- "Sharing %s failed, because %s is not a member of the group %s" : "Se falló al compartir %s, ya que %s no es miembro del grupo %s",
+ "Sharing %s failed, because this item is already shared with %s" : "Fallo al compartir %s, ya que este elemento ya está compartido con %s",
+ "Sharing %s failed, because this item is already shared with user %s" : "Fallo al compartir %s, porque este objeto ya se comparte con el usuario %s",
+ "Sharing %s failed, because the group %s does not exist" : "Fallo al compartir %s, ya que el grupo %s no existe",
+ "Sharing %s failed, because %s is not a member of the group %s" : "Fallo al compartir %s, ya que %s no es miembro del grupo %s",
"You need to provide a password to create a public link, only protected links are allowed" : "Es necesario definir una contraseña para crear un enlace publico. Solo los enlaces protegidos están permitidos",
- "Sharing %s failed, because sharing with links is not allowed" : "Se falló al compartir %s, ya que no está permitida la compartición con enlaces",
+ "Sharing %s failed, because sharing with links is not allowed" : "Fallo al compartir %s, ya que no se permite compartir con enlaces",
"Not allowed to create a federated share with the same user" : "No se permite crear un recurso compartido federado con el mismo usuario",
"Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Fallo al compartir %s. No se ha podido encontrar %s, quizás haya un problema de conexión con el servidor.",
"Share type %s is not valid for %s" : "El tipo de recurso compartido %s no es válido para %s",
@@ -124,7 +124,7 @@ OC.L10N.register(
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "Se ha fallado al compartir %s, ya que los permisos superan los permisos otorgados a %s",
"Sharing %s failed, because resharing is not allowed" : "Fallo al compartir %s, ya que no está permitido volverlo a compartir",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen",
- "Sharing %s failed, because the file could not be found in the file cache" : "Se ha fallado al compartir %s, ya que el archivo no pudo ser encontrado en el cache de archivo",
+ "Sharing %s failed, because the file could not be found in the file cache" : "Fallo al compartir %s, ya que el archivo no se ha encontrado en el caché de archivo",
"Can’t increase permissions of %s" : "No se pueden aumentar los permisos de %s",
"Files can’t be shared with delete permissions" : "Los archivos no se pueden compartir con permisos de borrado",
"Files can’t be shared with create permissions" : "Los archivos no se pueden compartir con permisos de creación",
@@ -205,7 +205,7 @@ OC.L10N.register(
"Cannot create \"data\" directory" : "No se puede crear el directorio \"data\"",
"This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Habitualmente, esto puede arreglarse dando al servidor web acceso de escritura al directorio raíz. Véase %s",
"Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "Habitualmente, los permisos pueden arreglarse dando al servidor web acceso de escritura al directorio raíz. Véase %s",
- "Setting locale to %s failed" : "Falló la activación del idioma %s ",
+ "Setting locale to %s failed" : "Ha fallado la activación del idioma %s ",
"Please install one of these locales on your system and restart your webserver." : "Instale uno de estos idiomas en su sistema y reinicie su servidor web.",
"Please ask your server administrator to install the module." : "Consulte al administrador de su servidor para instalar el módulo.",
"PHP module %s not installed." : "El módulo PHP %s no está instalado.",
diff --git a/lib/l10n/es.json b/lib/l10n/es.json
index c626ecc891a..76dda7f2c7d 100644
--- a/lib/l10n/es.json
+++ b/lib/l10n/es.json
@@ -60,7 +60,7 @@
"Help" : "Ayuda",
"Apps" : "Aplicaciones",
"Settings" : "Configuración",
- "Log out" : "Desconectar",
+ "Log out" : "Cerrar sesión",
"Users" : "Usuarios",
"Unknown user" : "Usuario desconocido",
"APCu" : "APCu",
@@ -101,15 +101,15 @@
"Sharing %s failed, because the backend does not allow shares from type %i" : "No se pudo compartir %s porque el repositorio no permite recursos compartidos del tipo %i",
"Sharing %s failed, because the file does not exist" : "No se pudo compartir %s porque el archivo no existe",
"You are not allowed to share %s" : "Usted no está autorizado para compartir %s",
- "Sharing %s failed, because you can not share with yourself" : "Se falló al compartir %s, porque no puedes compartir contigo mismo",
+ "Sharing %s failed, because you can not share with yourself" : "Fallo al compartir %s, porque no puedes compartir contigo mismo",
"Sharing %s failed, because the user %s does not exist" : "Se ha fallado al compartir %s, ya que el usuario %s no existe",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Se ha fallado al compartir %s, ya que el usuario %s no es miembro de ningún grupo del que %s sea miembro",
- "Sharing %s failed, because this item is already shared with %s" : "Se falló al compartir %s, ya que este elemento ya está compartido con %s",
- "Sharing %s failed, because this item is already shared with user %s" : "Compartiendo %s falló, porque este objeto ya se comparte con el usuario %s",
- "Sharing %s failed, because the group %s does not exist" : "Se falló al compartir %s, ya que el grupo %s no existe",
- "Sharing %s failed, because %s is not a member of the group %s" : "Se falló al compartir %s, ya que %s no es miembro del grupo %s",
+ "Sharing %s failed, because this item is already shared with %s" : "Fallo al compartir %s, ya que este elemento ya está compartido con %s",
+ "Sharing %s failed, because this item is already shared with user %s" : "Fallo al compartir %s, porque este objeto ya se comparte con el usuario %s",
+ "Sharing %s failed, because the group %s does not exist" : "Fallo al compartir %s, ya que el grupo %s no existe",
+ "Sharing %s failed, because %s is not a member of the group %s" : "Fallo al compartir %s, ya que %s no es miembro del grupo %s",
"You need to provide a password to create a public link, only protected links are allowed" : "Es necesario definir una contraseña para crear un enlace publico. Solo los enlaces protegidos están permitidos",
- "Sharing %s failed, because sharing with links is not allowed" : "Se falló al compartir %s, ya que no está permitida la compartición con enlaces",
+ "Sharing %s failed, because sharing with links is not allowed" : "Fallo al compartir %s, ya que no se permite compartir con enlaces",
"Not allowed to create a federated share with the same user" : "No se permite crear un recurso compartido federado con el mismo usuario",
"Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Fallo al compartir %s. No se ha podido encontrar %s, quizás haya un problema de conexión con el servidor.",
"Share type %s is not valid for %s" : "El tipo de recurso compartido %s no es válido para %s",
@@ -122,7 +122,7 @@
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "Se ha fallado al compartir %s, ya que los permisos superan los permisos otorgados a %s",
"Sharing %s failed, because resharing is not allowed" : "Fallo al compartir %s, ya que no está permitido volverlo a compartir",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen",
- "Sharing %s failed, because the file could not be found in the file cache" : "Se ha fallado al compartir %s, ya que el archivo no pudo ser encontrado en el cache de archivo",
+ "Sharing %s failed, because the file could not be found in the file cache" : "Fallo al compartir %s, ya que el archivo no se ha encontrado en el caché de archivo",
"Can’t increase permissions of %s" : "No se pueden aumentar los permisos de %s",
"Files can’t be shared with delete permissions" : "Los archivos no se pueden compartir con permisos de borrado",
"Files can’t be shared with create permissions" : "Los archivos no se pueden compartir con permisos de creación",
@@ -203,7 +203,7 @@
"Cannot create \"data\" directory" : "No se puede crear el directorio \"data\"",
"This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Habitualmente, esto puede arreglarse dando al servidor web acceso de escritura al directorio raíz. Véase %s",
"Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "Habitualmente, los permisos pueden arreglarse dando al servidor web acceso de escritura al directorio raíz. Véase %s",
- "Setting locale to %s failed" : "Falló la activación del idioma %s ",
+ "Setting locale to %s failed" : "Ha fallado la activación del idioma %s ",
"Please install one of these locales on your system and restart your webserver." : "Instale uno de estos idiomas en su sistema y reinicie su servidor web.",
"Please ask your server administrator to install the module." : "Consulte al administrador de su servidor para instalar el módulo.",
"PHP module %s not installed." : "El módulo PHP %s no está instalado.",
diff --git a/lib/l10n/es_MX.js b/lib/l10n/es_MX.js
index 344eb1bf312..8e83955040b 100644
--- a/lib/l10n/es_MX.js
+++ b/lib/l10n/es_MX.js
@@ -27,6 +27,7 @@ OC.L10N.register(
"Following platforms are supported: %s" : "Las siguientes plataformas están soportadas: %s",
"Server version %s or higher is required." : "Se requiere la versión del servidor %s o superior. ",
"Server version %s or lower is required." : "La versión del servidor %s o inferior es requerdia. ",
+ "Logged in user must be an admin" : "El usuario firmado debe ser un administrador",
"Unknown filetype" : "Tipo de archivo desconocido",
"Invalid image" : "Imagen inválida",
"Avatar image is not square" : "La imagen del avatar no es un cuadrado",
@@ -61,7 +62,7 @@ OC.L10N.register(
"Help" : "Ayuda",
"Apps" : "Aplicaciones",
"Settings" : "Configuraciones",
- "Log out" : "Salir",
+ "Log out" : "Cerrar sesión",
"Users" : "Usuarios",
"Unknown user" : "Ususario desconocido",
"APCu" : "APCu",
diff --git a/lib/l10n/es_MX.json b/lib/l10n/es_MX.json
index 088e85cf549..e6c4b4bc6e1 100644
--- a/lib/l10n/es_MX.json
+++ b/lib/l10n/es_MX.json
@@ -25,6 +25,7 @@
"Following platforms are supported: %s" : "Las siguientes plataformas están soportadas: %s",
"Server version %s or higher is required." : "Se requiere la versión del servidor %s o superior. ",
"Server version %s or lower is required." : "La versión del servidor %s o inferior es requerdia. ",
+ "Logged in user must be an admin" : "El usuario firmado debe ser un administrador",
"Unknown filetype" : "Tipo de archivo desconocido",
"Invalid image" : "Imagen inválida",
"Avatar image is not square" : "La imagen del avatar no es un cuadrado",
@@ -59,7 +60,7 @@
"Help" : "Ayuda",
"Apps" : "Aplicaciones",
"Settings" : "Configuraciones",
- "Log out" : "Salir",
+ "Log out" : "Cerrar sesión",
"Users" : "Usuarios",
"Unknown user" : "Ususario desconocido",
"APCu" : "APCu",
diff --git a/lib/l10n/fi.js b/lib/l10n/fi.js
index 118d0e02f28..ee1ed07051f 100644
--- a/lib/l10n/fi.js
+++ b/lib/l10n/fi.js
@@ -22,6 +22,7 @@ OC.L10N.register(
"Following platforms are supported: %s" : "Seuraavat alustat ovat tuettuja: %s",
"Server version %s or higher is required." : "Palvelinversio %s tai sitä uudempi vaaditaan.",
"Server version %s or lower is required." : "Palvelinversio %s tai alhaisempi vaaditaan.",
+ "Logged in user must be an admin" : "Sisäänkirjautuneen käyttäjän tulee olla ylläpitäjä",
"Unknown filetype" : "Tuntematon tiedostotyyppi",
"Invalid image" : "Virheellinen kuva",
"Avatar image is not square" : "Avatar-kuva ei ole neliö",
@@ -60,6 +61,10 @@ OC.L10N.register(
"Unknown user" : "Tuntematon käyttäjä",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Luo",
+ "Change" : "Muuta",
+ "Delete" : "Poista",
+ "Share" : "Jaa",
"Basic settings" : "Perusasetukset",
"Sharing" : "Jakaminen",
"Security" : "Turvallisuus",
diff --git a/lib/l10n/fi.json b/lib/l10n/fi.json
index 716eefdd5c9..8806183f8b3 100644
--- a/lib/l10n/fi.json
+++ b/lib/l10n/fi.json
@@ -20,6 +20,7 @@
"Following platforms are supported: %s" : "Seuraavat alustat ovat tuettuja: %s",
"Server version %s or higher is required." : "Palvelinversio %s tai sitä uudempi vaaditaan.",
"Server version %s or lower is required." : "Palvelinversio %s tai alhaisempi vaaditaan.",
+ "Logged in user must be an admin" : "Sisäänkirjautuneen käyttäjän tulee olla ylläpitäjä",
"Unknown filetype" : "Tuntematon tiedostotyyppi",
"Invalid image" : "Virheellinen kuva",
"Avatar image is not square" : "Avatar-kuva ei ole neliö",
@@ -58,6 +59,10 @@
"Unknown user" : "Tuntematon käyttäjä",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Luo",
+ "Change" : "Muuta",
+ "Delete" : "Poista",
+ "Share" : "Jaa",
"Basic settings" : "Perusasetukset",
"Sharing" : "Jakaminen",
"Security" : "Turvallisuus",
diff --git a/lib/l10n/hu.js b/lib/l10n/hu.js
index 2f3f5e8d9df..0384a02b158 100644
--- a/lib/l10n/hu.js
+++ b/lib/l10n/hu.js
@@ -27,6 +27,7 @@ OC.L10N.register(
"Following platforms are supported: %s" : "Ezek a platformok támogatottak: %s",
"Server version %s or higher is required." : "%s vagy újabb szerver verzió szükséges.",
"Server version %s or lower is required." : "%s vagy régebbi szerver verzió szükséges.",
+ "Logged in user must be an admin" : "Adminnak kell bejelentkeznie",
"Unknown filetype" : "Ismeretlen fájl típus",
"Invalid image" : "Hibás kép",
"Avatar image is not square" : "Az avatár kép nem négyzetes.",
@@ -66,6 +67,10 @@ OC.L10N.register(
"Unknown user" : "Ismeretlen felhasználó",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Létrehozás",
+ "Change" : "Változtatás",
+ "Delete" : "Törlés",
+ "Share" : "Megosztás",
"Basic settings" : "Alapvető beállítások",
"Sharing" : "Megosztás",
"Security" : "Biztonság",
diff --git a/lib/l10n/hu.json b/lib/l10n/hu.json
index 37e2d31362e..794d9eff0f2 100644
--- a/lib/l10n/hu.json
+++ b/lib/l10n/hu.json
@@ -25,6 +25,7 @@
"Following platforms are supported: %s" : "Ezek a platformok támogatottak: %s",
"Server version %s or higher is required." : "%s vagy újabb szerver verzió szükséges.",
"Server version %s or lower is required." : "%s vagy régebbi szerver verzió szükséges.",
+ "Logged in user must be an admin" : "Adminnak kell bejelentkeznie",
"Unknown filetype" : "Ismeretlen fájl típus",
"Invalid image" : "Hibás kép",
"Avatar image is not square" : "Az avatár kép nem négyzetes.",
@@ -64,6 +65,10 @@
"Unknown user" : "Ismeretlen felhasználó",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Létrehozás",
+ "Change" : "Változtatás",
+ "Delete" : "Törlés",
+ "Share" : "Megosztás",
"Basic settings" : "Alapvető beállítások",
"Sharing" : "Megosztás",
"Security" : "Biztonság",
diff --git a/lib/l10n/nb.js b/lib/l10n/nb.js
index 9fa5ef569d0..284984a1e1c 100644
--- a/lib/l10n/nb.js
+++ b/lib/l10n/nb.js
@@ -66,6 +66,10 @@ OC.L10N.register(
"Unknown user" : "Ukjent bruker",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Opprett",
+ "Change" : "Endre",
+ "Delete" : "Slett",
+ "Share" : "Del",
"Basic settings" : "Grunninnstillinger",
"Sharing" : "Deling",
"Security" : "Sikkerhet",
diff --git a/lib/l10n/nb.json b/lib/l10n/nb.json
index 327e7a0e0ae..daeb9246ef3 100644
--- a/lib/l10n/nb.json
+++ b/lib/l10n/nb.json
@@ -64,6 +64,10 @@
"Unknown user" : "Ukjent bruker",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Opprett",
+ "Change" : "Endre",
+ "Delete" : "Slett",
+ "Share" : "Del",
"Basic settings" : "Grunninnstillinger",
"Sharing" : "Deling",
"Security" : "Sikkerhet",
diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js
index a13c99f77d8..14961102ef5 100644
--- a/lib/l10n/nl.js
+++ b/lib/l10n/nl.js
@@ -27,6 +27,7 @@ OC.L10N.register(
"Following platforms are supported: %s" : "De volgende platformen worden ondersteund: %s",
"Server version %s or higher is required." : "Serverversie %s of hoger vereist.",
"Server version %s or lower is required." : "Serverversie %s of lager vereist.",
+ "Logged in user must be an admin" : "Ingelogde gebruiker moet een beheerder zijn",
"Unknown filetype" : "Onbekend bestandsformaat",
"Invalid image" : "Ongeldige afbeelding",
"Avatar image is not square" : "Avatar afbeelding is niet vierkant",
@@ -66,6 +67,10 @@ OC.L10N.register(
"Unknown user" : "Onbekende gebruiker",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Aanmaken",
+ "Change" : "Wijzigen",
+ "Delete" : "Verwijderen",
+ "Share" : "Delen",
"Basic settings" : "Basis-instellingen",
"Sharing" : "Delen",
"Security" : "Beveiliging",
@@ -231,8 +236,15 @@ OC.L10N.register(
"Personal" : "Persoonlijk",
"Admin" : "Beheerder",
"DB Error: \"%s\"" : "DB Fout: \"%s\"",
+ "Offending command was: \"%s\"" : "Onjuiste commando was: \"%s\"",
+ "Offending command was: \"%s\", name: %s, password: %s" : "Onjuiste commando was: \"%s\", naam: %s, wachtwoord: %s",
+ "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "Instellen van de gebruik rechten voor %s is mislukt, omdat de rechten hoger zijn dan de aan %s toegekende gebruik rechten",
+ "Setting permissions for %s failed, because the item was not found" : "Instellen van de gebruik rechten voor %s is mislukt, omdat het object niet is gevonden",
+ "Cannot clear expiration date. Shares are required to have an expiration date." : "Kan verval datum niet weghalen. Gedeelte folders moeten een vervaldatum hebben.",
+ "Cannot increase permissions of %s" : "Kan de rechten van %s niet verhogen.",
"Files can't be shared with delete permissions" : "Bestanden kunnen niet gedeeld worden met 'verwijder' rechten",
"Files can't be shared with create permissions" : "Bestanden kunnen niet gedeeld worden met 'creëer' rechten",
+ "Cannot set expiration date more than %s days in the future" : "Kan de vervaldatum niet meer dan %s dagen in de toekomst instellen",
"No app name specified" : "Geen app naam gespecificeerd",
"App '%s' could not be installed!" : "App '%s' kon niet geïnstalleerd worden!"
},
diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json
index 3cd3b329711..09b686da06e 100644
--- a/lib/l10n/nl.json
+++ b/lib/l10n/nl.json
@@ -25,6 +25,7 @@
"Following platforms are supported: %s" : "De volgende platformen worden ondersteund: %s",
"Server version %s or higher is required." : "Serverversie %s of hoger vereist.",
"Server version %s or lower is required." : "Serverversie %s of lager vereist.",
+ "Logged in user must be an admin" : "Ingelogde gebruiker moet een beheerder zijn",
"Unknown filetype" : "Onbekend bestandsformaat",
"Invalid image" : "Ongeldige afbeelding",
"Avatar image is not square" : "Avatar afbeelding is niet vierkant",
@@ -64,6 +65,10 @@
"Unknown user" : "Onbekende gebruiker",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Aanmaken",
+ "Change" : "Wijzigen",
+ "Delete" : "Verwijderen",
+ "Share" : "Delen",
"Basic settings" : "Basis-instellingen",
"Sharing" : "Delen",
"Security" : "Beveiliging",
@@ -229,8 +234,15 @@
"Personal" : "Persoonlijk",
"Admin" : "Beheerder",
"DB Error: \"%s\"" : "DB Fout: \"%s\"",
+ "Offending command was: \"%s\"" : "Onjuiste commando was: \"%s\"",
+ "Offending command was: \"%s\", name: %s, password: %s" : "Onjuiste commando was: \"%s\", naam: %s, wachtwoord: %s",
+ "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "Instellen van de gebruik rechten voor %s is mislukt, omdat de rechten hoger zijn dan de aan %s toegekende gebruik rechten",
+ "Setting permissions for %s failed, because the item was not found" : "Instellen van de gebruik rechten voor %s is mislukt, omdat het object niet is gevonden",
+ "Cannot clear expiration date. Shares are required to have an expiration date." : "Kan verval datum niet weghalen. Gedeelte folders moeten een vervaldatum hebben.",
+ "Cannot increase permissions of %s" : "Kan de rechten van %s niet verhogen.",
"Files can't be shared with delete permissions" : "Bestanden kunnen niet gedeeld worden met 'verwijder' rechten",
"Files can't be shared with create permissions" : "Bestanden kunnen niet gedeeld worden met 'creëer' rechten",
+ "Cannot set expiration date more than %s days in the future" : "Kan de vervaldatum niet meer dan %s dagen in de toekomst instellen",
"No app name specified" : "Geen app naam gespecificeerd",
"App '%s' could not be installed!" : "App '%s' kon niet geïnstalleerd worden!"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
diff --git a/lib/l10n/sk.js b/lib/l10n/sk.js
index ddd0c1de7f4..5b5f93ce175 100644
--- a/lib/l10n/sk.js
+++ b/lib/l10n/sk.js
@@ -66,6 +66,9 @@ OC.L10N.register(
"Unknown user" : "Neznámy používateľ",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Vytvoriť",
+ "Delete" : "Zmazať",
+ "Share" : "Zdieľať",
"Basic settings" : "Základné nastavenia",
"Sharing" : "Sprístupnenie",
"Security" : "Zabezpečenie",
@@ -227,6 +230,8 @@ OC.L10N.register(
"Storage incomplete configuration. %s" : "Neplatná konfigurácia úložiska. %s",
"Storage connection error. %s" : "Chyba pripojenia k úložisku. %s",
"Storage is temporarily not available" : "Úložisko je dočasne nedostupné",
- "Storage connection timeout. %s" : "Vypršanie pripojenia k úložisku. %s"
+ "Storage connection timeout. %s" : "Vypršanie pripojenia k úložisku. %s",
+ "Personal" : "Osobné",
+ "App '%s' could not be installed!" : "Aplikáciu '%s' nebolo možné nainštalovať!"
},
"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;");
diff --git a/lib/l10n/sk.json b/lib/l10n/sk.json
index a9b9e1e6957..107c44a73c3 100644
--- a/lib/l10n/sk.json
+++ b/lib/l10n/sk.json
@@ -64,6 +64,9 @@
"Unknown user" : "Neznámy používateľ",
"APCu" : "APCu",
"Redis" : "Redis",
+ "Create" : "Vytvoriť",
+ "Delete" : "Zmazať",
+ "Share" : "Zdieľať",
"Basic settings" : "Základné nastavenia",
"Sharing" : "Sprístupnenie",
"Security" : "Zabezpečenie",
@@ -225,6 +228,8 @@
"Storage incomplete configuration. %s" : "Neplatná konfigurácia úložiska. %s",
"Storage connection error. %s" : "Chyba pripojenia k úložisku. %s",
"Storage is temporarily not available" : "Úložisko je dočasne nedostupné",
- "Storage connection timeout. %s" : "Vypršanie pripojenia k úložisku. %s"
+ "Storage connection timeout. %s" : "Vypršanie pripojenia k úložisku. %s",
+ "Personal" : "Osobné",
+ "App '%s' could not be installed!" : "Aplikáciu '%s' nebolo možné nainštalovať!"
},"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
} \ No newline at end of file
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 745bab367d3..58706e290fb 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -233,7 +233,7 @@ class AllConfig implements \OCP\IConfig {
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key)));
$qb->execute();
- $this->userCache[$userId][$appName][$key] = $value;
+ $this->userCache[$userId][$appName][$key] = (string)$value;
return;
}
}
@@ -258,7 +258,7 @@ class AllConfig implements \OCP\IConfig {
if (!isset($this->userCache[$userId][$appName])) {
$this->userCache[$userId][$appName] = array();
}
- $this->userCache[$userId][$appName][$key] = $value;
+ $this->userCache[$userId][$appName][$key] = (string)$value;
}
}
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 4bf15c23fab..4d0859b1988 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -204,7 +204,9 @@ class AppManager implements IAppManager {
}
/**
- * Check if an app is installed in the instance
+ * Check if an app is enabled in the instance
+ *
+ * Notice: This actually checks if the app is enabled and not only if it is installed.
*
* @param string $appId
* @return bool
@@ -287,6 +289,13 @@ class AppManager implements IAppManager {
}
unset($this->installedAppsCache[$appId]);
$this->appConfig->setValue($appId, 'enabled', 'no');
+
+ // run uninstall steps
+ $appData = $this->getAppInfo($appId);
+ if (!is_null($appData)) {
+ \OC_App::executeRepairSteps($appId, $appData['repair-steps']['uninstall']);
+ }
+
$this->dispatcher->dispatch(ManagerEvent::EVENT_APP_DISABLE, new ManagerEvent(
ManagerEvent::EVENT_APP_DISABLE, $appId
));
@@ -349,7 +358,7 @@ class AppManager implements IAppManager {
*
* @param bool $path
* @param null $lang
- * @return array app info
+ * @return array|null app info
*/
public function getAppInfo(string $appId, bool $path = false, $lang = null) {
if ($path) {
@@ -402,7 +411,9 @@ class AppManager implements IAppManager {
$incompatibleApps = array();
foreach ($apps as $appId) {
$info = $this->getAppInfo($appId);
- if (!\OC_App::isAppCompatible($version, $info)) {
+ if ($info === null) {
+ $incompatibleApps[] = ['id' => $appId];
+ } else if (!\OC_App::isAppCompatible($version, $info)) {
$incompatibleApps[] = $info;
}
}
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php
index 63121c079bd..a8fd9349343 100644
--- a/lib/private/App/AppStore/Fetcher/AppFetcher.php
+++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php
@@ -133,9 +133,11 @@ class AppFetcher extends Fetcher {
/**
* @param string $version
+ * @param string $filename
*/
- public function setVersion($version) {
+ public function setVersion(string $version, string $fileName = 'apps.json') {
parent::setVersion($version);
+ $this->fileName = $fileName;
$this->setEndpoint();
}
}
diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php
index 4dbc360c0c4..172584c522b 100644
--- a/lib/private/App/AppStore/Fetcher/Fetcher.php
+++ b/lib/private/App/AppStore/Fetcher/Fetcher.php
@@ -194,7 +194,7 @@ abstract class Fetcher {
* Set the current Nextcloud version
* @param string $version
*/
- public function setVersion($version) {
+ public function setVersion(string $version) {
$this->version = $version;
}
}
diff --git a/lib/private/App/CodeChecker/DeprecationCheck.php b/lib/private/App/CodeChecker/DeprecationCheck.php
index 722697f3313..518ab1ec380 100644
--- a/lib/private/App/CodeChecker/DeprecationCheck.php
+++ b/lib/private/App/CodeChecker/DeprecationCheck.php
@@ -40,13 +40,13 @@ class DeprecationCheck extends AbstractCheck {
'OCP\Contacts' => '8.1.0',
'OCP\DB' => '8.1.0',
- 'OCP\IHelper' => '8.1.0',
'OCP\JSON' => '8.1.0',
'OCP\Response' => '8.1.0',
'OCP\AppFramework\IApi' => '8.0.0',
'OCP\User' => '13.0.0',
'OCP\BackgroundJob' => '14.0.0',
'OCP\App' => '14.0.0',
+ 'OCP\Files' => '14.0.0',
];
}
@@ -175,6 +175,13 @@ class DeprecationCheck extends AbstractCheck {
'OCP\Util::mb_substr_replace' => '8.2.0',
'OCP\Util::sendMail' => '8.1.0',
'OCP\Util::writeLog' => '13.0.0',
+
+ 'OCP\Files::rmdirr' => '14.0.0',
+ 'OCP\Files::getMimeType' => '14.0.0',
+ 'OCP\Files::searchByMime' => '14.0.0',
+ 'OCP\Files::streamCopy' => '14.0.0',
+ 'OCP\Files::buildNotExistingFileName' => '14.0.0',
+ 'OCP\Files::getStorage' => '14.0.0',
];
}
}
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index 6e8c3736fdb..25708245e26 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -55,7 +56,7 @@ class App {
* the transformed app id, defaults to OCA\
* @return string the starting namespace for the app
*/
- public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
+ public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string {
// Hit the cache!
if (isset(self::$nameSpaceCache[$appId])) {
return $topNamespace . self::$nameSpaceCache[$appId];
@@ -81,7 +82,7 @@ class App {
* @param DIContainer $container an instance of a pimple container.
* @param array $urlParams list of URL parameters (optional)
*/
- public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
+ public static function main(string $controllerName, string $methodName, DIContainer $container, array $urlParams = null) {
if (!is_null($urlParams)) {
$container[IRequest::class]->setUrlParameters($urlParams);
} else if (isset($container['urlParams']) && !is_null($container['urlParams'])) {
@@ -171,7 +172,7 @@ class App {
* @param array $urlParams an array with variables extracted from the routes
* @param DIContainer $container an instance of a pimple container.
*/
- public static function part($controllerName, $methodName, array $urlParams,
+ public static function part(string $controllerName, string $methodName, array $urlParams,
DIContainer $container){
$container['urlParams'] = $urlParams;
diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
index bb3083c835c..7eb730ac2a3 100644
--- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -39,6 +40,7 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Security\CSRF\CsrfTokenManager;
+use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
@@ -91,29 +93,14 @@ class SecurityMiddleware extends Middleware {
/** @var IL10N */
private $l10n;
- /**
- * @param IRequest $request
- * @param ControllerMethodReflector $reflector
- * @param INavigationManager $navigationManager
- * @param IURLGenerator $urlGenerator
- * @param ILogger $logger
- * @param string $appName
- * @param bool $isLoggedIn
- * @param bool $isAdminUser
- * @param ContentSecurityPolicyManager $contentSecurityPolicyManager
- * @param CSRFTokenManager $csrfTokenManager
- * @param ContentSecurityPolicyNonceManager $cspNonceManager
- * @param IAppManager $appManager
- * @param IL10N $l10n
- */
public function __construct(IRequest $request,
ControllerMethodReflector $reflector,
INavigationManager $navigationManager,
IURLGenerator $urlGenerator,
ILogger $logger,
- $appName,
- $isLoggedIn,
- $isAdminUser,
+ string $appName,
+ bool $isLoggedIn,
+ bool $isAdminUser,
ContentSecurityPolicyManager $contentSecurityPolicyManager,
CsrfTokenManager $csrfTokenManager,
ContentSecurityPolicyNonceManager $cspNonceManager,
@@ -156,10 +143,8 @@ class SecurityMiddleware extends Middleware {
throw new NotLoggedInException();
}
- if(!$this->reflector->hasAnnotation('NoAdminRequired')) {
- if(!$this->isAdminUser) {
- throw new NotAdminException($this->l10n->t('Logged in user must be an admin'));
- }
+ if(!$this->reflector->hasAnnotation('NoAdminRequired') && !$this->isAdminUser) {
+ throw new NotAdminException($this->l10n->t('Logged in user must be an admin'));
}
}
@@ -191,15 +176,20 @@ class SecurityMiddleware extends Middleware {
}
/**
- * FIXME: Use DI once available
* Checks if app is enabled (also includes a check whether user is allowed to access the resource)
* The getAppPath() check is here since components such as settings also use the AppFramework and
* therefore won't pass this check.
+ * If page is public, app does not need to be enabled for current user/visitor
*/
- if(\OC_App::getAppPath($this->appName) !== false && !$this->appManager->isEnabledForUser($this->appName)) {
- throw new AppNotEnabledException();
+ try {
+ $appPath = $this->appManager->getAppPath($this->appName);
+ } catch (AppPathNotFoundException $e) {
+ $appPath = false;
}
+ if ($appPath !== false && !$isPublicPage && !$this->appManager->isEnabledForUser($this->appName)) {
+ throw new AppNotEnabledException();
+ }
}
/**
@@ -211,7 +201,7 @@ class SecurityMiddleware extends Middleware {
* @param Response $response
* @return Response
*/
- public function afterController($controller, $methodName, Response $response) {
+ public function afterController($controller, $methodName, Response $response): Response {
$policy = !is_null($response->getContentSecurityPolicy()) ? $response->getContentSecurityPolicy() : new ContentSecurityPolicy();
if (get_class($policy) === EmptyContentSecurityPolicy::class) {
@@ -240,14 +230,14 @@ class SecurityMiddleware extends Middleware {
* @throws \Exception the passed in exception if it can't handle it
* @return Response a Response object or null in case that the exception could not be handled
*/
- public function afterException($controller, $methodName, \Exception $exception) {
+ public function afterException($controller, $methodName, \Exception $exception): Response {
if($exception instanceof SecurityException) {
if($exception instanceof StrictCookieMissingException) {
return new RedirectResponse(\OC::$WEBROOT);
}
if (stripos($this->request->getHeader('Accept'),'html') === false) {
$response = new JSONResponse(
- array('message' => $exception->getMessage()),
+ ['message' => $exception->getMessage()],
$exception->getCode()
);
} else {
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index b86d3339264..e96f24ed284 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -46,6 +46,7 @@ class SimpleContainer extends Container implements IContainer {
/**
* @param ReflectionClass $class the class to instantiate
* @return \stdClass the created class
+ * @suppress PhanUndeclaredClassInstanceof
*/
private function buildClass(ReflectionClass $class) {
$constructor = $class->getConstructor();
@@ -66,6 +67,12 @@ class SimpleContainer extends Container implements IContainer {
try {
$parameters[] = $this->query($resolveName);
} catch (\Exception $e) {
+ if (class_exists('PHPUnit_Framework_AssertionFailedError', false) &&
+ $e instanceof \PHPUnit_Framework_AssertionFailedError) {
+ // Easier debugging of "Your test case is not allowed to access the database."
+ throw $e;
+ }
+
// Service not found, use the default value when available
if ($parameter->isDefaultValueAvailable()) {
$parameters[] = $parameter->getDefaultValue();
diff --git a/lib/private/AppHelper.php b/lib/private/AppHelper.php
deleted file mode 100644
index c99cf4a8304..00000000000
--- a/lib/private/AppHelper.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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;
-
-/**
- * Class AppHelper
- * @deprecated 8.1.0
- */
-class AppHelper implements \OCP\IHelper {
- /**
- * Gets the content of an URL by using CURL or a fallback if it is not
- * installed
- * @param string $url the url that should be fetched
- * @return string the content of the webpage
- * @deprecated 8.1.0 Use \OCP\IServerContainer::getHTTPClientService
- */
- public function getUrlContent($url) {
- try {
- $client = \OC::$server->getHTTPClientService()->newClient();
- $response = $client->get($url);
- return $response->getBody();
- } catch (\Exception $e) {
- return false;
- }
- }
-}
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index f37da6fc52d..ef2ea83c3c6 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -139,7 +139,7 @@ class TAR extends Archive {
*/
public function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tar->extract($tmp);
rename($tmp . $source, $tmp . $dest);
$this->tar = null;
@@ -258,7 +258,7 @@ class TAR extends Archive {
* @return bool
*/
public function extractFile($path, $dest) {
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
if (!$this->fileExists($path)) {
return false;
}
@@ -323,7 +323,7 @@ class TAR extends Archive {
$this->fileList = false;
$this->cachedHeaders = false;
//no proper way to delete, extract entire archive, delete file and remake archive
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tar->extract($tmp);
\OCP\Files::rmdirr($tmp . $path);
$this->tar = null;
@@ -346,7 +346,7 @@ class TAR extends Archive {
} else {
$ext = '';
}
- $tmpFile = \OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if ($this->fileExists($path)) {
$this->extractFile($path, $tmpFile);
} elseif ($mode == 'r' or $mode == 'rb') {
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index fb3e2fdde97..fb727aba224 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -198,7 +198,7 @@ class ZIP extends Archive{
}else{
$ext='';
}
- $tmpFile=\OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if($this->fileExists($path)) {
$this->extractFile($path, $tmpFile);
}
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index b4964825182..101d6845ec3 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -73,7 +73,7 @@ class MailPlugin implements ISearchPlugin {
* @since 13.0.0
*/
public function search($search, $limit, $offset, ISearchResult $searchResult) {
- $result = ['wide' => [], 'exact' => []];
+ $result = $userResults = ['wide' => [], 'exact' => []];
$userType = new SearchResultType('users');
$emailType = new SearchResultType('emails');
@@ -88,6 +88,10 @@ class MailPlugin implements ISearchPlugin {
$emailAddresses = [$emailAddresses];
}
foreach ($emailAddresses as $emailAddress) {
+ $displayName = $emailAddress;
+ if (isset($contact['FN'])) {
+ $displayName = $contact['FN'] . ' (' . $emailAddress . ')';
+ }
$exactEmailMatch = strtolower($emailAddress) === $lowerSearch;
if (isset($contact['isLocalSystemBook'])) {
@@ -116,7 +120,7 @@ class MailPlugin implements ISearchPlugin {
if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
$singleResult = [[
- 'label' => $contact['FN'] . " ($emailAddress)",
+ 'label' => $displayName,
'value' => [
'shareType' => Share::SHARE_TYPE_USER,
'shareWith' => $cloud->getUser(),
@@ -136,25 +140,26 @@ class MailPlugin implements ISearchPlugin {
}
if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
- $singleResult = [[
- 'label' => $contact['FN'] . " ($emailAddress)",
+ $userResults['wide'][] = [
+ 'label' => $displayName,
'value' => [
'shareType' => Share::SHARE_TYPE_USER,
'shareWith' => $cloud->getUser(),
- ]],
+ ],
];
- $searchResult->addResultSet($userType, $singleResult, []);
}
}
continue;
}
- if ($exactEmailMatch || strtolower($contact['FN']) === $lowerSearch) {
+ if ($exactEmailMatch
+ || isset($contact['FN']) && strtolower($contact['FN']) === $lowerSearch)
+ {
if ($exactEmailMatch) {
$searchResult->markExactIdMatch($emailType);
}
$result['exact'][] = [
- 'label' => $contact['FN'] . " ($emailAddress)",
+ 'label' => $displayName,
'value' => [
'shareType' => Share::SHARE_TYPE_EMAIL,
'shareWith' => $emailAddress,
@@ -162,7 +167,7 @@ class MailPlugin implements ISearchPlugin {
];
} else {
$result['wide'][] = [
- 'label' => $contact['FN'] . " ($emailAddress)",
+ 'label' => $displayName,
'value' => [
'shareType' => Share::SHARE_TYPE_EMAIL,
'shareWith' => $emailAddress,
@@ -173,12 +178,19 @@ class MailPlugin implements ISearchPlugin {
}
}
+ $reachedEnd = true;
if (!$this->shareeEnumeration) {
$result['wide'] = [];
+ $userResults['wide'] = [];
} else {
+ $reachedEnd = (count($result['wide']) < $offset + $limit) &&
+ (count($userResults['wide']) < $offset + $limit);
+
$result['wide'] = array_slice($result['wide'], $offset, $limit);
+ $userResults['wide'] = array_slice($userResults['wide'], $offset, $limit);
}
+
if (!$searchResult->hasExactIdMatch($emailType) && filter_var($search, FILTER_VALIDATE_EMAIL)) {
$result['exact'][] = [
'label' => $search,
@@ -189,9 +201,12 @@ class MailPlugin implements ISearchPlugin {
];
}
+ if (!empty($userResults['wide'])) {
+ $searchResult->addResultSet($userType, $userResults['wide'], []);
+ }
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
- return true;
+ return !$reachedEnd;
}
public function isCurrentUser(ICloudId $cloud): bool {
diff --git a/lib/private/Config.php b/lib/private/Config.php
index 2abf00a718c..c881e485006 100644
--- a/lib/private/Config.php
+++ b/lib/private/Config.php
@@ -37,7 +37,7 @@ namespace OC;
/**
* This class is responsible for reading and writing config.php, the very basic
- * configuration file of ownCloud.
+ * configuration file of Nextcloud.
*/
class Config {
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index b9ef447b74b..8a8a2f100ef 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -401,7 +401,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
}
/**
- * Espace a parameter to be used in a LIKE query
+ * Escape a parameter to be used in a LIKE query
*
* @param string $param
* @return string
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
index a32ae4a1827..6e4a2061832 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
@@ -26,6 +26,7 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder as DoctrineExpressionBuilder;
use OC\DB\QueryBuilder\CompositeExpression;
+use OC\DB\QueryBuilder\FunctionBuilder\FunctionBuilder;
use OC\DB\QueryBuilder\Literal;
use OC\DB\QueryBuilder\QueryFunction;
use OC\DB\QueryBuilder\QuoteHelper;
@@ -45,15 +46,20 @@ class ExpressionBuilder implements IExpressionBuilder {
/** @var IDBConnection */
protected $connection;
+ /** @var FunctionBuilder */
+ protected $functionBuilder;
+
/**
* Initializes a new <tt>ExpressionBuilder</tt>.
*
- * @param \OCP\IDBConnection $connection
+ * @param IDBConnection $connection
+ * @param IQueryBuilder $queryBuilder
*/
- public function __construct(IDBConnection $connection) {
+ public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
$this->connection = $connection;
$this->helper = new QuoteHelper();
$this->expressionBuilder = new DoctrineExpressionBuilder($connection);
+ $this->functionBuilder = $queryBuilder->func();
}
/**
@@ -65,14 +71,13 @@ class ExpressionBuilder implements IExpressionBuilder {
* // (u.type = ?) AND (u.role = ?)
* $expr->andX('u.type = ?', 'u.role = ?'));
*
- * @param mixed $x Optional clause. Defaults = null, but requires
+ * @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
- public function andX($x = null) {
- $arguments = func_get_args();
- $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $arguments);
+ public function andX(...$x) {
+ $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x);
return new CompositeExpression($compositeExpression);
}
@@ -85,14 +90,13 @@ class ExpressionBuilder implements IExpressionBuilder {
* // (u.type = ?) OR (u.role = ?)
* $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
*
- * @param mixed $x Optional clause. Defaults = null, but requires
+ * @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
- public function orX($x = null) {
- $arguments = func_get_args();
- $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $arguments);
+ public function orX(...$x) {
+ $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x);
return new CompositeExpression($compositeExpression);
}
@@ -298,9 +302,7 @@ class ExpressionBuilder implements IExpressionBuilder {
* @since 9.0.0
*/
public function iLike($x, $y, $type = null) {
- $x = $this->helper->quoteColumnName($x);
- $y = $this->helper->quoteColumnName($y);
- return $this->expressionBuilder->comparison("LOWER($x)", 'LIKE', "LOWER($y)");
+ return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
}
/**
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
index 17f7fd5aa47..aa7ef8e70be 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
@@ -25,6 +25,7 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder;
use OC\DB\Connection;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
class MySqlExpressionBuilder extends ExpressionBuilder {
@@ -34,9 +35,10 @@ class MySqlExpressionBuilder extends ExpressionBuilder {
/**
* @param \OCP\IDBConnection|Connection $connection
+ * @param IQueryBuilder $queryBuilder
*/
- public function __construct(IDBConnection $connection) {
- parent::__construct($connection);
+ public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
+ parent::__construct($connection, $queryBuilder);
$params = $connection->getParams();
$this->charset = isset($params['charset']) ? $params['charset'] : 'utf8';
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php
index 14d8ad33e40..d9e8a1279cc 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php
@@ -31,4 +31,8 @@ class SqliteExpressionBuilder extends ExpressionBuilder {
public function like($x, $y, $type = null) {
return parent::like($x, $y, $type) . " ESCAPE '\\'";
}
+
+ public function iLike($x, $y, $type = null) {
+ return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type);
+ }
}
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
index 2789b8cb356..1d745306351 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
@@ -59,4 +59,8 @@ class FunctionBuilder implements IFunctionBuilder {
public function sum($field) {
return new QueryFunction('SUM(' . $this->helper->quoteColumnName($field) . ')');
}
+
+ public function lower($field) {
+ return new QueryFunction('LOWER(' . $this->helper->quoteColumnName($field) . ')');
+ }
}
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index 58be4b43255..3cb7ba133db 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -112,15 +112,15 @@ class QueryBuilder implements IQueryBuilder {
*/
public function expr() {
if ($this->connection instanceof OracleConnection) {
- return new OCIExpressionBuilder($this->connection);
+ return new OCIExpressionBuilder($this->connection, $this);
} else if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
- return new PgSqlExpressionBuilder($this->connection);
+ return new PgSqlExpressionBuilder($this->connection, $this);
} else if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
- return new MySqlExpressionBuilder($this->connection);
+ return new MySqlExpressionBuilder($this->connection, $this);
} else if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
- return new SqliteExpressionBuilder($this->connection);
+ return new SqliteExpressionBuilder($this->connection, $this);
} else {
- return new ExpressionBuilder($this->connection);
+ return new ExpressionBuilder($this->connection, $this);
}
}
@@ -379,12 +379,14 @@ class QueryBuilder implements IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
* </code>
*
- * @param mixed $select The selection expressions.
+ * @param mixed ...$selects The selection expressions.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function select($select = null) {
- $selects = is_array($select) ? $select : func_get_args();
+ public function select(...$selects) {
+ if (count($selects) === 1 && is_array($selects[0])) {
+ $selects = $selects[0];
+ }
$this->queryBuilder->select(
$this->helper->quoteColumnNames($selects)
@@ -450,12 +452,14 @@ class QueryBuilder implements IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
* </code>
*
- * @param mixed $select The selection expression.
+ * @param mixed ...$selects The selection expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function addSelect($select = null) {
- $selects = is_array($select) ? $select : func_get_args();
+ public function addSelect(...$selects) {
+ if (count($selects) === 1 && is_array($selects[0])) {
+ $selects = $selects[0];
+ }
$this->queryBuilder->addSelect(
$this->helper->quoteColumnNames($selects)
@@ -725,14 +729,14 @@ class QueryBuilder implements IQueryBuilder {
* ->where($or);
* </code>
*
- * @param mixed $predicates The restriction predicates.
+ * @param mixed ...$predicates The restriction predicates.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function where($predicates) {
+ public function where(...$predicates) {
call_user_func_array(
[$this->queryBuilder, 'where'],
- func_get_args()
+ $predicates
);
return $this;
@@ -750,16 +754,16 @@ class QueryBuilder implements IQueryBuilder {
* ->andWhere('u.is_active = 1');
* </code>
*
- * @param mixed $where The query restrictions.
+ * @param mixed ...$where The query restrictions.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*
* @see where()
*/
- public function andWhere($where) {
+ public function andWhere(...$where) {
call_user_func_array(
[$this->queryBuilder, 'andWhere'],
- func_get_args()
+ $where
);
return $this;
@@ -777,16 +781,16 @@ class QueryBuilder implements IQueryBuilder {
* ->orWhere('u.id = 2');
* </code>
*
- * @param mixed $where The WHERE statement.
+ * @param mixed ...$where The WHERE statement.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*
* @see where()
*/
- public function orWhere($where) {
+ public function orWhere(...$where) {
call_user_func_array(
[$this->queryBuilder, 'orWhere'],
- func_get_args()
+ $where
);
return $this;
@@ -803,12 +807,14 @@ class QueryBuilder implements IQueryBuilder {
* ->groupBy('u.id');
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBys The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function groupBy($groupBy) {
- $groupBys = is_array($groupBy) ? $groupBy : func_get_args();
+ public function groupBy(...$groupBys) {
+ if (count($groupBys) === 1 && is_array($groupBys[0])) {
+ $$groupBys = $groupBys[0];
+ }
call_user_func_array(
[$this->queryBuilder, 'groupBy'],
@@ -829,12 +835,14 @@ class QueryBuilder implements IQueryBuilder {
* ->addGroupBy('u.createdAt')
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBy The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function addGroupBy($groupBy) {
- $groupBys = is_array($groupBy) ? $groupBy : func_get_args();
+ public function addGroupBy(...$groupBys) {
+ if (count($groupBys) === 1 && is_array($groupBys[0])) {
+ $$groupBys = $groupBys[0];
+ }
call_user_func_array(
[$this->queryBuilder, 'addGroupBy'],
@@ -906,14 +914,14 @@ class QueryBuilder implements IQueryBuilder {
* Specifies a restriction over the groups of the query.
* Replaces any previous having restrictions, if any.
*
- * @param mixed $having The restriction over the groups.
+ * @param mixed ...$having The restriction over the groups.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function having($having) {
+ public function having(...$having) {
call_user_func_array(
[$this->queryBuilder, 'having'],
- func_get_args()
+ $having
);
return $this;
@@ -923,14 +931,14 @@ class QueryBuilder implements IQueryBuilder {
* Adds a restriction over the groups of the query, forming a logical
* conjunction with any existing having restrictions.
*
- * @param mixed $having The restriction to append.
+ * @param mixed ...$having The restriction to append.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function andHaving($having) {
+ public function andHaving(...$having) {
call_user_func_array(
[$this->queryBuilder, 'andHaving'],
- func_get_args()
+ $having
);
return $this;
@@ -940,14 +948,14 @@ class QueryBuilder implements IQueryBuilder {
* Adds a restriction over the groups of the query, forming a logical
* disjunction with any existing having restrictions.
*
- * @param mixed $having The restriction to add.
+ * @param mixed ...$having The restriction to add.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function orHaving($having) {
+ public function orHaving(...$having) {
call_user_func_array(
[$this->queryBuilder, 'orHaving'],
- func_get_args()
+ $having
);
return $this;
diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php
index fe34ef4555b..9bec1db73e3 100644
--- a/lib/private/Encryption/Manager.php
+++ b/lib/private/Encryption/Manager.php
@@ -101,15 +101,6 @@ class Manager implements IManager {
* @throws ServiceUnavailableException
*/
public function isReady() {
- // check if we are still in transit between the old and the new encryption
- $oldEncryption = $this->config->getAppValue('files_encryption', 'installed_version');
- if (!empty($oldEncryption)) {
- $warning = 'Installation is in transit between the old Encryption (ownCloud <= 8.0)
- and the new encryption. Please enable the "Default encryption module"
- and run \'occ encryption:migrate\'';
- $this->logger->warning($warning);
- return false;
- }
if ($this->isKeyStorageReady() === false) {
throw new ServiceUnavailableException('Key Storage is not ready');
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php
index fc0adbbd47b..ddd19ac6345 100644
--- a/lib/private/Encryption/Util.php
+++ b/lib/private/Encryption/Util.php
@@ -35,6 +35,7 @@ use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
+use OCP\IUser;
class Util {
@@ -271,9 +272,12 @@ class Util {
}
public function getUserWithAccessToMountPoint($users, $groups) {
- $result = array();
+ $result = [];
if (in_array('all', $users)) {
- $result = \OCP\User::getUsers();
+ $users = $this->userManager->search('', null, null);
+ $result = array_map(function(IUser $user) {
+ return $user->getUID();
+ }, $users);
} else {
$result = array_merge($result, $users);
diff --git a/lib/private/Files/Node/File.php b/lib/private/Files/Node/File.php
index 4bfa5d583f7..2ddbac97dce 100644
--- a/lib/private/Files/Node/File.php
+++ b/lib/private/Files/Node/File.php
@@ -26,6 +26,7 @@
namespace OC\Files\Node;
+use OCP\Files\GenericFileException;
use OCP\Files\NotPermittedException;
class File extends Node implements \OCP\Files\File {
@@ -57,11 +58,14 @@ class File extends Node implements \OCP\Files\File {
/**
* @param string $data
* @throws \OCP\Files\NotPermittedException
+ * @throws \OCP\Files\GenericFileException
*/
public function putContent($data) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(array('preWrite'));
- $this->view->file_put_contents($this->path, $data);
+ if ($this->view->file_put_contents($this->path, $data) === false) {
+ throw new GenericFileException('file_put_contents failed');
+ }
$this->fileInfo = null;
$this->sendHooks(array('postWrite'));
} else {
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index fcadbe27393..95ceeee3698 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -302,18 +302,15 @@ class Folder extends Node implements \OCP\Files\Folder {
return [];
}
- // we only need to get the cache info once, since all mounts we found point to the same storage
-
- $mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()];
- $cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
- if (!$cacheEntry) {
- return [];
- }
- // cache jails will hide the "true" internal path
- $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
-
- $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) {
+ $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) {
$mount = $folderMounts[$cachedMountInfo->getMountPoint()];
+ $cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
+ if (!$cacheEntry) {
+ return null;
+ }
+
+ // cache jails will hide the "true" internal path
+ $internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
$pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath()));
$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
$absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount;
@@ -323,6 +320,8 @@ class Folder extends Node implements \OCP\Files\Folder {
));
}, $mountsContainingFile);
+ $nodes = array_filter($nodes);
+
return array_filter($nodes, function (Node $node) {
return $this->getRelativePath($node->getPath());
});
diff --git a/lib/private/Files/Node/HookConnector.php b/lib/private/Files/Node/HookConnector.php
index 27f65d9987b..f5adcde4a00 100644
--- a/lib/private/Files/Node/HookConnector.php
+++ b/lib/private/Files/Node/HookConnector.php
@@ -72,6 +72,8 @@ class HookConnector {
Util::connectHook('OC_Filesystem', 'touch', $this, 'touch');
Util::connectHook('OC_Filesystem', 'post_touch', $this, 'postTouch');
+
+ Util::connectHook('OC_Filesystem', 'read', $this, 'read');
}
public function write($arguments) {
@@ -140,6 +142,11 @@ class HookConnector {
$this->root->emit('\OC\Files', 'postCopy', [$source, $target]);
}
+ public function read($arguments) {
+ $node = $this->getNodeForPath($arguments['path']);
+ $this->root->emit('\OC\Files', 'read', [$node]);
+ }
+
private function getNodeForPath($path) {
$info = Filesystem::getView()->getFileInfo($path);
if (!$info) {
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 45c22a81a7b..3ce919a4cbe 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -261,6 +261,12 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
public function fopen($path, $mode) {
$path = $this->normalizePath($path);
+ if (strrpos($path, '.') !== false) {
+ $ext = substr($path, strrpos($path, '.'));
+ } else {
+ $ext = '';
+ }
+
switch ($mode) {
case 'r':
case 'rb':
@@ -280,21 +286,21 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
}
case 'w':
case 'wb':
+ case 'w+':
+ case 'wb+':
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
+ $handle = fopen($tmpFile, $mode);
+ return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
+ $this->writeBack($tmpFile, $path);
+ });
case 'a':
case 'ab':
case 'r+':
- case 'w+':
- case 'wb+':
case 'a+':
case 'x':
case 'x+':
case 'c':
case 'c+':
- if (strrpos($path, '.') !== false) {
- $ext = substr($path, strrpos($path, '.'));
- } else {
- $ext = '';
- }
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if ($this->file_exists($path)) {
$source = $this->fopen($path, 'r');
@@ -423,4 +429,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
public function hasUpdated($path, $time) {
return false;
}
+
+ public function needsPartFile() {
+ return false;
+ }
}
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index 4451fbcc750..6bb01506c4c 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -36,16 +36,15 @@ class Swift implements IObjectStore {
*/
private $params;
- /**
- * @var \OpenStack\ObjectStore\v1\Models\Container|null
- */
- private $container = null;
-
/** @var SwiftFactory */
private $swiftFactory;
public function __construct($params, SwiftFactory $connectionFactory = null) {
- $this->swiftFactory = $connectionFactory ?: new SwiftFactory(\OC::$server->getMemCacheFactory()->createDistributed('swift::'), $params);
+ $this->swiftFactory = $connectionFactory ?: new SwiftFactory(
+ \OC::$server->getMemCacheFactory()->createDistributed('swift::'),
+ $params,
+ \OC::$server->getLogger()
+ );
$this->params = $params;
}
@@ -62,6 +61,10 @@ class Swift implements IObjectStore {
* @return string the container name where objects are stored
*/
public function getStorageId() {
+ if (isset($this->params['bucket'])) {
+ return $this->params['bucket'];
+ }
+
return $this->params['container'];
}
diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php
index 9513cdc3ab8..85bba573001 100644
--- a/lib/private/Files/ObjectStore/SwiftFactory.php
+++ b/lib/private/Files/ObjectStore/SwiftFactory.php
@@ -30,6 +30,7 @@ use GuzzleHttp\HandlerStack;
use OCP\Files\StorageAuthException;
use OCP\Files\StorageNotAvailableException;
use OCP\ICache;
+use OCP\ILogger;
use OpenStack\Common\Error\BadResponseError;
use OpenStack\Common\Auth\Token;
use OpenStack\Identity\v2\Service as IdentityV2Service;
@@ -44,10 +45,12 @@ class SwiftFactory {
private $params;
/** @var Container|null */
private $container = null;
+ private $logger;
- public function __construct(ICache $cache, array $params) {
+ public function __construct(ICache $cache, array $params, ILogger $logger) {
$this->cache = $cache;
$this->params = $params;
+ $this->logger = $logger;
}
private function getCachedToken(string $cacheKey) {
@@ -60,7 +63,12 @@ class SwiftFactory {
}
private function cacheToken(Token $token, string $cacheKey) {
- $this->cache->set($cacheKey . '/token', json_encode($token));
+ if ($token instanceof \OpenStack\Identity\v3\Models\Token) {
+ $value = json_encode($token->export());
+ } else {
+ $value = json_encode($token);
+ }
+ $this->cache->set($cacheKey . '/token', $value);
}
/**
@@ -72,7 +80,7 @@ class SwiftFactory {
$this->params['container'] = $this->params['bucket'];
}
if (!isset($this->params['container'])) {
- $this->params['container'] = 'owncloud';
+ $this->params['container'] = 'nextcloud';
}
if (!isset($this->params['autocreate'])) {
// should only be true for tests
@@ -90,12 +98,9 @@ class SwiftFactory {
$this->params['tenantName'] = $this->params['tenant'];
}
- $cacheKey = $userName . '@' . $this->params['url'] . '/' . $this->params['bucket'];
+ $cacheKey = $userName . '@' . $this->params['url'] . '/' . $this->params['container'];
$token = $this->getCachedToken($cacheKey);
- $hasToken = is_array($token) && (new \DateTimeImmutable($token['expires_at'])) > (new \DateTimeImmutable('now'));
- if ($hasToken) {
- $this->params['cachedToken'] = $token;
- }
+ $this->params['cachedToken'] = $token;
$httpClient = new Client([
'base_uri' => TransportUtils::normalizeUrl($this->params['url']),
@@ -120,7 +125,20 @@ class SwiftFactory {
$this->params['authUrl'] = $this->params['url'];
$client = new OpenStack($this->params);
- if (!isset($this->params['cachedToken'])) {
+ $cachedToken = $this->params['cachedToken'];
+ $hasValidCachedToken = false;
+ if (is_array($cachedToken)) {
+ $token = $authService->generateTokenFromCache($cachedToken);
+ if (is_null($token->catalog)) {
+ $this->logger->warning('Invalid cached token for swift, no catalog set: ' . json_encode($cachedToken));
+ } else if ($token->hasExpired()) {
+ $this->logger->debug('Cached token for swift expired');
+ } else {
+ $hasValidCachedToken = true;
+ }
+ }
+
+ if (!$hasValidCachedToken) {
try {
$token = $authService->generateToken($this->params);
$this->cacheToken($token, $cacheKey);
diff --git a/lib/private/Files/Storage/Flysystem.php b/lib/private/Files/Storage/Flysystem.php
index 423a6f0d83e..232222db358 100644
--- a/lib/private/Files/Storage/Flysystem.php
+++ b/lib/private/Files/Storage/Flysystem.php
@@ -206,7 +206,7 @@ abstract class Flysystem extends Common {
if (!$this->isCreatable(dirname($path))) {
return false;
}
- $tmpFile = \OCP\Files::tmpFile();
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
}
$source = fopen($tmpFile, $mode);
return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) {
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index a439a978cce..abd7f6ee6ee 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -40,23 +40,25 @@
namespace OC\Group;
+use OCP\IDBConnection;
+
/**
* Class for group management in a SQL Database (e.g. MySQL, SQLite)
*/
-class Database extends \OC\Group\Backend {
+class Database extends Backend {
/** @var string[] */
private $groupCache = [];
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
private $dbConn;
/**
* \OC\Group\Database constructor.
*
- * @param \OCP\IDBConnection|null $dbConn
+ * @param IDBConnection|null $dbConn
*/
- public function __construct(\OCP\IDBConnection $dbConn = null) {
+ public function __construct(IDBConnection $dbConn = null) {
$this->dbConn = $dbConn;
}
@@ -219,7 +221,7 @@ class Database extends \OC\Group\Backend {
$groups = [];
while( $row = $cursor->fetch()) {
- $groups[] = $row["gid"];
+ $groups[] = $row['gid'];
$this->groupCache[$row['gid']] = $row['gid'];
}
$cursor->closeCursor();
@@ -237,19 +239,29 @@ class Database extends \OC\Group\Backend {
* Returns a list with all groups
*/
public function getGroups($search = '', $limit = null, $offset = null) {
- $parameters = [];
- $searchLike = '';
+ $this->fixDI();
+
+ $query = $this->dbConn->getQueryBuilder();
+ $query->select('gid')
+ ->from('groups')
+ ->orderBy('gid', 'ASC');
+
if ($search !== '') {
- $parameters[] = '%' . $search . '%';
- $searchLike = ' WHERE LOWER(`gid`) LIKE LOWER(?)';
+ $query->where($query->expr()->iLike('gid', $query->createNamedParameter(
+ '%' . $this->dbConn->escapeLikeParameter($search) . '%'
+ )));
}
- $stmt = \OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups`' . $searchLike . ' ORDER BY `gid` ASC', $limit, $offset);
- $result = $stmt->execute($parameters);
- $groups = array();
- while ($row = $result->fetchRow()) {
+ $query->setMaxResults($limit)
+ ->setFirstResult($offset);
+ $result = $query->execute();
+
+ $groups = [];
+ while ($row = $result->fetch()) {
$groups[] = $row['gid'];
}
+ $result->closeCursor();
+
return $groups;
}
@@ -290,21 +302,30 @@ class Database extends \OC\Group\Backend {
* @return array an array of user ids
*/
public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
- $parameters = [$gid];
- $searchLike = '';
+ $this->fixDI();
+
+ $query = $this->dbConn->getQueryBuilder();
+ $query->select('uid')
+ ->from('group_user')
+ ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
+ ->orderBy('uid', 'ASC');
+
if ($search !== '') {
- $parameters[] = '%' . $this->dbConn->escapeLikeParameter($search) . '%';
- $searchLike = ' AND `uid` LIKE ?';
+ $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
+ '%' . $this->dbConn->escapeLikeParameter($search) . '%'
+ )));
}
- $stmt = \OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?' . $searchLike . ' ORDER BY `uid` ASC',
- $limit,
- $offset);
- $result = $stmt->execute($parameters);
- $users = array();
- while ($row = $result->fetchRow()) {
+ $query->setMaxResults($limit)
+ ->setFirstResult($offset);
+ $result = $query->execute();
+
+ $users = [];
+ while ($row = $result->fetch()) {
$users[] = $row['uid'];
}
+ $result->closeCursor();
+
return $users;
}
@@ -313,20 +334,26 @@ class Database extends \OC\Group\Backend {
* @param string $gid
* @param string $search
* @return int|false
- * @throws \OC\DatabaseException
*/
public function countUsersInGroup($gid, $search = '') {
- $parameters = [$gid];
- $searchLike = '';
+ $this->fixDI();
+
+ $query = $this->dbConn->getQueryBuilder();
+ $query->selectAlias($query->createFunction('COUNT(*)'), 'num_users')
+ ->from('group_user')
+ ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)));
+
if ($search !== '') {
- $parameters[] = '%' . $this->dbConn->escapeLikeParameter($search) . '%';
- $searchLike = ' AND `uid` LIKE ?';
+ $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
+ '%' . $this->dbConn->escapeLikeParameter($search) . '%'
+ )));
}
- $stmt = \OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ?' . $searchLike);
- $result = $stmt->execute($parameters);
- $count = $result->fetchOne();
- if($count !== false) {
+ $result = $query->execute();
+ $count = $result->fetchColumn();
+ $result->closeCursor();
+
+ if ($count !== false) {
$count = (int)$count;
}
return $count;
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index 2d40b447996..1dd951a1078 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -330,6 +330,17 @@ class Manager extends PublicEmitter implements IGroupManager {
}
/**
+ * get an array of groupid and displayName for a user
+ * @param IUser $user
+ * @return array ['displayName' => displayname]
+ */
+ public function getUserGroupNames(IUser $user) {
+ return array_map(function($group) {
+ return array('displayName' => $group->getDisplayName());
+ }, $this->getUserGroups($user));
+ }
+
+ /**
* get a list of all display names in a group
* @param string $gid
* @param string $search
diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php
index d5c8b581f8b..99594301990 100644
--- a/lib/private/Group/MetaData.php
+++ b/lib/private/Group/MetaData.php
@@ -160,7 +160,7 @@ class MetaData {
private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) {
return array(
'id' => $group->getGID(),
- 'name' => $group->getGID(),
+ 'name' => $group->getDisplayName(),
'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0,
);
}
diff --git a/lib/private/HTTPHelper.php b/lib/private/HTTPHelper.php
deleted file mode 100644
index d58f81fbbdc..00000000000
--- a/lib/private/HTTPHelper.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Björn Schießle <bjoern@schiessle.org>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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;
-
-use OCP\Http\Client\IClientService;
-use OCP\IConfig;
-
-/**
- * Class HTTPHelper
- *
- * @package OC
- * @deprecated Use \OCP\Http\Client\IClientService
- */
-class HTTPHelper {
- const USER_AGENT = 'ownCloud Server Crawler';
-
- /** @var \OCP\IConfig */
- private $config;
- /** @var IClientService */
- private $clientService;
-
- /**
- * @param IConfig $config
- * @param IClientService $clientService
- */
- public function __construct(IConfig $config,
- IClientService $clientService) {
- $this->config = $config;
- $this->clientService = $clientService;
- }
-
- /**
- * Get URL content
- * @param string $url Url to get content
- * @throws \Exception If the URL does not start with http:// or https://
- * @return string of the response or false on error
- * This function get the content of a page via curl, if curl is enabled.
- * If not, file_get_contents is used.
- * @deprecated Use \OCP\Http\Client\IClientService
- */
- public function getUrlContent($url) {
- try {
- $client = $this->clientService->newClient();
- $response = $client->get($url);
- return $response->getBody();
- } catch (\Exception $e) {
- return false;
- }
- }
-
- /**
- * Returns the response headers of a HTTP URL without following redirects
- * @param string $location Needs to be a HTTPS or HTTP URL
- * @return array
- * @deprecated Use \OCP\Http\Client\IClientService
- */
- public function getHeaders($location) {
- $client = $this->clientService->newClient();
- $response = $client->get($location);
- return $response->getHeaders();
- }
-
- /**
- * Checks whether the supplied URL begins with HTTPS:// or HTTP:// (case insensitive)
- * @param string $url
- * @return bool
- */
- public function isHTTPURL($url) {
- return stripos($url, 'https://') === 0 || stripos($url, 'http://') === 0;
- }
-
- /**
- * send http post request
- *
- * @param string $url
- * @param array $fields data send by the request
- * @return array
- * @deprecated Use \OCP\Http\Client\IClientService
- */
- public function post($url, array $fields) {
- $client = $this->clientService->newClient();
-
- try {
- $response = $client->post(
- $url,
- [
- 'body' => $fields,
- 'connect_timeout' => 10,
- ]
- );
- } catch (\Exception $e) {
- return ['success' => false, 'result' => $e->getMessage()];
- }
-
- return ['success' => true, 'result' => $response->getBody()];
- }
-
-}
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index ab0ef836fbb..1b40b4955d6 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -166,17 +166,6 @@ class Installer {
}
/**
- * @brief checks whether or not an app is installed
- * @param string $app app
- * @returns bool
- *
- * Checks whether or not an app is installed, i.e. registered in apps table.
- */
- public static function isInstalled( $app ) {
- return (\OC::$server->getConfig()->getAppValue($app, "installed_version", null) !== null);
- }
-
- /**
* Updates the specified app from the appstore
*
* @param string $appId
@@ -510,17 +499,19 @@ class Installer {
* @return array Array of error messages (appid => Exception)
*/
public static function installShippedApps($softErrors = false) {
+ $appManager = \OC::$server->getAppManager();
+ $config = \OC::$server->getConfig();
$errors = [];
foreach(\OC::$APPSROOTS as $app_dir) {
if($dir = opendir( $app_dir['path'] )) {
while( false !== ( $filename = readdir( $dir ))) {
if( $filename[0] !== '.' and is_dir($app_dir['path']."/$filename") ) {
if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) {
- if(!Installer::isInstalled($filename)) {
+ if($config->getAppValue($filename, "installed_version", null) === null) {
$info=OC_App::getAppInfo($filename);
$enabled = isset($info['default_enable']);
- if (($enabled || in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps()))
- && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') {
+ if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps()))
+ && $config->getAppValue($filename, 'enabled') !== 'no') {
if ($softErrors) {
try {
Installer::installShippedApp($filename);
@@ -534,7 +525,7 @@ class Installer {
} else {
Installer::installShippedApp($filename);
}
- \OC::$server->getConfig()->setAppValue($filename, 'enabled', 'yes');
+ $config->setAppValue($filename, 'enabled', 'yes');
}
}
}
diff --git a/lib/private/Mail/Attachment.php b/lib/private/Mail/Attachment.php
index 822fca5a24e..b696451e41c 100644
--- a/lib/private/Mail/Attachment.php
+++ b/lib/private/Mail/Attachment.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@@ -45,7 +46,7 @@ class Attachment implements IAttachment {
* @return $this
* @since 13.0.0
*/
- public function setFilename($filename) {
+ public function setFilename(string $filename): IAttachment {
$this->swiftAttachment->setFilename($filename);
return $this;
}
@@ -55,7 +56,7 @@ class Attachment implements IAttachment {
* @return $this
* @since 13.0.0
*/
- public function setContentType($contentType) {
+ public function setContentType(string $contentType): IAttachment {
$this->swiftAttachment->setContentType($contentType);
return $this;
}
@@ -65,7 +66,7 @@ class Attachment implements IAttachment {
* @return $this
* @since 13.0.0
*/
- public function setBody($body) {
+ public function setBody(string $body): IAttachment {
$this->swiftAttachment->setBody($body);
return $this;
}
@@ -73,7 +74,7 @@ class Attachment implements IAttachment {
/**
* @return \Swift_Mime_Attachment
*/
- public function getSwiftAttachment() {
+ public function getSwiftAttachment(): \Swift_Mime_Attachment {
return $this->swiftAttachment;
}
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index 38205af366e..0ba411d6926 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2017, Morris Jobke <hey@morrisjobke.de>
* @copyright 2017, Lukas Reschke <lukas@statuscode.ch>
@@ -367,7 +368,7 @@ EOF;
*
* @param string $subject
*/
- public function setSubject($subject) {
+ public function setSubject(string $subject) {
$this->subject = $subject;
}
@@ -391,7 +392,7 @@ EOF;
* @param string|bool $plainTitle Title that is used in the plain text email
* if empty the $title is used, if false none will be used
*/
- public function addHeading($title, $plainTitle = '') {
+ public function addHeading(string $title, $plainTitle = '') {
if ($this->footerAdded) {
return;
}
@@ -424,7 +425,7 @@ EOF;
* @param string|bool $plainText Text that is used in the plain text email
* if empty the $text is used, if false none will be used
*/
- public function addBodyText($text, $plainText = '') {
+ public function addBodyText(string $text, $plainText = '') {
if ($this->footerAdded) {
return;
}
@@ -447,13 +448,13 @@ EOF;
* @param string $text Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email
* @param string $metaInfo Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email
* @param string $icon Absolute path, must be 16*16 pixels
- * @param string $plainText Text that is used in the plain text email
+ * @param string|bool $plainText Text that is used in the plain text email
* if empty the $text is used, if false none will be used
- * @param string $plainMetaInfo Meta info that is used in the plain text email
+ * @param string|bool $plainMetaInfo Meta info that is used in the plain text email
* if empty the $metaInfo is used, if false none will be used
* @since 12.0.0
*/
- public function addBodyListItem($text, $metaInfo = '', $icon = '', $plainText = '', $plainMetaInfo = '') {
+ public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = '') {
$this->ensureBodyListOpened();
if ($plainText === '') {
@@ -513,12 +514,12 @@ EOF;
* @param string $plainTextLeft Text of left button that is used in the plain text version - if unset the $textLeft is used
* @param string $plainTextRight Text of right button that is used in the plain text version - if unset the $textRight is used
*/
- public function addBodyButtonGroup($textLeft,
- $urlLeft,
- $textRight,
- $urlRight,
- $plainTextLeft = '',
- $plainTextRight = '') {
+ public function addBodyButtonGroup(string $textLeft,
+ string $urlLeft,
+ string $textRight,
+ string $urlRight,
+ string $plainTextLeft = '',
+ string $plainTextRight = '') {
if ($this->footerAdded) {
return;
}
@@ -554,7 +555,7 @@ EOF;
*
* @since 12.0.0
*/
- public function addBodyButton($text, $url, $plainText = '') {
+ public function addBodyButton(string $text, string $url, $plainText = '') {
if ($this->footerAdded) {
return;
}
@@ -598,7 +599,7 @@ EOF;
*
* @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used
*/
- public function addFooter($text = '') {
+ public function addFooter(string $text = '') {
if($text === '') {
$text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically sent email, please do not reply.');
}
@@ -621,7 +622,7 @@ EOF;
*
* @return string
*/
- public function renderSubject() {
+ public function renderSubject(): string {
return $this->subject;
}
@@ -630,7 +631,7 @@ EOF;
*
* @return string
*/
- public function renderHtml() {
+ public function renderHtml(): string {
if (!$this->footerAdded) {
$this->footerAdded = true;
$this->ensureBodyIsClosed();
@@ -644,7 +645,7 @@ EOF;
*
* @return string
*/
- public function renderText() {
+ public function renderText(): string {
if (!$this->footerAdded) {
$this->footerAdded = true;
$this->ensureBodyIsClosed();
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 3637bb1e27d..5a054d2efd2 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -91,7 +92,7 @@ class Mailer implements IMailer {
*
* @return IMessage
*/
- public function createMessage() {
+ public function createMessage(): IMessage {
return new Message(new \Swift_Message());
}
@@ -102,7 +103,7 @@ class Mailer implements IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachment($data = null, $filename = null, $contentType = null) {
+ public function createAttachment($data = null, $filename = null, $contentType = null): IAttachment {
return new Attachment(\Swift_Attachment::newInstance($data, $filename, $contentType));
}
@@ -112,7 +113,7 @@ class Mailer implements IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachmentFromPath($path, $contentType = null) {
+ public function createAttachmentFromPath(string $path, $contentType = null): IAttachment {
return new Attachment(\Swift_Attachment::fromPath($path, $contentType));
}
@@ -124,7 +125,7 @@ class Mailer implements IMailer {
* @return IEMailTemplate
* @since 12.0.0
*/
- public function createEMailTemplate($emailId, array $data = []) {
+ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate {
$class = $this->config->getSystemValue('mail_template_class', '');
if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
@@ -156,7 +157,7 @@ class Mailer implements IMailer {
* @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address
* has been supplied.)
*/
- public function send(IMessage $message) {
+ public function send(IMessage $message): array {
$debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
if (empty($message->getFrom())) {
@@ -191,7 +192,7 @@ class Mailer implements IMailer {
* @param string $email Email address to be validated
* @return bool True if the mail address is valid, false otherwise
*/
- public function validateMailAddress($email) {
+ public function validateMailAddress(string $email): bool {
return \Swift_Validate::email($this->convertEmail($email));
}
@@ -203,7 +204,7 @@ class Mailer implements IMailer {
* @param string $email
* @return string Converted mail address if `idn_to_ascii` exists
*/
- protected function convertEmail($email) {
+ protected function convertEmail(string $email): string {
if (!function_exists('idn_to_ascii') || strpos($email, '@') === false) {
return $email;
}
@@ -246,7 +247,7 @@ class Mailer implements IMailer {
*
* @return \Swift_SmtpTransport
*/
- protected function getSmtpInstance() {
+ protected function getSmtpInstance(): \Swift_SmtpTransport {
$transport = \Swift_SmtpTransport::newInstance();
$transport->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10));
$transport->setHost($this->config->getSystemValue('mail_smtphost', '127.0.0.1'));
@@ -269,7 +270,7 @@ class Mailer implements IMailer {
*
* @return \Swift_SendmailTransport
*/
- protected function getSendMailInstance() {
+ protected function getSendMailInstance(): \Swift_SendmailTransport {
switch ($this->config->getSystemValue('mail_smtpmode', 'php')) {
case 'qmail':
$binaryPath = '/var/qmail/bin/sendmail';
@@ -287,7 +288,7 @@ class Mailer implements IMailer {
*
* @return \Swift_MailTransport
*/
- protected function getMailInstance() {
+ protected function getMailInstance(): \Swift_MailTransport {
return \Swift_MailTransport::newInstance();
}
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index c695f0f4fb1..622c18a9116 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -51,7 +52,7 @@ class Message implements IMessage {
* @return $this
* @since 13.0.0
*/
- public function attach(IAttachment $attachment) {
+ public function attach(IAttachment $attachment): IMessage {
/** @var Attachment $attachment */
$this->swiftMessage->attach($attachment->getSwiftAttachment());
return $this;
@@ -64,12 +65,12 @@ class Message implements IMessage {
* @param array $addresses Array of mail addresses, key will get converted
* @return array Converted addresses if `idn_to_ascii` exists
*/
- protected function convertAddresses($addresses) {
+ protected function convertAddresses(array $addresses): array {
if (!function_exists('idn_to_ascii')) {
return $addresses;
}
- $convertedAddresses = array();
+ $convertedAddresses = [];
foreach($addresses as $email => $readableName) {
if(!is_numeric($email)) {
@@ -94,7 +95,7 @@ class Message implements IMessage {
* @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
* @return $this
*/
- public function setFrom(array $addresses) {
+ public function setFrom(array $addresses): IMessage {
$addresses = $this->convertAddresses($addresses);
$this->swiftMessage->setFrom($addresses);
@@ -106,7 +107,7 @@ class Message implements IMessage {
*
* @return array
*/
- public function getFrom() {
+ public function getFrom(): array {
return $this->swiftMessage->getFrom();
}
@@ -116,7 +117,7 @@ class Message implements IMessage {
* @param array $addresses
* @return $this
*/
- public function setReplyTo(array $addresses) {
+ public function setReplyTo(array $addresses): IMessage {
$addresses = $this->convertAddresses($addresses);
$this->swiftMessage->setReplyTo($addresses);
@@ -126,9 +127,9 @@ class Message implements IMessage {
/**
* Returns the Reply-To address of this message
*
- * @return array
+ * @return string
*/
- public function getReplyTo() {
+ public function getReplyTo(): string {
return $this->swiftMessage->getReplyTo();
}
@@ -138,7 +139,7 @@ class Message implements IMessage {
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
* @return $this
*/
- public function setTo(array $recipients) {
+ public function setTo(array $recipients): IMessage {
$recipients = $this->convertAddresses($recipients);
$this->swiftMessage->setTo($recipients);
@@ -150,7 +151,7 @@ class Message implements IMessage {
*
* @return array
*/
- public function getTo() {
+ public function getTo(): array {
return $this->swiftMessage->getTo();
}
@@ -160,7 +161,7 @@ class Message implements IMessage {
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
* @return $this
*/
- public function setCc(array $recipients) {
+ public function setCc(array $recipients): IMessage {
$recipients = $this->convertAddresses($recipients);
$this->swiftMessage->setCc($recipients);
@@ -172,7 +173,7 @@ class Message implements IMessage {
*
* @return array
*/
- public function getCc() {
+ public function getCc(): array {
return $this->swiftMessage->getCc();
}
@@ -182,7 +183,7 @@ class Message implements IMessage {
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
* @return $this
*/
- public function setBcc(array $recipients) {
+ public function setBcc(array $recipients): IMessage {
$recipients = $this->convertAddresses($recipients);
$this->swiftMessage->setBcc($recipients);
@@ -194,17 +195,17 @@ class Message implements IMessage {
*
* @return array
*/
- public function getBcc() {
+ public function getBcc(): array {
return $this->swiftMessage->getBcc();
}
/**
* Set the subject of this message.
*
- * @param $subject
- * @return $this
+ * @param string $subject
+ * @return IMessage
*/
- public function setSubject($subject) {
+ public function setSubject(string $subject): IMessage {
$this->swiftMessage->setSubject($subject);
return $this;
}
@@ -214,7 +215,7 @@ class Message implements IMessage {
*
* @return string
*/
- public function getSubject() {
+ public function getSubject(): string {
return $this->swiftMessage->getSubject();
}
@@ -224,7 +225,7 @@ class Message implements IMessage {
* @param string $body
* @return $this
*/
- public function setPlainBody($body) {
+ public function setPlainBody(string $body): IMessage {
$this->swiftMessage->setBody($body);
return $this;
}
@@ -234,7 +235,7 @@ class Message implements IMessage {
*
* @return string
*/
- public function getPlainBody() {
+ public function getPlainBody(): string {
return $this->swiftMessage->getBody();
}
@@ -253,7 +254,7 @@ class Message implements IMessage {
* Get's the underlying SwiftMessage
* @return Swift_Message
*/
- public function getSwiftMessage() {
+ public function getSwiftMessage(): Swift_Message {
return $this->swiftMessage;
}
@@ -271,7 +272,7 @@ class Message implements IMessage {
* @param IEMailTemplate $emailTemplate
* @return $this
*/
- public function useTemplate(IEMailTemplate $emailTemplate) {
+ public function useTemplate(IEMailTemplate $emailTemplate): IMessage {
$this->setSubject($emailTemplate->renderSubject());
$this->setPlainBody($emailTemplate->renderText());
$this->setHtmlBody($emailTemplate->renderHtml());
diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php
index cb2cd8aabe2..8678c1b7999 100644
--- a/lib/private/Memcache/Factory.php
+++ b/lib/private/Memcache/Factory.php
@@ -185,11 +185,11 @@ class Factory implements ICacheFactory {
}
/**
- * check local memcache availability
+ * Check if a local memory cache backend is available
*
* @return bool
*/
- public function isAvailableLowLatency(): bool {
+ public function isLocalCacheAvailable(): bool {
return ($this->localCacheClass !== self::NULL_CACHE);
}
}
diff --git a/lib/private/Security/CSP/ContentSecurityPolicy.php b/lib/private/Security/CSP/ContentSecurityPolicy.php
index 2adc3d3d12c..77e20dedf44 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicy.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicy.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -33,147 +34,147 @@ class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy
/**
* @return boolean
*/
- public function isInlineScriptAllowed() {
+ public function isInlineScriptAllowed(): bool {
return $this->inlineScriptAllowed;
}
/**
* @param boolean $inlineScriptAllowed
*/
- public function setInlineScriptAllowed($inlineScriptAllowed) {
+ public function setInlineScriptAllowed(bool $inlineScriptAllowed) {
$this->inlineScriptAllowed = $inlineScriptAllowed;
}
/**
* @return boolean
*/
- public function isEvalScriptAllowed() {
+ public function isEvalScriptAllowed(): bool {
return $this->evalScriptAllowed;
}
/**
* @param boolean $evalScriptAllowed
*/
- public function setEvalScriptAllowed($evalScriptAllowed) {
+ public function setEvalScriptAllowed(bool $evalScriptAllowed) {
$this->evalScriptAllowed = $evalScriptAllowed;
}
/**
* @return array
*/
- public function getAllowedScriptDomains() {
+ public function getAllowedScriptDomains(): array {
return $this->allowedScriptDomains;
}
/**
* @param array $allowedScriptDomains
*/
- public function setAllowedScriptDomains($allowedScriptDomains) {
+ public function setAllowedScriptDomains(array $allowedScriptDomains) {
$this->allowedScriptDomains = $allowedScriptDomains;
}
/**
* @return boolean
*/
- public function isInlineStyleAllowed() {
+ public function isInlineStyleAllowed(): bool {
return $this->inlineStyleAllowed;
}
/**
* @param boolean $inlineStyleAllowed
*/
- public function setInlineStyleAllowed($inlineStyleAllowed) {
+ public function setInlineStyleAllowed(bool $inlineStyleAllowed) {
$this->inlineStyleAllowed = $inlineStyleAllowed;
}
/**
* @return array
*/
- public function getAllowedStyleDomains() {
+ public function getAllowedStyleDomains(): array {
return $this->allowedStyleDomains;
}
/**
* @param array $allowedStyleDomains
*/
- public function setAllowedStyleDomains($allowedStyleDomains) {
+ public function setAllowedStyleDomains(array $allowedStyleDomains) {
$this->allowedStyleDomains = $allowedStyleDomains;
}
/**
* @return array
*/
- public function getAllowedImageDomains() {
+ public function getAllowedImageDomains(): array {
return $this->allowedImageDomains;
}
/**
* @param array $allowedImageDomains
*/
- public function setAllowedImageDomains($allowedImageDomains) {
+ public function setAllowedImageDomains(array $allowedImageDomains) {
$this->allowedImageDomains = $allowedImageDomains;
}
/**
* @return array
*/
- public function getAllowedConnectDomains() {
+ public function getAllowedConnectDomains(): array {
return $this->allowedConnectDomains;
}
/**
* @param array $allowedConnectDomains
*/
- public function setAllowedConnectDomains($allowedConnectDomains) {
+ public function setAllowedConnectDomains(array $allowedConnectDomains) {
$this->allowedConnectDomains = $allowedConnectDomains;
}
/**
* @return array
*/
- public function getAllowedMediaDomains() {
+ public function getAllowedMediaDomains(): array {
return $this->allowedMediaDomains;
}
/**
* @param array $allowedMediaDomains
*/
- public function setAllowedMediaDomains($allowedMediaDomains) {
+ public function setAllowedMediaDomains(array $allowedMediaDomains) {
$this->allowedMediaDomains = $allowedMediaDomains;
}
/**
* @return array
*/
- public function getAllowedObjectDomains() {
+ public function getAllowedObjectDomains(): array {
return $this->allowedObjectDomains;
}
/**
* @param array $allowedObjectDomains
*/
- public function setAllowedObjectDomains($allowedObjectDomains) {
+ public function setAllowedObjectDomains(array $allowedObjectDomains) {
$this->allowedObjectDomains = $allowedObjectDomains;
}
/**
* @return array
*/
- public function getAllowedFrameDomains() {
+ public function getAllowedFrameDomains(): array {
return $this->allowedFrameDomains;
}
/**
* @param array $allowedFrameDomains
*/
- public function setAllowedFrameDomains($allowedFrameDomains) {
+ public function setAllowedFrameDomains(array $allowedFrameDomains) {
$this->allowedFrameDomains = $allowedFrameDomains;
}
/**
* @return array
*/
- public function getAllowedFontDomains() {
+ public function getAllowedFontDomains(): array {
return $this->allowedFontDomains;
}
@@ -187,7 +188,7 @@ class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy
/**
* @return array
*/
- public function getAllowedChildSrcDomains() {
+ public function getAllowedChildSrcDomains(): array {
return $this->allowedChildSrcDomains;
}
@@ -201,7 +202,7 @@ class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy
/**
* @return array
*/
- public function getAllowedFrameAncestors() {
+ public function getAllowedFrameAncestors(): array {
return $this->allowedFrameAncestors;
}
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php
index 0e6f0ac6152..27a0524d3f3 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -41,7 +42,7 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager {
*
* @return ContentSecurityPolicy
*/
- public function getDefaultPolicy() {
+ public function getDefaultPolicy(): ContentSecurityPolicy {
$defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy();
foreach($this->policies as $policy) {
$defaultPolicy = $this->mergePolicies($defaultPolicy, $policy);
@@ -57,14 +58,14 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager {
* @return ContentSecurityPolicy
*/
public function mergePolicies(ContentSecurityPolicy $defaultPolicy,
- EmptyContentSecurityPolicy $originalPolicy) {
+ EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy {
foreach((object)(array)$originalPolicy as $name => $value) {
$setter = 'set'.ucfirst($name);
- if(is_array($value)) {
+ if(\is_array($value)) {
$getter = 'get'.ucfirst($name);
- $currentValues = is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
+ $currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
$defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value))));
- } elseif (is_bool($value)) {
+ } elseif (\is_bool($value)) {
$defaultPolicy->$setter($value);
}
}
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
index 266e5809c24..088fb2d859d 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
@@ -55,7 +56,7 @@ class ContentSecurityPolicyNonceManager {
*
* @return string
*/
- public function getNonce() {
+ public function getNonce(): string {
if($this->nonce === '') {
$this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
}
@@ -68,7 +69,7 @@ class ContentSecurityPolicyNonceManager {
*
* @return bool
*/
- public function browserSupportsCspV3() {
+ public function browserSupportsCspV3(): bool {
$browserWhitelist = [
Request::USER_AGENT_CHROME,
// Firefox 45+
diff --git a/lib/private/Security/CSRF/CsrfToken.php b/lib/private/Security/CSRF/CsrfToken.php
index d9e27ff80e3..643e58e1d53 100644
--- a/lib/private/Security/CSRF/CsrfToken.php
+++ b/lib/private/Security/CSRF/CsrfToken.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -40,7 +41,7 @@ class CsrfToken {
/**
* @param string $value Value of the token. Can be encrypted or not encrypted.
*/
- public function __construct($value) {
+ public function __construct(string $value) {
$this->value = $value;
}
@@ -50,9 +51,9 @@ class CsrfToken {
*
* @return string
*/
- public function getEncryptedValue() {
+ public function getEncryptedValue(): string {
if($this->encryptedValue === '') {
- $sharedSecret = random_bytes(strlen($this->value));
+ $sharedSecret = random_bytes(\strlen($this->value));
$this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
}
@@ -65,9 +66,9 @@ class CsrfToken {
*
* @return string
*/
- public function getDecryptedValue() {
+ public function getDecryptedValue(): string {
$token = explode(':', $this->value);
- if (count($token) !== 2) {
+ if (\count($token) !== 2) {
return '';
}
$obfuscatedToken = $token[0];
diff --git a/lib/private/Security/CSRF/CsrfTokenGenerator.php b/lib/private/Security/CSRF/CsrfTokenGenerator.php
index 85207956e1a..be628ea176c 100644
--- a/lib/private/Security/CSRF/CsrfTokenGenerator.php
+++ b/lib/private/Security/CSRF/CsrfTokenGenerator.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -47,7 +48,7 @@ class CsrfTokenGenerator {
* @param int $length Length of the token in characters.
* @return string
*/
- public function generateToken($length = 32) {
+ public function generateToken(int $length = 32): string {
return $this->random->generate($length);
}
}
diff --git a/lib/private/Security/CSRF/CsrfTokenManager.php b/lib/private/Security/CSRF/CsrfTokenManager.php
index b43ca3d3679..deacd1f512c 100644
--- a/lib/private/Security/CSRF/CsrfTokenManager.php
+++ b/lib/private/Security/CSRF/CsrfTokenManager.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -52,8 +53,8 @@ class CsrfTokenManager {
*
* @return CsrfToken
*/
- public function getToken() {
- if(!is_null($this->csrfToken)) {
+ public function getToken(): CsrfToken {
+ if(!\is_null($this->csrfToken)) {
return $this->csrfToken;
}
@@ -73,7 +74,7 @@ class CsrfTokenManager {
*
* @return CsrfToken
*/
- public function refreshToken() {
+ public function refreshToken(): CsrfToken {
$value = $this->tokenGenerator->generateToken();
$this->sessionStorage->setToken($value);
$this->csrfToken = new CsrfToken($value);
@@ -94,7 +95,7 @@ class CsrfTokenManager {
* @param CsrfToken $token
* @return bool
*/
- public function isTokenValid(CsrfToken $token) {
+ public function isTokenValid(CsrfToken $token): bool {
if(!$this->sessionStorage->hasToken()) {
return false;
}
diff --git a/lib/private/Security/CSRF/TokenStorage/SessionStorage.php b/lib/private/Security/CSRF/TokenStorage/SessionStorage.php
index 946330b0c8c..b35e148c7ce 100644
--- a/lib/private/Security/CSRF/TokenStorage/SessionStorage.php
+++ b/lib/private/Security/CSRF/TokenStorage/SessionStorage.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -54,7 +55,7 @@ class SessionStorage {
* @return string
* @throws \Exception
*/
- public function getToken() {
+ public function getToken(): string {
$token = $this->session->get('requesttoken');
if(empty($token)) {
throw new \Exception('Session does not contain a requesttoken');
@@ -68,7 +69,7 @@ class SessionStorage {
*
* @param string $value
*/
- public function setToken($value) {
+ public function setToken(string $value) {
$this->session->set('requesttoken', $value);
}
@@ -83,7 +84,7 @@ class SessionStorage {
*
* @return bool
*/
- public function hasToken() {
+ public function hasToken(): bool {
return $this->session->exists('requesttoken');
}
}
diff --git a/lib/private/Security/IdentityProof/Key.php b/lib/private/Security/IdentityProof/Key.php
index b01a5c66bb8..4f79dee15db 100644
--- a/lib/private/Security/IdentityProof/Key.php
+++ b/lib/private/Security/IdentityProof/Key.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
@@ -33,16 +34,16 @@ class Key {
* @param string $publicKey
* @param string $privateKey
*/
- public function __construct($publicKey, $privateKey) {
+ public function __construct(string $publicKey, string $privateKey) {
$this->publicKey = $publicKey;
$this->privateKey = $privateKey;
}
- public function getPrivate() {
+ public function getPrivate(): string {
return $this->privateKey;
}
- public function getPublic() {
+ public function getPublic(): string {
return $this->publicKey;
}
}
diff --git a/lib/private/Security/IdentityProof/Manager.php b/lib/private/Security/IdentityProof/Manager.php
index 7bfc139b94c..fb27f04d873 100644
--- a/lib/private/Security/IdentityProof/Manager.php
+++ b/lib/private/Security/IdentityProof/Manager.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
@@ -59,7 +60,7 @@ class Manager {
*
* @return array [$publicKey, $privateKey]
*/
- protected function generateKeyPair() {
+ protected function generateKeyPair(): array {
$config = [
'digest_alg' => 'sha512',
'private_key_bits' => 2048,
@@ -83,7 +84,7 @@ class Manager {
* @param string $id key id
* @return Key
*/
- protected function generateKey($id) {
+ protected function generateKey(string $id): Key {
list($publicKey, $privateKey) = $this->generateKeyPair();
// Write the private and public key to the disk
@@ -105,7 +106,7 @@ class Manager {
* @param string $id
* @return Key
*/
- protected function retrieveKey($id) {
+ protected function retrieveKey(string $id): Key {
try {
$folder = $this->appData->getFolder($id);
$privateKey = $this->crypto->decrypt(
@@ -124,7 +125,7 @@ class Manager {
* @param IUser $user
* @return Key
*/
- public function getKey(IUser $user) {
+ public function getKey(IUser $user): Key {
$uid = $user->getUID();
return $this->retrieveKey('user-' . $uid);
}
@@ -135,7 +136,7 @@ class Manager {
* @return Key
* @throws \RuntimeException
*/
- public function getSystemKey() {
+ public function getSystemKey(): Key {
$instanceId = $this->config->getSystemValue('instanceid', null);
if ($instanceId === null) {
throw new \RuntimeException('no instance id!');
diff --git a/lib/private/Security/IdentityProof/Signer.php b/lib/private/Security/IdentityProof/Signer.php
index ed2a38f99b8..95546876bdc 100644
--- a/lib/private/Security/IdentityProof/Signer.php
+++ b/lib/private/Security/IdentityProof/Signer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
@@ -57,7 +58,7 @@ class Signer {
* @param IUser $user
* @return array ['message', 'signature']
*/
- public function sign($type, array $data, IUser $user) {
+ public function sign(string $type, array $data, IUser $user): array {
$privateKey = $this->keyManager->getKey($user)->getPrivate();
$data = [
'data' => $data,
@@ -79,7 +80,7 @@ class Signer {
* @param array $data
* @return bool
*/
- public function verify(array $data) {
+ public function verify(array $data): bool {
if(isset($data['message'])
&& isset($data['signature'])
&& isset($data['message']['signer'])
diff --git a/lib/private/Server.php b/lib/private/Server.php
index d586bab15b9..109fb002ce5 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -470,9 +470,6 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
- $this->registerService('AppHelper', function ($c) {
- return new \OC\AppHelper();
- });
$this->registerAlias('AppFetcher', AppFetcher::class);
$this->registerAlias('CategoryFetcher', CategoryFetcher::class);
@@ -498,7 +495,7 @@ class Server extends ServerContainer implements IServerContainer {
$version = implode(',', $v);
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
- $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl());
+ $prefix = md5($instanceId . '-' . $version . '-' . $path);
return new \OC\Memcache\Factory($prefix, $c->getLogger(),
$config->getSystemValue('memcache.local', null),
$config->getSystemValue('memcache.distributed', null),
@@ -570,7 +567,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
$cacheFactory = $c->getMemCacheFactory();
$logger = $c->getLogger();
- if ($cacheFactory->isAvailableLowLatency()) {
+ if ($cacheFactory->isLocalCacheAvailable()) {
$router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
} else {
$router = new \OC\Route\Router($logger);
@@ -584,7 +581,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerAlias('Search', \OCP\ISearch::class);
- $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) {
+ $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
return new \OC\Security\RateLimiting\Limiter(
$this->getUserSession(),
$this->getRequest(),
@@ -633,13 +630,6 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerAlias('DatabaseConnection', IDBConnection::class);
- $this->registerService('HTTPHelper', function (Server $c) {
- $config = $c->getConfig();
- return new HTTPHelper(
- $config,
- $c->getHTTPClientService()
- );
- });
$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
$user = \OC_User::getUser();
@@ -965,7 +955,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig(),
$c->getThemingDefaults(),
\OC::$SERVERROOT,
- $cacheFactory->createDistributed('SCSS')
+ $this->getMemCacheFactory()
);
});
$this->registerService(JSCombiner::class, function (Server $c) {
@@ -974,7 +964,7 @@ class Server extends ServerContainer implements IServerContainer {
return new JSCombiner(
$c->getAppDataDir('js'),
$c->getURLGenerator(),
- $cacheFactory->createDistributed('JS'),
+ $this->getMemCacheFactory(),
$c->getSystemConfig(),
$c->getLogger()
);
@@ -1459,13 +1449,6 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * @return \OCP\IHelper
- */
- public function getHelper() {
- return $this->query('AppHelper');
- }
-
- /**
* @return AppFetcher
*/
public function getAppFetcher() {
@@ -1593,16 +1576,6 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * Returns an instance of the HTTP helper class
- *
- * @deprecated Use getHTTPClientService()
- * @return \OC\HTTPHelper
- */
- public function getHTTPHelper() {
- return $this->query('HTTPHelper');
- }
-
- /**
* Get the certificate manager for the user
*
* @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
index 6411912513f..813d06195b5 100644
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ b/lib/private/Settings/Personal/PersonalInfo.php
@@ -174,7 +174,7 @@ class PersonalInfo implements ISettings {
private function getGroups(IUser $user) {
$groups = array_map(
function(IGroup $group) {
- return $group->getGID();
+ return $group->getDisplayName();
},
$this->groupManager->getUserGroups($user)
);
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index e6056679c1c..9c82fcc268b 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -283,29 +283,6 @@ class Share extends Constants {
}
/**
- * resolves reshares down to the last real share
- * @param array $linkItem
- * @return array file owner
- */
- public static function resolveReShare($linkItem)
- {
- if (isset($linkItem['parent'])) {
- $parent = $linkItem['parent'];
- while (isset($parent)) {
- $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ?', 1);
- $item = $query->execute(array($parent))->fetchRow();
- if (isset($item['parent'])) {
- $parent = $item['parent'];
- } else {
- return $item;
- }
- }
- }
- return $linkItem;
- }
-
-
- /**
* Get the shared items of item type owned by the current user
* @param string $itemType
* @param int $format (optional) Format type must be defined by the backend
@@ -1261,7 +1238,8 @@ class Share extends Constants {
$row['share_with_displayname'] = $row['share_with'];
if ( isset($row['share_with']) && $row['share_with'] != '' &&
$row['share_type'] === self::SHARE_TYPE_USER) {
- $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']);
+ $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']);
+ $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName();
} else if(isset($row['share_with']) && $row['share_with'] != '' &&
$row['share_type'] === self::SHARE_TYPE_REMOTE) {
$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']);
@@ -1274,7 +1252,8 @@ class Share extends Constants {
}
}
if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
- $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
+ $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']);
+ $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName();
}
if ($row['permissions'] > 0) {
@@ -1991,7 +1970,22 @@ class Share extends Constants {
while ($result['success'] === false && $try < 2) {
$federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING');
$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
- $result = \OC::$server->getHTTPHelper()->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, $fields);
+ $client = \OC::$server->getHTTPClientService()->newClient();
+
+ try {
+ $response = $client->post(
+ $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT,
+ [
+ 'body' => $fields,
+ 'connect_timeout' => 10,
+ ]
+ );
+
+ $result = ['success' => true, 'result' => $response->getBody()];
+ } catch (\Exception $e) {
+ $result = ['success' => false, 'result' => $e->getMessage()];
+ }
+
$try++;
$protocol = 'http://';
}
diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php
index cd16d07e43d..44d79d8994e 100644
--- a/lib/private/SubAdmin.php
+++ b/lib/private/SubAdmin.php
@@ -62,7 +62,7 @@ class SubAdmin extends PublicEmitter {
$this->post_deleteUser($user);
});
$this->groupManager->listen('\OC\Group', 'postDelete', function($group) {
- $this->post_deleteGroup($group);
+ $this->post_deleteGroup($group);
});
}
@@ -123,7 +123,7 @@ class SubAdmin extends PublicEmitter {
while($row = $result->fetch()) {
$group = $this->groupManager->get($row['gid']);
if(!is_null($group)) {
- $groups[] = $group;
+ $groups[$group->getGID()] = $group;
}
}
$result->closeCursor();
@@ -132,6 +132,17 @@ class SubAdmin extends PublicEmitter {
}
/**
+ * get an array of groupid and displayName for a user
+ * @param IUser $user
+ * @return array ['displayName' => displayname]
+ */
+ public function getSubAdminsGroupsName(IUser $user) {
+ return array_map(function($group) {
+ return array('displayName' => $group->getDisplayName());
+ }, $this->getSubAdminsGroups($user));
+ }
+
+ /**
* get SubAdmins of a group
* @param IGroup $group the group
* @return IUser[]
@@ -185,7 +196,7 @@ class SubAdmin extends PublicEmitter {
/**
* checks if a user is a SubAdmin of a group
- * @param IUser $user
+ * @param IUser $user
* @param IGroup $group
* @return bool
*/
@@ -210,7 +221,7 @@ class SubAdmin extends PublicEmitter {
/**
* checks if a user is a SubAdmin
- * @param IUser $user
+ * @param IUser $user
* @return bool
*/
public function isSubAdmin(IUser $user) {
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index 1b3505da5bd..c78297e5290 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -236,8 +236,8 @@ class Tags implements \OCP\ITags {
}
$entries[$objId][] = $row['category'];
}
- if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
+ if ($result === null) {
+ \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
}
@@ -288,10 +288,10 @@ class Tags implements \OCP\ITags {
. '` WHERE `categoryid` = ?';
try {
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$result = $stmt->execute(array($tagId));
- if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
+ if ($result === null) {
+ \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
} catch(\Exception $e) {
@@ -491,12 +491,13 @@ class Tags implements \OCP\ITags {
$tags = $this->tags;
// For some reason this is needed or array_search(i) will return 0..?
ksort($tags);
+ $dbConnection = \OC::$server->getDatabaseConnection();
foreach(self::$relations as $relation) {
$tagId = $this->getTagId($relation['tag']);
\OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, \OCP\Util::DEBUG);
if($tagId) {
try {
- \OCP\DB::insertIfNotExist(self::RELATION_TABLE,
+ $dbConnection->insertIfNotExist(self::RELATION_TABLE,
array(
'objid' => $relation['objid'],
'categoryid' => $tagId,
@@ -529,11 +530,11 @@ class Tags implements \OCP\ITags {
// Find all objectid/tagId pairs.
$result = null;
try {
- $stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
+ $stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
- if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
+ if ($result === null) {
+ \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
}
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@@ -545,7 +546,7 @@ class Tags implements \OCP\ITags {
if(!is_null($result)) {
try {
- $stmt = \OCP\DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
+ $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `categoryid` = ?');
while( $row = $result->fetchRow()) {
try {
@@ -567,11 +568,11 @@ class Tags implements \OCP\ITags {
}
}
try {
- $stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
+ $stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
- if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
+ if ($result === null) {
+ \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
}
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@@ -599,10 +600,10 @@ class Tags implements \OCP\ITags {
$query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) ';
$query .= 'AND `type`= ?';
$updates[] = $this->type;
- $stmt = \OCP\DB::prepare($query);
+ $stmt = \OC_DB::prepare($query);
$result = $stmt->execute($updates);
- if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
+ if ($result === null) {
+ \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
} catch(\Exception $e) {
@@ -679,7 +680,7 @@ class Tags implements \OCP\ITags {
$tagId = $tag;
}
try {
- \OCP\DB::insertIfNotExist(self::RELATION_TABLE,
+ \OC::$server->getDatabaseConnection()->insertIfNotExist(self::RELATION_TABLE,
array(
'objid' => $objid,
'categoryid' => $tagId,
@@ -718,7 +719,7 @@ class Tags implements \OCP\ITags {
try {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?';
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$stmt->execute(array($objid, $tagId, $this->type));
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@@ -768,11 +769,11 @@ class Tags implements \OCP\ITags {
try {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `categoryid` = ?';
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$result = $stmt->execute(array($id));
- if (\OCP\DB::isError($result)) {
+ if ($result === null) {
\OCP\Util::writeLog('core',
- __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(),
+ __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
\OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index c5adcee6854..93683753899 100644
--- a/lib/private/Template/JSCombiner.php
+++ b/lib/private/Template/JSCombiner.php
@@ -30,6 +30,7 @@ use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFolder;
+use OCP\ICacheFactory;
use OCP\ILogger;
use OCP\IURLGenerator;
@@ -50,21 +51,25 @@ class JSCombiner {
/** @var ILogger */
protected $logger;
+ /** @var ICacheFactory */
+ private $cacheFactory;
+
/**
* @param IAppData $appData
* @param IURLGenerator $urlGenerator
- * @param ICache $depsCache
+ * @param ICacheFactory $cacheFactory
* @param SystemConfig $config
* @param ILogger $logger
*/
public function __construct(IAppData $appData,
IURLGenerator $urlGenerator,
- ICache $depsCache,
+ ICacheFactory $cacheFactory,
SystemConfig $config,
ILogger $logger) {
$this->appData = $appData;
$this->urlGenerator = $urlGenerator;
- $this->depsCache = $depsCache;
+ $this->cacheFactory = $cacheFactory;
+ $this->depsCache = $this->cacheFactory->createDistributed('JS-' . md5($this->urlGenerator->getBaseUrl()));
$this->config = $config;
$this->logger = $logger;
}
@@ -104,13 +109,20 @@ class JSCombiner {
* @return bool
*/
protected function isCached($fileName, ISimpleFolder $folder) {
- $fileName = str_replace('.json', '.js', $fileName) . '.deps';
+ $fileName = str_replace('.json', '.js', $fileName);
+
+ if (!$folder->fileExists($fileName)) {
+ return false;
+ }
+
+ $fileName = $fileName . '.deps';
try {
$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
if ($deps === null || $deps === '') {
$depFile = $folder->getFile($fileName);
$deps = $depFile->getContent();
}
+
// check again
if ($deps === null || $deps === '') {
$this->logger->info('JSCombiner: deps file empty: ' . $fileName);
@@ -236,7 +248,7 @@ class JSCombiner {
* @throws NotFoundException
*/
public function resetCache() {
- $this->depsCache->clear();
+ $this->cacheFactory->createDistributed('JS-')->clear();
$appDirectory = $this->appData->getDirectoryListing();
foreach ($appDirectory as $folder) {
foreach ($folder->getDirectoryListing() as $file) {
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 433d5e5d0bf..6fb9d11953b 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -39,6 +39,7 @@ use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\ICache;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IURLGenerator;
@@ -69,6 +70,9 @@ class SCSSCacher {
/** @var null|string */
private $injectedVariables;
+ /** @var ICacheFactory */
+ private $cacheFactory;
+
/**
* @param ILogger $logger
* @param Factory $appDataFactory
@@ -76,7 +80,7 @@ class SCSSCacher {
* @param IConfig $config
* @param \OC_Defaults $defaults
* @param string $serverRoot
- * @param ICache $depsCache
+ * @param ICacheFactory $cacheFactory
*/
public function __construct(ILogger $logger,
Factory $appDataFactory,
@@ -84,14 +88,15 @@ class SCSSCacher {
IConfig $config,
\OC_Defaults $defaults,
$serverRoot,
- ICache $depsCache) {
+ ICacheFactory $cacheFactory) {
$this->logger = $logger;
$this->appData = $appDataFactory->get('css');
$this->urlGenerator = $urlGenerator;
$this->config = $config;
$this->defaults = $defaults;
$this->serverRoot = $serverRoot;
- $this->depsCache = $depsCache;
+ $this->cacheFactory = $cacheFactory;
+ $this->depsCache = $cacheFactory->createDistributed('SCSS-' . md5($this->urlGenerator->getBaseUrl()));
}
/**
@@ -107,7 +112,7 @@ class SCSSCacher {
$path = explode('/', $root . '/' . $file);
$fileNameSCSS = array_pop($path);
- $fileNameCSS = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS));
+ $fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app);
$path = implode('/', $path);
$webDir = $this->getWebDir($path, $app, $this->serverRoot, \OC::$WEBROOT);
@@ -133,7 +138,8 @@ class SCSSCacher {
*/
public function getCachedCSS(string $appName, string $fileName): ISimpleFile {
$folder = $this->appData->getFolder($appName);
- return $folder->getFile($this->prependBaseurlPrefix($fileName));
+ $cachedFileName = $this->prependVersionPrefix($this->prependBaseurlPrefix($fileName), $appName);
+ return $folder->getFile($cachedFileName);
}
/**
@@ -263,7 +269,7 @@ class SCSSCacher {
*/
public function resetCache() {
$this->injectedVariables = null;
- $this->depsCache->clear();
+ $this->cacheFactory->createDistributed('SCSS-')->clear();
$appDirectory = $this->appData->getDirectoryListing();
foreach ($appDirectory as $folder) {
foreach ($folder->getDirectoryListing() as $file) {
@@ -317,19 +323,34 @@ class SCSSCacher {
public function getCachedSCSS(string $appName, string $fileName): string {
$tmpfileLoc = explode('/', $fileName);
$fileName = array_pop($tmpfileLoc);
- $fileName = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName));
+ $fileName = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)), $appName);
return substr($this->urlGenerator->linkToRoute('core.Css.getCss', ['fileName' => $fileName, 'appName' => $appName]), strlen(\OC::$WEBROOT) + 1);
}
/**
* Prepend hashed base url to the css file
- * @param string$cssFile
+ * @param string $cssFile
* @return string
*/
private function prependBaseurlPrefix(string $cssFile): string {
$frontendController = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
- return substr(md5($this->urlGenerator->getBaseUrl() . $frontendController), 0, 8) . '-' . $cssFile;
+ return substr(md5($this->urlGenerator->getBaseUrl() . $frontendController), 0, 4) . '-' . $cssFile;
+ }
+
+ /**
+ * Prepend hashed app version hash
+ * @param string $cssFile
+ * @param string $appId
+ * @return string
+ */
+ private function prependVersionPrefix(string $cssFile, string $appId): string {
+ $appVersion = \OC_App::getAppVersion($appId);
+ if ($appVersion !== '0') {
+ return substr(md5($appVersion), 0, 4) . '-' . $cssFile;
+ }
+ $coreVersion = \OC_Util::getVersionString();
+ return substr(md5($coreVersion), 0, 4) . '-' . $cssFile;
}
/**
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 0f2eb48bef3..c378396c727 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -306,13 +306,7 @@ class TemplateLayout extends \OC_Template {
$theme,
array( \OC::$SERVERROOT => \OC::$WEBROOT ),
array( \OC::$SERVERROOT => \OC::$WEBROOT ),
- new JSCombiner(
- \OC::$server->getAppDataDir('js'),
- \OC::$server->getURLGenerator(),
- \OC::$server->getMemCacheFactory()->createDistributed('JS'),
- \OC::$server->getSystemConfig(),
- \OC::$server->getLogger()
- )
+ \OC::$server->query(JSCombiner::class)
);
$locator->find($scripts);
return $locator->getResources();
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index c70113e1c7d..49a4a1094ed 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -391,11 +391,11 @@ class Updater extends BasicEmitter {
foreach ($apps as $app) {
// check if the app is compatible with this version of ownCloud
$info = OC_App::getAppInfo($app);
- if(!OC_App::isAppCompatible($version, $info)) {
+ if($info === null || !OC_App::isAppCompatible($version, $info)) {
if ($appManager->isShipped($app)) {
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
}
- OC_App::disable($app);
+ \OC::$server->getAppManager()->disableApp($app);
$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
}
// no need to disable any app in case this is a non-core upgrade
diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php
index c7b829c9ec5..5cfc3c81a14 100644
--- a/lib/private/Updater/VersionCheck.php
+++ b/lib/private/Updater/VersionCheck.php
@@ -98,6 +98,7 @@ class VersionCheck {
$tmp['url'] = (string)$data->url;
$tmp['web'] = (string)$data->web;
$tmp['autoupdater'] = (string)$data->autoupdater;
+ $tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0';
} else {
libxml_clear_errors();
}
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 471ff1f45ae..d92390cdc96 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -40,6 +41,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
/*
*
* The following SQL statement is just a help for developers and will not be
@@ -56,7 +58,14 @@
namespace OC\User;
use OC\Cache\CappedMemoryCache;
-use OCP\IUserBackend;
+use OCP\User\Backend\ABackend;
+use OCP\User\Backend\ICheckPasswordBackend;
+use OCP\User\Backend\ICountUsersBackend;
+use OCP\User\Backend\ICreateUserBackend;
+use OCP\User\Backend\IGetDisplayNameBackend;
+use OCP\User\Backend\IGetHomeBackend;
+use OCP\User\Backend\ISetDisplayNameBackend;
+use OCP\User\Backend\ISetPasswordBackend;
use OCP\Util;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
@@ -64,7 +73,14 @@ use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class for user management in a SQL Database (e.g. MySQL, SQLite)
*/
-class Database extends Backend implements IUserBackend {
+class Database extends ABackend
+ implements ICreateUserBackend,
+ ISetPasswordBackend,
+ ISetDisplayNameBackend,
+ IGetDisplayNameBackend,
+ ICheckPasswordBackend,
+ IGetHomeBackend,
+ ICountUsersBackend {
/** @var CappedMemoryCache */
private $cache;
@@ -83,6 +99,7 @@ class Database extends Backend implements IUserBackend {
/**
* Create a new user
+ *
* @param string $uid The username of the user to create
* @param string $password The password of the new user
* @return bool
@@ -90,13 +107,13 @@ class Database extends Backend implements IUserBackend {
* Creates a new user. Basic checking of username is done in OC_User
* itself, not in its subclasses.
*/
- public function createUser($uid, $password) {
+ public function createUser(string $uid, string $password): bool {
if (!$this->userExists($uid)) {
$event = new GenericEvent($password);
$this->eventDispatcher->dispatch('OCP\PasswordPolicy::validate', $event);
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )');
try {
- $result = $query->execute(array($uid, \OC::$server->getHasher()->hash($password)));
+ $result = $query->execute([$uid, \OC::$server->getHasher()->hash($password)]);
} catch (\Exception $e) {
$result = false;
}
@@ -112,6 +129,7 @@ class Database extends Backend implements IUserBackend {
/**
* delete a user
+ *
* @param string $uid The username of the user to delete
* @return bool
*
@@ -120,7 +138,7 @@ class Database extends Backend implements IUserBackend {
public function deleteUser($uid) {
// Delete user-group-relation
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*users` WHERE `uid` = ?');
- $result = $query->execute(array($uid));
+ $result = $query->execute([$uid]);
if (isset($this->cache[$uid])) {
unset($this->cache[$uid]);
@@ -131,18 +149,19 @@ class Database extends Backend implements IUserBackend {
/**
* Set password
+ *
* @param string $uid The username
* @param string $password The new password
* @return bool
*
* Change the password of a user
*/
- public function setPassword($uid, $password) {
+ public function setPassword(string $uid, string $password): bool {
if ($this->userExists($uid)) {
$event = new GenericEvent($password);
$this->eventDispatcher->dispatch('OCP\PasswordPolicy::validate', $event);
$query = \OC_DB::prepare('UPDATE `*PREFIX*users` SET `password` = ? WHERE `uid` = ?');
- $result = $query->execute(array(\OC::$server->getHasher()->hash($password), $uid));
+ $result = $query->execute([\OC::$server->getHasher()->hash($password), $uid]);
return $result ? true : false;
}
@@ -152,16 +171,17 @@ class Database extends Backend implements IUserBackend {
/**
* Set display name
+ *
* @param string $uid The username
* @param string $displayName The new display name
* @return bool
*
* Change the display name of a user
*/
- public function setDisplayName($uid, $displayName) {
+ public function setDisplayName(string $uid, string $displayName): bool {
if ($this->userExists($uid)) {
$query = \OC_DB::prepare('UPDATE `*PREFIX*users` SET `displayname` = ? WHERE LOWER(`uid`) = LOWER(?)');
- $query->execute(array($displayName, $uid));
+ $query->execute([$displayName, $uid]);
$this->cache[$uid]['displayname'] = $displayName;
return true;
@@ -172,10 +192,11 @@ class Database extends Backend implements IUserBackend {
/**
* get display name of the user
+ *
* @param string $uid user ID of the user
* @return string display name
*/
- public function getDisplayName($uid) {
+ public function getDisplayName($uid): string {
$this->loadUser($uid);
return empty($this->cache[$uid]['displayname']) ? $uid : $this->cache[$uid]['displayname'];
}
@@ -189,20 +210,29 @@ class Database extends Backend implements IUserBackend {
* @return array an array of all displayNames (value) and the corresponding uids (key)
*/
public function getDisplayNames($search = '', $limit = null, $offset = null) {
- $parameters = [];
- $searchLike = '';
- if ($search !== '') {
- $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
- $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
- $searchLike = ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR '
- . 'LOWER(`uid`) LIKE LOWER(?)';
- }
+ $connection = \OC::$server->getDatabaseConnection();
+
+ $query = $connection->getQueryBuilder();
+
+ $query->select('uid', 'displayname')
+ ->from('users', 'u')
+ ->leftJoin('u', 'preferences', 'p', $query->expr()->andX(
+ $query->expr()->eq('userid', 'uid'),
+ $query->expr()->eq('appid', $query->expr()->literal('settings')),
+ $query->expr()->eq('configkey', $query->expr()->literal('email')))
+ )
+ // sqlite doesn't like re-using a single named parameter here
+ ->where($query->expr()->iLike('uid', $query->createPositionalParameter('%' . $connection->escapeLikeParameter($search) . '%')))
+ ->orWhere($query->expr()->iLike('displayname', $query->createPositionalParameter('%' . $connection->escapeLikeParameter($search) . '%')))
+ ->orWhere($query->expr()->iLike('configvalue', $query->createPositionalParameter('%' . $connection->escapeLikeParameter($search) . '%')))
+ ->orderBy($query->func()->lower('displayname'), 'ASC')
+ ->orderBy($query->func()->lower('uid'), 'ASC')
+ ->setMaxResults($limit)
+ ->setFirstResult($offset);
- $displayNames = array();
- $query = \OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`'
- . $searchLike .' ORDER BY LOWER(`displayname`), LOWER(`uid`) ASC', $limit, $offset);
- $result = $query->execute($parameters);
- while ($row = $result->fetchRow()) {
+ $result = $query->execute();
+ $displayNames = [];
+ while ($row = $result->fetch()) {
$displayNames[$row['uid']] = $row['displayname'];
}
@@ -211,6 +241,7 @@ class Database extends Backend implements IUserBackend {
/**
* Check if the password is correct
+ *
* @param string $uid The username
* @param string $password The password
* @return string
@@ -218,16 +249,16 @@ class Database extends Backend implements IUserBackend {
* Check if the password is correct without logging in the user
* returns the user id or false
*/
- public function checkPassword($uid, $password) {
+ public function checkPassword(string $uid, string $password) {
$query = \OC_DB::prepare('SELECT `uid`, `password` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
- $result = $query->execute(array($uid));
+ $result = $query->execute([$uid]);
$row = $result->fetchRow();
if ($row) {
$storedHash = $row['password'];
$newHash = '';
- if(\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) {
- if(!empty($newHash)) {
+ if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) {
+ if (!empty($newHash)) {
$this->setPassword($uid, $password);
}
return $row['uid'];
@@ -240,20 +271,21 @@ class Database extends Backend implements IUserBackend {
/**
* Load an user in the cache
+ *
* @param string $uid the username
* @return boolean true if user was found, false otherwise
*/
private function loadUser($uid) {
- $uid = (string) $uid;
+ $uid = (string)$uid;
if (!isset($this->cache[$uid])) {
//guests $uid could be NULL or ''
if ($uid === '') {
- $this->cache[$uid]=false;
+ $this->cache[$uid] = false;
return true;
}
$query = \OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
- $result = $query->execute(array($uid));
+ $result = $query->execute([$uid]);
if ($result === false) {
Util::writeLog('core', \OC_DB::getErrorMessage(), Util::ERROR);
@@ -285,26 +317,15 @@ class Database extends Backend implements IUserBackend {
* @return string[] an array of all uids
*/
public function getUsers($search = '', $limit = null, $offset = null) {
- $parameters = [];
- $searchLike = '';
- if ($search !== '') {
- $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
- $searchLike = ' WHERE LOWER(`uid`) LIKE LOWER(?)';
- $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
- $searchLike .= ' OR LOWER(`displayname`) LIKE LOWER(?)';
- }
-
- $query = \OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users`' . $searchLike . ' ORDER BY LOWER(`uid`) ASC', $limit, $offset);
- $result = $query->execute($parameters);
- $users = array();
- while ($row = $result->fetchRow()) {
- $users[] = $row['uid'];
- }
- return $users;
+ $users = $this->getDisplayNames($search, $limit, $offset);
+ $userIds = array_keys($users);
+ sort($userIds, SORT_STRING | SORT_FLAG_CASE);
+ return $userIds;
}
/**
* check if a user exists
+ *
* @param string $uid the username
* @return boolean
*/
@@ -315,12 +336,13 @@ class Database extends Backend implements IUserBackend {
/**
* get the user's home directory
+ *
* @param string $uid the username
* @return string|false
*/
- public function getHome($uid) {
+ public function getHome(string $uid) {
if ($this->userExists($uid)) {
- return \OC::$server->getConfig()->getSystemValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $uid;
+ return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
}
return false;
@@ -364,14 +386,15 @@ class Database extends Backend implements IUserBackend {
/**
* Backend name to be shown in user management
+ *
* @return string the name of the backend to be shown
*/
- public function getBackendName(){
+ public function getBackendName() {
return 'Database';
}
public static function preLoginNameUsedAsUserName($param) {
- if(!isset($param['uid'])) {
+ if (!isset($param['uid'])) {
throw new \Exception('key uid is expected to be set in $param');
}
diff --git a/lib/private/legacy/api.php b/lib/private/legacy/api.php
index 7fe84b73c43..fde1d99e79d 100644
--- a/lib/private/legacy/api.php
+++ b/lib/private/legacy/api.php
@@ -38,43 +38,9 @@ use OCP\AppFramework\Http;
class OC_API {
/**
- * API authentication levels
- */
-
- /** @deprecated Use \OCP\API::GUEST_AUTH instead */
- const GUEST_AUTH = 0;
-
- /** @deprecated Use \OCP\API::USER_AUTH instead */
- const USER_AUTH = 1;
-
- /** @deprecated Use \OCP\API::SUBADMIN_AUTH instead */
- const SUBADMIN_AUTH = 2;
-
- /** @deprecated Use \OCP\API::ADMIN_AUTH instead */
- const ADMIN_AUTH = 3;
-
- /**
- * API Response Codes
- */
-
- /** @deprecated Use \OCP\API::RESPOND_UNAUTHORISED instead */
- const RESPOND_UNAUTHORISED = 997;
-
- /** @deprecated Use \OCP\API::RESPOND_SERVER_ERROR instead */
- const RESPOND_SERVER_ERROR = 996;
-
- /** @deprecated Use \OCP\API::RESPOND_NOT_FOUND instead */
- const RESPOND_NOT_FOUND = 998;
-
- /** @deprecated Use \OCP\API::RESPOND_UNKNOWN_ERROR instead */
- const RESPOND_UNKNOWN_ERROR = 999;
-
- /**
* api actions
*/
protected static $actions = array();
- private static $logoutRequired = false;
- private static $isLoggedIn = false;
/**
* registers an api call
@@ -107,249 +73,6 @@ class OC_API {
}
/**
- * handles an api call
- * @param array $parameters
- */
- public static function call($parameters) {
- $request = \OC::$server->getRequest();
- $method = $request->getMethod();
-
- // Prepare the request variables
- if($method === 'PUT') {
- $parameters['_put'] = $request->getParams();
- } else if($method === 'DELETE') {
- $parameters['_delete'] = $request->getParams();
- }
- $name = $parameters['_route'];
- // Foreach registered action
- $responses = array();
- $appManager = \OC::$server->getAppManager();
- foreach(self::$actions[$name] as $action) {
- // Check authentication and availability
- if(!self::isAuthorised($action)) {
- $responses[] = array(
- 'app' => $action['app'],
- 'response' => new \OC\OCS\Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
- 'shipped' => $appManager->isShipped($action['app']),
- );
- continue;
- }
- if(!is_callable($action['action'])) {
- $responses[] = array(
- 'app' => $action['app'],
- 'response' => new \OC\OCS\Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'),
- 'shipped' => $appManager->isShipped($action['app']),
- );
- continue;
- }
- // Run the action
- $responses[] = array(
- 'app' => $action['app'],
- 'response' => call_user_func($action['action'], $parameters),
- 'shipped' => $appManager->isShipped($action['app']),
- );
- }
- $response = self::mergeResponses($responses);
- $format = self::requestedFormat();
- if (self::$logoutRequired) {
- \OC::$server->getUserSession()->logout();
- }
-
- self::respond($response, $format);
- }
-
- /**
- * merge the returned result objects into one response
- * @param array $responses
- * @return \OC\OCS\Result
- */
- public static function mergeResponses($responses) {
- // Sort into shipped and third-party
- $shipped = array(
- 'succeeded' => array(),
- 'failed' => array(),
- );
- $thirdparty = array(
- 'succeeded' => array(),
- 'failed' => array(),
- );
-
- foreach($responses as $response) {
- if($response['shipped'] || ($response['app'] === 'core')) {
- if($response['response']->succeeded()) {
- $shipped['succeeded'][$response['app']] = $response;
- } else {
- $shipped['failed'][$response['app']] = $response;
- }
- } else {
- if($response['response']->succeeded()) {
- $thirdparty['succeeded'][$response['app']] = $response;
- } else {
- $thirdparty['failed'][$response['app']] = $response;
- }
- }
- }
-
- // Remove any error responses if there is one shipped response that succeeded
- if(!empty($shipped['failed'])) {
- // Which shipped response do we use if they all failed?
- // They may have failed for different reasons (different status codes)
- // Which response code should we return?
- // Maybe any that are not \OCP\API::RESPOND_SERVER_ERROR
- // Merge failed responses if more than one
- $data = array();
- foreach($shipped['failed'] as $failure) {
- $data = array_merge_recursive($data, $failure['response']->getData());
- }
- $picked = reset($shipped['failed']);
- $code = $picked['response']->getStatusCode();
- $meta = $picked['response']->getMeta();
- $headers = $picked['response']->getHeaders();
- $response = new \OC\OCS\Result($data, $code, $meta['message'], $headers);
- return $response;
- } elseif(!empty($shipped['succeeded'])) {
- $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
- } elseif(!empty($thirdparty['failed'])) {
- // Merge failed responses if more than one
- $data = array();
- foreach($thirdparty['failed'] as $failure) {
- $data = array_merge_recursive($data, $failure['response']->getData());
- }
- $picked = reset($thirdparty['failed']);
- $code = $picked['response']->getStatusCode();
- $meta = $picked['response']->getMeta();
- $headers = $picked['response']->getHeaders();
- $response = new \OC\OCS\Result($data, $code, $meta['message'], $headers);
- return $response;
- } else {
- $responses = $thirdparty['succeeded'];
- }
- // Merge the successful responses
- $data = [];
- $codes = [];
- $header = [];
-
- foreach($responses as $response) {
- if($response['shipped']) {
- $data = array_merge_recursive($response['response']->getData(), $data);
- } else {
- $data = array_merge_recursive($data, $response['response']->getData());
- }
- $header = array_merge_recursive($header, $response['response']->getHeaders());
- $codes[] = ['code' => $response['response']->getStatusCode(),
- 'meta' => $response['response']->getMeta()];
- }
-
- // Use any non 100 status codes
- $statusCode = 100;
- $statusMessage = null;
- foreach($codes as $code) {
- if($code['code'] != 100) {
- $statusCode = $code['code'];
- $statusMessage = $code['meta']['message'];
- break;
- }
- }
-
- return new \OC\OCS\Result($data, $statusCode, $statusMessage, $header);
- }
-
- /**
- * authenticate the api call
- * @param array $action the action details as supplied to OC_API::register()
- * @return bool
- */
- private static function isAuthorised($action) {
- $level = $action['authlevel'];
- switch($level) {
- case API::GUEST_AUTH:
- // Anyone can access
- return true;
- case API::USER_AUTH:
- // User required
- return self::loginUser();
- case API::SUBADMIN_AUTH:
- // Check for subadmin
- $user = self::loginUser();
- if(!$user) {
- return false;
- } else {
- $userObject = \OC::$server->getUserSession()->getUser();
- if($userObject === null) {
- return false;
- }
- $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject);
- $admin = OC_User::isAdminUser($user);
- if($isSubAdmin || $admin) {
- return true;
- } else {
- return false;
- }
- }
- case API::ADMIN_AUTH:
- // Check for admin
- $user = self::loginUser();
- if(!$user) {
- return false;
- } else {
- return OC_User::isAdminUser($user);
- }
- default:
- // oops looks like invalid level supplied
- return false;
- }
- }
-
- /**
- * http basic auth
- * @return string|false (username, or false on failure)
- */
- private static function loginUser() {
- if(self::$isLoggedIn === true) {
- return \OC_User::getUser();
- }
-
- // reuse existing login
- $loggedIn = \OC::$server->getUserSession()->isLoggedIn();
- if ($loggedIn === true) {
- if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
- // Do not allow access to OCS until the 2FA challenge was solved successfully
- return false;
- }
- $ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
- if ($ocsApiRequest) {
-
- // initialize the user's filesystem
- \OC_Util::setupFS(\OC_User::getUser());
- self::$isLoggedIn = true;
-
- return OC_User::getUser();
- }
- return false;
- }
-
- // basic auth - because OC_User::login will create a new session we shall only try to login
- // if user and pass are set
- $userSession = \OC::$server->getUserSession();
- $request = \OC::$server->getRequest();
- try {
- if ($userSession->tryTokenLogin($request)
- || $userSession->tryBasicAuthLogin($request, \OC::$server->getBruteForceThrottler())) {
- self::$logoutRequired = true;
- } else {
- return false;
- }
- // initialize the user's filesystem
- \OC_Util::setupFS(\OC_User::getUser());
- self::$isLoggedIn = true;
-
- return \OC_User::getUser();
- } catch (\OC\User\LoginException $e) {
- return false;
- }
- }
-
- /**
* respond to a call
* @param \OC\OCS\Result $result
* @param string $format the format xml|json
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 16e57d43ebc..cabeed1d62d 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -154,16 +154,9 @@ class OC_App {
\OC::$server->getLogger()->logException($ex);
if (!\OC::$server->getAppManager()->isShipped($app)) {
// Only disable apps which are not shipped
- self::disable($app);
+ \OC::$server->getAppManager()->disableApp($app);
}
}
- if (self::isType($app, array('authentication'))) {
- // since authentication apps affect the "is app enabled for group" check,
- // the enabled apps cache needs to be cleared to make sure that the
- // next time getEnableApps() is called it will also include apps that were
- // enabled for groups
- self::$enabledAppsCache = [];
- }
\OC::$server->getEventLogger()->end('load_app_' . $app);
}
@@ -330,11 +323,6 @@ class OC_App {
}
/**
- * get all enabled apps
- */
- protected static $enabledAppsCache = [];
-
- /**
* Returns apps enabled for the current user.
*
* @param bool $forceRefresh whether to refresh the cache
@@ -393,9 +381,9 @@ class OC_App {
*/
public function enable(string $appId,
array $groups = []) {
- self::$enabledAppsCache = []; // flush
// Check if app is already downloaded
+ /** @var Installer $installer */
$installer = \OC::$server->query(Installer::class);
$isDownloaded = $installer->isDownloaded($appId);
@@ -422,30 +410,6 @@ class OC_App {
}
/**
- * This function set an app as disabled in appconfig.
- *
- * @param string $app app
- * @throws Exception
- */
- public static function disable(string $app) {
- // flush
- self::$enabledAppsCache = [];
-
- // run uninstall steps
- $appData = OC_App::getAppInfo($app);
- if (!is_null($appData)) {
- OC_App::executeRepairSteps($app, $appData['repair-steps']['uninstall']);
- }
-
- // emit disable hook - needed anymore ?
- \OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
-
- // finally disable it
- $appManager = \OC::$server->getAppManager();
- $appManager->disableApp($app);
- }
-
- /**
* Get the path where to install apps
*
* @return string|false
diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php
index c541e53a48d..3a22c91a8df 100644
--- a/lib/private/legacy/defaults.php
+++ b/lib/private/legacy/defaults.php
@@ -54,15 +54,16 @@ class OC_Defaults {
public function __construct() {
$this->l = \OC::$server->getL10N('lib');
+ $config = \OC::$server->getConfig();
$this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
$this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */
$this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */
$this->defaultBaseUrl = 'https://nextcloud.com';
- $this->defaultSyncClientUrl = 'https://nextcloud.com/install/#install-clients';
- $this->defaultiOSClientUrl = 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8';
- $this->defaultiTunesAppId = '1125420102';
- $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.nextcloud.client';
+ $this->defaultSyncClientUrl = $config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients');
+ $this->defaultiOSClientUrl = $config->getSystemValue('customclient_ios', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8');
+ $this->defaultiTunesAppId = $config->getSystemValue('customclient_ios_appid', '1125420102');
+ $this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client');
$this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
$this->defaultDocVersion = '14'; // used to generate doc links
$this->defaultSlogan = $this->l->t('a safe home for all your data');
diff --git a/lib/private/legacy/eventsource.php b/lib/private/legacy/eventsource.php
index 1a8061c0ed2..1e68dd24af0 100644
--- a/lib/private/legacy/eventsource.php
+++ b/lib/private/legacy/eventsource.php
@@ -110,13 +110,13 @@ class OC_EventSource implements \OCP\IEventSource {
}
if ($this->fallback) {
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
- . $this->fallBackId . ',"' . $type . '",' . OCP\JSON::encode($data) . ')</script>' . PHP_EOL;
+ . $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
echo $response;
} else {
if ($type) {
echo 'event: ' . $type . PHP_EOL;
}
- echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL;
+ echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
}
echo PHP_EOL;
flush();
diff --git a/lib/private/legacy/group/backend.php b/lib/private/legacy/group/backend.php
deleted file mode 100644
index 534004c97e9..00000000000
--- a/lib/private/legacy/group/backend.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Jakob Sack <mail@jakobsack.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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/>
- *
- */
-
-/**
- * error code for functions not provided by the group backend
- * @deprecated Use \OC_Group_Backend::NOT_IMPLEMENTED instead
- */
-define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501);
-
-/**
- * actions that user backends can define
- */
-/** @deprecated Use \OC_Group_Backend::CREATE_GROUP instead */
-define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001);
-/** @deprecated Use \OC_Group_Backend::DELETE_GROUP instead */
-define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
-/** @deprecated Use \OC_Group_Backend::ADD_TO_GROUP instead */
-define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
-/** @deprecated Use \OC_Group_Backend::REMOVE_FROM_GOUP instead */
-define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
-/** @deprecated Obsolete */
-define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000); //OBSOLETE
-/** @deprecated Use \OC_Group_Backend::COUNT_USERS instead */
-define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000);
-
-/**
- * Abstract base class for user management
- * @deprecated Since 9.1.0 use \OC\Group\Backend
- */
-abstract class OC_Group_Backend extends \OC\Group\Backend {
-}
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php
index 0afa179b3d8..9588834e934 100644
--- a/lib/private/legacy/json.php
+++ b/lib/private/legacy/json.php
@@ -37,18 +37,6 @@
* @deprecated Use a AppFramework JSONResponse instead
*/
class OC_JSON{
- static protected $send_content_type_header = false;
- /**
- * set Content-Type header to jsonrequest
- * @deprecated Use a AppFramework JSONResponse instead
- */
- public static function setContentTypeHeader($type='application/json') {
- if (!self::$send_content_type_header) {
- // We send json data
- header( 'Content-Type: '.$type . '; charset=utf-8');
- self::$send_content_type_header = true;
- }
- }
/**
* Check if the app is enabled, send json error msg if not
@@ -112,21 +100,6 @@ class OC_JSON{
}
/**
- * Check is a given user exists - send json error msg if not
- * @param string $user
- * @deprecated Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function checkUserExists($user) {
- if (!\OC::$server->getUserManager()->userExists($user)) {
- $l = \OC::$server->getL10N('lib');
- OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' )));
- exit;
- }
- }
-
-
- /**
* Check if the user is a subadmin, send json error msg if not
* @deprecated Use annotation based ACLs from the AppFramework instead
* @suppress PhanDeprecatedFunction
@@ -152,7 +125,8 @@ class OC_JSON{
*/
public static function error($data = array()) {
$data['status'] = 'error';
- self::encodedPrint($data);
+ header( 'Content-Type: application/json; charset=utf-8');
+ echo self::encode($data);
}
/**
@@ -162,7 +136,8 @@ class OC_JSON{
*/
public static function success($data = array()) {
$data['status'] = 'success';
- self::encodedPrint($data);
+ header( 'Content-Type: application/json; charset=utf-8');
+ echo self::encode($data);
}
/**
@@ -175,18 +150,6 @@ class OC_JSON{
}
/**
- * Encode and print $data in json format
- * @deprecated Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function encodedPrint($data, $setContentType=true) {
- if($setContentType) {
- self::setContentTypeHeader();
- }
- echo self::encode($data);
- }
-
- /**
* Encode JSON
* @deprecated Use a AppFramework JSONResponse instead
*/
diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php
index 1b0b01de972..4186822c269 100644
--- a/lib/private/legacy/response.php
+++ b/lib/private/legacy/response.php
@@ -31,7 +31,7 @@
*/
class OC_Response {
- const STATUS_FOUND = 304;
+ const STATUS_FOUND = 302;
const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_BAD_REQUEST = 400;
@@ -41,32 +41,6 @@ class OC_Response {
const STATUS_SERVICE_UNAVAILABLE = 503;
/**
- * Enable response caching by sending correct HTTP headers
- * @param integer $cache_time time to cache the response
- * >0 cache time in seconds
- * 0 and <0 enable default browser caching
- * null cache indefinitely
- */
- static public function enableCaching($cache_time = null) {
- if (is_numeric($cache_time)) {
- header('Pragma: public');// enable caching in IE
- if ($cache_time > 0) {
- self::setExpiresHeader('PT'.$cache_time.'S');
- header('Cache-Control: max-age='.$cache_time.', must-revalidate');
- }
- else {
- header('Expires: 0');
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- }
- }
- else {
- header('Cache-Control: cache');
- header('Pragma: cache');
- }
-
- }
-
- /**
* Set response status
* @param int $status a HTTP status code, see also the STATUS constants
*/
@@ -77,12 +51,12 @@ class OC_Response {
$status = $status . ' Not Modified';
break;
case self::STATUS_TEMPORARY_REDIRECT:
- if ($protocol == 'HTTP/1.1') {
- $status = $status . ' Temporary Redirect';
- break;
- } else {
+ if ($protocol == 'HTTP/1.0') {
$status = self::STATUS_FOUND;
// fallthrough
+ } else {
+ $status = $status . ' Temporary Redirect';
+ break;
}
case self::STATUS_FOUND;
$status = $status . ' Found';
@@ -101,75 +75,6 @@ class OC_Response {
}
/**
- * Send redirect response
- * @param string $location to redirect to
- */
- static public function redirect($location) {
- self::setStatus(self::STATUS_TEMPORARY_REDIRECT);
- header('Location: '.$location);
- }
-
- /**
- * Set response expire time
- * @param string|DateTime|int $expires date-time when the response expires
- * string for DateInterval from now
- * DateTime object when to expire response
- */
- static public function setExpiresHeader($expires) {
- if (is_string($expires) && $expires[0] == 'P') {
- $interval = $expires;
- $expires = new DateTime('now');
- $expires->add(new DateInterval($interval));
- }
- if ($expires instanceof DateTime) {
- $expires->setTimezone(new DateTimeZone('GMT'));
- $expires = $expires->format(DateTime::RFC2822);
- }
- header('Expires: '.$expires);
- }
-
- /**
- * Checks and set ETag header, when the request matches sends a
- * 'not modified' response
- * @param string $etag token to use for modification check
- */
- static public function setETagHeader($etag) {
- if (empty($etag)) {
- return;
- }
- $etag = '"'.$etag.'"';
- if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
- trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
- self::setStatus(self::STATUS_NOT_MODIFIED);
- exit;
- }
- header('ETag: '.$etag);
- }
-
- /**
- * Checks and set Last-Modified header, when the request matches sends a
- * 'not modified' response
- * @param int|DateTime|string $lastModified time when the response was last modified
- */
- static public function setLastModifiedHeader($lastModified) {
- if (empty($lastModified)) {
- return;
- }
- if (is_int($lastModified)) {
- $lastModified = gmdate(DateTime::RFC2822, $lastModified);
- }
- if ($lastModified instanceof DateTime) {
- $lastModified = $lastModified->format(DateTime::RFC2822);
- }
- if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
- trim($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
- self::setStatus(self::STATUS_NOT_MODIFIED);
- exit;
- }
- header('Last-Modified: '.$lastModified);
- }
-
- /**
* Sets the content disposition header (with possible workarounds)
* @param string $filename file name
* @param string $type disposition type, either 'attachment' or 'inline'
@@ -210,25 +115,6 @@ class OC_Response {
}
/**
- * Send file as response, checking and setting caching headers
- * @param string $filepath of file to send
- * @deprecated 8.1.0 - Use \OCP\AppFramework\Http\StreamResponse or another AppFramework controller instead
- */
- static public function sendFile($filepath) {
- $fp = fopen($filepath, 'rb');
- if ($fp) {
- self::setLastModifiedHeader(filemtime($filepath));
- self::setETagHeader(md5_file($filepath));
-
- self::setContentLengthHeader(filesize($filepath));
- fpassthru($fp);
- }
- else {
- self::setStatus(self::STATUS_NOT_FOUND);
- }
- }
-
- /**
* This function adds some security related headers to all requests served via base.php
* The implementation of this function has to happen here to ensure that all third-party
* components (e.g. SabreDAV) also benefit from this headers.
diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php
index 8f342281adb..9c877f22a46 100644
--- a/lib/private/legacy/user.php
+++ b/lib/private/legacy/user.php
@@ -312,6 +312,8 @@ class OC_User {
*
* @param string $uid
* @return string|bool uid or false
+ * @deprecated 8.1.0 fetch \OCP\IUser (has getDisplayName()) by using method
+ * get() of \OCP\IUserManager - \OC::$server->getUserManager()
*/
public static function getDisplayName($uid = null) {
if ($uid) {
@@ -367,25 +369,6 @@ class OC_User {
}
/**
- * Get a list of all users
- *
- * @return array an array of all uids
- *
- * Get a list of all users.
- * @param string $search
- * @param integer $limit
- * @param integer $offset
- */
- public static function getUsers($search = '', $limit = null, $offset = null) {
- $users = \OC::$server->getUserManager()->search($search, $limit, $offset);
- $uids = array();
- foreach ($users as $user) {
- $uids[] = $user->getUID();
- }
- return $uids;
- }
-
- /**
* Get a list of all users display name
*
* @param string $search
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 7e083b2ba0e..3313ccdec91 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -679,29 +679,6 @@ class OC_Util {
}
/**
- * formats a timestamp in the "right" way
- *
- * @param int $timestamp
- * @param bool $dateOnly option to omit time from the result
- * @param DateTimeZone|string $timeZone where the given timestamp shall be converted to
- * @return string timestamp
- *
- * @deprecated Use \OC::$server->query('DateTimeFormatter') instead
- */
- public static function formatDate($timestamp, $dateOnly = false, $timeZone = null) {
- if ($timeZone !== null && !$timeZone instanceof \DateTimeZone) {
- $timeZone = new \DateTimeZone($timeZone);
- }
-
- /** @var \OC\DateTimeFormatter $formatter */
- $formatter = \OC::$server->query('DateTimeFormatter');
- if ($dateOnly) {
- return $formatter->formatDate($timestamp, 'long', $timeZone);
- }
- return $formatter->formatDateTime($timestamp, 'long', 'long', $timeZone);
- }
-
- /**
* check if the current server configuration is suitable for ownCloud
*
* @param \OC\SystemConfig $config
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index f0f14061e35..4840d71d756 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -67,7 +67,9 @@ interface IAppManager {
public function isEnabledForUser($appId, $user = null);
/**
- * Check if an app is installed in the instance
+ * Check if an app is enabled in the instance
+ *
+ * Notice: This actually checks if the app is enabled and not only if it is installed.
*
* @param string $appId
* @return bool
diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php
index d5a9075fa3e..b6ed2da5076 100644
--- a/lib/public/AppFramework/App.php
+++ b/lib/public/AppFramework/App.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -33,6 +34,7 @@
namespace OCP\AppFramework;
use OC\AppFramework\Routing\RouteConfig;
+use OCP\Route\IRouter;
/**
@@ -45,6 +47,8 @@ use OC\AppFramework\Routing\RouteConfig;
*/
class App {
+ /** @var IAppContainer */
+ private $container;
/**
* Turns an app id into a namespace by convetion. The id is split at the
@@ -56,7 +60,7 @@ class App {
* @return string the starting namespace for the app
* @since 8.0.0
*/
- public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
+ public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string {
return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace);
}
@@ -65,17 +69,15 @@ class App {
* @param array $urlParams an array with variables extracted from the routes
* @since 6.0.0
*/
- public function __construct($appName, $urlParams = array()) {
+ public function __construct(string $appName, array $urlParams = []) {
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
}
- private $container;
-
/**
* @return IAppContainer
* @since 6.0.0
*/
- public function getContainer() {
+ public function getContainer(): IAppContainer {
return $this->container;
}
@@ -98,7 +100,7 @@ class App {
* @since 6.0.0
* @suppress PhanAccessMethodInternal
*/
- public function registerRoutes($router, $routes) {
+ public function registerRoutes(IRouter $router, array $routes) {
$routeConfig = new RouteConfig($this->container, $router, $routes);
$routeConfig->register();
}
@@ -134,7 +136,7 @@ class App {
* @param string $methodName the method that you want to call
* @since 6.0.0
*/
- public function dispatch($controllerName, $methodName) {
+ public function dispatch(string $controllerName, string $methodName) {
\OC\AppFramework\App::main($controllerName, $methodName, $this->container);
}
}
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvider.php b/lib/public/Authentication/TwoFactorAuth/IProvider.php
index c4c481a2f32..84752cecc77 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvider.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvider.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -43,7 +44,7 @@ interface IProvider {
*
* @return string
*/
- public function getId();
+ public function getId(): string;
/**
* Get the display name for selecting the 2FA provider
@@ -54,7 +55,7 @@ interface IProvider {
*
* @return string
*/
- public function getDisplayName();
+ public function getDisplayName(): string;
/**
* Get the description for selecting the 2FA provider
@@ -65,7 +66,7 @@ interface IProvider {
*
* @return string
*/
- public function getDescription();
+ public function getDescription(): string;
/**
* Get the template for rending the 2FA provider view
@@ -75,7 +76,7 @@ interface IProvider {
* @param IUser $user
* @return Template
*/
- public function getTemplate(IUser $user);
+ public function getTemplate(IUser $user): Template;
/**
* Verify the given challenge
@@ -84,8 +85,9 @@ interface IProvider {
*
* @param IUser $user
* @param string $challenge
+ * @return bool
*/
- public function verifyChallenge(IUser $user, $challenge);
+ public function verifyChallenge(IUser $user, string $challenge): bool;
/**
* Decides whether 2FA is enabled for the given user
@@ -93,7 +95,7 @@ interface IProvider {
* @since 9.1.0
*
* @param IUser $user
- * @return boolean
+ * @return bool
*/
- public function isTwoFactorAuthEnabledForUser(IUser $user);
+ public function isTwoFactorAuthEnabledForUser(IUser $user): bool;
}
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php b/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
index 2a498adc0b8..3b477dc53fe 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
*
*
@@ -35,5 +36,5 @@ interface IProvidesCustomCSP {
*
* @since 13.0.0
*/
- public function getCSP();
+ public function getCSP(): ContentSecurityPolicy;
}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
index a18b9e8c4a8..d94c3e61465 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud GmbH.
*
diff --git a/lib/public/BackgroundJob.php b/lib/public/BackgroundJob.php
index 9e37ff30145..58d44231ae3 100644
--- a/lib/public/BackgroundJob.php
+++ b/lib/public/BackgroundJob.php
@@ -46,11 +46,4 @@ class BackgroundJob {
*/
public static function setExecutionType($type) {
}
-
- /**
- * @since 6.0.0
- * @deprecated 8.1.0 Use \OC::$server->getJobList()->add() instead
- */
- public static function registerJob($job, $argument = null) {
- }
}
diff --git a/lib/public/Contacts.php b/lib/public/Contacts.php
deleted file mode 100644
index 16cd52d19cf..00000000000
--- a/lib/public/Contacts.php
+++ /dev/null
@@ -1,185 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin McCorkell <robin@mccorkell.me.uk>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @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/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * Contacts Class
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP {
-
- /**
- * This class provides access to the contacts app. Use this class exclusively if you want to access contacts.
- *
- * Contacts in general will be expressed as an array of key-value-pairs.
- * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1
- *
- * Proposed workflow for working with contacts:
- * - search for the contacts
- * - manipulate the results array
- * - createOrUpdate will save the given contacts overwriting the existing data
- *
- * For updating it is mandatory to keep the id.
- * Without an id a new contact will be created.
- *
- * @deprecated 8.1.0 use methods of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- class Contacts {
-
- /**
- * This function is used to search and find contacts within the users address books.
- * In case $pattern is empty all contacts will be returned.
- *
- * Example:
- * Following function shows how to search for contacts for the name and the email address.
- *
- * public static function getMatchingRecipient($term) {
- * // The API is not active -> nothing to do
- * if (!\OCP\Contacts::isEnabled()) {
- * return array();
- * }
- *
- * $result = \OCP\Contacts::search($term, array('FN', 'EMAIL'));
- * $receivers = array();
- * foreach ($result as $r) {
- * $id = $r['id'];
- * $fn = $r['FN'];
- * $email = $r['EMAIL'];
- * if (!is_array($email)) {
- * $email = array($email);
- * }
- *
- * // loop through all email addresses of this contact
- * foreach ($email as $e) {
- * $displayName = $fn . " <$e>";
- * $receivers[] = array(
- * 'id' => $id,
- * 'label' => $displayName,
- * 'value' => $displayName);
- * }
- * }
- *
- * return $receivers;
- * }
- *
- *
- * @param string $pattern which should match within the $searchProperties
- * @param array $searchProperties defines the properties within the query pattern should match
- * @param array $options - for future use. One should always have options!
- * @return array an array of contacts which are arrays of key-value-pairs
- * @deprecated 8.1.0 use search() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function search($pattern, $searchProperties = array(), $options = array()) {
- $cm = \OC::$server->getContactsManager();
- return $cm->search($pattern, $searchProperties, $options);
- }
-
- /**
- * This function can be used to delete the contact identified by the given id
- *
- * @param object $id the unique identifier to a contact
- * @param string $address_book_key
- * @return bool successful or not
- * @deprecated 8.1.0 use delete() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function delete($id, $address_book_key) {
- $cm = \OC::$server->getContactsManager();
- return $cm->delete($id, $address_book_key);
- }
-
- /**
- * This function is used to create a new contact if 'id' is not given or not present.
- * Otherwise the contact will be updated by replacing the entire data set.
- *
- * @param array $properties this array if key-value-pairs defines a contact
- * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
- * @return array an array representing the contact just created or updated
- * @deprecated 8.1.0 use createOrUpdate() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function createOrUpdate($properties, $address_book_key) {
- $cm = \OC::$server->getContactsManager();
- return $cm->createOrUpdate($properties, $address_book_key);
- }
-
- /**
- * Check if contacts are available (e.g. contacts app enabled)
- *
- * @return bool true if enabled, false if not
- * @deprecated 8.1.0 use isEnabled() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function isEnabled() {
- $cm = \OC::$server->getContactsManager();
- return $cm->isEnabled();
- }
-
- /**
- * @param \OCP\IAddressBook $address_book
- * @deprecated 8.1.0 use registerAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function registerAddressBook(\OCP\IAddressBook $address_book) {
- $cm = \OC::$server->getContactsManager();
- $cm->registerAddressBook($address_book);
- }
-
- /**
- * @param \OCP\IAddressBook $address_book
- * @deprecated 8.1.0 use unregisterAddressBook() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function unregisterAddressBook(\OCP\IAddressBook $address_book) {
- $cm = \OC::$server->getContactsManager();
- $cm->unregisterAddressBook($address_book);
- }
-
- /**
- * @return array
- * @deprecated 8.1.0 use getAddressBooks() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function getAddressBooks() {
- $cm = \OC::$server->getContactsManager();
- return $cm->getAddressBooks();
- }
-
- /**
- * removes all registered address book instances
- * @deprecated 8.1.0 use clear() of \OCP\Contacts\IManager - \OC::$server->getContactsManager();
- * @since 5.0.0
- */
- public static function clear() {
- $cm = \OC::$server->getContactsManager();
- $cm->clear();
- }
- }
-}
diff --git a/lib/public/DB.php b/lib/public/DB.php
deleted file mode 100644
index e132c5ff2ec..00000000000
--- a/lib/public/DB.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Dan Bartram <daneybartram@gmail.com>
- * @author Frank Karlitschek <frank@karlitschek.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- *
- * @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/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * DB Class
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP;
-
-/**
- * This class provides access to the internal database system. Use this class exlusively if you want to access databases
- * @deprecated 8.1.0 use methods of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
-class DB {
- /**
- * Prepare a SQL query
- * @param string $query Query string
- * @param int $limit Limit of the SQL statement
- * @param int $offset Offset of the SQL statement
- * @return \OC_DB_StatementWrapper prepared SQL query
- *
- * SQL query via Doctrine prepare(), needs to be execute()'d!
- * @deprecated 8.1.0 use prepare() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
- static public function prepare( $query, $limit=null, $offset=null ) {
- return \OC_DB::prepare($query, $limit, $offset);
- }
-
- /**
- * Insert a row if the matching row does not exists.
- *
- * @param string $table The table name (will replace *PREFIX* with the actual prefix)
- * @param array $input data that should be inserted into the table (column name => value)
- * @param array|null $compare List of values that should be checked for "if not exists"
- * If this is null or an empty array, all keys of $input will be compared
- * @return int number of inserted rows
- * @throws \Doctrine\DBAL\DBALException
- * @deprecated 8.1.0 use insertIfNotExist() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 5.0.0 - parameter $compare was added in 8.1.0
- *
- */
- public static function insertIfNotExist($table, $input, array $compare = null) {
- return \OC::$server->getDatabaseConnection()->insertIfNotExist($table, $input, $compare);
- }
-
- /**
- * Gets last value of autoincrement
- * @param string $table The optional table name (will replace *PREFIX*) and add sequence suffix
- * @return string
- *
- * \Doctrine\DBAL\Connection lastInsertID()
- *
- * Call this method right after the insert command or other functions may
- * cause trouble!
- * @deprecated 8.1.0 use lastInsertId() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
- public static function insertid($table=null) {
- return (string)\OC::$server->getDatabaseConnection()->lastInsertId($table);
- }
-
- /**
- * Start a transaction
- * @deprecated 8.1.0 use beginTransaction() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
- public static function beginTransaction() {
- \OC::$server->getDatabaseConnection()->beginTransaction();
- }
-
- /**
- * Commit the database changes done during a transaction that is in progress
- * @deprecated 8.1.0 use commit() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
- public static function commit() {
- \OC::$server->getDatabaseConnection()->commit();
- }
-
- /**
- * Rollback the database changes done during a transaction that is in progress
- * @deprecated 8.1.0 use rollback() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 8.0.0
- */
- public static function rollback() {
- \OC::$server->getDatabaseConnection()->rollBack();
- }
-
- /**
- * Check if a result is an error, works with Doctrine
- * @param mixed $result
- * @return bool
- * @deprecated 8.1.0 Doctrine returns false on error (and throws an exception)
- * @since 4.5.0
- */
- public static function isError($result) {
- // Doctrine returns false on error (and throws an exception)
- return $result === false;
- }
-
- /**
- * returns the error code and message as a string for logging
- * works with DoctrineException
- * @return string
- * @deprecated 8.1.0 use getError() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 6.0.0
- */
- public static function getErrorMessage() {
- return \OC::$server->getDatabaseConnection()->getError();
- }
-
-}
diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
index eab93b52f8a..0a212e8f828 100644
--- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php
+++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
@@ -66,13 +66,13 @@ interface IExpressionBuilder {
* // (u.type = ?) AND (u.role = ?)
* $expr->andX('u.type = ?', 'u.role = ?'));
*
- * @param mixed $x Optional clause. Defaults = null, but requires
+ * @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
* @since 8.2.0
*/
- public function andX($x = null);
+ public function andX(...$x);
/**
* Creates a disjunction of the given boolean expressions.
@@ -83,13 +83,13 @@ interface IExpressionBuilder {
* // (u.type = ?) OR (u.role = ?)
* $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
*
- * @param mixed $x Optional clause. Defaults = null, but requires
+ * @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
* @since 8.2.0
*/
- public function orX($x = null);
+ public function orX(...$x);
/**
* Creates a comparison expression.
diff --git a/lib/public/DB/QueryBuilder/IFunctionBuilder.php b/lib/public/DB/QueryBuilder/IFunctionBuilder.php
index 478fd879404..d867d9e5edb 100644
--- a/lib/public/DB/QueryBuilder/IFunctionBuilder.php
+++ b/lib/public/DB/QueryBuilder/IFunctionBuilder.php
@@ -71,4 +71,13 @@ interface IFunctionBuilder {
* @since 12.0.0
*/
public function sum($field);
+
+ /**
+ * Transforms a string field or value to lower case
+ *
+ * @param mixed $field
+ * @return IQueryFunction
+ * @since 14.0.0
+ */
+ public function lower($field);
}
diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php
index 7f179dd7e26..7fea31f4688 100644
--- a/lib/public/DB/QueryBuilder/IQueryBuilder.php
+++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php
@@ -292,12 +292,12 @@ interface IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
* </code>
*
- * @param mixed $select The selection expressions.
+ * @param mixed ...$selects The selection expressions.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function select($select = null);
+ public function select(...$selects);
/**
* Specifies an item that is to be returned with a different name in the query result.
@@ -344,12 +344,12 @@ interface IQueryBuilder {
* ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
* </code>
*
- * @param mixed $select The selection expression.
+ * @param mixed ...$select The selection expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function addSelect($select = null);
+ public function addSelect(...$select);
/**
* Turns the query being built into a bulk delete query that ranges over
@@ -554,7 +554,7 @@ interface IQueryBuilder {
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function where($predicates);
+ public function where(...$predicates);
/**
* Adds one or more restrictions to the query results, forming a logical
@@ -568,14 +568,14 @@ interface IQueryBuilder {
* ->andWhere('u.is_active = 1');
* </code>
*
- * @param mixed $where The query restrictions.
+ * @param mixed ...$where The query restrictions.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*
* @see where()
* @since 8.2.0
*/
- public function andWhere($where);
+ public function andWhere(...$where);
/**
* Adds one or more restrictions to the query results, forming a logical
@@ -589,14 +589,14 @@ interface IQueryBuilder {
* ->orWhere('u.id = 2');
* </code>
*
- * @param mixed $where The WHERE statement.
+ * @param mixed ...$where The WHERE statement.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*
* @see where()
* @since 8.2.0
*/
- public function orWhere($where);
+ public function orWhere(...$where);
/**
* Specifies a grouping over the results of the query.
@@ -609,12 +609,12 @@ interface IQueryBuilder {
* ->groupBy('u.id');
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBys The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function groupBy($groupBy);
+ public function groupBy(...$groupBys);
/**
* Adds a grouping expression to the query.
@@ -627,12 +627,12 @@ interface IQueryBuilder {
* ->addGroupBy('u.createdAt')
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBy The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function addGroupBy($groupBy);
+ public function addGroupBy(...$groupBy);
/**
* Sets a value for a column in an insert query.
@@ -682,34 +682,34 @@ interface IQueryBuilder {
* Specifies a restriction over the groups of the query.
* Replaces any previous having restrictions, if any.
*
- * @param mixed $having The restriction over the groups.
+ * @param mixed ...$having The restriction over the groups.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function having($having);
+ public function having(...$having);
/**
* Adds a restriction over the groups of the query, forming a logical
* conjunction with any existing having restrictions.
*
- * @param mixed $having The restriction to append.
+ * @param mixed ...$having The restriction to append.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function andHaving($having);
+ public function andHaving(...$having);
/**
* Adds a restriction over the groups of the query, forming a logical
* disjunction with any existing having restrictions.
*
- * @param mixed $having The restriction to add.
+ * @param mixed ...$having The restriction to add.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function orHaving($having);
+ public function orHaving(...$having);
/**
* Specifies an ordering for the query results.
diff --git a/lib/public/Files.php b/lib/public/Files.php
index d66e0f1b645..1cfd73fb288 100644
--- a/lib/public/Files.php
+++ b/lib/public/Files.php
@@ -44,12 +44,14 @@ namespace OCP;
* This class provides access to the internal filesystem abstraction layer. Use
* this class exlusively if you want to access files
* @since 5.0.0
+ * @deprecated 14.0.0
*/
class Files {
/**
* Recusive deletion of folders
* @return bool
* @since 5.0.0
+ * @deprecated 14.0.0
*/
static public function rmdirr( $dir ) {
return \OC_Helper::rmdirr( $dir );
@@ -61,6 +63,7 @@ class Files {
* @return string
* does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
* @since 5.0.0
+ * @deprecated 14.0.0
*/
static public function getMimeType( $path ) {
return \OC::$server->getMimeTypeDetector()->detect($path);
@@ -71,6 +74,7 @@ class Files {
* @param string $mimetype
* @return array
* @since 6.0.0
+ * @deprecated 14.0.0
*/
static public function searchByMime($mimetype) {
return \OC\Files\Filesystem::searchByMime($mimetype);
@@ -82,6 +86,7 @@ class Files {
* @param resource $target
* @return int the number of bytes copied
* @since 5.0.0
+ * @deprecated 14.0.0
*/
public static function streamCopy( $source, $target ) {
list($count, ) = \OC_Helper::streamCopy( $source, $target );
@@ -89,36 +94,12 @@ class Files {
}
/**
- * Create a temporary file with an unique filename
- * @param string $postfix
- * @return string
- *
- * temporary files are automatically cleaned up after the script is finished
- * @deprecated 8.1.0 use getTemporaryFile() of \OCP\ITempManager - \OC::$server->getTempManager()
- * @since 5.0.0
- */
- public static function tmpFile( $postfix='' ) {
- return \OC::$server->getTempManager()->getTemporaryFile($postfix);
- }
-
- /**
- * Create a temporary folder with an unique filename
- * @return string
- *
- * temporary files are automatically cleaned up after the script is finished
- * @deprecated 8.1.0 use getTemporaryFolder() of \OCP\ITempManager - \OC::$server->getTempManager()
- * @since 5.0.0
- */
- public static function tmpFolder() {
- return \OC::$server->getTempManager()->getTemporaryFolder();
- }
-
- /**
* Adds a suffix to the name in case the file exists
* @param string $path
* @param string $filename
* @return string
* @since 5.0.0
+ * @deprecated 14.0.0 use getNonExistingName of the OCP\Files\Folder object
*/
public static function buildNotExistingFileName($path, $filename) {
return \OC_Helper::buildNotExistingFileName($path, $filename);
@@ -130,6 +111,7 @@ class Files {
* @param string $app
* @return \OC\Files\View
* @since 5.0.0
+ * @deprecated 14.0.0 use IAppData instead
*/
public static function getStorage($app) {
return \OC_App::getStorage( $app );
diff --git a/lib/public/Files/File.php b/lib/public/Files/File.php
index 8b57b3cfd87..0f052bc66ad 100644
--- a/lib/public/Files/File.php
+++ b/lib/public/Files/File.php
@@ -53,7 +53,7 @@ interface File extends Node {
*
* @param string $data
* @throws \OCP\Files\NotPermittedException
- * @return void
+ * @throws \OCP\Files\GenericFileException
* @since 6.0.0
*/
public function putContent($data);
diff --git a/lib/public/Files/Folder.php b/lib/public/Files/Folder.php
index 52a4b303196..425813c7e21 100644
--- a/lib/public/Files/Folder.php
+++ b/lib/public/Files/Folder.php
@@ -145,6 +145,9 @@ interface Folder extends Node {
/**
* get a file or folder inside the folder by it's internal id
*
+ * This method could return multiple entries. For example once the file/folder
+ * is shared or mounted (files_external) to the user multiple times.
+ *
* @param int $id
* @return \OCP\Files\Node[]
* @since 6.0.0
diff --git a/lib/public/Files/GenericFileException.php b/lib/public/Files/GenericFileException.php
new file mode 100644
index 00000000000..b5da4aabebd
--- /dev/null
+++ b/lib/public/Files/GenericFileException.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @copyright 2018, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCP\Files;
+
+/**
+ * Class GenericFileException
+ *
+ * @package OCP\Files
+ * @since 14.0.0
+ */
+class GenericFileException extends \Exception {
+
+}
diff --git a/lib/public/ICacheFactory.php b/lib/public/ICacheFactory.php
index 76145fe1f78..a078543b092 100644
--- a/lib/public/ICacheFactory.php
+++ b/lib/public/ICacheFactory.php
@@ -52,6 +52,14 @@ interface ICacheFactory{
public function isAvailable(): bool;
/**
+ * Check if a local memory cache backend is available
+ *
+ * @return bool
+ * @since 14.0.0
+ */
+ public function isLocalCacheAvailable(): bool;
+
+ /**
* create a cache instance for storing locks
*
* @param string $prefix
diff --git a/lib/public/IHelper.php b/lib/public/IHelper.php
deleted file mode 100644
index 707884b82f8..00000000000
--- a/lib/public/IHelper.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * Helper interface
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP;
-
-/**
- * Functions that don't have any specific interface to place
- * @since 6.0.0
- * @deprecated 8.1.0
- */
-interface IHelper {
- /**
- * Gets the content of an URL by using CURL or a fallback if it is not
- * installed
- * @param string $url the url that should be fetched
- * @return string the content of the webpage
- * @since 6.0.0
- * @deprecated 8.1.0 Use \OCP\IServerContainer::getHTTPClientService
- */
- public function getUrlContent($url);
-}
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 851a3c7e2bb..19c9578ee23 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -125,7 +125,7 @@ interface IServerContainer extends IContainer {
*
* @return \OCP\Files\Folder
* @since 6.0.0
- * @deprecated since 9.2.0 use IAppData
+ * @deprecated 9.2.0 use IAppData
*/
public function getAppFolder();
@@ -251,14 +251,6 @@ interface IServerContainer extends IContainer {
public function getURLGenerator();
/**
- * Returns the Helper
- *
- * @return \OCP\IHelper
- * @since 6.0.0
- */
- public function getHelper();
-
- /**
* Returns an ICache instance
*
* @return \OCP\ICache
@@ -356,14 +348,6 @@ interface IServerContainer extends IContainer {
public function createEventSource();
/**
- * Returns an instance of the HTTP helper class
- * @return \OC\HTTPHelper
- * @deprecated 8.1.0 Use \OCP\Http\Client\IClientService
- * @since 8.0.0
- */
- public function getHTTPHelper();
-
- /**
* Returns an instance of the HTTP client service
*
* @return \OCP\Http\Client\IClientService
diff --git a/lib/public/JSON.php b/lib/public/JSON.php
deleted file mode 100644
index c56c3b645a9..00000000000
--- a/lib/public/JSON.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Frank Karlitschek <frank@karlitschek.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- * @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/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * JSON Class
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP;
-
-/**
- * This class provides convenient functions to generate and send JSON data. Useful for Ajax calls
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- */
-class JSON {
- /**
- * Encode and print $data in JSON format
- * @param array $data The data to use
- * @param bool $setContentType the optional content type
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- *
- * @suppress PhanDeprecatedFunction
- */
- public static function encodedPrint( $data, $setContentType=true ) {
- \OC_JSON::encodedPrint($data, $setContentType);
- }
-
- /**
- * Check if the user is logged in, send json error msg if not.
- *
- * This method checks if a user is logged in. If not, a json error
- * response will be return and the method will exit from execution
- * of the script.
- * The returned json will be in the format:
- *
- * {"status":"error","data":{"message":"Authentication error."}}
- *
- * Add this call to the start of all ajax method files that requires
- * an authenticated user.
- * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead
- *
- * @suppress PhanDeprecatedFunction
- */
- public static function checkLoggedIn() {
- \OC_JSON::checkLoggedIn();
- }
-
- /**
- * Check an ajax get/post call if the request token is valid.
- *
- * This method checks for a valid variable 'requesttoken' in $_GET,
- * $_POST and $_SERVER. If a valid token is not found, a json error
- * response will be return and the method will exit from execution
- * of the script.
- * The returned json will be in the format:
- *
- * {"status":"error","data":{"message":"Token expired. Please reload page."}}
- *
- * Add this call to the start of all ajax method files that creates,
- * updates or deletes anything.
- * In cases where you e.g. use an ajax call to load a dialog containing
- * a submittable form, you will need to add the requesttoken first as a
- * parameter to the ajax call, then assign it to the template and finally
- * add a hidden input field also named 'requesttoken' containing the value.
- * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead
- *
- * @suppress PhanDeprecatedFunction
- */
- public static function callCheck() {
- \OC_JSON::callCheck();
- }
-
- /**
- * Send json success msg
- *
- * Return a json success message with optional extra data.
- * @see \OCP\JSON::error() for the format to use.
- *
- * @param array $data The data to use
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function success( $data = array() ) {
- \OC_JSON::success($data);
- }
-
- /**
- * Send json error msg
- *
- * Return a json error message with optional extra data for
- * error message or app specific data.
- *
- * Example use:
- *
- * $id = [some value]
- * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id)));
- *
- * Will return the json formatted string:
- *
- * {"status":"error","data":{"message":"An error happened", "id":[some value]}}
- *
- * @param array $data The data to use
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function error( $data = array() ) {
- \OC_JSON::error($data);
- }
-
- /**
- * Set Content-Type header to jsonrequest
- * @param string $type The content type header
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function setContentTypeHeader( $type='application/json' ) {
- \OC_JSON::setContentTypeHeader($type);
- }
-
- /**
- * Check if the App is enabled and send JSON error message instead
- *
- * This method checks if a specific app is enabled. If not, a json error
- * response will be return and the method will exit from execution
- * of the script.
- * The returned json will be in the format:
- *
- * {"status":"error","data":{"message":"Application is not enabled."}}
- *
- * Add this call to the start of all ajax method files that requires
- * a specific app to be enabled.
- *
- * @param string $app The app to check
- * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled.
- * @suppress PhanDeprecatedFunction
- */
- public static function checkAppEnabled( $app ) {
- \OC_JSON::checkAppEnabled($app);
- }
-
- /**
- * Check if the user is a admin, send json error msg if not
- *
- * This method checks if the current user has admin rights. If not, a json error
- * response will be return and the method will exit from execution
- * of the script.
- * The returned json will be in the format:
- *
- * {"status":"error","data":{"message":"Authentication error."}}
- *
- * Add this call to the start of all ajax method files that requires
- * administrative rights.
- *
- * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead
- * @suppress PhanDeprecatedFunction
- */
- public static function checkAdminUser() {
- \OC_JSON::checkAdminUser();
- }
-
- /**
- * Encode JSON
- * @param array $data
- * @return string
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function encode($data) {
- return \OC_JSON::encode($data);
- }
-
- /**
- * Check is a given user exists - send json error msg if not
- * @param string $user
- * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function checkUserExists($user) {
- \OC_JSON::checkUserExists($user);
- }
-}
diff --git a/lib/public/Mail/IAttachment.php b/lib/public/Mail/IAttachment.php
index 4b617d67f5e..71fa841b26c 100644
--- a/lib/public/Mail/IAttachment.php
+++ b/lib/public/Mail/IAttachment.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@@ -33,23 +34,23 @@ interface IAttachment {
/**
* @param string $filename
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setFilename($filename);
+ public function setFilename(string $filename): IAttachment;
/**
* @param string $contentType
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setContentType($contentType);
+ public function setContentType(string $contentType): IAttachment;
/**
* @param string $body
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setBody($body);
+ public function setBody(string $body): IAttachment;
}
diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php
index 6d37c21ada1..1c0ddbe54d4 100644
--- a/lib/public/Mail/IEMailTemplate.php
+++ b/lib/public/Mail/IEMailTemplate.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2017, Morris Jobke <hey@morrisjobke.de>
*
@@ -62,7 +63,7 @@ interface IEMailTemplate {
*
* @since 13.0.0
*/
- public function setSubject($subject);
+ public function setSubject(string $subject);
/**
* Adds a header to the email
@@ -80,7 +81,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addHeading($title, $plainTitle = '');
+ public function addHeading(string $title, $plainTitle = '');
/**
* Adds a paragraph to the body of the email
@@ -91,7 +92,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyText($text, $plainText = '');
+ public function addBodyText(string $text, $plainText = '');
/**
* Adds a list item to the body of the email
@@ -99,13 +100,13 @@ interface IEMailTemplate {
* @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email
* @param string $metaInfo; Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email
* @param string $icon Absolute path, must be 16*16 pixels
- * @param string $plainText Text that is used in the plain text email
+ * @param string|bool $plainText Text that is used in the plain text email
* if empty the $text is used, if false none will be used
- * @param string $plainMetaInfo Meta info that is used in the plain text email
+ * @param string|bool $plainMetaInfo Meta info that is used in the plain text email
* if empty the $metaInfo is used, if false none will be used
* @since 12.0.0
*/
- public function addBodyListItem($text, $metaInfo = '', $icon = '', $plainText = '', $plainMetaInfo = '');
+ public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = '');
/**
* Adds a button group of two buttons to the body of the email
@@ -119,7 +120,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = '');
+ public function addBodyButtonGroup(string $textLeft, string $urlLeft, string $textRight, string $urlRight, string $plainTextLeft = '', string $plainTextRight = '');
/**
* Adds a button to the body of the email
@@ -131,7 +132,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyButton($text, $url, $plainText = '');
+ public function addBodyButton(string $text, string $url, $plainText = '');
/**
* Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email
@@ -140,7 +141,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addFooter($text = '');
+ public function addFooter(string $text = '');
/**
* Returns the rendered email subject as string
@@ -149,7 +150,7 @@ interface IEMailTemplate {
*
* @since 13.0.0
*/
- public function renderSubject();
+ public function renderSubject(): string;
/**
* Returns the rendered HTML email as string
@@ -158,7 +159,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function renderHtml();
+ public function renderHtml(): string;
/**
* Returns the rendered plain text email as string
@@ -167,5 +168,5 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function renderText();
+ public function renderText(): string;
}
diff --git a/lib/public/Mail/IMailer.php b/lib/public/Mail/IMailer.php
index 10096548256..e8f5d6e7d03 100644
--- a/lib/public/Mail/IMailer.php
+++ b/lib/public/Mail/IMailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -51,7 +52,7 @@ interface IMailer {
* @return IMessage
* @since 8.1.0
*/
- public function createMessage();
+ public function createMessage(): IMessage;
/**
* @param string|null $data
@@ -60,7 +61,7 @@ interface IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachment($data = null, $filename = null, $contentType = null);
+ public function createAttachment($data = null, $filename = null, $contentType = null): IAttachment;
/**
* @param string $path
@@ -68,7 +69,7 @@ interface IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachmentFromPath($path, $contentType = null);
+ public function createAttachmentFromPath(string $path, $contentType = null): IAttachment;
/**
* Creates a new email template object
@@ -78,7 +79,7 @@ interface IMailer {
* @return IEMailTemplate
* @since 12.0.0 Parameters added in 12.0.3
*/
- public function createEMailTemplate($emailId, array $data = []);
+ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate;
/**
* Send the specified message. Also sets the from address to the value defined in config.php
@@ -91,7 +92,7 @@ interface IMailer {
* has been supplied.)
* @since 8.1.0
*/
- public function send(IMessage $message);
+ public function send(IMessage $message): array;
/**
* Checks if an e-mail address is valid
@@ -100,5 +101,5 @@ interface IMailer {
* @return bool True if the mail address is valid, false otherwise
* @since 8.1.0
*/
- public function validateMailAddress($email);
+ public function validateMailAddress(string $email): bool;
}
diff --git a/lib/public/Mail/IMessage.php b/lib/public/Mail/IMessage.php
index cec47adc19d..638fd9d103f 100644
--- a/lib/public/Mail/IMessage.php
+++ b/lib/public/Mail/IMessage.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@@ -33,10 +34,10 @@ interface IMessage {
/**
* @param IAttachment $attachment
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function attach(IAttachment $attachment);
+ public function attach(IAttachment $attachment): IMessage;
/**
* Set the from address of this message.
@@ -44,51 +45,51 @@ interface IMessage {
* If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php
*
* @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setFrom(array $addresses);
+ public function setFrom(array $addresses): IMessage;
/**
* Set the Reply-To address of this message
*
* @param array $addresses
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setReplyTo(array $addresses);
+ public function setReplyTo(array $addresses): IMessage;
/**
* Set the to addresses of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setTo(array $recipients);
+ public function setTo(array $recipients): IMessage;
/**
* Set the CC recipients of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setCc(array $recipients);
+ public function setCc(array $recipients): IMessage;
/**
* Set the BCC recipients of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setBcc(array $recipients);
+ public function setBcc(array $recipients): IMessage;
/**
* @param IEMailTemplate $emailTemplate
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function useTemplate(IEMailTemplate $emailTemplate);
+ public function useTemplate(IEMailTemplate $emailTemplate): IMessage;
}
diff --git a/lib/public/Response.php b/lib/public/Response.php
deleted file mode 100644
index dbd506d379d..00000000000
--- a/lib/public/Response.php
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Andreas Fischer <bantu@owncloud.com>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Frank Karlitschek <frank@karlitschek.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Stefan Weil <sw@weilnetz.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/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * Response Class.
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP;
-
-/**
- * This class provides convenient functions to send the correct http response headers
- * @since 4.0.0
- * @deprecated 8.1.0 - Use AppFramework controllers instead and modify the response object
- */
-class Response {
- /**
- * Enable response caching by sending correct HTTP headers
- * @param int $cache_time time to cache the response
- * >0 cache time in seconds
- * 0 and <0 enable default browser caching
- * null cache indefinitely
- * @since 4.0.0
- */
- static public function enableCaching( $cache_time = null ) {
- \OC_Response::enableCaching( $cache_time );
- }
-
- /**
- * Checks and set Last-Modified header, when the request matches sends a
- * 'not modified' response
- * @param string $lastModified time when the response was last modified
- * @since 4.0.0
- */
- static public function setLastModifiedHeader( $lastModified ) {
- \OC_Response::setLastModifiedHeader( $lastModified );
- }
-
- /**
- * Sets the content disposition header (with possible workarounds)
- * @param string $filename file name
- * @param string $type disposition type, either 'attachment' or 'inline'
- * @since 7.0.0
- */
- static public function setContentDispositionHeader( $filename, $type = 'attachment' ) {
- \OC_Response::setContentDispositionHeader( $filename, $type );
- }
-
- /**
- * Sets the content length header (with possible workarounds)
- * @param string|int|float $length Length to be sent
- * @since 8.1.0
- */
- static public function setContentLengthHeader($length) {
- \OC_Response::setContentLengthHeader($length);
- }
-
- /**
- * Disable browser caching
- * @see enableCaching with cache_time = 0
- * @since 4.0.0
- * @deprecated 14.0.0 just set the headers
- */
- static public function disableCaching() {
- header('Pragma: public');// enable caching in IE
- header('Expires: 0');
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- }
-
- /**
- * Checks and set ETag header, when the request matches sends a
- * 'not modified' response
- * @param string $etag token to use for modification check
- * @since 4.0.0
- */
- static public function setETagHeader( $etag ) {
- \OC_Response::setETagHeader( $etag );
- }
-
- /**
- * Send file as response, checking and setting caching headers
- * @param string $filepath of file to send
- * @since 4.0.0
- * @deprecated 8.1.0 - Use \OCP\AppFramework\Http\StreamResponse or another AppFramework controller instead
- * @suppress PhanDeprecatedFunction
- */
- static public function sendFile( $filepath ) {
- \OC_Response::sendFile( $filepath );
- }
-
- /**
- * Set response expire time
- * @param string|\DateTime $expires date-time when the response expires
- * string for DateInterval from now
- * DateTime object when to expire response
- * @since 4.0.0
- */
- static public function setExpiresHeader( $expires ) {
- \OC_Response::setExpiresHeader( $expires );
- }
-
- /**
- * Send redirect response
- * @param string $location to redirect to
- * @since 4.0.0
- */
- static public function redirect( $location ) {
- \OC_Response::redirect( $location );
- }
-}
diff --git a/lib/public/Share.php b/lib/public/Share.php
index b7fb7296e49..011d56ab5af 100644
--- a/lib/public/Share.php
+++ b/lib/public/Share.php
@@ -85,16 +85,6 @@ class Share extends \OC\Share\Constants {
return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection);
}
- /**
- * resolves reshares down to the last real share
- * @param array $linkItem
- * @return array file owner
- * @since 6.0.0
- */
- public static function resolveReShare($linkItem) {
- return \OC\Share\Share::resolveReShare($linkItem);
- }
-
/**
* Get the shared items of item type owned by the current user
diff --git a/lib/public/User.php b/lib/public/User.php
index 2fdf540b958..a669a3a06fc 100644
--- a/lib/public/User.php
+++ b/lib/public/User.php
@@ -58,45 +58,6 @@ class User {
}
/**
- * Get a list of all users
- * @param string $search search pattern
- * @param int|null $limit
- * @param int|null $offset
- * @return array an array of all uids
- * @deprecated 8.1.0 use method search() of \OCP\IUserManager - \OC::$server->getUserManager()
- * @since 5.0.0
- */
- public static function getUsers( $search = '', $limit = null, $offset = null ) {
- return \OC_User::getUsers( $search, $limit, $offset );
- }
-
- /**
- * Get the user display name of the user currently logged in.
- * @param string|null $user user id or null for current user
- * @return string display name
- * @deprecated 8.1.0 fetch \OCP\IUser (has getDisplayName()) by using method
- * get() of \OCP\IUserManager - \OC::$server->getUserManager()
- * @since 5.0.0
- */
- public static function getDisplayName( $user = null ) {
- return \OC_User::getDisplayName( $user );
- }
-
- /**
- * Get a list of all display names and user ids.
- * @param string $search search pattern
- * @param int|null $limit
- * @param int|null $offset
- * @return array an array of all display names (value) and the correspondig uids (key)
- * @deprecated 8.1.0 use method searchDisplayName() of \OCP\IUserManager - \OC::$server->getUserManager()
- * @since 5.0.0
- * @suppress PhanDeprecatedFunction
- */
- public static function getDisplayNames( $search = '', $limit = null, $offset = null ) {
- return \OC_User::getDisplayNames( $search, $limit, $offset );
- }
-
- /**
* Check if the user is logged in
* @return boolean
* @since 5.0.0
@@ -107,18 +68,6 @@ class User {
}
/**
- * Check if a user exists
- * @param string $uid the username
- * @param string $excludingBackend (default none)
- * @return boolean
- * @deprecated 8.1.0 use method userExists() of \OCP\IUserManager - \OC::$server->getUserManager()
- * @since 5.0.0
- */
- public static function userExists($uid, $excludingBackend = null) {
- return \OC::$server->getUserManager()->userExists($uid);
- }
-
- /**
* Check if the user is a admin, redirects to home if not
* @since 5.0.0
* @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
diff --git a/lib/public/User/Backend/ABackend.php b/lib/public/User/Backend/ABackend.php
new file mode 100644
index 00000000000..a110ba5202a
--- /dev/null
+++ b/lib/public/User/Backend/ABackend.php
@@ -0,0 +1,72 @@
+<?php
+declare(strict_types=1);
+/**
+* @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+*
+* @author Roeland Jago Douma <roeland@famdouma.nl>
+*
+* @license GNU AGPL version 3 or any later version
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Affero General Public License as
+* published by the Free Software Foundation, either version 3 of the
+* License, or (at your option) any later version.
+*
+* 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
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCP\User\Backend;
+
+use OC\User\Backend;
+use OCP\IUserBackend;
+use OCP\UserInterface;
+
+/**
+ * @since 14.0.0
+ */
+abstract class ABackend implements IUserBackend, UserInterface {
+
+ /**
+ * @deprecated 14.0.0
+ *
+ * @param int $actions The action to check for
+ * @return bool
+ */
+ public function implementsActions($actions): bool {
+ $implements = 0;
+
+ if ($this instanceof ICreateUserBackend) {
+ $implements |= Backend::CREATE_USER;
+ }
+ if ($this instanceof ISetPasswordBackend) {
+ $implements |= Backend::SET_PASSWORD;
+ }
+ if ($this instanceof ICheckPasswordBackend) {
+ $implements |= Backend::CHECK_PASSWORD;
+ }
+ if ($this instanceof IGetHomeBackend) {
+ $implements |= Backend::GET_HOME;
+ }
+ if ($this instanceof IGetDisplayNameBackend) {
+ $implements |= Backend::GET_DISPLAYNAME;
+ }
+ if ($this instanceof ISetDisplayNameBackend) {
+ $implements |= Backend::SET_DISPLAYNAME;
+ }
+ if ($this instanceof IProvideAvatarBackend) {
+ $implements |= Backend::PROVIDE_AVATAR;
+ }
+ if ($this instanceof ICountUsersBackend) {
+ $implements |= Backend::COUNT_USERS;
+ }
+
+ return (bool)($actions & $implements);
+ }
+}
diff --git a/lib/public/User/Backend/ICheckPasswordBackend.php b/lib/public/User/Backend/ICheckPasswordBackend.php
new file mode 100644
index 00000000000..b28c94f1a6c
--- /dev/null
+++ b/lib/public/User/Backend/ICheckPasswordBackend.php
@@ -0,0 +1,39 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface ICheckPasswordBackend {
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid The username
+ * @param string $password The password
+ * @return string|bool The uid on success false on failure
+ */
+ public function checkPassword(string $loginName, string $password);
+}
diff --git a/lib/public/User/Backend/ICountUsersBackend.php b/lib/public/User/Backend/ICountUsersBackend.php
new file mode 100644
index 00000000000..1cb46712aa0
--- /dev/null
+++ b/lib/public/User/Backend/ICountUsersBackend.php
@@ -0,0 +1,38 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface ICountUsersBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @return int|bool The number of users on success false on failure
+ */
+ public function countUsers();
+}
diff --git a/lib/public/User/Backend/ICreateUserBackend.php b/lib/public/User/Backend/ICreateUserBackend.php
new file mode 100644
index 00000000000..09a20e12453
--- /dev/null
+++ b/lib/public/User/Backend/ICreateUserBackend.php
@@ -0,0 +1,40 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface ICreateUserBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid The username of the user to create
+ * @param string $password The password of the new user
+ * @return bool
+ */
+ public function createUser(string $uid, string $password): bool;
+}
diff --git a/lib/public/User/Backend/IGetDisplayNameBackend.php b/lib/public/User/Backend/IGetDisplayNameBackend.php
new file mode 100644
index 00000000000..6382ddd6eb6
--- /dev/null
+++ b/lib/public/User/Backend/IGetDisplayNameBackend.php
@@ -0,0 +1,39 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface IGetDisplayNameBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid user ID of the user
+ * @return string display name
+ */
+ public function getDisplayName($uid): string;
+}
diff --git a/lib/public/User/Backend/IGetHomeBackend.php b/lib/public/User/Backend/IGetHomeBackend.php
new file mode 100644
index 00000000000..20fcd004bba
--- /dev/null
+++ b/lib/public/User/Backend/IGetHomeBackend.php
@@ -0,0 +1,39 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface IGetHomeBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid the username
+ * @return string|bool Datadir on success false on failure
+ */
+ public function getHome(string $uid);
+}
diff --git a/lib/public/User/Backend/IProvideAvatarBackend.php b/lib/public/User/Backend/IProvideAvatarBackend.php
new file mode 100644
index 00000000000..328c7450b40
--- /dev/null
+++ b/lib/public/User/Backend/IProvideAvatarBackend.php
@@ -0,0 +1,39 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface IProvideAvatarBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid
+ * @return bool
+ */
+ public function canChangeAvatar(string $uid): bool;
+}
diff --git a/lib/public/User/Backend/ISetDisplayNameBackend.php b/lib/public/User/Backend/ISetDisplayNameBackend.php
new file mode 100644
index 00000000000..ac41cd3e2c3
--- /dev/null
+++ b/lib/public/User/Backend/ISetDisplayNameBackend.php
@@ -0,0 +1,40 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface ISetDisplayNameBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid The username
+ * @param string $displayName The new display name
+ * @return bool
+ */
+ public function setDisplayName(string $uid, string $displayName): bool;
+}
diff --git a/lib/public/User/Backend/ISetPasswordBackend.php b/lib/public/User/Backend/ISetPasswordBackend.php
new file mode 100644
index 00000000000..687ac5f70bb
--- /dev/null
+++ b/lib/public/User/Backend/ISetPasswordBackend.php
@@ -0,0 +1,40 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\User\Backend;
+
+/**
+ * @since 14.0.0
+ */
+interface ISetPasswordBackend {
+
+ /**
+ * @since 14.0.0
+ *
+ * @param string $uid The username
+ * @param string $password The new password
+ * @return bool
+ */
+ public function setPassword(string $uid, string $password): bool;
+}
diff --git a/lib/public/UserInterface.php b/lib/public/UserInterface.php
index 61136783b3c..b82fc6ba550 100644
--- a/lib/public/UserInterface.php
+++ b/lib/public/UserInterface.php
@@ -48,6 +48,7 @@ interface UserInterface {
* Returns the supported actions as int to be
* compared with \OC\User\Backend::CREATE_USER etc.
* @since 4.5.0
+ * @deprecated 14.0.0 Switch to the interfaces from OCP\User\Backend
*/
public function implementsActions($actions);
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 106107591c3..9ffa55e2dfd 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -95,56 +95,6 @@ class Util {
}
/**
- * send an email
- * @param string $toaddress
- * @param string $toname
- * @param string $subject
- * @param string $mailtext
- * @param string $fromaddress
- * @param string $fromname
- * @param int $html
- * @param string $altbody
- * @param string $ccaddress
- * @param string $ccname
- * @param string $bcc
- * @deprecated 8.1.0 Use \OCP\Mail\IMailer instead
- * @since 4.0.0
- */
- public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname,
- $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
- $mailer = \OC::$server->getMailer();
- $message = $mailer->createMessage();
- $message->setTo([$toaddress => $toname]);
- $message->setSubject($subject);
- $message->setPlainBody($mailtext);
- $message->setFrom([$fromaddress => $fromname]);
- if($html === 1) {
- $message->setHtmlBody($altbody);
- }
-
- if($altbody === '') {
- $message->setHtmlBody($mailtext);
- $message->setPlainBody('');
- } else {
- $message->setHtmlBody($mailtext);
- $message->setPlainBody($altbody);
- }
-
- if(!empty($ccaddress)) {
- if(!empty($ccname)) {
- $message->setCc([$ccaddress => $ccname]);
- } else {
- $message->setCc([$ccaddress]);
- }
- }
- if(!empty($bcc)) {
- $message->setBcc([$bcc]);
- }
-
- $mailer->send($message);
- }
-
- /**
* write a message in the log
* @param string $app
* @param string $message
@@ -244,17 +194,6 @@ class Util {
}
/**
- * check if some encrypted files are stored
- * @return bool
- *
- * @deprecated 8.1.0 No longer required
- * @since 6.0.0
- */
- public static function encryptedFiles() {
- return false;
- }
-
- /**
* Creates an absolute url to the given app and file.
* @param string $app app
* @param string $file file
@@ -295,43 +234,6 @@ class Util {
}
/**
- * Creates an url using a defined route
- * @param string $route
- * @param array $parameters
- * @internal param array $args with param=>value, will be appended to the returned url
- * @return string the url
- * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters)
- * @since 5.0.0
- */
- public static function linkToRoute( $route, $parameters = array() ) {
- return \OC::$server->getURLGenerator()->linkToRoute($route, $parameters);
- }
-
- /**
- * Creates an url to the given app and file
- * @param string $app app
- * @param string $file file
- * @param array $args array with param=>value, will be appended to the returned url
- * The value of $args will be urlencoded
- * @return string the url
- * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args)
- * @since 4.0.0 - parameter $args was added in 4.5.0
- */
- public static function linkTo( $app, $file, $args = array() ) {
- return \OC::$server->getURLGenerator()->linkTo($app, $file, $args);
- }
-
- /**
- * Returns the server host, even if the website uses one or more reverse proxy
- * @return string the server host
- * @deprecated 8.1.0 Use \OCP\IRequest::getServerHost
- * @since 4.0.0
- */
- public static function getServerHost() {
- return \OC::$server->getRequest()->getServerHost();
- }
-
- /**
* Returns the server host name without an eventual port number
* @return string the server hostname
* @since 5.0.0
@@ -379,48 +281,6 @@ class Util {
}
/**
- * Returns the server protocol. It respects reverse proxy servers and load balancers
- * @return string the server protocol
- * @deprecated 8.1.0 Use \OCP\IRequest::getServerProtocol
- * @since 4.5.0
- */
- public static function getServerProtocol() {
- return \OC::$server->getRequest()->getServerProtocol();
- }
-
- /**
- * Returns the request uri, even if the website uses one or more reverse proxies
- * @return string the request uri
- * @deprecated 8.1.0 Use \OCP\IRequest::getRequestUri
- * @since 5.0.0
- */
- public static function getRequestUri() {
- return \OC::$server->getRequest()->getRequestUri();
- }
-
- /**
- * Returns the script name, even if the website uses one or more reverse proxies
- * @return string the script name
- * @deprecated 8.1.0 Use \OCP\IRequest::getScriptName
- * @since 5.0.0
- */
- public static function getScriptName() {
- return \OC::$server->getRequest()->getScriptName();
- }
-
- /**
- * Creates path to an image
- * @param string $app app
- * @param string $image image name
- * @return string the url
- * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->imagePath($app, $image)
- * @since 4.0.0
- */
- public static function imagePath( $app, $image ) {
- return \OC::$server->getURLGenerator()->imagePath($app, $image);
- }
-
- /**
* Make a human file size (2048 to 2 kB)
* @param int $bytes file size in bytes
* @return string a human readable file size