@@ -29,11 +29,11 @@ |
||
| 29 | 29 | $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api'); |
| 30 | 30 | |
| 31 | 31 | if ($isEnabled) { |
| 32 | - $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
| 33 | - header('Content-Type: application/json'); |
|
| 34 | - echo json_encode($capabilities->getCapabilities()['ocm']); |
|
| 32 | + $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
| 33 | + header('Content-Type: application/json'); |
|
| 34 | + echo json_encode($capabilities->getCapabilities()['ocm']); |
|
| 35 | 35 | } else { |
| 36 | - header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
| 37 | - exit("501 Not Implemented"); |
|
| 36 | + header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
| 37 | + exit("501 Not Implemented"); |
|
| 38 | 38 | } |
| 39 | 39 | |
@@ -32,15 +32,15 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class Config { |
| 34 | 34 | |
| 35 | - public function __construct() { |
|
| 36 | - } |
|
| 35 | + public function __construct() { |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function incomingRequestsEnabled() { |
|
| 39 | - return true; |
|
| 40 | - } |
|
| 38 | + public function incomingRequestsEnabled() { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function outgoingRequestsEnabled() { |
|
| 43 | - return true; |
|
| 44 | - } |
|
| 42 | + public function outgoingRequestsEnabled() { |
|
| 43 | + return true; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | |
| 29 | 29 | class Application extends App { |
| 30 | 30 | |
| 31 | - public function __construct() { |
|
| 32 | - parent::__construct('cloud_federation_api'); |
|
| 31 | + public function __construct() { |
|
| 32 | + parent::__construct('cloud_federation_api'); |
|
| 33 | 33 | |
| 34 | - $container = $this->getContainer(); |
|
| 35 | - $container->registerCapability(Capabilities::class); |
|
| 36 | - } |
|
| 34 | + $container = $this->getContainer(); |
|
| 35 | + $container->registerCapability(Capabilities::class); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | class ProviderCouldNotAddShareException extends HintException { |
| 28 | 28 | |
| 29 | - public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 30 | - parent::__construct($message, $hint, $code, $previous); |
|
| 31 | - } |
|
| 29 | + public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 30 | + parent::__construct($message, $hint, $code, $previous); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | } |
@@ -25,16 +25,16 @@ |
||
| 25 | 25 | |
| 26 | 26 | class ProviderDoesNotExistsException extends HintException { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * ProviderDoesNotExistsException constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $providerId cloud federation provider ID |
|
| 32 | - */ |
|
| 33 | - public function __construct($providerId) { |
|
| 34 | - $l = \OC::$server->getL10N('federation'); |
|
| 35 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 36 | - $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 37 | - parent::__construct($message, $hint); |
|
| 38 | - } |
|
| 28 | + /** |
|
| 29 | + * ProviderDoesNotExistsException constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $providerId cloud federation provider ID |
|
| 32 | + */ |
|
| 33 | + public function __construct($providerId) { |
|
| 34 | + $l = \OC::$server->getL10N('federation'); |
|
| 35 | + $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 36 | + $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 37 | + parent::__construct($message, $hint); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -25,17 +25,17 @@ |
||
| 25 | 25 | |
| 26 | 26 | class ProviderAlreadyExistsException extends HintException { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * ProviderAlreadyExistsException constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | - */ |
|
| 34 | - public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | - $l = \OC::$server->getL10N('federation'); |
|
| 36 | - $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | - $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | - parent::__construct($message, $hint); |
|
| 39 | - } |
|
| 28 | + /** |
|
| 29 | + * ProviderAlreadyExistsException constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | + */ |
|
| 34 | + public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | + $l = \OC::$server->getL10N('federation'); |
|
| 36 | + $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | + $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | + parent::__construct($message, $hint); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -36,47 +36,47 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $application = new Application(); |
| 38 | 38 | $application->registerRoutes($this, [ |
| 39 | - 'routes' => [ |
|
| 40 | - ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 41 | - ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 42 | - ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 43 | - ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 44 | - ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 45 | - ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 46 | - ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 47 | - ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 48 | - ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 49 | - ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 50 | - ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 51 | - ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 52 | - ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 53 | - ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 54 | - ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 55 | - ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'], |
|
| 56 | - ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 57 | - ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 58 | - ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 59 | - ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 60 | - ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 61 | - ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 62 | - ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 63 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 64 | - ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 65 | - ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 66 | - ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 67 | - ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 68 | - ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 69 | - ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 70 | - ], |
|
| 71 | - 'ocs' => [ |
|
| 72 | - ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 73 | - ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 74 | - ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 75 | - ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 76 | - ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 77 | - ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 78 | - ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 79 | - ], |
|
| 39 | + 'routes' => [ |
|
| 40 | + ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 41 | + ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 42 | + ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 43 | + ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 44 | + ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 45 | + ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 46 | + ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 47 | + ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 48 | + ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 49 | + ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 50 | + ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 51 | + ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 52 | + ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 53 | + ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 54 | + ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 55 | + ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'], |
|
| 56 | + ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 57 | + ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 58 | + ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 59 | + ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 60 | + ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 61 | + ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 62 | + ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 63 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 64 | + ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 65 | + ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 66 | + ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 67 | + ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 68 | + ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 69 | + ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 70 | + ], |
|
| 71 | + 'ocs' => [ |
|
| 72 | + ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 73 | + ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 74 | + ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 75 | + ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 76 | + ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 77 | + ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 78 | + ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 79 | + ], |
|
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | 82 | // Post installation check |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | // Core ajax actions |
| 86 | 86 | // Routing |
| 87 | 87 | $this->create('core_ajax_update', '/core/ajax/update.php') |
| 88 | - ->actionInclude('core/ajax/update.php'); |
|
| 88 | + ->actionInclude('core/ajax/update.php'); |
|
| 89 | 89 | |
| 90 | 90 | // File routes |
| 91 | 91 | $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) { |
| 92 | - $app = new \OCA\Files\AppInfo\Application($urlParams); |
|
| 93 | - $app->dispatch('ViewController', 'index'); |
|
| 92 | + $app = new \OCA\Files\AppInfo\Application($urlParams); |
|
| 93 | + $app->dispatch('ViewController', 'index'); |
|
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | 96 | // Call routes |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | * @suppress PhanUndeclaredClassMethod |
| 100 | 100 | */ |
| 101 | 101 | $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) { |
| 102 | - if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { |
|
| 103 | - $app = new \OCA\Spreed\AppInfo\Application($urlParams); |
|
| 104 | - $app->dispatch('PageController', 'index'); |
|
| 105 | - } else { |
|
| 106 | - throw new \OC\HintException('App spreed is not enabled'); |
|
| 107 | - } |
|
| 102 | + if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { |
|
| 103 | + $app = new \OCA\Spreed\AppInfo\Application($urlParams); |
|
| 104 | + $app->dispatch('PageController', 'index'); |
|
| 105 | + } else { |
|
| 106 | + throw new \OC\HintException('App spreed is not enabled'); |
|
| 107 | + } |
|
| 108 | 108 | }); |
| 109 | 109 | |
| 110 | 110 | // OCM routes |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * @suppress PhanUndeclaredClassMethod |
| 114 | 114 | */ |
| 115 | 115 | $this->create('cloud_federation_api.requesthandlercontroller.addShare', '/ocm/shares')->post()->action(function($urlParams) { |
| 116 | - if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 117 | - $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 118 | - $app->dispatch('RequestHandlerController', 'addShare'); |
|
| 119 | - } else { |
|
| 120 | - throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 121 | - } |
|
| 116 | + if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 117 | + $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 118 | + $app->dispatch('RequestHandlerController', 'addShare'); |
|
| 119 | + } else { |
|
| 120 | + throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 121 | + } |
|
| 122 | 122 | }); |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,53 +126,53 @@ discard block |
||
| 126 | 126 | * @suppress PhanUndeclaredClassMethod |
| 127 | 127 | */ |
| 128 | 128 | $this->create('cloud_federation_api.requesthandlercontroller.receiveNotification', '/ocm/notifications')->post()->action(function($urlParams) { |
| 129 | - if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 130 | - $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 131 | - $app->dispatch('RequestHandlerController', 'receiveNotification'); |
|
| 132 | - } else { |
|
| 133 | - throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 134 | - } |
|
| 129 | + if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 130 | + $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 131 | + $app->dispatch('RequestHandlerController', 'receiveNotification'); |
|
| 132 | + } else { |
|
| 133 | + throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 134 | + } |
|
| 135 | 135 | }); |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | // Sharing routes |
| 139 | 139 | $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) { |
| 140 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 141 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 142 | - $app->dispatch('ShareController', 'showShare'); |
|
| 143 | - } else { |
|
| 144 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 145 | - } |
|
| 140 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 141 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 142 | + $app->dispatch('ShareController', 'showShare'); |
|
| 143 | + } else { |
|
| 144 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 145 | + } |
|
| 146 | 146 | }); |
| 147 | 147 | $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate/{redirect}')->post()->action(function($urlParams) { |
| 148 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 149 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 150 | - $app->dispatch('ShareController', 'authenticate'); |
|
| 151 | - } else { |
|
| 152 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 153 | - } |
|
| 148 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 149 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 150 | + $app->dispatch('ShareController', 'authenticate'); |
|
| 151 | + } else { |
|
| 152 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 153 | + } |
|
| 154 | 154 | }); |
| 155 | 155 | $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate/{redirect}')->get()->action(function($urlParams) { |
| 156 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 157 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 158 | - $app->dispatch('ShareController', 'showAuthenticate'); |
|
| 159 | - } else { |
|
| 160 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 161 | - } |
|
| 156 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 157 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 158 | + $app->dispatch('ShareController', 'showAuthenticate'); |
|
| 159 | + } else { |
|
| 160 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 161 | + } |
|
| 162 | 162 | }); |
| 163 | 163 | $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) { |
| 164 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 165 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 166 | - $app->dispatch('ShareController', 'downloadShare'); |
|
| 167 | - } else { |
|
| 168 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 169 | - } |
|
| 164 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 165 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 166 | + $app->dispatch('ShareController', 'downloadShare'); |
|
| 167 | + } else { |
|
| 168 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 169 | + } |
|
| 170 | 170 | }); |
| 171 | 171 | $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) { |
| 172 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 173 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 174 | - $app->dispatch('PublicPreviewController', 'directLink'); |
|
| 175 | - } else { |
|
| 176 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 177 | - } |
|
| 172 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 173 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 174 | + $app->dispatch('PublicPreviewController', 'directLink'); |
|
| 175 | + } else { |
|
| 176 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 177 | + } |
|
| 178 | 178 | }); |
@@ -60,509 +60,509 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | interface IServerContainer extends IContainer { |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * The calendar manager will act as a broker between consumers for calendar information and |
|
| 65 | - * providers which actual deliver the calendar information. |
|
| 66 | - * |
|
| 67 | - * @return \OCP\Calendar\IManager |
|
| 68 | - * @since 13.0.0 |
|
| 69 | - */ |
|
| 70 | - public function getCalendarManager(); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * The contacts manager will act as a broker between consumers for contacts information and |
|
| 74 | - * providers which actual deliver the contact information. |
|
| 75 | - * |
|
| 76 | - * @return \OCP\Contacts\IManager |
|
| 77 | - * @since 6.0.0 |
|
| 78 | - */ |
|
| 79 | - public function getContactsManager(); |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * The current request object holding all information about the request currently being processed |
|
| 83 | - * is returned from this method. |
|
| 84 | - * In case the current execution was not initiated by a web request null is returned |
|
| 85 | - * |
|
| 86 | - * @return \OCP\IRequest |
|
| 87 | - * @since 6.0.0 |
|
| 88 | - */ |
|
| 89 | - public function getRequest(); |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns the preview manager which can create preview images for a given file |
|
| 93 | - * |
|
| 94 | - * @return \OCP\IPreview |
|
| 95 | - * @since 6.0.0 |
|
| 96 | - */ |
|
| 97 | - public function getPreviewManager(); |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * Returns the tag manager which can get and set tags for different object types |
|
| 101 | - * |
|
| 102 | - * @see \OCP\ITagManager::load() |
|
| 103 | - * @return \OCP\ITagManager |
|
| 104 | - * @since 6.0.0 |
|
| 105 | - */ |
|
| 106 | - public function getTagManager(); |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Returns the root folder of ownCloud's data directory |
|
| 110 | - * |
|
| 111 | - * @return \OCP\Files\IRootFolder |
|
| 112 | - * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder |
|
| 113 | - */ |
|
| 114 | - public function getRootFolder(); |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Returns a view to ownCloud's files folder |
|
| 118 | - * |
|
| 119 | - * @param string $userId user ID |
|
| 120 | - * @return \OCP\Files\Folder |
|
| 121 | - * @since 6.0.0 - parameter $userId was added in 8.0.0 |
|
| 122 | - * @see getUserFolder in \OCP\Files\IRootFolder |
|
| 123 | - */ |
|
| 124 | - public function getUserFolder($userId = null); |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Returns an app-specific view in ownClouds data directory |
|
| 128 | - * |
|
| 129 | - * @return \OCP\Files\Folder |
|
| 130 | - * @since 6.0.0 |
|
| 131 | - * @deprecated 9.2.0 use IAppData |
|
| 132 | - */ |
|
| 133 | - public function getAppFolder(); |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Returns a user manager |
|
| 137 | - * |
|
| 138 | - * @return \OCP\IUserManager |
|
| 139 | - * @since 8.0.0 |
|
| 140 | - */ |
|
| 141 | - public function getUserManager(); |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Returns a group manager |
|
| 145 | - * |
|
| 146 | - * @return \OCP\IGroupManager |
|
| 147 | - * @since 8.0.0 |
|
| 148 | - */ |
|
| 149 | - public function getGroupManager(); |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * Returns the user session |
|
| 153 | - * |
|
| 154 | - * @return \OCP\IUserSession |
|
| 155 | - * @since 6.0.0 |
|
| 156 | - */ |
|
| 157 | - public function getUserSession(); |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Returns the navigation manager |
|
| 161 | - * |
|
| 162 | - * @return \OCP\INavigationManager |
|
| 163 | - * @since 6.0.0 |
|
| 164 | - */ |
|
| 165 | - public function getNavigationManager(); |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Returns the config manager |
|
| 169 | - * |
|
| 170 | - * @return \OCP\IConfig |
|
| 171 | - * @since 6.0.0 |
|
| 172 | - */ |
|
| 173 | - public function getConfig(); |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Returns a Crypto instance |
|
| 177 | - * |
|
| 178 | - * @return \OCP\Security\ICrypto |
|
| 179 | - * @since 8.0.0 |
|
| 180 | - */ |
|
| 181 | - public function getCrypto(); |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Returns a Hasher instance |
|
| 185 | - * |
|
| 186 | - * @return \OCP\Security\IHasher |
|
| 187 | - * @since 8.0.0 |
|
| 188 | - */ |
|
| 189 | - public function getHasher(); |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * Returns a SecureRandom instance |
|
| 193 | - * |
|
| 194 | - * @return \OCP\Security\ISecureRandom |
|
| 195 | - * @since 8.1.0 |
|
| 196 | - */ |
|
| 197 | - public function getSecureRandom(); |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * Returns a CredentialsManager instance |
|
| 201 | - * |
|
| 202 | - * @return \OCP\Security\ICredentialsManager |
|
| 203 | - * @since 9.0.0 |
|
| 204 | - */ |
|
| 205 | - public function getCredentialsManager(); |
|
| 206 | - |
|
| 207 | - /** |
|
| 208 | - * Returns the app config manager |
|
| 209 | - * |
|
| 210 | - * @return \OCP\IAppConfig |
|
| 211 | - * @since 7.0.0 |
|
| 212 | - */ |
|
| 213 | - public function getAppConfig(); |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * @return \OCP\L10N\IFactory |
|
| 217 | - * @since 8.2.0 |
|
| 218 | - */ |
|
| 219 | - public function getL10NFactory(); |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * get an L10N instance |
|
| 223 | - * @param string $app appid |
|
| 224 | - * @param string $lang |
|
| 225 | - * @return \OCP\IL10N |
|
| 226 | - * @since 6.0.0 - parameter $lang was added in 8.0.0 |
|
| 227 | - */ |
|
| 228 | - public function getL10N($app, $lang = null); |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * @return \OC\Encryption\Manager |
|
| 232 | - * @since 8.1.0 |
|
| 233 | - */ |
|
| 234 | - public function getEncryptionManager(); |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * @return \OC\Encryption\File |
|
| 238 | - * @since 8.1.0 |
|
| 239 | - */ |
|
| 240 | - public function getEncryptionFilesHelper(); |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @return \OCP\Encryption\Keys\IStorage |
|
| 244 | - * @since 8.1.0 |
|
| 245 | - */ |
|
| 246 | - public function getEncryptionKeyStorage(); |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * Returns the URL generator |
|
| 250 | - * |
|
| 251 | - * @return \OCP\IURLGenerator |
|
| 252 | - * @since 6.0.0 |
|
| 253 | - */ |
|
| 254 | - public function getURLGenerator(); |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * Returns an ICache instance |
|
| 258 | - * |
|
| 259 | - * @return \OCP\ICache |
|
| 260 | - * @since 6.0.0 |
|
| 261 | - */ |
|
| 262 | - public function getCache(); |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Returns an \OCP\CacheFactory instance |
|
| 266 | - * |
|
| 267 | - * @return \OCP\ICacheFactory |
|
| 268 | - * @since 7.0.0 |
|
| 269 | - */ |
|
| 270 | - public function getMemCacheFactory(); |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Returns the current session |
|
| 274 | - * |
|
| 275 | - * @return \OCP\ISession |
|
| 276 | - * @since 6.0.0 |
|
| 277 | - */ |
|
| 278 | - public function getSession(); |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Returns the activity manager |
|
| 282 | - * |
|
| 283 | - * @return \OCP\Activity\IManager |
|
| 284 | - * @since 6.0.0 |
|
| 285 | - */ |
|
| 286 | - public function getActivityManager(); |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Returns the current session |
|
| 290 | - * |
|
| 291 | - * @return \OCP\IDBConnection |
|
| 292 | - * @since 6.0.0 |
|
| 293 | - */ |
|
| 294 | - public function getDatabaseConnection(); |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * Returns an avatar manager, used for avatar functionality |
|
| 298 | - * |
|
| 299 | - * @return \OCP\IAvatarManager |
|
| 300 | - * @since 6.0.0 |
|
| 301 | - */ |
|
| 302 | - public function getAvatarManager(); |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * Returns an job list for controlling background jobs |
|
| 306 | - * |
|
| 307 | - * @return \OCP\BackgroundJob\IJobList |
|
| 308 | - * @since 7.0.0 |
|
| 309 | - */ |
|
| 310 | - public function getJobList(); |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * Returns a logger instance |
|
| 314 | - * |
|
| 315 | - * @return \OCP\ILogger |
|
| 316 | - * @since 8.0.0 |
|
| 317 | - */ |
|
| 318 | - public function getLogger(); |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * returns a log factory instance |
|
| 322 | - * |
|
| 323 | - * @return ILogFactory |
|
| 324 | - * @since 14.0.0 |
|
| 325 | - */ |
|
| 326 | - public function getLogFactory(); |
|
| 327 | - |
|
| 328 | - /** |
|
| 329 | - * Returns a router for generating and matching urls |
|
| 330 | - * |
|
| 331 | - * @return \OCP\Route\IRouter |
|
| 332 | - * @since 7.0.0 |
|
| 333 | - */ |
|
| 334 | - public function getRouter(); |
|
| 335 | - |
|
| 336 | - /** |
|
| 337 | - * Returns a search instance |
|
| 338 | - * |
|
| 339 | - * @return \OCP\ISearch |
|
| 340 | - * @since 7.0.0 |
|
| 341 | - */ |
|
| 342 | - public function getSearch(); |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * Get the certificate manager for the user |
|
| 346 | - * |
|
| 347 | - * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
| 348 | - * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in |
|
| 349 | - * @since 8.0.0 |
|
| 350 | - */ |
|
| 351 | - public function getCertificateManager($userId = null); |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * Create a new event source |
|
| 355 | - * |
|
| 356 | - * @return \OCP\IEventSource |
|
| 357 | - * @since 8.0.0 |
|
| 358 | - */ |
|
| 359 | - public function createEventSource(); |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * Returns an instance of the HTTP client service |
|
| 363 | - * |
|
| 364 | - * @return \OCP\Http\Client\IClientService |
|
| 365 | - * @since 8.1.0 |
|
| 366 | - */ |
|
| 367 | - public function getHTTPClientService(); |
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * Get the active event logger |
|
| 371 | - * |
|
| 372 | - * @return \OCP\Diagnostics\IEventLogger |
|
| 373 | - * @since 8.0.0 |
|
| 374 | - */ |
|
| 375 | - public function getEventLogger(); |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * Get the active query logger |
|
| 379 | - * |
|
| 380 | - * The returned logger only logs data when debug mode is enabled |
|
| 381 | - * |
|
| 382 | - * @return \OCP\Diagnostics\IQueryLogger |
|
| 383 | - * @since 8.0.0 |
|
| 384 | - */ |
|
| 385 | - public function getQueryLogger(); |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Get the manager for temporary files and folders |
|
| 389 | - * |
|
| 390 | - * @return \OCP\ITempManager |
|
| 391 | - * @since 8.0.0 |
|
| 392 | - */ |
|
| 393 | - public function getTempManager(); |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * Get the app manager |
|
| 397 | - * |
|
| 398 | - * @return \OCP\App\IAppManager |
|
| 399 | - * @since 8.0.0 |
|
| 400 | - */ |
|
| 401 | - public function getAppManager(); |
|
| 402 | - |
|
| 403 | - /** |
|
| 404 | - * Get the webroot |
|
| 405 | - * |
|
| 406 | - * @return string |
|
| 407 | - * @since 8.0.0 |
|
| 408 | - */ |
|
| 409 | - public function getWebRoot(); |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * @return \OCP\Files\Config\IMountProviderCollection |
|
| 413 | - * @since 8.0.0 |
|
| 414 | - */ |
|
| 415 | - public function getMountProviderCollection(); |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * Get the IniWrapper |
|
| 419 | - * |
|
| 420 | - * @return \bantu\IniGetWrapper\IniGetWrapper |
|
| 421 | - * @since 8.0.0 |
|
| 422 | - */ |
|
| 423 | - public function getIniWrapper(); |
|
| 424 | - /** |
|
| 425 | - * @return \OCP\Command\IBus |
|
| 426 | - * @since 8.1.0 |
|
| 427 | - */ |
|
| 428 | - public function getCommandBus(); |
|
| 429 | - |
|
| 430 | - /** |
|
| 431 | - * Creates a new mailer |
|
| 432 | - * |
|
| 433 | - * @return \OCP\Mail\IMailer |
|
| 434 | - * @since 8.1.0 |
|
| 435 | - */ |
|
| 436 | - public function getMailer(); |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * Get the locking provider |
|
| 440 | - * |
|
| 441 | - * @return \OCP\Lock\ILockingProvider |
|
| 442 | - * @since 8.1.0 |
|
| 443 | - */ |
|
| 444 | - public function getLockingProvider(); |
|
| 445 | - |
|
| 446 | - /** |
|
| 447 | - * @return \OCP\Files\Mount\IMountManager |
|
| 448 | - * @since 8.2.0 |
|
| 449 | - */ |
|
| 450 | - public function getMountManager(); |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * Get the MimeTypeDetector |
|
| 454 | - * |
|
| 455 | - * @return \OCP\Files\IMimeTypeDetector |
|
| 456 | - * @since 8.2.0 |
|
| 457 | - */ |
|
| 458 | - public function getMimeTypeDetector(); |
|
| 459 | - |
|
| 460 | - /** |
|
| 461 | - * Get the MimeTypeLoader |
|
| 462 | - * |
|
| 463 | - * @return \OCP\Files\IMimeTypeLoader |
|
| 464 | - * @since 8.2.0 |
|
| 465 | - */ |
|
| 466 | - public function getMimeTypeLoader(); |
|
| 467 | - |
|
| 468 | - /** |
|
| 469 | - * Get the EventDispatcher |
|
| 470 | - * |
|
| 471 | - * @return EventDispatcherInterface |
|
| 472 | - * @since 8.2.0 |
|
| 473 | - */ |
|
| 474 | - public function getEventDispatcher(); |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * Get the Notification Manager |
|
| 478 | - * |
|
| 479 | - * @return \OCP\Notification\IManager |
|
| 480 | - * @since 9.0.0 |
|
| 481 | - */ |
|
| 482 | - public function getNotificationManager(); |
|
| 483 | - |
|
| 484 | - /** |
|
| 485 | - * @return \OCP\Comments\ICommentsManager |
|
| 486 | - * @since 9.0.0 |
|
| 487 | - */ |
|
| 488 | - public function getCommentsManager(); |
|
| 489 | - |
|
| 490 | - /** |
|
| 491 | - * Returns the system-tag manager |
|
| 492 | - * |
|
| 493 | - * @return \OCP\SystemTag\ISystemTagManager |
|
| 494 | - * |
|
| 495 | - * @since 9.0.0 |
|
| 496 | - */ |
|
| 497 | - public function getSystemTagManager(); |
|
| 498 | - |
|
| 499 | - /** |
|
| 500 | - * Returns the system-tag object mapper |
|
| 501 | - * |
|
| 502 | - * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
| 503 | - * |
|
| 504 | - * @since 9.0.0 |
|
| 505 | - */ |
|
| 506 | - public function getSystemTagObjectMapper(); |
|
| 507 | - |
|
| 508 | - /** |
|
| 509 | - * Returns the share manager |
|
| 510 | - * |
|
| 511 | - * @return \OCP\Share\IManager |
|
| 512 | - * @since 9.0.0 |
|
| 513 | - */ |
|
| 514 | - public function getShareManager(); |
|
| 515 | - |
|
| 516 | - /** |
|
| 517 | - * @return IContentSecurityPolicyManager |
|
| 518 | - * @since 9.0.0 |
|
| 519 | - */ |
|
| 520 | - public function getContentSecurityPolicyManager(); |
|
| 521 | - |
|
| 522 | - /** |
|
| 523 | - * @return \OCP\IDateTimeZone |
|
| 524 | - * @since 8.0.0 |
|
| 525 | - */ |
|
| 526 | - public function getDateTimeZone(); |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * @return \OCP\IDateTimeFormatter |
|
| 530 | - * @since 8.0.0 |
|
| 531 | - */ |
|
| 532 | - public function getDateTimeFormatter(); |
|
| 533 | - |
|
| 534 | - /** |
|
| 535 | - * @return \OCP\Federation\ICloudIdManager |
|
| 536 | - * @since 12.0.0 |
|
| 537 | - */ |
|
| 538 | - public function getCloudIdManager(); |
|
| 539 | - |
|
| 540 | - /** |
|
| 541 | - * @return \OCP\GlobalScale\IConfig |
|
| 542 | - */ |
|
| 543 | - public function getGlobalScaleConfig(); |
|
| 544 | - |
|
| 545 | - /** |
|
| 546 | - * @return ICloudFederationFactory |
|
| 547 | - * @since 14.0.0 |
|
| 548 | - */ |
|
| 549 | - public function getCloudFederationFactory(); |
|
| 550 | - |
|
| 551 | - /** |
|
| 552 | - * @return ICloudFederationProviderManager |
|
| 553 | - * @since 14.0.0 |
|
| 554 | - */ |
|
| 555 | - public function getCloudFederationProviderManager(); |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * @return \OCP\Remote\Api\IApiFactory |
|
| 559 | - * @since 13.0.0 |
|
| 560 | - */ |
|
| 561 | - public function getRemoteApiFactory(); |
|
| 562 | - |
|
| 563 | - /** |
|
| 564 | - * @return \OCP\Remote\IInstanceFactory |
|
| 565 | - * @since 13.0.0 |
|
| 566 | - */ |
|
| 567 | - public function getRemoteInstanceFactory(); |
|
| 63 | + /** |
|
| 64 | + * The calendar manager will act as a broker between consumers for calendar information and |
|
| 65 | + * providers which actual deliver the calendar information. |
|
| 66 | + * |
|
| 67 | + * @return \OCP\Calendar\IManager |
|
| 68 | + * @since 13.0.0 |
|
| 69 | + */ |
|
| 70 | + public function getCalendarManager(); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * The contacts manager will act as a broker between consumers for contacts information and |
|
| 74 | + * providers which actual deliver the contact information. |
|
| 75 | + * |
|
| 76 | + * @return \OCP\Contacts\IManager |
|
| 77 | + * @since 6.0.0 |
|
| 78 | + */ |
|
| 79 | + public function getContactsManager(); |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * The current request object holding all information about the request currently being processed |
|
| 83 | + * is returned from this method. |
|
| 84 | + * In case the current execution was not initiated by a web request null is returned |
|
| 85 | + * |
|
| 86 | + * @return \OCP\IRequest |
|
| 87 | + * @since 6.0.0 |
|
| 88 | + */ |
|
| 89 | + public function getRequest(); |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns the preview manager which can create preview images for a given file |
|
| 93 | + * |
|
| 94 | + * @return \OCP\IPreview |
|
| 95 | + * @since 6.0.0 |
|
| 96 | + */ |
|
| 97 | + public function getPreviewManager(); |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * Returns the tag manager which can get and set tags for different object types |
|
| 101 | + * |
|
| 102 | + * @see \OCP\ITagManager::load() |
|
| 103 | + * @return \OCP\ITagManager |
|
| 104 | + * @since 6.0.0 |
|
| 105 | + */ |
|
| 106 | + public function getTagManager(); |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Returns the root folder of ownCloud's data directory |
|
| 110 | + * |
|
| 111 | + * @return \OCP\Files\IRootFolder |
|
| 112 | + * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder |
|
| 113 | + */ |
|
| 114 | + public function getRootFolder(); |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Returns a view to ownCloud's files folder |
|
| 118 | + * |
|
| 119 | + * @param string $userId user ID |
|
| 120 | + * @return \OCP\Files\Folder |
|
| 121 | + * @since 6.0.0 - parameter $userId was added in 8.0.0 |
|
| 122 | + * @see getUserFolder in \OCP\Files\IRootFolder |
|
| 123 | + */ |
|
| 124 | + public function getUserFolder($userId = null); |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Returns an app-specific view in ownClouds data directory |
|
| 128 | + * |
|
| 129 | + * @return \OCP\Files\Folder |
|
| 130 | + * @since 6.0.0 |
|
| 131 | + * @deprecated 9.2.0 use IAppData |
|
| 132 | + */ |
|
| 133 | + public function getAppFolder(); |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Returns a user manager |
|
| 137 | + * |
|
| 138 | + * @return \OCP\IUserManager |
|
| 139 | + * @since 8.0.0 |
|
| 140 | + */ |
|
| 141 | + public function getUserManager(); |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Returns a group manager |
|
| 145 | + * |
|
| 146 | + * @return \OCP\IGroupManager |
|
| 147 | + * @since 8.0.0 |
|
| 148 | + */ |
|
| 149 | + public function getGroupManager(); |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * Returns the user session |
|
| 153 | + * |
|
| 154 | + * @return \OCP\IUserSession |
|
| 155 | + * @since 6.0.0 |
|
| 156 | + */ |
|
| 157 | + public function getUserSession(); |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Returns the navigation manager |
|
| 161 | + * |
|
| 162 | + * @return \OCP\INavigationManager |
|
| 163 | + * @since 6.0.0 |
|
| 164 | + */ |
|
| 165 | + public function getNavigationManager(); |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Returns the config manager |
|
| 169 | + * |
|
| 170 | + * @return \OCP\IConfig |
|
| 171 | + * @since 6.0.0 |
|
| 172 | + */ |
|
| 173 | + public function getConfig(); |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Returns a Crypto instance |
|
| 177 | + * |
|
| 178 | + * @return \OCP\Security\ICrypto |
|
| 179 | + * @since 8.0.0 |
|
| 180 | + */ |
|
| 181 | + public function getCrypto(); |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Returns a Hasher instance |
|
| 185 | + * |
|
| 186 | + * @return \OCP\Security\IHasher |
|
| 187 | + * @since 8.0.0 |
|
| 188 | + */ |
|
| 189 | + public function getHasher(); |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * Returns a SecureRandom instance |
|
| 193 | + * |
|
| 194 | + * @return \OCP\Security\ISecureRandom |
|
| 195 | + * @since 8.1.0 |
|
| 196 | + */ |
|
| 197 | + public function getSecureRandom(); |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * Returns a CredentialsManager instance |
|
| 201 | + * |
|
| 202 | + * @return \OCP\Security\ICredentialsManager |
|
| 203 | + * @since 9.0.0 |
|
| 204 | + */ |
|
| 205 | + public function getCredentialsManager(); |
|
| 206 | + |
|
| 207 | + /** |
|
| 208 | + * Returns the app config manager |
|
| 209 | + * |
|
| 210 | + * @return \OCP\IAppConfig |
|
| 211 | + * @since 7.0.0 |
|
| 212 | + */ |
|
| 213 | + public function getAppConfig(); |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * @return \OCP\L10N\IFactory |
|
| 217 | + * @since 8.2.0 |
|
| 218 | + */ |
|
| 219 | + public function getL10NFactory(); |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * get an L10N instance |
|
| 223 | + * @param string $app appid |
|
| 224 | + * @param string $lang |
|
| 225 | + * @return \OCP\IL10N |
|
| 226 | + * @since 6.0.0 - parameter $lang was added in 8.0.0 |
|
| 227 | + */ |
|
| 228 | + public function getL10N($app, $lang = null); |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * @return \OC\Encryption\Manager |
|
| 232 | + * @since 8.1.0 |
|
| 233 | + */ |
|
| 234 | + public function getEncryptionManager(); |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * @return \OC\Encryption\File |
|
| 238 | + * @since 8.1.0 |
|
| 239 | + */ |
|
| 240 | + public function getEncryptionFilesHelper(); |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @return \OCP\Encryption\Keys\IStorage |
|
| 244 | + * @since 8.1.0 |
|
| 245 | + */ |
|
| 246 | + public function getEncryptionKeyStorage(); |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * Returns the URL generator |
|
| 250 | + * |
|
| 251 | + * @return \OCP\IURLGenerator |
|
| 252 | + * @since 6.0.0 |
|
| 253 | + */ |
|
| 254 | + public function getURLGenerator(); |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * Returns an ICache instance |
|
| 258 | + * |
|
| 259 | + * @return \OCP\ICache |
|
| 260 | + * @since 6.0.0 |
|
| 261 | + */ |
|
| 262 | + public function getCache(); |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Returns an \OCP\CacheFactory instance |
|
| 266 | + * |
|
| 267 | + * @return \OCP\ICacheFactory |
|
| 268 | + * @since 7.0.0 |
|
| 269 | + */ |
|
| 270 | + public function getMemCacheFactory(); |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Returns the current session |
|
| 274 | + * |
|
| 275 | + * @return \OCP\ISession |
|
| 276 | + * @since 6.0.0 |
|
| 277 | + */ |
|
| 278 | + public function getSession(); |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Returns the activity manager |
|
| 282 | + * |
|
| 283 | + * @return \OCP\Activity\IManager |
|
| 284 | + * @since 6.0.0 |
|
| 285 | + */ |
|
| 286 | + public function getActivityManager(); |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Returns the current session |
|
| 290 | + * |
|
| 291 | + * @return \OCP\IDBConnection |
|
| 292 | + * @since 6.0.0 |
|
| 293 | + */ |
|
| 294 | + public function getDatabaseConnection(); |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * Returns an avatar manager, used for avatar functionality |
|
| 298 | + * |
|
| 299 | + * @return \OCP\IAvatarManager |
|
| 300 | + * @since 6.0.0 |
|
| 301 | + */ |
|
| 302 | + public function getAvatarManager(); |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * Returns an job list for controlling background jobs |
|
| 306 | + * |
|
| 307 | + * @return \OCP\BackgroundJob\IJobList |
|
| 308 | + * @since 7.0.0 |
|
| 309 | + */ |
|
| 310 | + public function getJobList(); |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * Returns a logger instance |
|
| 314 | + * |
|
| 315 | + * @return \OCP\ILogger |
|
| 316 | + * @since 8.0.0 |
|
| 317 | + */ |
|
| 318 | + public function getLogger(); |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * returns a log factory instance |
|
| 322 | + * |
|
| 323 | + * @return ILogFactory |
|
| 324 | + * @since 14.0.0 |
|
| 325 | + */ |
|
| 326 | + public function getLogFactory(); |
|
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * Returns a router for generating and matching urls |
|
| 330 | + * |
|
| 331 | + * @return \OCP\Route\IRouter |
|
| 332 | + * @since 7.0.0 |
|
| 333 | + */ |
|
| 334 | + public function getRouter(); |
|
| 335 | + |
|
| 336 | + /** |
|
| 337 | + * Returns a search instance |
|
| 338 | + * |
|
| 339 | + * @return \OCP\ISearch |
|
| 340 | + * @since 7.0.0 |
|
| 341 | + */ |
|
| 342 | + public function getSearch(); |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * Get the certificate manager for the user |
|
| 346 | + * |
|
| 347 | + * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
| 348 | + * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in |
|
| 349 | + * @since 8.0.0 |
|
| 350 | + */ |
|
| 351 | + public function getCertificateManager($userId = null); |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * Create a new event source |
|
| 355 | + * |
|
| 356 | + * @return \OCP\IEventSource |
|
| 357 | + * @since 8.0.0 |
|
| 358 | + */ |
|
| 359 | + public function createEventSource(); |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * Returns an instance of the HTTP client service |
|
| 363 | + * |
|
| 364 | + * @return \OCP\Http\Client\IClientService |
|
| 365 | + * @since 8.1.0 |
|
| 366 | + */ |
|
| 367 | + public function getHTTPClientService(); |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * Get the active event logger |
|
| 371 | + * |
|
| 372 | + * @return \OCP\Diagnostics\IEventLogger |
|
| 373 | + * @since 8.0.0 |
|
| 374 | + */ |
|
| 375 | + public function getEventLogger(); |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * Get the active query logger |
|
| 379 | + * |
|
| 380 | + * The returned logger only logs data when debug mode is enabled |
|
| 381 | + * |
|
| 382 | + * @return \OCP\Diagnostics\IQueryLogger |
|
| 383 | + * @since 8.0.0 |
|
| 384 | + */ |
|
| 385 | + public function getQueryLogger(); |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Get the manager for temporary files and folders |
|
| 389 | + * |
|
| 390 | + * @return \OCP\ITempManager |
|
| 391 | + * @since 8.0.0 |
|
| 392 | + */ |
|
| 393 | + public function getTempManager(); |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * Get the app manager |
|
| 397 | + * |
|
| 398 | + * @return \OCP\App\IAppManager |
|
| 399 | + * @since 8.0.0 |
|
| 400 | + */ |
|
| 401 | + public function getAppManager(); |
|
| 402 | + |
|
| 403 | + /** |
|
| 404 | + * Get the webroot |
|
| 405 | + * |
|
| 406 | + * @return string |
|
| 407 | + * @since 8.0.0 |
|
| 408 | + */ |
|
| 409 | + public function getWebRoot(); |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * @return \OCP\Files\Config\IMountProviderCollection |
|
| 413 | + * @since 8.0.0 |
|
| 414 | + */ |
|
| 415 | + public function getMountProviderCollection(); |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * Get the IniWrapper |
|
| 419 | + * |
|
| 420 | + * @return \bantu\IniGetWrapper\IniGetWrapper |
|
| 421 | + * @since 8.0.0 |
|
| 422 | + */ |
|
| 423 | + public function getIniWrapper(); |
|
| 424 | + /** |
|
| 425 | + * @return \OCP\Command\IBus |
|
| 426 | + * @since 8.1.0 |
|
| 427 | + */ |
|
| 428 | + public function getCommandBus(); |
|
| 429 | + |
|
| 430 | + /** |
|
| 431 | + * Creates a new mailer |
|
| 432 | + * |
|
| 433 | + * @return \OCP\Mail\IMailer |
|
| 434 | + * @since 8.1.0 |
|
| 435 | + */ |
|
| 436 | + public function getMailer(); |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * Get the locking provider |
|
| 440 | + * |
|
| 441 | + * @return \OCP\Lock\ILockingProvider |
|
| 442 | + * @since 8.1.0 |
|
| 443 | + */ |
|
| 444 | + public function getLockingProvider(); |
|
| 445 | + |
|
| 446 | + /** |
|
| 447 | + * @return \OCP\Files\Mount\IMountManager |
|
| 448 | + * @since 8.2.0 |
|
| 449 | + */ |
|
| 450 | + public function getMountManager(); |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * Get the MimeTypeDetector |
|
| 454 | + * |
|
| 455 | + * @return \OCP\Files\IMimeTypeDetector |
|
| 456 | + * @since 8.2.0 |
|
| 457 | + */ |
|
| 458 | + public function getMimeTypeDetector(); |
|
| 459 | + |
|
| 460 | + /** |
|
| 461 | + * Get the MimeTypeLoader |
|
| 462 | + * |
|
| 463 | + * @return \OCP\Files\IMimeTypeLoader |
|
| 464 | + * @since 8.2.0 |
|
| 465 | + */ |
|
| 466 | + public function getMimeTypeLoader(); |
|
| 467 | + |
|
| 468 | + /** |
|
| 469 | + * Get the EventDispatcher |
|
| 470 | + * |
|
| 471 | + * @return EventDispatcherInterface |
|
| 472 | + * @since 8.2.0 |
|
| 473 | + */ |
|
| 474 | + public function getEventDispatcher(); |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * Get the Notification Manager |
|
| 478 | + * |
|
| 479 | + * @return \OCP\Notification\IManager |
|
| 480 | + * @since 9.0.0 |
|
| 481 | + */ |
|
| 482 | + public function getNotificationManager(); |
|
| 483 | + |
|
| 484 | + /** |
|
| 485 | + * @return \OCP\Comments\ICommentsManager |
|
| 486 | + * @since 9.0.0 |
|
| 487 | + */ |
|
| 488 | + public function getCommentsManager(); |
|
| 489 | + |
|
| 490 | + /** |
|
| 491 | + * Returns the system-tag manager |
|
| 492 | + * |
|
| 493 | + * @return \OCP\SystemTag\ISystemTagManager |
|
| 494 | + * |
|
| 495 | + * @since 9.0.0 |
|
| 496 | + */ |
|
| 497 | + public function getSystemTagManager(); |
|
| 498 | + |
|
| 499 | + /** |
|
| 500 | + * Returns the system-tag object mapper |
|
| 501 | + * |
|
| 502 | + * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
| 503 | + * |
|
| 504 | + * @since 9.0.0 |
|
| 505 | + */ |
|
| 506 | + public function getSystemTagObjectMapper(); |
|
| 507 | + |
|
| 508 | + /** |
|
| 509 | + * Returns the share manager |
|
| 510 | + * |
|
| 511 | + * @return \OCP\Share\IManager |
|
| 512 | + * @since 9.0.0 |
|
| 513 | + */ |
|
| 514 | + public function getShareManager(); |
|
| 515 | + |
|
| 516 | + /** |
|
| 517 | + * @return IContentSecurityPolicyManager |
|
| 518 | + * @since 9.0.0 |
|
| 519 | + */ |
|
| 520 | + public function getContentSecurityPolicyManager(); |
|
| 521 | + |
|
| 522 | + /** |
|
| 523 | + * @return \OCP\IDateTimeZone |
|
| 524 | + * @since 8.0.0 |
|
| 525 | + */ |
|
| 526 | + public function getDateTimeZone(); |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * @return \OCP\IDateTimeFormatter |
|
| 530 | + * @since 8.0.0 |
|
| 531 | + */ |
|
| 532 | + public function getDateTimeFormatter(); |
|
| 533 | + |
|
| 534 | + /** |
|
| 535 | + * @return \OCP\Federation\ICloudIdManager |
|
| 536 | + * @since 12.0.0 |
|
| 537 | + */ |
|
| 538 | + public function getCloudIdManager(); |
|
| 539 | + |
|
| 540 | + /** |
|
| 541 | + * @return \OCP\GlobalScale\IConfig |
|
| 542 | + */ |
|
| 543 | + public function getGlobalScaleConfig(); |
|
| 544 | + |
|
| 545 | + /** |
|
| 546 | + * @return ICloudFederationFactory |
|
| 547 | + * @since 14.0.0 |
|
| 548 | + */ |
|
| 549 | + public function getCloudFederationFactory(); |
|
| 550 | + |
|
| 551 | + /** |
|
| 552 | + * @return ICloudFederationProviderManager |
|
| 553 | + * @since 14.0.0 |
|
| 554 | + */ |
|
| 555 | + public function getCloudFederationProviderManager(); |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * @return \OCP\Remote\Api\IApiFactory |
|
| 559 | + * @since 13.0.0 |
|
| 560 | + */ |
|
| 561 | + public function getRemoteApiFactory(); |
|
| 562 | + |
|
| 563 | + /** |
|
| 564 | + * @return \OCP\Remote\IInstanceFactory |
|
| 565 | + * @since 13.0.0 |
|
| 566 | + */ |
|
| 567 | + public function getRemoteInstanceFactory(); |
|
| 568 | 568 | } |
@@ -45,105 +45,105 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | class RetryJob extends Job { |
| 47 | 47 | |
| 48 | - /** @var bool */ |
|
| 49 | - private $retainJob = true; |
|
| 50 | - |
|
| 51 | - /** @var Notifications */ |
|
| 52 | - private $notifications; |
|
| 53 | - |
|
| 54 | - /** @var int max number of attempts to send the request */ |
|
| 55 | - private $maxTry = 20; |
|
| 56 | - |
|
| 57 | - /** @var int how much time should be between two tries (10 minutes) */ |
|
| 58 | - private $interval = 600; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * UnShare constructor. |
|
| 62 | - * |
|
| 63 | - * @param Notifications $notifications |
|
| 64 | - */ |
|
| 65 | - public function __construct(Notifications $notifications = null) { |
|
| 66 | - if ($notifications) { |
|
| 67 | - $this->notifications = $notifications; |
|
| 68 | - } else { |
|
| 69 | - $addressHandler = new AddressHandler( |
|
| 70 | - \OC::$server->getURLGenerator(), |
|
| 71 | - \OC::$server->getL10N('federatedfilesharing'), |
|
| 72 | - \OC::$server->getCloudIdManager() |
|
| 73 | - ); |
|
| 74 | - $this->notifications = new Notifications( |
|
| 75 | - $addressHandler, |
|
| 76 | - \OC::$server->getHTTPClientService(), |
|
| 77 | - \OC::$server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 78 | - \OC::$server->getJobList(), |
|
| 79 | - \OC::$server->getCloudFederationProviderManager(), |
|
| 80 | - \OC::$server->getCloudFederationFactory() |
|
| 81 | - ); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * run the job, then remove it from the jobList |
|
| 88 | - * |
|
| 89 | - * @param JobList $jobList |
|
| 90 | - * @param ILogger|null $logger |
|
| 91 | - */ |
|
| 92 | - public function execute($jobList, ILogger $logger = null) { |
|
| 93 | - |
|
| 94 | - if ($this->shouldRun($this->argument)) { |
|
| 95 | - parent::execute($jobList, $logger); |
|
| 96 | - $jobList->remove($this, $this->argument); |
|
| 97 | - if ($this->retainJob) { |
|
| 98 | - $this->reAddJob($jobList, $this->argument); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - protected function run($argument) { |
|
| 104 | - $remote = $argument['remote']; |
|
| 105 | - $remoteId = $argument['remoteId']; |
|
| 106 | - $token = $argument['token']; |
|
| 107 | - $action = $argument['action']; |
|
| 108 | - $data = json_decode($argument['data'], true); |
|
| 109 | - $try = (int)$argument['try'] + 1; |
|
| 110 | - |
|
| 111 | - $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
|
| 112 | - |
|
| 113 | - if ($result === true || $try > $this->maxTry) { |
|
| 114 | - $this->retainJob = false; |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * re-add background job with new arguments |
|
| 120 | - * |
|
| 121 | - * @param IJobList $jobList |
|
| 122 | - * @param array $argument |
|
| 123 | - */ |
|
| 124 | - protected function reAddJob(IJobList $jobList, array $argument) { |
|
| 125 | - $jobList->add(RetryJob::class, |
|
| 126 | - [ |
|
| 127 | - 'remote' => $argument['remote'], |
|
| 128 | - 'remoteId' => $argument['remoteId'], |
|
| 129 | - 'token' => $argument['token'], |
|
| 130 | - 'data' => $argument['data'], |
|
| 131 | - 'action' => $argument['action'], |
|
| 132 | - 'try' => (int)$argument['try'] + 1, |
|
| 133 | - 'lastRun' => time() |
|
| 134 | - ] |
|
| 135 | - ); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * test if it is time for the next run |
|
| 140 | - * |
|
| 141 | - * @param array $argument |
|
| 142 | - * @return bool |
|
| 143 | - */ |
|
| 144 | - protected function shouldRun(array $argument) { |
|
| 145 | - $lastRun = (int)$argument['lastRun']; |
|
| 146 | - return ((time() - $lastRun) > $this->interval); |
|
| 147 | - } |
|
| 48 | + /** @var bool */ |
|
| 49 | + private $retainJob = true; |
|
| 50 | + |
|
| 51 | + /** @var Notifications */ |
|
| 52 | + private $notifications; |
|
| 53 | + |
|
| 54 | + /** @var int max number of attempts to send the request */ |
|
| 55 | + private $maxTry = 20; |
|
| 56 | + |
|
| 57 | + /** @var int how much time should be between two tries (10 minutes) */ |
|
| 58 | + private $interval = 600; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * UnShare constructor. |
|
| 62 | + * |
|
| 63 | + * @param Notifications $notifications |
|
| 64 | + */ |
|
| 65 | + public function __construct(Notifications $notifications = null) { |
|
| 66 | + if ($notifications) { |
|
| 67 | + $this->notifications = $notifications; |
|
| 68 | + } else { |
|
| 69 | + $addressHandler = new AddressHandler( |
|
| 70 | + \OC::$server->getURLGenerator(), |
|
| 71 | + \OC::$server->getL10N('federatedfilesharing'), |
|
| 72 | + \OC::$server->getCloudIdManager() |
|
| 73 | + ); |
|
| 74 | + $this->notifications = new Notifications( |
|
| 75 | + $addressHandler, |
|
| 76 | + \OC::$server->getHTTPClientService(), |
|
| 77 | + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 78 | + \OC::$server->getJobList(), |
|
| 79 | + \OC::$server->getCloudFederationProviderManager(), |
|
| 80 | + \OC::$server->getCloudFederationFactory() |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * run the job, then remove it from the jobList |
|
| 88 | + * |
|
| 89 | + * @param JobList $jobList |
|
| 90 | + * @param ILogger|null $logger |
|
| 91 | + */ |
|
| 92 | + public function execute($jobList, ILogger $logger = null) { |
|
| 93 | + |
|
| 94 | + if ($this->shouldRun($this->argument)) { |
|
| 95 | + parent::execute($jobList, $logger); |
|
| 96 | + $jobList->remove($this, $this->argument); |
|
| 97 | + if ($this->retainJob) { |
|
| 98 | + $this->reAddJob($jobList, $this->argument); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + protected function run($argument) { |
|
| 104 | + $remote = $argument['remote']; |
|
| 105 | + $remoteId = $argument['remoteId']; |
|
| 106 | + $token = $argument['token']; |
|
| 107 | + $action = $argument['action']; |
|
| 108 | + $data = json_decode($argument['data'], true); |
|
| 109 | + $try = (int)$argument['try'] + 1; |
|
| 110 | + |
|
| 111 | + $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
|
| 112 | + |
|
| 113 | + if ($result === true || $try > $this->maxTry) { |
|
| 114 | + $this->retainJob = false; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * re-add background job with new arguments |
|
| 120 | + * |
|
| 121 | + * @param IJobList $jobList |
|
| 122 | + * @param array $argument |
|
| 123 | + */ |
|
| 124 | + protected function reAddJob(IJobList $jobList, array $argument) { |
|
| 125 | + $jobList->add(RetryJob::class, |
|
| 126 | + [ |
|
| 127 | + 'remote' => $argument['remote'], |
|
| 128 | + 'remoteId' => $argument['remoteId'], |
|
| 129 | + 'token' => $argument['token'], |
|
| 130 | + 'data' => $argument['data'], |
|
| 131 | + 'action' => $argument['action'], |
|
| 132 | + 'try' => (int)$argument['try'] + 1, |
|
| 133 | + 'lastRun' => time() |
|
| 134 | + ] |
|
| 135 | + ); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * test if it is time for the next run |
|
| 140 | + * |
|
| 141 | + * @param array $argument |
|
| 142 | + * @return bool |
|
| 143 | + */ |
|
| 144 | + protected function shouldRun(array $argument) { |
|
| 145 | + $lastRun = (int)$argument['lastRun']; |
|
| 146 | + return ((time() - $lastRun) > $this->interval); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | } |