@@ -22,10 +22,10 @@ |
||
22 | 22 | $dispatcher = \OC::$server->getEventDispatcher(); |
23 | 23 | |
24 | 24 | $dispatcher->addListener('OC\AccountManager::userUpdated', function(\Symfony\Component\EventDispatcher\GenericEvent $event) { |
25 | - /** @var \OCP\IUser $user */ |
|
26 | - $user = $event->getSubject(); |
|
25 | + /** @var \OCP\IUser $user */ |
|
26 | + $user = $event->getSubject(); |
|
27 | 27 | |
28 | - /** @var \OCA\LookupServerConnector\UpdateLookupServer $updateLookupServer */ |
|
29 | - $updateLookupServer = \OC::$server->query(\OCA\LookupServerConnector\UpdateLookupServer::class); |
|
30 | - $updateLookupServer->userUpdated($user); |
|
28 | + /** @var \OCA\LookupServerConnector\UpdateLookupServer $updateLookupServer */ |
|
29 | + $updateLookupServer = \OC::$server->query(\OCA\LookupServerConnector\UpdateLookupServer::class); |
|
30 | + $updateLookupServer->userUpdated($user); |
|
31 | 31 | }); |
@@ -36,108 +36,108 @@ |
||
36 | 36 | * @package OCA\LookupServerConnector |
37 | 37 | */ |
38 | 38 | class UpdateLookupServer { |
39 | - /** @var AccountManager */ |
|
40 | - private $accountManager; |
|
41 | - /** @var IClientService */ |
|
42 | - private $clientService; |
|
43 | - /** @var Signer */ |
|
44 | - private $signer; |
|
45 | - /** @var IJobList */ |
|
46 | - private $jobList; |
|
47 | - /** @var string URL point to lookup server */ |
|
48 | - private $lookupServer; |
|
39 | + /** @var AccountManager */ |
|
40 | + private $accountManager; |
|
41 | + /** @var IClientService */ |
|
42 | + private $clientService; |
|
43 | + /** @var Signer */ |
|
44 | + private $signer; |
|
45 | + /** @var IJobList */ |
|
46 | + private $jobList; |
|
47 | + /** @var string URL point to lookup server */ |
|
48 | + private $lookupServer; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param AccountManager $accountManager |
|
52 | - * @param IClientService $clientService |
|
53 | - * @param Signer $signer |
|
54 | - * @param IJobList $jobList |
|
55 | - * @param IConfig $config |
|
56 | - */ |
|
57 | - public function __construct(AccountManager $accountManager, |
|
58 | - IClientService $clientService, |
|
59 | - Signer $signer, |
|
60 | - IJobList $jobList, |
|
61 | - IConfig $config) { |
|
62 | - $this->accountManager = $accountManager; |
|
63 | - $this->clientService = $clientService; |
|
64 | - $this->signer = $signer; |
|
65 | - $this->jobList = $jobList; |
|
50 | + /** |
|
51 | + * @param AccountManager $accountManager |
|
52 | + * @param IClientService $clientService |
|
53 | + * @param Signer $signer |
|
54 | + * @param IJobList $jobList |
|
55 | + * @param IConfig $config |
|
56 | + */ |
|
57 | + public function __construct(AccountManager $accountManager, |
|
58 | + IClientService $clientService, |
|
59 | + Signer $signer, |
|
60 | + IJobList $jobList, |
|
61 | + IConfig $config) { |
|
62 | + $this->accountManager = $accountManager; |
|
63 | + $this->clientService = $clientService; |
|
64 | + $this->signer = $signer; |
|
65 | + $this->jobList = $jobList; |
|
66 | 66 | |
67 | - $this->lookupServer = $config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com'); |
|
68 | - $this->lookupServer = rtrim($this->lookupServer, '/'); |
|
69 | - $this->lookupServer .= '/users'; |
|
70 | - } |
|
67 | + $this->lookupServer = $config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com'); |
|
68 | + $this->lookupServer = rtrim($this->lookupServer, '/'); |
|
69 | + $this->lookupServer .= '/users'; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param IUser $user |
|
74 | - */ |
|
75 | - public function userUpdated(IUser $user) { |
|
76 | - $userData = $this->accountManager->getUser($user); |
|
77 | - $publicData = []; |
|
72 | + /** |
|
73 | + * @param IUser $user |
|
74 | + */ |
|
75 | + public function userUpdated(IUser $user) { |
|
76 | + $userData = $this->accountManager->getUser($user); |
|
77 | + $publicData = []; |
|
78 | 78 | |
79 | - foreach ($userData as $key => $data) { |
|
80 | - if ($data['scope'] === AccountManager::VISIBILITY_PUBLIC) { |
|
81 | - $publicData[$key] = $data; |
|
82 | - } |
|
83 | - } |
|
79 | + foreach ($userData as $key => $data) { |
|
80 | + if ($data['scope'] === AccountManager::VISIBILITY_PUBLIC) { |
|
81 | + $publicData[$key] = $data; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | - $this->sendToLookupServer($user, $publicData); |
|
86 | - } |
|
85 | + $this->sendToLookupServer($user, $publicData); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * send public user data to the lookup server |
|
90 | - * |
|
91 | - * @param IUser $user |
|
92 | - * @param array $publicData |
|
93 | - */ |
|
94 | - protected function sendToLookupServer(IUser $user, array $publicData) { |
|
88 | + /** |
|
89 | + * send public user data to the lookup server |
|
90 | + * |
|
91 | + * @param IUser $user |
|
92 | + * @param array $publicData |
|
93 | + */ |
|
94 | + protected function sendToLookupServer(IUser $user, array $publicData) { |
|
95 | 95 | |
96 | - $dataArray = ['federationId' => $user->getCloudId()]; |
|
96 | + $dataArray = ['federationId' => $user->getCloudId()]; |
|
97 | 97 | |
98 | - if (!empty($publicData)) { |
|
99 | - $dataArray['name'] = isset($publicData[AccountManager::PROPERTY_DISPLAYNAME]) ? $publicData[AccountManager::PROPERTY_DISPLAYNAME]['value'] : ''; |
|
100 | - $dataArray['email'] = isset($publicData[AccountManager::PROPERTY_EMAIL]) ? $publicData[AccountManager::PROPERTY_EMAIL]['value'] : ''; |
|
101 | - $dataArray['address'] = isset($publicData[AccountManager::PROPERTY_ADDRESS]) ? $publicData[AccountManager::PROPERTY_ADDRESS]['value'] : ''; |
|
102 | - $dataArray['website'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['value'] : ''; |
|
103 | - $dataArray['twitter'] = isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['value'] : ''; |
|
104 | - $dataArray['phone'] = isset($publicData[AccountManager::PROPERTY_PHONE]) ? $publicData[AccountManager::PROPERTY_PHONE]['value'] : ''; |
|
105 | - $dataArray['twitter_signature'] = isset($publicData[AccountManager::PROPERTY_TWITTER]['signature']) ? $publicData[AccountManager::PROPERTY_TWITTER]['signature'] : ''; |
|
106 | - $dataArray['website_signature'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]['signature']) ? $publicData[AccountManager::PROPERTY_WEBSITE]['signature'] : ''; |
|
107 | - $dataArray['verificationStatus'] = |
|
108 | - [ |
|
109 | - AccountManager::PROPERTY_WEBSITE => isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['verified'] : '', |
|
110 | - AccountManager::PROPERTY_TWITTER => isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['verified'] : '', |
|
111 | - ]; |
|
112 | - } |
|
98 | + if (!empty($publicData)) { |
|
99 | + $dataArray['name'] = isset($publicData[AccountManager::PROPERTY_DISPLAYNAME]) ? $publicData[AccountManager::PROPERTY_DISPLAYNAME]['value'] : ''; |
|
100 | + $dataArray['email'] = isset($publicData[AccountManager::PROPERTY_EMAIL]) ? $publicData[AccountManager::PROPERTY_EMAIL]['value'] : ''; |
|
101 | + $dataArray['address'] = isset($publicData[AccountManager::PROPERTY_ADDRESS]) ? $publicData[AccountManager::PROPERTY_ADDRESS]['value'] : ''; |
|
102 | + $dataArray['website'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['value'] : ''; |
|
103 | + $dataArray['twitter'] = isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['value'] : ''; |
|
104 | + $dataArray['phone'] = isset($publicData[AccountManager::PROPERTY_PHONE]) ? $publicData[AccountManager::PROPERTY_PHONE]['value'] : ''; |
|
105 | + $dataArray['twitter_signature'] = isset($publicData[AccountManager::PROPERTY_TWITTER]['signature']) ? $publicData[AccountManager::PROPERTY_TWITTER]['signature'] : ''; |
|
106 | + $dataArray['website_signature'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]['signature']) ? $publicData[AccountManager::PROPERTY_WEBSITE]['signature'] : ''; |
|
107 | + $dataArray['verificationStatus'] = |
|
108 | + [ |
|
109 | + AccountManager::PROPERTY_WEBSITE => isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['verified'] : '', |
|
110 | + AccountManager::PROPERTY_TWITTER => isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['verified'] : '', |
|
111 | + ]; |
|
112 | + } |
|
113 | 113 | |
114 | - $dataArray = $this->signer->sign('lookupserver', $dataArray, $user); |
|
115 | - $httpClient = $this->clientService->newClient(); |
|
116 | - try { |
|
117 | - if (empty($publicData)) { |
|
118 | - $httpClient->delete($this->lookupServer, |
|
119 | - [ |
|
120 | - 'body' => json_encode($dataArray), |
|
121 | - 'timeout' => 10, |
|
122 | - 'connect_timeout' => 3, |
|
123 | - ] |
|
124 | - ); |
|
125 | - } else { |
|
126 | - $httpClient->post($this->lookupServer, |
|
127 | - [ |
|
128 | - 'body' => json_encode($dataArray), |
|
129 | - 'timeout' => 10, |
|
130 | - 'connect_timeout' => 3, |
|
131 | - ] |
|
132 | - ); |
|
133 | - } |
|
134 | - } catch (\Exception $e) { |
|
135 | - $this->jobList->add(RetryJob::class, |
|
136 | - [ |
|
137 | - 'dataArray' => $dataArray, |
|
138 | - 'retryNo' => 0, |
|
139 | - ] |
|
140 | - ); |
|
141 | - } |
|
142 | - } |
|
114 | + $dataArray = $this->signer->sign('lookupserver', $dataArray, $user); |
|
115 | + $httpClient = $this->clientService->newClient(); |
|
116 | + try { |
|
117 | + if (empty($publicData)) { |
|
118 | + $httpClient->delete($this->lookupServer, |
|
119 | + [ |
|
120 | + 'body' => json_encode($dataArray), |
|
121 | + 'timeout' => 10, |
|
122 | + 'connect_timeout' => 3, |
|
123 | + ] |
|
124 | + ); |
|
125 | + } else { |
|
126 | + $httpClient->post($this->lookupServer, |
|
127 | + [ |
|
128 | + 'body' => json_encode($dataArray), |
|
129 | + 'timeout' => 10, |
|
130 | + 'connect_timeout' => 3, |
|
131 | + ] |
|
132 | + ); |
|
133 | + } |
|
134 | + } catch (\Exception $e) { |
|
135 | + $this->jobList->add(RetryJob::class, |
|
136 | + [ |
|
137 | + 'dataArray' => $dataArray, |
|
138 | + 'retryNo' => 0, |
|
139 | + ] |
|
140 | + ); |
|
141 | + } |
|
142 | + } |
|
143 | 143 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $json = file_get_contents('php://stdin'); |
113 | 113 | } else { |
114 | 114 | if (!file_exists($path)) { |
115 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
115 | + $output->writeln('<error>File not found: '.$path.'</error>'); |
|
116 | 116 | return 1; |
117 | 117 | } |
118 | 118 | $json = file_get_contents($path); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
165 | 165 | $existingMount->getBackendOptions() === $mount->getBackendOptions() |
166 | 166 | ) { |
167 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
167 | + $output->writeln("<error>Duplicate mount (".$mount->getMountPoint().")</error>"); |
|
168 | 168 | return 1; |
169 | 169 | } |
170 | 170 | } |
@@ -39,187 +39,187 @@ |
||
39 | 39 | use Symfony\Component\Console\Output\OutputInterface; |
40 | 40 | |
41 | 41 | class Import extends Base { |
42 | - /** |
|
43 | - * @var GlobalStoragesService |
|
44 | - */ |
|
45 | - private $globalService; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var UserStoragesService |
|
49 | - */ |
|
50 | - private $userService; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var IUserSession |
|
54 | - */ |
|
55 | - private $userSession; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var IUserManager |
|
59 | - */ |
|
60 | - private $userManager; |
|
61 | - |
|
62 | - /** @var ImportLegacyStoragesService */ |
|
63 | - private $importLegacyStorageService; |
|
64 | - |
|
65 | - /** @var BackendService */ |
|
66 | - private $backendService; |
|
67 | - |
|
68 | - function __construct(GlobalStoragesService $globalService, |
|
69 | - UserStoragesService $userService, |
|
70 | - IUserSession $userSession, |
|
71 | - IUserManager $userManager, |
|
72 | - ImportLegacyStoragesService $importLegacyStorageService, |
|
73 | - BackendService $backendService |
|
74 | - ) { |
|
75 | - parent::__construct(); |
|
76 | - $this->globalService = $globalService; |
|
77 | - $this->userService = $userService; |
|
78 | - $this->userSession = $userSession; |
|
79 | - $this->userManager = $userManager; |
|
80 | - $this->importLegacyStorageService = $importLegacyStorageService; |
|
81 | - $this->backendService = $backendService; |
|
82 | - } |
|
83 | - |
|
84 | - protected function configure() { |
|
85 | - $this |
|
86 | - ->setName('files_external:import') |
|
87 | - ->setDescription('Import mount configurations') |
|
88 | - ->addOption( |
|
89 | - 'user', |
|
90 | - '', |
|
91 | - InputOption::VALUE_OPTIONAL, |
|
92 | - 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
93 | - ) |
|
94 | - ->addArgument( |
|
95 | - 'path', |
|
96 | - InputArgument::REQUIRED, |
|
97 | - 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
98 | - ) |
|
99 | - ->addOption( |
|
100 | - 'dry', |
|
101 | - '', |
|
102 | - InputOption::VALUE_NONE, |
|
103 | - 'Don\'t save the imported mounts, only list the new mounts' |
|
104 | - ); |
|
105 | - parent::configure(); |
|
106 | - } |
|
107 | - |
|
108 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
109 | - $user = $input->getOption('user'); |
|
110 | - $path = $input->getArgument('path'); |
|
111 | - if ($path === '-') { |
|
112 | - $json = file_get_contents('php://stdin'); |
|
113 | - } else { |
|
114 | - if (!file_exists($path)) { |
|
115 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
116 | - return 1; |
|
117 | - } |
|
118 | - $json = file_get_contents($path); |
|
119 | - } |
|
120 | - if (!is_string($json) || strlen($json) < 2) { |
|
121 | - $output->writeln('<error>Error while reading json</error>'); |
|
122 | - return 1; |
|
123 | - } |
|
124 | - $data = json_decode($json, true); |
|
125 | - if (!is_array($data)) { |
|
126 | - $output->writeln('<error>Error while parsing json</error>'); |
|
127 | - return 1; |
|
128 | - } |
|
129 | - |
|
130 | - $isLegacy = isset($data['user']) || isset($data['group']); |
|
131 | - if ($isLegacy) { |
|
132 | - $this->importLegacyStorageService->setData($data); |
|
133 | - $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
134 | - foreach ($mounts as $mount) { |
|
135 | - if ($mount->getBackendOption('password') === false) { |
|
136 | - $output->writeln('<error>Failed to decrypt password</error>'); |
|
137 | - return 1; |
|
138 | - } |
|
139 | - } |
|
140 | - } else { |
|
141 | - if (!isset($data[0])) { //normalize to an array of mounts |
|
142 | - $data = [$data]; |
|
143 | - } |
|
144 | - $mounts = array_map([$this, 'parseData'], $data); |
|
145 | - } |
|
146 | - |
|
147 | - if ($user) { |
|
148 | - // ensure applicables are correct for personal mounts |
|
149 | - foreach ($mounts as $mount) { |
|
150 | - $mount->setApplicableGroups([]); |
|
151 | - $mount->setApplicableUsers([$user]); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - $storageService = $this->getStorageService($user); |
|
156 | - |
|
157 | - $existingMounts = $storageService->getAllStorages(); |
|
158 | - |
|
159 | - foreach ($mounts as $mount) { |
|
160 | - foreach ($existingMounts as $existingMount) { |
|
161 | - if ( |
|
162 | - $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
163 | - $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
164 | - $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
165 | - $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
166 | - ) { |
|
167 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
168 | - return 1; |
|
169 | - } |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - if ($input->getOption('dry')) { |
|
174 | - if (count($mounts) === 0) { |
|
175 | - $output->writeln('<error>No mounts to be imported</error>'); |
|
176 | - return 1; |
|
177 | - } |
|
178 | - $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
179 | - $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
180 | - $listInput->setOption('output', $input->getOption('output')); |
|
181 | - $listInput->setOption('show-password', true); |
|
182 | - $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
183 | - } else { |
|
184 | - foreach ($mounts as $mount) { |
|
185 | - $storageService->addStorage($mount); |
|
186 | - } |
|
187 | - } |
|
188 | - return 0; |
|
189 | - } |
|
190 | - |
|
191 | - private function parseData(array $data) { |
|
192 | - $mount = new StorageConfig($data['mount_id']); |
|
193 | - $mount->setMountPoint($data['mount_point']); |
|
194 | - $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
195 | - $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
196 | - $mount->setAuthMechanism($authBackend); |
|
197 | - $mount->setBackendOptions($data['configuration']); |
|
198 | - $mount->setMountOptions($data['options']); |
|
199 | - $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
200 | - $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
201 | - return $mount; |
|
202 | - } |
|
203 | - |
|
204 | - private function getBackendByClass($className) { |
|
205 | - $backends = $this->backendService->getBackends(); |
|
206 | - foreach ($backends as $backend) { |
|
207 | - if ($backend->getStorageClass() === $className) { |
|
208 | - return $backend; |
|
209 | - } |
|
210 | - } |
|
211 | - } |
|
212 | - |
|
213 | - protected function getStorageService($userId) { |
|
214 | - if (!empty($userId)) { |
|
215 | - $user = $this->userManager->get($userId); |
|
216 | - if (is_null($user)) { |
|
217 | - throw new NoUserException("user $userId not found"); |
|
218 | - } |
|
219 | - $this->userSession->setUser($user); |
|
220 | - return $this->userService; |
|
221 | - } else { |
|
222 | - return $this->globalService; |
|
223 | - } |
|
224 | - } |
|
42 | + /** |
|
43 | + * @var GlobalStoragesService |
|
44 | + */ |
|
45 | + private $globalService; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var UserStoragesService |
|
49 | + */ |
|
50 | + private $userService; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var IUserSession |
|
54 | + */ |
|
55 | + private $userSession; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var IUserManager |
|
59 | + */ |
|
60 | + private $userManager; |
|
61 | + |
|
62 | + /** @var ImportLegacyStoragesService */ |
|
63 | + private $importLegacyStorageService; |
|
64 | + |
|
65 | + /** @var BackendService */ |
|
66 | + private $backendService; |
|
67 | + |
|
68 | + function __construct(GlobalStoragesService $globalService, |
|
69 | + UserStoragesService $userService, |
|
70 | + IUserSession $userSession, |
|
71 | + IUserManager $userManager, |
|
72 | + ImportLegacyStoragesService $importLegacyStorageService, |
|
73 | + BackendService $backendService |
|
74 | + ) { |
|
75 | + parent::__construct(); |
|
76 | + $this->globalService = $globalService; |
|
77 | + $this->userService = $userService; |
|
78 | + $this->userSession = $userSession; |
|
79 | + $this->userManager = $userManager; |
|
80 | + $this->importLegacyStorageService = $importLegacyStorageService; |
|
81 | + $this->backendService = $backendService; |
|
82 | + } |
|
83 | + |
|
84 | + protected function configure() { |
|
85 | + $this |
|
86 | + ->setName('files_external:import') |
|
87 | + ->setDescription('Import mount configurations') |
|
88 | + ->addOption( |
|
89 | + 'user', |
|
90 | + '', |
|
91 | + InputOption::VALUE_OPTIONAL, |
|
92 | + 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
93 | + ) |
|
94 | + ->addArgument( |
|
95 | + 'path', |
|
96 | + InputArgument::REQUIRED, |
|
97 | + 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
98 | + ) |
|
99 | + ->addOption( |
|
100 | + 'dry', |
|
101 | + '', |
|
102 | + InputOption::VALUE_NONE, |
|
103 | + 'Don\'t save the imported mounts, only list the new mounts' |
|
104 | + ); |
|
105 | + parent::configure(); |
|
106 | + } |
|
107 | + |
|
108 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
109 | + $user = $input->getOption('user'); |
|
110 | + $path = $input->getArgument('path'); |
|
111 | + if ($path === '-') { |
|
112 | + $json = file_get_contents('php://stdin'); |
|
113 | + } else { |
|
114 | + if (!file_exists($path)) { |
|
115 | + $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
116 | + return 1; |
|
117 | + } |
|
118 | + $json = file_get_contents($path); |
|
119 | + } |
|
120 | + if (!is_string($json) || strlen($json) < 2) { |
|
121 | + $output->writeln('<error>Error while reading json</error>'); |
|
122 | + return 1; |
|
123 | + } |
|
124 | + $data = json_decode($json, true); |
|
125 | + if (!is_array($data)) { |
|
126 | + $output->writeln('<error>Error while parsing json</error>'); |
|
127 | + return 1; |
|
128 | + } |
|
129 | + |
|
130 | + $isLegacy = isset($data['user']) || isset($data['group']); |
|
131 | + if ($isLegacy) { |
|
132 | + $this->importLegacyStorageService->setData($data); |
|
133 | + $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
134 | + foreach ($mounts as $mount) { |
|
135 | + if ($mount->getBackendOption('password') === false) { |
|
136 | + $output->writeln('<error>Failed to decrypt password</error>'); |
|
137 | + return 1; |
|
138 | + } |
|
139 | + } |
|
140 | + } else { |
|
141 | + if (!isset($data[0])) { //normalize to an array of mounts |
|
142 | + $data = [$data]; |
|
143 | + } |
|
144 | + $mounts = array_map([$this, 'parseData'], $data); |
|
145 | + } |
|
146 | + |
|
147 | + if ($user) { |
|
148 | + // ensure applicables are correct for personal mounts |
|
149 | + foreach ($mounts as $mount) { |
|
150 | + $mount->setApplicableGroups([]); |
|
151 | + $mount->setApplicableUsers([$user]); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + $storageService = $this->getStorageService($user); |
|
156 | + |
|
157 | + $existingMounts = $storageService->getAllStorages(); |
|
158 | + |
|
159 | + foreach ($mounts as $mount) { |
|
160 | + foreach ($existingMounts as $existingMount) { |
|
161 | + if ( |
|
162 | + $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
163 | + $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
164 | + $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
165 | + $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
166 | + ) { |
|
167 | + $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
168 | + return 1; |
|
169 | + } |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + if ($input->getOption('dry')) { |
|
174 | + if (count($mounts) === 0) { |
|
175 | + $output->writeln('<error>No mounts to be imported</error>'); |
|
176 | + return 1; |
|
177 | + } |
|
178 | + $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
179 | + $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
180 | + $listInput->setOption('output', $input->getOption('output')); |
|
181 | + $listInput->setOption('show-password', true); |
|
182 | + $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
183 | + } else { |
|
184 | + foreach ($mounts as $mount) { |
|
185 | + $storageService->addStorage($mount); |
|
186 | + } |
|
187 | + } |
|
188 | + return 0; |
|
189 | + } |
|
190 | + |
|
191 | + private function parseData(array $data) { |
|
192 | + $mount = new StorageConfig($data['mount_id']); |
|
193 | + $mount->setMountPoint($data['mount_point']); |
|
194 | + $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
195 | + $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
196 | + $mount->setAuthMechanism($authBackend); |
|
197 | + $mount->setBackendOptions($data['configuration']); |
|
198 | + $mount->setMountOptions($data['options']); |
|
199 | + $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
200 | + $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
201 | + return $mount; |
|
202 | + } |
|
203 | + |
|
204 | + private function getBackendByClass($className) { |
|
205 | + $backends = $this->backendService->getBackends(); |
|
206 | + foreach ($backends as $backend) { |
|
207 | + if ($backend->getStorageClass() === $className) { |
|
208 | + return $backend; |
|
209 | + } |
|
210 | + } |
|
211 | + } |
|
212 | + |
|
213 | + protected function getStorageService($userId) { |
|
214 | + if (!empty($userId)) { |
|
215 | + $user = $this->userManager->get($userId); |
|
216 | + if (is_null($user)) { |
|
217 | + throw new NoUserException("user $userId not found"); |
|
218 | + } |
|
219 | + $this->userSession->setUser($user); |
|
220 | + return $this->userService; |
|
221 | + } else { |
|
222 | + return $this->globalService; |
|
223 | + } |
|
224 | + } |
|
225 | 225 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $files_list = json_decode($files); |
38 | 38 | // in case we get only a single file |
39 | 39 | if (!is_array($files_list)) { |
40 | - $files_list = array($files); |
|
40 | + $files_list = array($files); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * alphanumeric characters |
47 | 47 | */ |
48 | 48 | if(isset($_GET['downloadStartSecret']) |
49 | - && !isset($_GET['downloadStartSecret'][32]) |
|
50 | - && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | - setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
49 | + && !isset($_GET['downloadStartSecret'][32]) |
|
50 | + && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | + setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Http range requests support |
58 | 58 | */ |
59 | 59 | if (isset($_SERVER['HTTP_RANGE'])) { |
60 | - $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
60 | + $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | OC_Files::get($dir, $files_list, $server_params); |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | OCP\User::checkLoggedIn(); |
32 | 32 | \OC::$server->getSession()->close(); |
33 | 33 | |
34 | -$files = isset($_GET['files']) ? (string)$_GET['files'] : ''; |
|
35 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
34 | +$files = isset($_GET['files']) ? (string) $_GET['files'] : ''; |
|
35 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
36 | 36 | |
37 | 37 | $files_list = json_decode($files); |
38 | 38 | // in case we get only a single file |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * the content must not be longer than 32 characters and must only contain |
46 | 46 | * alphanumeric characters |
47 | 47 | */ |
48 | -if(isset($_GET['downloadStartSecret']) |
|
48 | +if (isset($_GET['downloadStartSecret']) |
|
49 | 49 | && !isset($_GET['downloadStartSecret'][32]) |
50 | 50 | && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
51 | 51 | setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
52 | 52 | } |
53 | 53 | |
54 | -$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ); |
|
54 | +$server_params = array('head' => \OC::$server->getRequest()->getMethod() === 'HEAD'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Http range requests support |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | $query = $this->connection->getQueryBuilder(); |
70 | 70 | $query->update('share') |
71 | - ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
71 | + ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | 72 | ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
73 | 73 | $query->execute(); |
74 | 74 | } |
@@ -36,47 +36,47 @@ |
||
36 | 36 | */ |
37 | 37 | class OwncloudGuestShareType implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | 41 | |
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | 44 | |
45 | 45 | |
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query->update('share') |
|
71 | - ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
|
73 | - $query->execute(); |
|
74 | - } |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query->update('share') |
|
71 | + ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
|
73 | + $query->execute(); |
|
74 | + } |
|
75 | 75 | |
76 | - protected function shouldRun() { |
|
77 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
78 | - return $appVersion === '0.10.0' || |
|
79 | - $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
80 | - } |
|
76 | + protected function shouldRun() { |
|
77 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
78 | + return $appVersion === '0.10.0' || |
|
79 | + $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class SetPasswordColumn implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
41 | - |
|
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
44 | - |
|
45 | - |
|
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Copy the share password into the dedicated column'; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
68 | - |
|
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query |
|
71 | - ->update('share') |
|
72 | - ->set('password', 'share_with') |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | - ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | - $result = $query->execute(); |
|
76 | - |
|
77 | - if ($result === 0) { |
|
78 | - // No link updated, no need to run the second query |
|
79 | - return; |
|
80 | - } |
|
81 | - |
|
82 | - $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | - $clearQuery |
|
84 | - ->update('share') |
|
85 | - ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | - ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | - |
|
88 | - $clearQuery->execute(); |
|
89 | - |
|
90 | - } |
|
91 | - |
|
92 | - protected function shouldRun() { |
|
93 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | - return version_compare($appVersion, '1.4.0', '<'); |
|
95 | - } |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | + |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | + |
|
45 | + |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Copy the share password into the dedicated column'; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | + |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query |
|
71 | + ->update('share') |
|
72 | + ->set('password', 'share_with') |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | + ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | + $result = $query->execute(); |
|
76 | + |
|
77 | + if ($result === 0) { |
|
78 | + // No link updated, no need to run the second query |
|
79 | + return; |
|
80 | + } |
|
81 | + |
|
82 | + $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | + $clearQuery |
|
84 | + ->update('share') |
|
85 | + ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | + ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | + |
|
88 | + $clearQuery->execute(); |
|
89 | + |
|
90 | + } |
|
91 | + |
|
92 | + protected function shouldRun() { |
|
93 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | + return version_compare($appVersion, '1.4.0', '<'); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * ubos-raspberry-pi.local and ubos-raspberry-pi-2.local |
68 | 68 | */ |
69 | 69 | 'trusted_domains' => |
70 | - array ( |
|
70 | + array( |
|
71 | 71 | 'demo.example.org', |
72 | 72 | 'otherdomain.example.org', |
73 | 73 | ), |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * Defaults to ``60*60*24*15`` seconds (15 days) |
194 | 194 | */ |
195 | -'remember_login_cookie_lifetime' => 60*60*24*15, |
|
195 | +'remember_login_cookie_lifetime' => 60 * 60 * 24 * 15, |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * The lifetime of a session after inactivity. |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * See https://redis.io/topics/cluster-spec for details about the Redis cluster |
1075 | 1075 | */ |
1076 | 1076 | 'redis.cluster' => [ |
1077 | - 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1077 | + 'seeds' => [// provide some/all of the cluster servers to bootstrap discovery, port required |
|
1078 | 1078 | 'localhost:7000', |
1079 | 1079 | 'localhost:7001' |
1080 | 1080 | ], |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | * |
1139 | 1139 | * Defaults to ``60*60*24`` (1 day) |
1140 | 1140 | */ |
1141 | -'cache_chunk_gc_ttl' => 60*60*24, |
|
1141 | +'cache_chunk_gc_ttl' => 60 * 60 * 24, |
|
1142 | 1142 | |
1143 | 1143 | /** |
1144 | 1144 | * Using Object Store with Nextcloud |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * Defaults to ``60*60`` seconds (1 hour) or the php |
1463 | 1463 | * max_execution_time, whichever is higher. |
1464 | 1464 | */ |
1465 | -'filelocking.ttl' => 60*60, |
|
1465 | +'filelocking.ttl' => 60 * 60, |
|
1466 | 1466 | |
1467 | 1467 | /** |
1468 | 1468 | * Memory caching backend for file locking |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | 'instanceid' => '', |
43 | 43 | |
44 | - /** |
|
45 | - * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | - * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | - * all your passwords. This example is for documentation only, and you should |
|
48 | - * never use it. |
|
49 | - * |
|
50 | - * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | - * developers should *NOT* use this value for anything nowadays. |
|
52 | - * |
|
53 | - * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | - */ |
|
44 | + /** |
|
45 | + * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | + * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | + * all your passwords. This example is for documentation only, and you should |
|
48 | + * never use it. |
|
49 | + * |
|
50 | + * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | + * developers should *NOT* use this value for anything nowadays. |
|
52 | + * |
|
53 | + * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | + */ |
|
55 | 55 | 'passwordsalt' => '', |
56 | 56 | |
57 | 57 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * ubos-raspberry-pi.local and ubos-raspberry-pi-2.local |
68 | 68 | */ |
69 | 69 | 'trusted_domains' => |
70 | - array ( |
|
70 | + array ( |
|
71 | 71 | 'demo.example.org', |
72 | 72 | 'otherdomain.example.org', |
73 | - ), |
|
73 | + ), |
|
74 | 74 | |
75 | 75 | |
76 | 76 | /** |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * IMAP (OC_User_IMAP), SMB (OC_User_SMB), and FTP (OC_User_FTP). |
284 | 284 | */ |
285 | 285 | 'user_backends' => array( |
286 | - array( |
|
287 | - 'class' => 'OC_User_IMAP', |
|
288 | - 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
289 | - ) |
|
286 | + array( |
|
287 | + 'class' => 'OC_User_IMAP', |
|
288 | + 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
289 | + ) |
|
290 | 290 | ), |
291 | 291 | |
292 | 292 | /** |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * Defaults to an empty array. |
763 | 763 | */ |
764 | 764 | 'log.condition' => [ |
765 | - 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
766 | - 'users' => ['sample-user'], |
|
767 | - 'apps' => ['files'], |
|
765 | + 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
766 | + 'users' => ['sample-user'], |
|
767 | + 'apps' => ['files'], |
|
768 | 768 | ], |
769 | 769 | |
770 | 770 | /** |
@@ -818,18 +818,18 @@ discard block |
||
818 | 818 | * - iOS client app id: ``1125420102`` |
819 | 819 | */ |
820 | 820 | 'customclient_desktop' => |
821 | - 'https://nextcloud.com/install/#install-clients', |
|
821 | + 'https://nextcloud.com/install/#install-clients', |
|
822 | 822 | 'customclient_android' => |
823 | - 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
823 | + 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
824 | 824 | 'customclient_ios' => |
825 | - 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
825 | + 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
826 | 826 | 'customclient_ios_appid' => |
827 | - '1125420102', |
|
827 | + '1125420102', |
|
828 | 828 | /** |
829 | - * Apps |
|
830 | - * |
|
831 | - * Options for the Apps folder, Apps store, and App code checker. |
|
832 | - */ |
|
829 | + * Apps |
|
830 | + * |
|
831 | + * Options for the Apps folder, Apps store, and App code checker. |
|
832 | + */ |
|
833 | 833 | |
834 | 834 | /** |
835 | 835 | * When enabled, admins may install apps from the Nextcloud app store. |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | * indicates if a Web server can write files to that folder. |
848 | 848 | */ |
849 | 849 | 'apps_paths' => array( |
850 | - array( |
|
851 | - 'path'=> '/var/www/nextcloud/apps', |
|
852 | - 'url' => '/apps', |
|
853 | - 'writable' => true, |
|
854 | - ), |
|
850 | + array( |
|
851 | + 'path'=> '/var/www/nextcloud/apps', |
|
852 | + 'url' => '/apps', |
|
853 | + 'writable' => true, |
|
854 | + ), |
|
855 | 855 | ), |
856 | 856 | |
857 | 857 | /** |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | * Defaults to ``''`` (empty string) |
917 | 917 | */ |
918 | 918 | 'preview_office_cl_parameters' => |
919 | - ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
920 | - '--convert-to png --outdir ', |
|
919 | + ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
920 | + '--convert-to png --outdir ', |
|
921 | 921 | |
922 | 922 | /** |
923 | 923 | * Only register providers that have been explicitly enabled |
@@ -960,14 +960,14 @@ discard block |
||
960 | 960 | * - OC\Preview\XBitmap |
961 | 961 | */ |
962 | 962 | 'enabledPreviewProviders' => array( |
963 | - 'OC\Preview\PNG', |
|
964 | - 'OC\Preview\JPEG', |
|
965 | - 'OC\Preview\GIF', |
|
966 | - 'OC\Preview\BMP', |
|
967 | - 'OC\Preview\XBitmap', |
|
968 | - 'OC\Preview\MP3', |
|
969 | - 'OC\Preview\TXT', |
|
970 | - 'OC\Preview\MarkDown' |
|
963 | + 'OC\Preview\PNG', |
|
964 | + 'OC\Preview\JPEG', |
|
965 | + 'OC\Preview\GIF', |
|
966 | + 'OC\Preview\BMP', |
|
967 | + 'OC\Preview\XBitmap', |
|
968 | + 'OC\Preview\MP3', |
|
969 | + 'OC\Preview\TXT', |
|
970 | + 'OC\Preview\MarkDown' |
|
971 | 971 | ), |
972 | 972 | |
973 | 973 | /** |
@@ -1043,11 +1043,11 @@ discard block |
||
1043 | 1043 | |
1044 | 1044 | /** |
1045 | 1045 | * Extra SSL options to be used for configuration. |
1046 | - * |
|
1046 | + * |
|
1047 | 1047 | * Defaults to an empty array. |
1048 | 1048 | */ |
1049 | 1049 | 'openssl' => array( |
1050 | - 'config' => '/absolute/location/of/openssl.cnf', |
|
1050 | + 'config' => '/absolute/location/of/openssl.cnf', |
|
1051 | 1051 | ), |
1052 | 1052 | |
1053 | 1053 | /** |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * for more information. |
1096 | 1096 | */ |
1097 | 1097 | 'redis' => [ |
1098 | - 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1099 | - 'port' => 6379, |
|
1100 | - 'timeout' => 0.0, |
|
1101 | - 'password' => '', // Optional, if not defined no password will be used. |
|
1102 | - 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1098 | + 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1099 | + 'port' => 6379, |
|
1100 | + 'timeout' => 0.0, |
|
1101 | + 'password' => '', // Optional, if not defined no password will be used. |
|
1102 | + 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1103 | 1103 | ], |
1104 | 1104 | |
1105 | 1105 | /** |
@@ -1125,13 +1125,13 @@ discard block |
||
1125 | 1125 | * See https://redis.io/topics/cluster-spec for details about the Redis cluster |
1126 | 1126 | */ |
1127 | 1127 | 'redis.cluster' => [ |
1128 | - 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1129 | - 'localhost:7000', |
|
1130 | - 'localhost:7001' |
|
1131 | - ], |
|
1132 | - 'timeout' => 0.0, |
|
1133 | - 'read_timeout' => 0.0, |
|
1134 | - 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1128 | + 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1129 | + 'localhost:7000', |
|
1130 | + 'localhost:7001' |
|
1131 | + ], |
|
1132 | + 'timeout' => 0.0, |
|
1133 | + 'read_timeout' => 0.0, |
|
1134 | + 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1135 | 1135 | ], |
1136 | 1136 | |
1137 | 1137 | |
@@ -1139,35 +1139,35 @@ discard block |
||
1139 | 1139 | * Server details for one or more memcached servers to use for memory caching. |
1140 | 1140 | */ |
1141 | 1141 | 'memcached_servers' => array( |
1142 | - // hostname, port and optional weight. Also see: |
|
1143 | - // http://www.php.net/manual/en/memcached.addservers.php |
|
1144 | - // http://www.php.net/manual/en/memcached.addserver.php |
|
1145 | - array('localhost', 11211), |
|
1146 | - //array('other.host.local', 11211), |
|
1142 | + // hostname, port and optional weight. Also see: |
|
1143 | + // http://www.php.net/manual/en/memcached.addservers.php |
|
1144 | + // http://www.php.net/manual/en/memcached.addserver.php |
|
1145 | + array('localhost', 11211), |
|
1146 | + //array('other.host.local', 11211), |
|
1147 | 1147 | ), |
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Connection options for memcached, see http://apprize.info/php/scaling/15.html |
1151 | 1151 | */ |
1152 | 1152 | 'memcached_options' => array( |
1153 | - // Set timeouts to 50ms |
|
1154 | - \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1155 | - \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1156 | - \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1157 | - \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1158 | - \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1153 | + // Set timeouts to 50ms |
|
1154 | + \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1155 | + \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1156 | + \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1157 | + \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1158 | + \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1159 | 1159 | |
1160 | - // Enable compression |
|
1161 | - \Memcached::OPT_COMPRESSION => true, |
|
1160 | + // Enable compression |
|
1161 | + \Memcached::OPT_COMPRESSION => true, |
|
1162 | 1162 | |
1163 | - // Turn on consistent hashing |
|
1164 | - \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1163 | + // Turn on consistent hashing |
|
1164 | + \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1165 | 1165 | |
1166 | - // Enable Binary Protocol |
|
1167 | - \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1166 | + // Enable Binary Protocol |
|
1167 | + \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1168 | 1168 | |
1169 | - // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1170 | - //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1169 | + // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1170 | + //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1171 | 1171 | ), |
1172 | 1172 | |
1173 | 1173 | |
@@ -1213,61 +1213,61 @@ discard block |
||
1213 | 1213 | * One way to test is applying for a trystack account at http://trystack.org/ |
1214 | 1214 | */ |
1215 | 1215 | 'objectstore' => [ |
1216 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1217 | - 'arguments' => [ |
|
1218 | - // trystack will use your facebook id as the user name |
|
1219 | - 'username' => 'facebook100000123456789', |
|
1220 | - // in the trystack dashboard go to user -> settings -> API Password to |
|
1221 | - // generate a password |
|
1222 | - 'password' => 'Secr3tPaSSWoRdt7', |
|
1223 | - // must already exist in the objectstore, name can be different |
|
1224 | - 'container' => 'nextcloud', |
|
1225 | - // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1226 | - 'objectPrefix' => 'oid:urn:', |
|
1227 | - // create the container if it does not exist. default is false |
|
1228 | - 'autocreate' => true, |
|
1229 | - // required, dev-/trystack defaults to 'RegionOne' |
|
1230 | - 'region' => 'RegionOne', |
|
1231 | - // The Identity / Keystone endpoint |
|
1232 | - 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1233 | - // required on dev-/trystack |
|
1234 | - 'tenantName' => 'facebook100000123456789', |
|
1235 | - // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1236 | - // if omitted |
|
1237 | - 'serviceName' => 'swift', |
|
1238 | - // The Interface / url Type, optional |
|
1239 | - 'urlType' => 'internal' |
|
1240 | - ], |
|
1216 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1217 | + 'arguments' => [ |
|
1218 | + // trystack will use your facebook id as the user name |
|
1219 | + 'username' => 'facebook100000123456789', |
|
1220 | + // in the trystack dashboard go to user -> settings -> API Password to |
|
1221 | + // generate a password |
|
1222 | + 'password' => 'Secr3tPaSSWoRdt7', |
|
1223 | + // must already exist in the objectstore, name can be different |
|
1224 | + 'container' => 'nextcloud', |
|
1225 | + // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1226 | + 'objectPrefix' => 'oid:urn:', |
|
1227 | + // create the container if it does not exist. default is false |
|
1228 | + 'autocreate' => true, |
|
1229 | + // required, dev-/trystack defaults to 'RegionOne' |
|
1230 | + 'region' => 'RegionOne', |
|
1231 | + // The Identity / Keystone endpoint |
|
1232 | + 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1233 | + // required on dev-/trystack |
|
1234 | + 'tenantName' => 'facebook100000123456789', |
|
1235 | + // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1236 | + // if omitted |
|
1237 | + 'serviceName' => 'swift', |
|
1238 | + // The Interface / url Type, optional |
|
1239 | + 'urlType' => 'internal' |
|
1240 | + ], |
|
1241 | 1241 | ], |
1242 | 1242 | |
1243 | 1243 | /** |
1244 | 1244 | * To use swift V3 |
1245 | 1245 | */ |
1246 | 1246 | 'objectstore' => [ |
1247 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1248 | - 'arguments' => [ |
|
1249 | - 'autocreate' => true, |
|
1250 | - 'user' => [ |
|
1251 | - 'name' => 'swift', |
|
1252 | - 'password' => 'swift', |
|
1253 | - 'domain' => [ |
|
1254 | - 'name' => 'default', |
|
1255 | - ], |
|
1256 | - ], |
|
1257 | - 'scope' => [ |
|
1258 | - 'project' => [ |
|
1259 | - 'name' => 'service', |
|
1260 | - 'domain' => [ |
|
1261 | - 'name' => 'default', |
|
1262 | - ], |
|
1263 | - ], |
|
1264 | - ], |
|
1265 | - 'tenantName' => 'service', |
|
1266 | - 'serviceName' => 'swift', |
|
1267 | - 'region' => 'regionOne', |
|
1268 | - 'url' => 'http://yourswifthost:5000/v3', |
|
1269 | - 'bucket' => 'nextcloud', |
|
1270 | - ], |
|
1247 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1248 | + 'arguments' => [ |
|
1249 | + 'autocreate' => true, |
|
1250 | + 'user' => [ |
|
1251 | + 'name' => 'swift', |
|
1252 | + 'password' => 'swift', |
|
1253 | + 'domain' => [ |
|
1254 | + 'name' => 'default', |
|
1255 | + ], |
|
1256 | + ], |
|
1257 | + 'scope' => [ |
|
1258 | + 'project' => [ |
|
1259 | + 'name' => 'service', |
|
1260 | + 'domain' => [ |
|
1261 | + 'name' => 'default', |
|
1262 | + ], |
|
1263 | + ], |
|
1264 | + ], |
|
1265 | + 'tenantName' => 'service', |
|
1266 | + 'serviceName' => 'swift', |
|
1267 | + 'region' => 'regionOne', |
|
1268 | + 'url' => 'http://yourswifthost:5000/v3', |
|
1269 | + 'bucket' => 'nextcloud', |
|
1270 | + ], |
|
1271 | 1271 | ], |
1272 | 1272 | |
1273 | 1273 | |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | * encryption in MySQL or specify a custom wait timeout on a cheap hoster. |
1308 | 1308 | */ |
1309 | 1309 | 'dbdriveroptions' => array( |
1310 | - PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1311 | - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1310 | + PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1311 | + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1312 | 1312 | ), |
1313 | 1313 | |
1314 | 1314 | /** |
@@ -1365,10 +1365,10 @@ discard block |
||
1365 | 1365 | * - pgsql (PostgreSQL) |
1366 | 1366 | */ |
1367 | 1367 | 'supportedDatabases' => array( |
1368 | - 'sqlite', |
|
1369 | - 'mysql', |
|
1370 | - 'pgsql', |
|
1371 | - 'oci', |
|
1368 | + 'sqlite', |
|
1369 | + 'mysql', |
|
1370 | + 'pgsql', |
|
1371 | + 'oci', |
|
1372 | 1372 | ), |
1373 | 1373 | |
1374 | 1374 | /** |
@@ -1628,8 +1628,8 @@ discard block |
||
1628 | 1628 | * WARNING: only use this if you know what you are doing |
1629 | 1629 | */ |
1630 | 1630 | 'csrf.optout' => array( |
1631 | - '/^WebDAVFS/', // OS X Finder |
|
1632 | - '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1631 | + '/^WebDAVFS/', // OS X Finder |
|
1632 | + '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1633 | 1633 | ), |
1634 | 1634 | |
1635 | 1635 | ); |
@@ -28,26 +28,26 @@ |
||
28 | 28 | use OCP\ILogger; |
29 | 29 | |
30 | 30 | class CategoryFetcher extends Fetcher { |
31 | - /** |
|
32 | - * @param Factory $appDataFactory |
|
33 | - * @param IClientService $clientService |
|
34 | - * @param ITimeFactory $timeFactory |
|
35 | - * @param IConfig $config |
|
36 | - * @param ILogger $logger |
|
37 | - */ |
|
38 | - public function __construct(Factory $appDataFactory, |
|
39 | - IClientService $clientService, |
|
40 | - ITimeFactory $timeFactory, |
|
41 | - IConfig $config, |
|
42 | - ILogger $logger) { |
|
43 | - parent::__construct( |
|
44 | - $appDataFactory, |
|
45 | - $clientService, |
|
46 | - $timeFactory, |
|
47 | - $config, |
|
48 | - $logger |
|
49 | - ); |
|
50 | - $this->fileName = 'categories.json'; |
|
51 | - $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | - } |
|
31 | + /** |
|
32 | + * @param Factory $appDataFactory |
|
33 | + * @param IClientService $clientService |
|
34 | + * @param ITimeFactory $timeFactory |
|
35 | + * @param IConfig $config |
|
36 | + * @param ILogger $logger |
|
37 | + */ |
|
38 | + public function __construct(Factory $appDataFactory, |
|
39 | + IClientService $clientService, |
|
40 | + ITimeFactory $timeFactory, |
|
41 | + IConfig $config, |
|
42 | + ILogger $logger) { |
|
43 | + parent::__construct( |
|
44 | + $appDataFactory, |
|
45 | + $clientService, |
|
46 | + $timeFactory, |
|
47 | + $config, |
|
48 | + $logger |
|
49 | + ); |
|
50 | + $this->fileName = 'categories.json'; |
|
51 | + $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | + } |
|
53 | 53 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setName(string $name) |
35 | 35 | */ |
36 | 36 | class Client extends Entity { |
37 | - /** @var string */ |
|
38 | - protected $name; |
|
39 | - /** @var string */ |
|
40 | - protected $redirectUri; |
|
41 | - /** @var string */ |
|
42 | - protected $clientIdentifier; |
|
43 | - /** @var string */ |
|
44 | - protected $secret; |
|
37 | + /** @var string */ |
|
38 | + protected $name; |
|
39 | + /** @var string */ |
|
40 | + protected $redirectUri; |
|
41 | + /** @var string */ |
|
42 | + protected $clientIdentifier; |
|
43 | + /** @var string */ |
|
44 | + protected $secret; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('name', 'string'); |
|
49 | - $this->addType('redirect_uri', 'string'); |
|
50 | - $this->addType('client_identifier', 'string'); |
|
51 | - $this->addType('secret', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('name', 'string'); |
|
49 | + $this->addType('redirect_uri', 'string'); |
|
50 | + $this->addType('client_identifier', 'string'); |
|
51 | + $this->addType('secret', 'string'); |
|
52 | + } |
|
53 | 53 | } |