@@ -30,30 +30,30 @@ |
||
30 | 30 | |
31 | 31 | class PersonalInfo implements IIconSection { |
32 | 32 | |
33 | - /** @var IL10N */ |
|
34 | - private $l; |
|
33 | + /** @var IL10N */ |
|
34 | + private $l; |
|
35 | 35 | |
36 | - /** @var IURLGenerator */ |
|
37 | - private $urlGenerator; |
|
36 | + /** @var IURLGenerator */ |
|
37 | + private $urlGenerator; |
|
38 | 38 | |
39 | - public function __construct(IL10N $l, IURLGenerator $urlGenerator) { |
|
40 | - $this->l = $l; |
|
41 | - $this->urlGenerator = $urlGenerator; |
|
42 | - } |
|
39 | + public function __construct(IL10N $l, IURLGenerator $urlGenerator) { |
|
40 | + $this->l = $l; |
|
41 | + $this->urlGenerator = $urlGenerator; |
|
42 | + } |
|
43 | 43 | |
44 | - public function getIcon() { |
|
45 | - return $this->urlGenerator->imagePath('core', 'actions/user.svg'); |
|
46 | - } |
|
44 | + public function getIcon() { |
|
45 | + return $this->urlGenerator->imagePath('core', 'actions/user.svg'); |
|
46 | + } |
|
47 | 47 | |
48 | - public function getID(): string { |
|
49 | - return 'personal-info'; |
|
50 | - } |
|
48 | + public function getID(): string { |
|
49 | + return 'personal-info'; |
|
50 | + } |
|
51 | 51 | |
52 | - public function getName(): string { |
|
53 | - return $this->l->t('Personal info'); |
|
54 | - } |
|
52 | + public function getName(): string { |
|
53 | + return $this->l->t('Personal info'); |
|
54 | + } |
|
55 | 55 | |
56 | - public function getPriority(): int { |
|
57 | - return 0; |
|
58 | - } |
|
56 | + public function getPriority(): int { |
|
57 | + return 0; |
|
58 | + } |
|
59 | 59 | } |
@@ -106,12 +106,12 @@ |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | return [ |
109 | - 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
109 | + 'providers' => array_map(function(IProvidesPersonalSettings $provider) use ($user) { |
|
110 | 110 | return [ |
111 | 111 | 'provider' => $provider, |
112 | 112 | 'settings' => $provider->getPersonalSettings($user) |
113 | 113 | ]; |
114 | - }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
114 | + }, array_filter($this->providerLoader->getProviders($user), function(IProvider $provider) { |
|
115 | 115 | return $provider instanceof IProvidesPersonalSettings; |
116 | 116 | })) |
117 | 117 | ]; |
@@ -42,95 +42,95 @@ |
||
42 | 42 | |
43 | 43 | class TwoFactor implements ISettings { |
44 | 44 | |
45 | - /** @var ProviderLoader */ |
|
46 | - private $providerLoader; |
|
47 | - |
|
48 | - /** @var MandatoryTwoFactor */ |
|
49 | - private $mandatoryTwoFactor; |
|
50 | - |
|
51 | - /** @var IUserSession */ |
|
52 | - private $userSession; |
|
53 | - |
|
54 | - /** @var string|null */ |
|
55 | - private $uid; |
|
56 | - |
|
57 | - /** @var IConfig */ |
|
58 | - private $config; |
|
59 | - |
|
60 | - public function __construct(ProviderLoader $providerLoader, |
|
61 | - MandatoryTwoFactor $mandatoryTwoFactor, |
|
62 | - IUserSession $userSession, |
|
63 | - IConfig $config, |
|
64 | - ?string $UserId) { |
|
65 | - $this->providerLoader = $providerLoader; |
|
66 | - $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
67 | - $this->userSession = $userSession; |
|
68 | - $this->uid = $UserId; |
|
69 | - $this->config = $config; |
|
70 | - } |
|
71 | - |
|
72 | - public function getForm(): TemplateResponse { |
|
73 | - return new TemplateResponse('settings', 'settings/personal/security/twofactor', [ |
|
74 | - 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
75 | - ]); |
|
76 | - } |
|
77 | - |
|
78 | - public function getSection(): ?string { |
|
79 | - if (!$this->shouldShow()) { |
|
80 | - return null; |
|
81 | - } |
|
82 | - return 'security'; |
|
83 | - } |
|
84 | - |
|
85 | - public function getPriority(): int { |
|
86 | - return 15; |
|
87 | - } |
|
88 | - |
|
89 | - private function shouldShow(): bool { |
|
90 | - $user = $this->userSession->getUser(); |
|
91 | - if (is_null($user)) { |
|
92 | - // Actually impossible, but still … |
|
93 | - return false; |
|
94 | - } |
|
95 | - |
|
96 | - // Anyone who's supposed to use 2FA should see 2FA settings |
|
97 | - if ($this->mandatoryTwoFactor->isEnforcedFor($user)) { |
|
98 | - return true; |
|
99 | - } |
|
100 | - |
|
101 | - // If there is at least one provider with personal settings but it's not |
|
102 | - // the backup codes provider, then these settings should show. |
|
103 | - try { |
|
104 | - $providers = $this->providerLoader->getProviders($user); |
|
105 | - } catch (Exception $e) { |
|
106 | - // Let's hope for the best |
|
107 | - return true; |
|
108 | - } |
|
109 | - foreach ($providers as $provider) { |
|
110 | - if ($provider instanceof IProvidesPersonalSettings |
|
111 | - && !($provider instanceof BackupCodesProvider)) { |
|
112 | - return true; |
|
113 | - } |
|
114 | - } |
|
115 | - return false; |
|
116 | - } |
|
117 | - |
|
118 | - private function getTwoFactorProviderData(): array { |
|
119 | - $user = $this->userSession->getUser(); |
|
120 | - if (is_null($user)) { |
|
121 | - // Actually impossible, but still … |
|
122 | - return []; |
|
123 | - } |
|
124 | - |
|
125 | - return [ |
|
126 | - 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
127 | - return [ |
|
128 | - 'provider' => $provider, |
|
129 | - 'settings' => $provider->getPersonalSettings($user) |
|
130 | - ]; |
|
131 | - }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
132 | - return $provider instanceof IProvidesPersonalSettings; |
|
133 | - })) |
|
134 | - ]; |
|
135 | - } |
|
45 | + /** @var ProviderLoader */ |
|
46 | + private $providerLoader; |
|
47 | + |
|
48 | + /** @var MandatoryTwoFactor */ |
|
49 | + private $mandatoryTwoFactor; |
|
50 | + |
|
51 | + /** @var IUserSession */ |
|
52 | + private $userSession; |
|
53 | + |
|
54 | + /** @var string|null */ |
|
55 | + private $uid; |
|
56 | + |
|
57 | + /** @var IConfig */ |
|
58 | + private $config; |
|
59 | + |
|
60 | + public function __construct(ProviderLoader $providerLoader, |
|
61 | + MandatoryTwoFactor $mandatoryTwoFactor, |
|
62 | + IUserSession $userSession, |
|
63 | + IConfig $config, |
|
64 | + ?string $UserId) { |
|
65 | + $this->providerLoader = $providerLoader; |
|
66 | + $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
67 | + $this->userSession = $userSession; |
|
68 | + $this->uid = $UserId; |
|
69 | + $this->config = $config; |
|
70 | + } |
|
71 | + |
|
72 | + public function getForm(): TemplateResponse { |
|
73 | + return new TemplateResponse('settings', 'settings/personal/security/twofactor', [ |
|
74 | + 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
75 | + ]); |
|
76 | + } |
|
77 | + |
|
78 | + public function getSection(): ?string { |
|
79 | + if (!$this->shouldShow()) { |
|
80 | + return null; |
|
81 | + } |
|
82 | + return 'security'; |
|
83 | + } |
|
84 | + |
|
85 | + public function getPriority(): int { |
|
86 | + return 15; |
|
87 | + } |
|
88 | + |
|
89 | + private function shouldShow(): bool { |
|
90 | + $user = $this->userSession->getUser(); |
|
91 | + if (is_null($user)) { |
|
92 | + // Actually impossible, but still … |
|
93 | + return false; |
|
94 | + } |
|
95 | + |
|
96 | + // Anyone who's supposed to use 2FA should see 2FA settings |
|
97 | + if ($this->mandatoryTwoFactor->isEnforcedFor($user)) { |
|
98 | + return true; |
|
99 | + } |
|
100 | + |
|
101 | + // If there is at least one provider with personal settings but it's not |
|
102 | + // the backup codes provider, then these settings should show. |
|
103 | + try { |
|
104 | + $providers = $this->providerLoader->getProviders($user); |
|
105 | + } catch (Exception $e) { |
|
106 | + // Let's hope for the best |
|
107 | + return true; |
|
108 | + } |
|
109 | + foreach ($providers as $provider) { |
|
110 | + if ($provider instanceof IProvidesPersonalSettings |
|
111 | + && !($provider instanceof BackupCodesProvider)) { |
|
112 | + return true; |
|
113 | + } |
|
114 | + } |
|
115 | + return false; |
|
116 | + } |
|
117 | + |
|
118 | + private function getTwoFactorProviderData(): array { |
|
119 | + $user = $this->userSession->getUser(); |
|
120 | + if (is_null($user)) { |
|
121 | + // Actually impossible, but still … |
|
122 | + return []; |
|
123 | + } |
|
124 | + |
|
125 | + return [ |
|
126 | + 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
127 | + return [ |
|
128 | + 'provider' => $provider, |
|
129 | + 'settings' => $provider->getPersonalSettings($user) |
|
130 | + ]; |
|
131 | + }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
132 | + return $provider instanceof IProvidesPersonalSettings; |
|
133 | + })) |
|
134 | + ]; |
|
135 | + } |
|
136 | 136 | } |
@@ -34,35 +34,35 @@ |
||
34 | 34 | |
35 | 35 | class Password implements ISettings { |
36 | 36 | |
37 | - /** @var IUserManager */ |
|
38 | - private $userManager; |
|
37 | + /** @var IUserManager */ |
|
38 | + private $userManager; |
|
39 | 39 | |
40 | - /** @var string|null */ |
|
41 | - private $uid; |
|
40 | + /** @var string|null */ |
|
41 | + private $uid; |
|
42 | 42 | |
43 | - public function __construct(IUserManager $userManager, |
|
44 | - ?string $UserId) { |
|
45 | - $this->userManager = $userManager; |
|
46 | - $this->uid = $UserId; |
|
47 | - } |
|
43 | + public function __construct(IUserManager $userManager, |
|
44 | + ?string $UserId) { |
|
45 | + $this->userManager = $userManager; |
|
46 | + $this->uid = $UserId; |
|
47 | + } |
|
48 | 48 | |
49 | - public function getForm(): TemplateResponse { |
|
50 | - $user = $this->userManager->get($this->uid); |
|
51 | - $passwordChangeSupported = false; |
|
52 | - if ($user !== null) { |
|
53 | - $passwordChangeSupported = $user->canChangePassword(); |
|
54 | - } |
|
49 | + public function getForm(): TemplateResponse { |
|
50 | + $user = $this->userManager->get($this->uid); |
|
51 | + $passwordChangeSupported = false; |
|
52 | + if ($user !== null) { |
|
53 | + $passwordChangeSupported = $user->canChangePassword(); |
|
54 | + } |
|
55 | 55 | |
56 | - return new TemplateResponse('settings', 'settings/personal/security/password', [ |
|
57 | - 'passwordChangeSupported' => $passwordChangeSupported, |
|
58 | - ]); |
|
59 | - } |
|
56 | + return new TemplateResponse('settings', 'settings/personal/security/password', [ |
|
57 | + 'passwordChangeSupported' => $passwordChangeSupported, |
|
58 | + ]); |
|
59 | + } |
|
60 | 60 | |
61 | - public function getSection(): string { |
|
62 | - return 'security'; |
|
63 | - } |
|
61 | + public function getSection(): string { |
|
62 | + return 'security'; |
|
63 | + } |
|
64 | 64 | |
65 | - public function getPriority(): int { |
|
66 | - return 10; |
|
67 | - } |
|
65 | + public function getPriority(): int { |
|
66 | + return 10; |
|
67 | + } |
|
68 | 68 | } |
@@ -57,17 +57,17 @@ |
||
57 | 57 | |
58 | 58 | try { |
59 | 59 | $jobStartTime = time(); |
60 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
60 | + $logger->debug('Run '.get_class($this).' job with ID '.$this->getId(), ['app' => 'cron']); |
|
61 | 61 | $this->run($this->argument); |
62 | 62 | $timeTaken = time() - $jobStartTime; |
63 | 63 | |
64 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
64 | + $logger->debug('Finished '.get_class($this).' job with ID '.$this->getId().' in '.$timeTaken.' seconds', ['app' => 'cron']); |
|
65 | 65 | $jobList->setExecutionTime($this, $timeTaken); |
66 | 66 | } catch (\Throwable $e) { |
67 | 67 | if ($logger) { |
68 | 68 | $logger->logException($e, [ |
69 | 69 | 'app' => 'core', |
70 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
70 | + 'message' => 'Error while running background job (class: '.get_class($this).', arguments: '.print_r($this->argument, true).')' |
|
71 | 71 | ]); |
72 | 72 | } |
73 | 73 | } |
@@ -33,66 +33,66 @@ |
||
33 | 33 | * @deprecated internal class, use \OCP\BackgroundJob\Job |
34 | 34 | */ |
35 | 35 | abstract class Job implements IJob { |
36 | - /** @var int */ |
|
37 | - protected $id; |
|
36 | + /** @var int */ |
|
37 | + protected $id; |
|
38 | 38 | |
39 | - /** @var int */ |
|
40 | - protected $lastRun; |
|
39 | + /** @var int */ |
|
40 | + protected $lastRun; |
|
41 | 41 | |
42 | - /** @var mixed */ |
|
43 | - protected $argument; |
|
42 | + /** @var mixed */ |
|
43 | + protected $argument; |
|
44 | 44 | |
45 | - public function execute(IJobList $jobList, ILogger $logger = null) { |
|
46 | - $jobList->setLastRun($this); |
|
47 | - if ($logger === null) { |
|
48 | - $logger = \OC::$server->getLogger(); |
|
49 | - } |
|
45 | + public function execute(IJobList $jobList, ILogger $logger = null) { |
|
46 | + $jobList->setLastRun($this); |
|
47 | + if ($logger === null) { |
|
48 | + $logger = \OC::$server->getLogger(); |
|
49 | + } |
|
50 | 50 | |
51 | - try { |
|
52 | - $jobStartTime = time(); |
|
53 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
54 | - $this->run($this->argument); |
|
55 | - $timeTaken = time() - $jobStartTime; |
|
51 | + try { |
|
52 | + $jobStartTime = time(); |
|
53 | + $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
54 | + $this->run($this->argument); |
|
55 | + $timeTaken = time() - $jobStartTime; |
|
56 | 56 | |
57 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
58 | - $jobList->setExecutionTime($this, $timeTaken); |
|
59 | - } catch (\Throwable $e) { |
|
60 | - if ($logger) { |
|
61 | - $logger->logException($e, [ |
|
62 | - 'app' => 'core', |
|
63 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
64 | - ]); |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
57 | + $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
58 | + $jobList->setExecutionTime($this, $timeTaken); |
|
59 | + } catch (\Throwable $e) { |
|
60 | + if ($logger) { |
|
61 | + $logger->logException($e, [ |
|
62 | + 'app' => 'core', |
|
63 | + 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
64 | + ]); |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - public function start(IJobList $jobList): void { |
|
70 | - $this->execute($jobList); |
|
71 | - } |
|
69 | + public function start(IJobList $jobList): void { |
|
70 | + $this->execute($jobList); |
|
71 | + } |
|
72 | 72 | |
73 | - abstract protected function run($argument); |
|
73 | + abstract protected function run($argument); |
|
74 | 74 | |
75 | - public function setId(int $id) { |
|
76 | - $this->id = $id; |
|
77 | - } |
|
75 | + public function setId(int $id) { |
|
76 | + $this->id = $id; |
|
77 | + } |
|
78 | 78 | |
79 | - public function setLastRun(int $lastRun) { |
|
80 | - $this->lastRun = $lastRun; |
|
81 | - } |
|
79 | + public function setLastRun(int $lastRun) { |
|
80 | + $this->lastRun = $lastRun; |
|
81 | + } |
|
82 | 82 | |
83 | - public function setArgument($argument) { |
|
84 | - $this->argument = $argument; |
|
85 | - } |
|
83 | + public function setArgument($argument) { |
|
84 | + $this->argument = $argument; |
|
85 | + } |
|
86 | 86 | |
87 | - public function getId() { |
|
88 | - return $this->id; |
|
89 | - } |
|
87 | + public function getId() { |
|
88 | + return $this->id; |
|
89 | + } |
|
90 | 90 | |
91 | - public function getLastRun() { |
|
92 | - return $this->lastRun; |
|
93 | - } |
|
91 | + public function getLastRun() { |
|
92 | + return $this->lastRun; |
|
93 | + } |
|
94 | 94 | |
95 | - public function getArgument() { |
|
96 | - return $this->argument; |
|
97 | - } |
|
95 | + public function getArgument() { |
|
96 | + return $this->argument; |
|
97 | + } |
|
98 | 98 | } |
@@ -32,15 +32,15 @@ |
||
32 | 32 | use Doctrine\DBAL\TransactionIsolationLevel; |
33 | 33 | |
34 | 34 | class SetTransactionIsolationLevel implements EventSubscriber { |
35 | - /** |
|
36 | - * @param ConnectionEventArgs $args |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function postConnect(ConnectionEventArgs $args) { |
|
40 | - $args->getConnection()->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param ConnectionEventArgs $args |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function postConnect(ConnectionEventArgs $args) { |
|
40 | + $args->getConnection()->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED); |
|
41 | + } |
|
42 | 42 | |
43 | - public function getSubscribedEvents() { |
|
44 | - return [Events::postConnect]; |
|
45 | - } |
|
43 | + public function getSubscribedEvents() { |
|
44 | + return [Events::postConnect]; |
|
45 | + } |
|
46 | 46 | } |
@@ -32,42 +32,42 @@ |
||
32 | 32 | */ |
33 | 33 | interface ICalendarProvider { |
34 | 34 | |
35 | - /** |
|
36 | - * Provides the appId of the plugin |
|
37 | - * |
|
38 | - * @since 19.0.0 |
|
39 | - * @return string AppId |
|
40 | - */ |
|
41 | - public function getAppId(): string; |
|
35 | + /** |
|
36 | + * Provides the appId of the plugin |
|
37 | + * |
|
38 | + * @since 19.0.0 |
|
39 | + * @return string AppId |
|
40 | + */ |
|
41 | + public function getAppId(): string; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Fetches all calendars for a given principal uri |
|
45 | - * |
|
46 | - * @since 19.0.0 |
|
47 | - * @param string $principalUri E.g. principals/users/user1 |
|
48 | - * @return ExternalCalendar[] Array of all calendars |
|
49 | - */ |
|
50 | - public function fetchAllForCalendarHome(string $principalUri): array; |
|
43 | + /** |
|
44 | + * Fetches all calendars for a given principal uri |
|
45 | + * |
|
46 | + * @since 19.0.0 |
|
47 | + * @param string $principalUri E.g. principals/users/user1 |
|
48 | + * @return ExternalCalendar[] Array of all calendars |
|
49 | + */ |
|
50 | + public function fetchAllForCalendarHome(string $principalUri): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Checks whether plugin has a calendar for a given principalUri and calendarUri |
|
54 | - * |
|
55 | - * @since 19.0.0 |
|
56 | - * @param string $principalUri E.g. principals/users/user1 |
|
57 | - * @param string $calendarUri E.g. personal |
|
58 | - * @return bool True if calendar for principalUri and calendarUri exists, false otherwise |
|
59 | - */ |
|
60 | - public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool; |
|
52 | + /** |
|
53 | + * Checks whether plugin has a calendar for a given principalUri and calendarUri |
|
54 | + * |
|
55 | + * @since 19.0.0 |
|
56 | + * @param string $principalUri E.g. principals/users/user1 |
|
57 | + * @param string $calendarUri E.g. personal |
|
58 | + * @return bool True if calendar for principalUri and calendarUri exists, false otherwise |
|
59 | + */ |
|
60 | + public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Fetches a calendar for a given principalUri and calendarUri |
|
64 | - * Returns null if calendar does not exist |
|
65 | - * |
|
66 | - * @since 19.0.0 |
|
67 | - * @param string $principalUri E.g. principals/users/user1 |
|
68 | - * @param string $calendarUri E.g. personal |
|
69 | - * @return ExternalCalendar|null Calendar if it exists, null otherwise |
|
70 | - */ |
|
71 | - public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar; |
|
62 | + /** |
|
63 | + * Fetches a calendar for a given principalUri and calendarUri |
|
64 | + * Returns null if calendar does not exist |
|
65 | + * |
|
66 | + * @since 19.0.0 |
|
67 | + * @param string $principalUri E.g. principals/users/user1 |
|
68 | + * @param string $calendarUri E.g. personal |
|
69 | + * @return ExternalCalendar|null Calendar if it exists, null otherwise |
|
70 | + */ |
|
71 | + public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar; |
|
72 | 72 | |
73 | 73 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'targetUser' => $recipient, |
113 | 113 | 'nodeName' => $node->getName(), |
114 | 114 | ]) |
115 | - ->setObject('transfer', (string)$transferOwnership->getId()); |
|
115 | + ->setObject('transfer', (string) $transferOwnership->getId()); |
|
116 | 116 | |
117 | 117 | $this->notificationManager->notify($notification); |
118 | 118 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $notification = $this->notificationManager->createNotification(); |
137 | 137 | $notification->setApp('files') |
138 | - ->setObject('transfer', (string)$id); |
|
138 | + ->setObject('transfer', (string) $id); |
|
139 | 139 | $this->notificationManager->markProcessed($notification); |
140 | 140 | |
141 | 141 | $newTransferOwnership = new TransferOwnershipEntity(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $notification = $this->notificationManager->createNotification(); |
170 | 170 | $notification->setApp('files') |
171 | - ->setObject('transfer', (string)$id); |
|
171 | + ->setObject('transfer', (string) $id); |
|
172 | 172 | $this->notificationManager->markProcessed($notification); |
173 | 173 | |
174 | 174 | $notification = $this->notificationManager->createNotification(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'targetUser' => $transferOwnership->getTargetUser(), |
181 | 181 | 'nodeName' => $transferOwnership->getNodeName() |
182 | 182 | ]) |
183 | - ->setObject('transfer', (string)$transferOwnership->getId()); |
|
183 | + ->setObject('transfer', (string) $transferOwnership->getId()); |
|
184 | 184 | $this->notificationManager->notify($notification); |
185 | 185 | |
186 | 186 | $this->mapper->delete($transferOwnership); |
@@ -44,153 +44,153 @@ |
||
44 | 44 | |
45 | 45 | class TransferOwnershipController extends OCSController { |
46 | 46 | |
47 | - /** @var string */ |
|
48 | - private $userId; |
|
49 | - /** @var NotificationManager */ |
|
50 | - private $notificationManager; |
|
51 | - /** @var ITimeFactory */ |
|
52 | - private $timeFactory; |
|
53 | - /** @var IJobList */ |
|
54 | - private $jobList; |
|
55 | - /** @var TransferOwnershipMapper */ |
|
56 | - private $mapper; |
|
57 | - /** @var IUserManager */ |
|
58 | - private $userManager; |
|
59 | - /** @var IRootFolder */ |
|
60 | - private $rootFolder; |
|
61 | - |
|
62 | - public function __construct(string $appName, |
|
63 | - IRequest $request, |
|
64 | - string $userId, |
|
65 | - NotificationManager $notificationManager, |
|
66 | - ITimeFactory $timeFactory, |
|
67 | - IJobList $jobList, |
|
68 | - TransferOwnershipMapper $mapper, |
|
69 | - IUserManager $userManager, |
|
70 | - IRootFolder $rootFolder) { |
|
71 | - parent::__construct($appName, $request); |
|
72 | - |
|
73 | - $this->userId = $userId; |
|
74 | - $this->notificationManager = $notificationManager; |
|
75 | - $this->timeFactory = $timeFactory; |
|
76 | - $this->jobList = $jobList; |
|
77 | - $this->mapper = $mapper; |
|
78 | - $this->userManager = $userManager; |
|
79 | - $this->rootFolder = $rootFolder; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @NoAdminRequired |
|
85 | - */ |
|
86 | - public function transfer(string $recipient, string $path): DataResponse { |
|
87 | - $recipientUser = $this->userManager->get($recipient); |
|
88 | - |
|
89 | - if ($recipientUser === null) { |
|
90 | - return new DataResponse([], Http::STATUS_BAD_REQUEST); |
|
91 | - } |
|
92 | - |
|
93 | - $userRoot = $this->rootFolder->getUserFolder($this->userId); |
|
94 | - |
|
95 | - try { |
|
96 | - $node = $userRoot->get($path); |
|
97 | - } catch (\Exception $e) { |
|
98 | - return new DataResponse([], Http::STATUS_BAD_REQUEST); |
|
99 | - } |
|
100 | - |
|
101 | - if ($node->getOwner()->getUID() !== $this->userId || !$node->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
102 | - return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
103 | - } |
|
104 | - |
|
105 | - $transferOwnership = new TransferOwnershipEntity(); |
|
106 | - $transferOwnership->setSourceUser($this->userId); |
|
107 | - $transferOwnership->setTargetUser($recipient); |
|
108 | - $transferOwnership->setFileId($node->getId()); |
|
109 | - $transferOwnership->setNodeName($node->getName()); |
|
110 | - $transferOwnership = $this->mapper->insert($transferOwnership); |
|
111 | - |
|
112 | - $notification = $this->notificationManager->createNotification(); |
|
113 | - $notification->setUser($recipient) |
|
114 | - ->setApp($this->appName) |
|
115 | - ->setDateTime($this->timeFactory->getDateTime()) |
|
116 | - ->setSubject('transferownershipRequest', [ |
|
117 | - 'sourceUser' => $this->userId, |
|
118 | - 'targetUser' => $recipient, |
|
119 | - 'nodeName' => $node->getName(), |
|
120 | - ]) |
|
121 | - ->setObject('transfer', (string)$transferOwnership->getId()); |
|
122 | - |
|
123 | - $this->notificationManager->notify($notification); |
|
124 | - |
|
125 | - return new DataResponse([]); |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * @NoAdminRequired |
|
130 | - */ |
|
131 | - public function accept(int $id): DataResponse { |
|
132 | - try { |
|
133 | - $transferOwnership = $this->mapper->getById($id); |
|
134 | - } catch (DoesNotExistException $e) { |
|
135 | - return new DataResponse([], Http::STATUS_NOT_FOUND); |
|
136 | - } |
|
137 | - |
|
138 | - if ($transferOwnership->getTargetUser() !== $this->userId) { |
|
139 | - return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
140 | - } |
|
141 | - |
|
142 | - $notification = $this->notificationManager->createNotification(); |
|
143 | - $notification->setApp('files') |
|
144 | - ->setObject('transfer', (string)$id); |
|
145 | - $this->notificationManager->markProcessed($notification); |
|
146 | - |
|
147 | - $newTransferOwnership = new TransferOwnershipEntity(); |
|
148 | - $newTransferOwnership->setNodeName($transferOwnership->getNodeName()); |
|
149 | - $newTransferOwnership->setFileId($transferOwnership->getFileId()); |
|
150 | - $newTransferOwnership->setSourceUser($transferOwnership->getSourceUser()); |
|
151 | - $newTransferOwnership->setTargetUser($transferOwnership->getTargetUser()); |
|
152 | - $this->mapper->insert($newTransferOwnership); |
|
153 | - |
|
154 | - $this->jobList->add(TransferOwnership::class, [ |
|
155 | - 'id' => $newTransferOwnership->getId(), |
|
156 | - ]); |
|
157 | - |
|
158 | - return new DataResponse([], Http::STATUS_OK); |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * @NoAdminRequired |
|
163 | - */ |
|
164 | - public function reject(int $id): DataResponse { |
|
165 | - try { |
|
166 | - $transferOwnership = $this->mapper->getById($id); |
|
167 | - } catch (DoesNotExistException $e) { |
|
168 | - return new DataResponse([], Http::STATUS_NOT_FOUND); |
|
169 | - } |
|
170 | - |
|
171 | - if ($transferOwnership->getTargetUser() !== $this->userId) { |
|
172 | - return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
173 | - } |
|
174 | - |
|
175 | - $notification = $this->notificationManager->createNotification(); |
|
176 | - $notification->setApp('files') |
|
177 | - ->setObject('transfer', (string)$id); |
|
178 | - $this->notificationManager->markProcessed($notification); |
|
179 | - |
|
180 | - $notification = $this->notificationManager->createNotification(); |
|
181 | - $notification->setUser($transferOwnership->getSourceUser()) |
|
182 | - ->setApp($this->appName) |
|
183 | - ->setDateTime($this->timeFactory->getDateTime()) |
|
184 | - ->setSubject('transferownershipRequestDenied', [ |
|
185 | - 'sourceUser' => $transferOwnership->getSourceUser(), |
|
186 | - 'targetUser' => $transferOwnership->getTargetUser(), |
|
187 | - 'nodeName' => $transferOwnership->getNodeName() |
|
188 | - ]) |
|
189 | - ->setObject('transfer', (string)$transferOwnership->getId()); |
|
190 | - $this->notificationManager->notify($notification); |
|
191 | - |
|
192 | - $this->mapper->delete($transferOwnership); |
|
193 | - |
|
194 | - return new DataResponse([], Http::STATUS_OK); |
|
195 | - } |
|
47 | + /** @var string */ |
|
48 | + private $userId; |
|
49 | + /** @var NotificationManager */ |
|
50 | + private $notificationManager; |
|
51 | + /** @var ITimeFactory */ |
|
52 | + private $timeFactory; |
|
53 | + /** @var IJobList */ |
|
54 | + private $jobList; |
|
55 | + /** @var TransferOwnershipMapper */ |
|
56 | + private $mapper; |
|
57 | + /** @var IUserManager */ |
|
58 | + private $userManager; |
|
59 | + /** @var IRootFolder */ |
|
60 | + private $rootFolder; |
|
61 | + |
|
62 | + public function __construct(string $appName, |
|
63 | + IRequest $request, |
|
64 | + string $userId, |
|
65 | + NotificationManager $notificationManager, |
|
66 | + ITimeFactory $timeFactory, |
|
67 | + IJobList $jobList, |
|
68 | + TransferOwnershipMapper $mapper, |
|
69 | + IUserManager $userManager, |
|
70 | + IRootFolder $rootFolder) { |
|
71 | + parent::__construct($appName, $request); |
|
72 | + |
|
73 | + $this->userId = $userId; |
|
74 | + $this->notificationManager = $notificationManager; |
|
75 | + $this->timeFactory = $timeFactory; |
|
76 | + $this->jobList = $jobList; |
|
77 | + $this->mapper = $mapper; |
|
78 | + $this->userManager = $userManager; |
|
79 | + $this->rootFolder = $rootFolder; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @NoAdminRequired |
|
85 | + */ |
|
86 | + public function transfer(string $recipient, string $path): DataResponse { |
|
87 | + $recipientUser = $this->userManager->get($recipient); |
|
88 | + |
|
89 | + if ($recipientUser === null) { |
|
90 | + return new DataResponse([], Http::STATUS_BAD_REQUEST); |
|
91 | + } |
|
92 | + |
|
93 | + $userRoot = $this->rootFolder->getUserFolder($this->userId); |
|
94 | + |
|
95 | + try { |
|
96 | + $node = $userRoot->get($path); |
|
97 | + } catch (\Exception $e) { |
|
98 | + return new DataResponse([], Http::STATUS_BAD_REQUEST); |
|
99 | + } |
|
100 | + |
|
101 | + if ($node->getOwner()->getUID() !== $this->userId || !$node->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
102 | + return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
103 | + } |
|
104 | + |
|
105 | + $transferOwnership = new TransferOwnershipEntity(); |
|
106 | + $transferOwnership->setSourceUser($this->userId); |
|
107 | + $transferOwnership->setTargetUser($recipient); |
|
108 | + $transferOwnership->setFileId($node->getId()); |
|
109 | + $transferOwnership->setNodeName($node->getName()); |
|
110 | + $transferOwnership = $this->mapper->insert($transferOwnership); |
|
111 | + |
|
112 | + $notification = $this->notificationManager->createNotification(); |
|
113 | + $notification->setUser($recipient) |
|
114 | + ->setApp($this->appName) |
|
115 | + ->setDateTime($this->timeFactory->getDateTime()) |
|
116 | + ->setSubject('transferownershipRequest', [ |
|
117 | + 'sourceUser' => $this->userId, |
|
118 | + 'targetUser' => $recipient, |
|
119 | + 'nodeName' => $node->getName(), |
|
120 | + ]) |
|
121 | + ->setObject('transfer', (string)$transferOwnership->getId()); |
|
122 | + |
|
123 | + $this->notificationManager->notify($notification); |
|
124 | + |
|
125 | + return new DataResponse([]); |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * @NoAdminRequired |
|
130 | + */ |
|
131 | + public function accept(int $id): DataResponse { |
|
132 | + try { |
|
133 | + $transferOwnership = $this->mapper->getById($id); |
|
134 | + } catch (DoesNotExistException $e) { |
|
135 | + return new DataResponse([], Http::STATUS_NOT_FOUND); |
|
136 | + } |
|
137 | + |
|
138 | + if ($transferOwnership->getTargetUser() !== $this->userId) { |
|
139 | + return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
140 | + } |
|
141 | + |
|
142 | + $notification = $this->notificationManager->createNotification(); |
|
143 | + $notification->setApp('files') |
|
144 | + ->setObject('transfer', (string)$id); |
|
145 | + $this->notificationManager->markProcessed($notification); |
|
146 | + |
|
147 | + $newTransferOwnership = new TransferOwnershipEntity(); |
|
148 | + $newTransferOwnership->setNodeName($transferOwnership->getNodeName()); |
|
149 | + $newTransferOwnership->setFileId($transferOwnership->getFileId()); |
|
150 | + $newTransferOwnership->setSourceUser($transferOwnership->getSourceUser()); |
|
151 | + $newTransferOwnership->setTargetUser($transferOwnership->getTargetUser()); |
|
152 | + $this->mapper->insert($newTransferOwnership); |
|
153 | + |
|
154 | + $this->jobList->add(TransferOwnership::class, [ |
|
155 | + 'id' => $newTransferOwnership->getId(), |
|
156 | + ]); |
|
157 | + |
|
158 | + return new DataResponse([], Http::STATUS_OK); |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * @NoAdminRequired |
|
163 | + */ |
|
164 | + public function reject(int $id): DataResponse { |
|
165 | + try { |
|
166 | + $transferOwnership = $this->mapper->getById($id); |
|
167 | + } catch (DoesNotExistException $e) { |
|
168 | + return new DataResponse([], Http::STATUS_NOT_FOUND); |
|
169 | + } |
|
170 | + |
|
171 | + if ($transferOwnership->getTargetUser() !== $this->userId) { |
|
172 | + return new DataResponse([], Http::STATUS_FORBIDDEN); |
|
173 | + } |
|
174 | + |
|
175 | + $notification = $this->notificationManager->createNotification(); |
|
176 | + $notification->setApp('files') |
|
177 | + ->setObject('transfer', (string)$id); |
|
178 | + $this->notificationManager->markProcessed($notification); |
|
179 | + |
|
180 | + $notification = $this->notificationManager->createNotification(); |
|
181 | + $notification->setUser($transferOwnership->getSourceUser()) |
|
182 | + ->setApp($this->appName) |
|
183 | + ->setDateTime($this->timeFactory->getDateTime()) |
|
184 | + ->setSubject('transferownershipRequestDenied', [ |
|
185 | + 'sourceUser' => $transferOwnership->getSourceUser(), |
|
186 | + 'targetUser' => $transferOwnership->getTargetUser(), |
|
187 | + 'nodeName' => $transferOwnership->getNodeName() |
|
188 | + ]) |
|
189 | + ->setObject('transfer', (string)$transferOwnership->getId()); |
|
190 | + $this->notificationManager->notify($notification); |
|
191 | + |
|
192 | + $this->mapper->delete($transferOwnership); |
|
193 | + |
|
194 | + return new DataResponse([], Http::STATUS_OK); |
|
195 | + } |
|
196 | 196 | } |
@@ -135,15 +135,15 @@ |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | if ( |
138 | - $this->testUrl('https://' . $remote . '/ocs-provider/') || |
|
139 | - $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || |
|
140 | - $this->testUrl('https://' . $remote . '/status.php', true) |
|
138 | + $this->testUrl('https://'.$remote.'/ocs-provider/') || |
|
139 | + $this->testUrl('https://'.$remote.'/ocs-provider/index.php') || |
|
140 | + $this->testUrl('https://'.$remote.'/status.php', true) |
|
141 | 141 | ) { |
142 | 142 | return new DataResponse('https'); |
143 | 143 | } elseif ( |
144 | - $this->testUrl('http://' . $remote . '/ocs-provider/') || |
|
145 | - $this->testUrl('http://' . $remote . '/ocs-provider/index.php') || |
|
146 | - $this->testUrl('http://' . $remote . '/status.php', true) |
|
144 | + $this->testUrl('http://'.$remote.'/ocs-provider/') || |
|
145 | + $this->testUrl('http://'.$remote.'/ocs-provider/index.php') || |
|
146 | + $this->testUrl('http://'.$remote.'/status.php', true) |
|
147 | 147 | ) { |
148 | 148 | return new DataResponse('http'); |
149 | 149 | } else { |
@@ -40,115 +40,115 @@ |
||
40 | 40 | */ |
41 | 41 | class ExternalSharesController extends Controller { |
42 | 42 | |
43 | - /** @var \OCA\Files_Sharing\External\Manager */ |
|
44 | - private $externalManager; |
|
45 | - /** @var IClientService */ |
|
46 | - private $clientService; |
|
43 | + /** @var \OCA\Files_Sharing\External\Manager */ |
|
44 | + private $externalManager; |
|
45 | + /** @var IClientService */ |
|
46 | + private $clientService; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param string $appName |
|
50 | - * @param IRequest $request |
|
51 | - * @param \OCA\Files_Sharing\External\Manager $externalManager |
|
52 | - * @param IClientService $clientService |
|
53 | - */ |
|
54 | - public function __construct($appName, |
|
55 | - IRequest $request, |
|
56 | - \OCA\Files_Sharing\External\Manager $externalManager, |
|
57 | - IClientService $clientService) { |
|
58 | - parent::__construct($appName, $request); |
|
59 | - $this->externalManager = $externalManager; |
|
60 | - $this->clientService = $clientService; |
|
61 | - } |
|
48 | + /** |
|
49 | + * @param string $appName |
|
50 | + * @param IRequest $request |
|
51 | + * @param \OCA\Files_Sharing\External\Manager $externalManager |
|
52 | + * @param IClientService $clientService |
|
53 | + */ |
|
54 | + public function __construct($appName, |
|
55 | + IRequest $request, |
|
56 | + \OCA\Files_Sharing\External\Manager $externalManager, |
|
57 | + IClientService $clientService) { |
|
58 | + parent::__construct($appName, $request); |
|
59 | + $this->externalManager = $externalManager; |
|
60 | + $this->clientService = $clientService; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @NoAdminRequired |
|
65 | - * @NoOutgoingFederatedSharingRequired |
|
66 | - * |
|
67 | - * @return JSONResponse |
|
68 | - */ |
|
69 | - public function index() { |
|
70 | - return new JSONResponse($this->externalManager->getOpenShares()); |
|
71 | - } |
|
63 | + /** |
|
64 | + * @NoAdminRequired |
|
65 | + * @NoOutgoingFederatedSharingRequired |
|
66 | + * |
|
67 | + * @return JSONResponse |
|
68 | + */ |
|
69 | + public function index() { |
|
70 | + return new JSONResponse($this->externalManager->getOpenShares()); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @NoAdminRequired |
|
75 | - * @NoOutgoingFederatedSharingRequired |
|
76 | - * |
|
77 | - * @param int $id |
|
78 | - * @return JSONResponse |
|
79 | - */ |
|
80 | - public function create($id) { |
|
81 | - $this->externalManager->acceptShare($id); |
|
82 | - return new JSONResponse(); |
|
83 | - } |
|
73 | + /** |
|
74 | + * @NoAdminRequired |
|
75 | + * @NoOutgoingFederatedSharingRequired |
|
76 | + * |
|
77 | + * @param int $id |
|
78 | + * @return JSONResponse |
|
79 | + */ |
|
80 | + public function create($id) { |
|
81 | + $this->externalManager->acceptShare($id); |
|
82 | + return new JSONResponse(); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @NoAdminRequired |
|
87 | - * @NoOutgoingFederatedSharingRequired |
|
88 | - * |
|
89 | - * @param integer $id |
|
90 | - * @return JSONResponse |
|
91 | - */ |
|
92 | - public function destroy($id) { |
|
93 | - $this->externalManager->declineShare($id); |
|
94 | - return new JSONResponse(); |
|
95 | - } |
|
85 | + /** |
|
86 | + * @NoAdminRequired |
|
87 | + * @NoOutgoingFederatedSharingRequired |
|
88 | + * |
|
89 | + * @param integer $id |
|
90 | + * @return JSONResponse |
|
91 | + */ |
|
92 | + public function destroy($id) { |
|
93 | + $this->externalManager->declineShare($id); |
|
94 | + return new JSONResponse(); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Test whether the specified remote is accessible |
|
99 | - * |
|
100 | - * @param string $remote |
|
101 | - * @param bool $checkVersion |
|
102 | - * @return bool |
|
103 | - */ |
|
104 | - protected function testUrl($remote, $checkVersion = false) { |
|
105 | - try { |
|
106 | - $client = $this->clientService->newClient(); |
|
107 | - $response = json_decode($client->get( |
|
108 | - $remote, |
|
109 | - [ |
|
110 | - 'timeout' => 3, |
|
111 | - 'connect_timeout' => 3, |
|
112 | - ] |
|
113 | - )->getBody()); |
|
97 | + /** |
|
98 | + * Test whether the specified remote is accessible |
|
99 | + * |
|
100 | + * @param string $remote |
|
101 | + * @param bool $checkVersion |
|
102 | + * @return bool |
|
103 | + */ |
|
104 | + protected function testUrl($remote, $checkVersion = false) { |
|
105 | + try { |
|
106 | + $client = $this->clientService->newClient(); |
|
107 | + $response = json_decode($client->get( |
|
108 | + $remote, |
|
109 | + [ |
|
110 | + 'timeout' => 3, |
|
111 | + 'connect_timeout' => 3, |
|
112 | + ] |
|
113 | + )->getBody()); |
|
114 | 114 | |
115 | - if ($checkVersion) { |
|
116 | - return !empty($response->version) && version_compare($response->version, '7.0.0', '>='); |
|
117 | - } else { |
|
118 | - return is_object($response); |
|
119 | - } |
|
120 | - } catch (\Exception $e) { |
|
121 | - return false; |
|
122 | - } |
|
123 | - } |
|
115 | + if ($checkVersion) { |
|
116 | + return !empty($response->version) && version_compare($response->version, '7.0.0', '>='); |
|
117 | + } else { |
|
118 | + return is_object($response); |
|
119 | + } |
|
120 | + } catch (\Exception $e) { |
|
121 | + return false; |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * @PublicPage |
|
127 | - * @NoOutgoingFederatedSharingRequired |
|
128 | - * @NoIncomingFederatedSharingRequired |
|
129 | - * |
|
130 | - * @param string $remote |
|
131 | - * @return DataResponse |
|
132 | - */ |
|
133 | - public function testRemote($remote) { |
|
134 | - if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) { |
|
135 | - return new DataResponse(false); |
|
136 | - } |
|
125 | + /** |
|
126 | + * @PublicPage |
|
127 | + * @NoOutgoingFederatedSharingRequired |
|
128 | + * @NoIncomingFederatedSharingRequired |
|
129 | + * |
|
130 | + * @param string $remote |
|
131 | + * @return DataResponse |
|
132 | + */ |
|
133 | + public function testRemote($remote) { |
|
134 | + if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) { |
|
135 | + return new DataResponse(false); |
|
136 | + } |
|
137 | 137 | |
138 | - if ( |
|
139 | - $this->testUrl('https://' . $remote . '/ocs-provider/') || |
|
140 | - $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || |
|
141 | - $this->testUrl('https://' . $remote . '/status.php', true) |
|
142 | - ) { |
|
143 | - return new DataResponse('https'); |
|
144 | - } elseif ( |
|
145 | - $this->testUrl('http://' . $remote . '/ocs-provider/') || |
|
146 | - $this->testUrl('http://' . $remote . '/ocs-provider/index.php') || |
|
147 | - $this->testUrl('http://' . $remote . '/status.php', true) |
|
148 | - ) { |
|
149 | - return new DataResponse('http'); |
|
150 | - } else { |
|
151 | - return new DataResponse(false); |
|
152 | - } |
|
153 | - } |
|
138 | + if ( |
|
139 | + $this->testUrl('https://' . $remote . '/ocs-provider/') || |
|
140 | + $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || |
|
141 | + $this->testUrl('https://' . $remote . '/status.php', true) |
|
142 | + ) { |
|
143 | + return new DataResponse('https'); |
|
144 | + } elseif ( |
|
145 | + $this->testUrl('http://' . $remote . '/ocs-provider/') || |
|
146 | + $this->testUrl('http://' . $remote . '/ocs-provider/index.php') || |
|
147 | + $this->testUrl('http://' . $remote . '/status.php', true) |
|
148 | + ) { |
|
149 | + return new DataResponse('http'); |
|
150 | + } else { |
|
151 | + return new DataResponse(false); |
|
152 | + } |
|
153 | + } |
|
154 | 154 | } |
@@ -33,61 +33,61 @@ |
||
33 | 33 | |
34 | 34 | class Version010000Date20200304152605 extends SimpleMigrationStep { |
35 | 35 | |
36 | - /** |
|
37 | - * @param IOutput $output |
|
38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | - * @param array $options |
|
40 | - * |
|
41 | - * @return ISchemaWrapper |
|
42 | - */ |
|
43 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | - /** @var ISchemaWrapper $schema */ |
|
45 | - $schema = $schemaClosure(); |
|
36 | + /** |
|
37 | + * @param IOutput $output |
|
38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | + * @param array $options |
|
40 | + * |
|
41 | + * @return ISchemaWrapper |
|
42 | + */ |
|
43 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | + /** @var ISchemaWrapper $schema */ |
|
45 | + $schema = $schemaClosure(); |
|
46 | 46 | |
47 | - $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | - $table->addColumn('id', 'integer', [ |
|
49 | - 'autoincrement' => true, |
|
50 | - 'notnull' => true, |
|
51 | - 'length' => 4, |
|
52 | - ]); |
|
53 | - $table->addColumn('actor_uid', 'string', [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 64, |
|
56 | - ]); |
|
57 | - $table->addColumn('uid', 'string', [ |
|
58 | - 'notnull' => false, |
|
59 | - 'length' => 64, |
|
60 | - ]); |
|
61 | - $table->addColumn('email', 'string', [ |
|
62 | - 'notnull' => false, |
|
63 | - 'length' => 255, |
|
64 | - ]); |
|
65 | - $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | - 'notnull' => false, |
|
67 | - 'length' => 255, |
|
68 | - ]); |
|
69 | - $table->addColumn('card', 'blob', [ |
|
70 | - 'notnull' => true, |
|
71 | - ]); |
|
72 | - $table->addColumn('last_contact', 'integer', [ |
|
73 | - 'notnull' => true, |
|
74 | - 'length' => 4, |
|
75 | - ]); |
|
76 | - $table->setPrimaryKey(['id']); |
|
77 | - // To find all recent entries |
|
78 | - $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | - // To find a specific entry |
|
80 | - $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | - // To find all recent entries with a given UID |
|
82 | - $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | - // To find all recent entries with a given email address |
|
84 | - $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | - // To find all recent entries with a give federated cloud id |
|
86 | - $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | - // For the cleanup |
|
88 | - $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
47 | + $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | + $table->addColumn('id', 'integer', [ |
|
49 | + 'autoincrement' => true, |
|
50 | + 'notnull' => true, |
|
51 | + 'length' => 4, |
|
52 | + ]); |
|
53 | + $table->addColumn('actor_uid', 'string', [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 64, |
|
56 | + ]); |
|
57 | + $table->addColumn('uid', 'string', [ |
|
58 | + 'notnull' => false, |
|
59 | + 'length' => 64, |
|
60 | + ]); |
|
61 | + $table->addColumn('email', 'string', [ |
|
62 | + 'notnull' => false, |
|
63 | + 'length' => 255, |
|
64 | + ]); |
|
65 | + $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | + 'notnull' => false, |
|
67 | + 'length' => 255, |
|
68 | + ]); |
|
69 | + $table->addColumn('card', 'blob', [ |
|
70 | + 'notnull' => true, |
|
71 | + ]); |
|
72 | + $table->addColumn('last_contact', 'integer', [ |
|
73 | + 'notnull' => true, |
|
74 | + 'length' => 4, |
|
75 | + ]); |
|
76 | + $table->setPrimaryKey(['id']); |
|
77 | + // To find all recent entries |
|
78 | + $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | + // To find a specific entry |
|
80 | + $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | + // To find all recent entries with a given UID |
|
82 | + $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | + // To find all recent entries with a given email address |
|
84 | + $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | + // To find all recent entries with a give federated cloud id |
|
86 | + $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | + // For the cleanup |
|
88 | + $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
89 | 89 | |
90 | - return $schema; |
|
91 | - } |
|
90 | + return $schema; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -75,17 +75,17 @@ |
||
75 | 75 | ]); |
76 | 76 | $table->setPrimaryKey(['id']); |
77 | 77 | // To find all recent entries |
78 | - $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
78 | + $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME.'_actor_uid'); |
|
79 | 79 | // To find a specific entry |
80 | - $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
80 | + $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME.'_id_uid'); |
|
81 | 81 | // To find all recent entries with a given UID |
82 | - $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
82 | + $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME.'_uid'); |
|
83 | 83 | // To find all recent entries with a given email address |
84 | - $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
84 | + $table->addIndex(['email'], RecentContactMapper::TABLE_NAME.'_email'); |
|
85 | 85 | // To find all recent entries with a give federated cloud id |
86 | - $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
86 | + $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME.'_fed_id'); |
|
87 | 87 | // For the cleanup |
88 | - $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
88 | + $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME.'_last_contact'); |
|
89 | 89 | |
90 | 90 | return $schema; |
91 | 91 | } |