@@ -26,65 +26,65 @@ |
||
26 | 26 | use OCP\Diagnostics\IQuery; |
27 | 27 | |
28 | 28 | class Query implements IQuery { |
29 | - private $sql; |
|
29 | + private $sql; |
|
30 | 30 | |
31 | - private $params; |
|
31 | + private $params; |
|
32 | 32 | |
33 | - private $start; |
|
33 | + private $start; |
|
34 | 34 | |
35 | - private $end; |
|
35 | + private $end; |
|
36 | 36 | |
37 | - private $stack; |
|
37 | + private $stack; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $sql |
|
41 | - * @param array $params |
|
42 | - * @param int $start |
|
43 | - */ |
|
44 | - public function __construct($sql, $params, $start, array $stack) { |
|
45 | - $this->sql = $sql; |
|
46 | - $this->params = $params; |
|
47 | - $this->start = $start; |
|
48 | - $this->stack = $stack; |
|
49 | - } |
|
39 | + /** |
|
40 | + * @param string $sql |
|
41 | + * @param array $params |
|
42 | + * @param int $start |
|
43 | + */ |
|
44 | + public function __construct($sql, $params, $start, array $stack) { |
|
45 | + $this->sql = $sql; |
|
46 | + $this->params = $params; |
|
47 | + $this->start = $start; |
|
48 | + $this->stack = $stack; |
|
49 | + } |
|
50 | 50 | |
51 | - public function end($time) { |
|
52 | - $this->end = $time; |
|
53 | - } |
|
51 | + public function end($time) { |
|
52 | + $this->end = $time; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getParams() { |
|
59 | - return $this->params; |
|
60 | - } |
|
55 | + /** |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getParams() { |
|
59 | + return $this->params; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getSql() { |
|
66 | - return $this->sql; |
|
67 | - } |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getSql() { |
|
66 | + return $this->sql; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return float |
|
71 | - */ |
|
72 | - public function getStart() { |
|
73 | - return $this->start; |
|
74 | - } |
|
69 | + /** |
|
70 | + * @return float |
|
71 | + */ |
|
72 | + public function getStart() { |
|
73 | + return $this->start; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return float |
|
78 | - */ |
|
79 | - public function getDuration() { |
|
80 | - return $this->end - $this->start; |
|
81 | - } |
|
76 | + /** |
|
77 | + * @return float |
|
78 | + */ |
|
79 | + public function getDuration() { |
|
80 | + return $this->end - $this->start; |
|
81 | + } |
|
82 | 82 | |
83 | - public function getStartTime() { |
|
84 | - return $this->start; |
|
85 | - } |
|
83 | + public function getStartTime() { |
|
84 | + return $this->start; |
|
85 | + } |
|
86 | 86 | |
87 | - public function getStacktrace() { |
|
88 | - return $this->stack; |
|
89 | - } |
|
87 | + public function getStacktrace() { |
|
88 | + return $this->stack; |
|
89 | + } |
|
90 | 90 | } |
@@ -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 | } |
@@ -40,168 +40,168 @@ |
||
40 | 40 | use Symfony\Component\Console\Output\OutputInterface; |
41 | 41 | |
42 | 42 | class Import extends Base { |
43 | - private GlobalStoragesService $globalService; |
|
44 | - private UserStoragesService $userService; |
|
45 | - private IUserSession $userSession; |
|
46 | - private IUserManager $userManager; |
|
47 | - private ImportLegacyStoragesService $importLegacyStorageService; |
|
48 | - private BackendService $backendService; |
|
43 | + private GlobalStoragesService $globalService; |
|
44 | + private UserStoragesService $userService; |
|
45 | + private IUserSession $userSession; |
|
46 | + private IUserManager $userManager; |
|
47 | + private ImportLegacyStoragesService $importLegacyStorageService; |
|
48 | + private BackendService $backendService; |
|
49 | 49 | |
50 | - public function __construct(GlobalStoragesService $globalService, |
|
51 | - UserStoragesService $userService, |
|
52 | - IUserSession $userSession, |
|
53 | - IUserManager $userManager, |
|
54 | - ImportLegacyStoragesService $importLegacyStorageService, |
|
55 | - BackendService $backendService |
|
56 | - ) { |
|
57 | - parent::__construct(); |
|
58 | - $this->globalService = $globalService; |
|
59 | - $this->userService = $userService; |
|
60 | - $this->userSession = $userSession; |
|
61 | - $this->userManager = $userManager; |
|
62 | - $this->importLegacyStorageService = $importLegacyStorageService; |
|
63 | - $this->backendService = $backendService; |
|
64 | - } |
|
50 | + public function __construct(GlobalStoragesService $globalService, |
|
51 | + UserStoragesService $userService, |
|
52 | + IUserSession $userSession, |
|
53 | + IUserManager $userManager, |
|
54 | + ImportLegacyStoragesService $importLegacyStorageService, |
|
55 | + BackendService $backendService |
|
56 | + ) { |
|
57 | + parent::__construct(); |
|
58 | + $this->globalService = $globalService; |
|
59 | + $this->userService = $userService; |
|
60 | + $this->userSession = $userSession; |
|
61 | + $this->userManager = $userManager; |
|
62 | + $this->importLegacyStorageService = $importLegacyStorageService; |
|
63 | + $this->backendService = $backendService; |
|
64 | + } |
|
65 | 65 | |
66 | - protected function configure(): void { |
|
67 | - $this |
|
68 | - ->setName('files_external:import') |
|
69 | - ->setDescription('Import mount configurations') |
|
70 | - ->addOption( |
|
71 | - 'user', |
|
72 | - '', |
|
73 | - InputOption::VALUE_OPTIONAL, |
|
74 | - 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
75 | - ) |
|
76 | - ->addArgument( |
|
77 | - 'path', |
|
78 | - InputArgument::REQUIRED, |
|
79 | - 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
80 | - ) |
|
81 | - ->addOption( |
|
82 | - 'dry', |
|
83 | - '', |
|
84 | - InputOption::VALUE_NONE, |
|
85 | - 'Don\'t save the imported mounts, only list the new mounts' |
|
86 | - ); |
|
87 | - parent::configure(); |
|
88 | - } |
|
66 | + protected function configure(): void { |
|
67 | + $this |
|
68 | + ->setName('files_external:import') |
|
69 | + ->setDescription('Import mount configurations') |
|
70 | + ->addOption( |
|
71 | + 'user', |
|
72 | + '', |
|
73 | + InputOption::VALUE_OPTIONAL, |
|
74 | + 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
75 | + ) |
|
76 | + ->addArgument( |
|
77 | + 'path', |
|
78 | + InputArgument::REQUIRED, |
|
79 | + 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
80 | + ) |
|
81 | + ->addOption( |
|
82 | + 'dry', |
|
83 | + '', |
|
84 | + InputOption::VALUE_NONE, |
|
85 | + 'Don\'t save the imported mounts, only list the new mounts' |
|
86 | + ); |
|
87 | + parent::configure(); |
|
88 | + } |
|
89 | 89 | |
90 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
91 | - $user = (string) $input->getOption('user'); |
|
92 | - $path = $input->getArgument('path'); |
|
93 | - if ($path === '-') { |
|
94 | - $json = file_get_contents('php://stdin'); |
|
95 | - } else { |
|
96 | - if (!file_exists($path)) { |
|
97 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
98 | - return 1; |
|
99 | - } |
|
100 | - $json = file_get_contents($path); |
|
101 | - } |
|
102 | - if (!is_string($json) || strlen($json) < 2) { |
|
103 | - $output->writeln('<error>Error while reading json</error>'); |
|
104 | - return 1; |
|
105 | - } |
|
106 | - $data = json_decode($json, true); |
|
107 | - if (!is_array($data)) { |
|
108 | - $output->writeln('<error>Error while parsing json</error>'); |
|
109 | - return 1; |
|
110 | - } |
|
90 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
91 | + $user = (string) $input->getOption('user'); |
|
92 | + $path = $input->getArgument('path'); |
|
93 | + if ($path === '-') { |
|
94 | + $json = file_get_contents('php://stdin'); |
|
95 | + } else { |
|
96 | + if (!file_exists($path)) { |
|
97 | + $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
98 | + return 1; |
|
99 | + } |
|
100 | + $json = file_get_contents($path); |
|
101 | + } |
|
102 | + if (!is_string($json) || strlen($json) < 2) { |
|
103 | + $output->writeln('<error>Error while reading json</error>'); |
|
104 | + return 1; |
|
105 | + } |
|
106 | + $data = json_decode($json, true); |
|
107 | + if (!is_array($data)) { |
|
108 | + $output->writeln('<error>Error while parsing json</error>'); |
|
109 | + return 1; |
|
110 | + } |
|
111 | 111 | |
112 | - $isLegacy = isset($data['user']) || isset($data['group']); |
|
113 | - if ($isLegacy) { |
|
114 | - $this->importLegacyStorageService->setData($data); |
|
115 | - $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
116 | - foreach ($mounts as $mount) { |
|
117 | - if ($mount->getBackendOption('password') === false) { |
|
118 | - $output->writeln('<error>Failed to decrypt password</error>'); |
|
119 | - return 1; |
|
120 | - } |
|
121 | - } |
|
122 | - } else { |
|
123 | - if (!isset($data[0])) { //normalize to an array of mounts |
|
124 | - $data = [$data]; |
|
125 | - } |
|
126 | - $mounts = array_map([$this, 'parseData'], $data); |
|
127 | - } |
|
112 | + $isLegacy = isset($data['user']) || isset($data['group']); |
|
113 | + if ($isLegacy) { |
|
114 | + $this->importLegacyStorageService->setData($data); |
|
115 | + $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
116 | + foreach ($mounts as $mount) { |
|
117 | + if ($mount->getBackendOption('password') === false) { |
|
118 | + $output->writeln('<error>Failed to decrypt password</error>'); |
|
119 | + return 1; |
|
120 | + } |
|
121 | + } |
|
122 | + } else { |
|
123 | + if (!isset($data[0])) { //normalize to an array of mounts |
|
124 | + $data = [$data]; |
|
125 | + } |
|
126 | + $mounts = array_map([$this, 'parseData'], $data); |
|
127 | + } |
|
128 | 128 | |
129 | - if ($user) { |
|
130 | - // ensure applicables are correct for personal mounts |
|
131 | - foreach ($mounts as $mount) { |
|
132 | - $mount->setApplicableGroups([]); |
|
133 | - $mount->setApplicableUsers([$user]); |
|
134 | - } |
|
135 | - } |
|
129 | + if ($user) { |
|
130 | + // ensure applicables are correct for personal mounts |
|
131 | + foreach ($mounts as $mount) { |
|
132 | + $mount->setApplicableGroups([]); |
|
133 | + $mount->setApplicableUsers([$user]); |
|
134 | + } |
|
135 | + } |
|
136 | 136 | |
137 | - $storageService = $this->getStorageService($user); |
|
137 | + $storageService = $this->getStorageService($user); |
|
138 | 138 | |
139 | - $existingMounts = $storageService->getAllStorages(); |
|
139 | + $existingMounts = $storageService->getAllStorages(); |
|
140 | 140 | |
141 | - foreach ($mounts as $mount) { |
|
142 | - foreach ($existingMounts as $existingMount) { |
|
143 | - if ( |
|
144 | - $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
145 | - $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
146 | - $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
147 | - $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
148 | - ) { |
|
149 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
150 | - return 1; |
|
151 | - } |
|
152 | - } |
|
153 | - } |
|
141 | + foreach ($mounts as $mount) { |
|
142 | + foreach ($existingMounts as $existingMount) { |
|
143 | + if ( |
|
144 | + $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
145 | + $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
146 | + $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
147 | + $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
148 | + ) { |
|
149 | + $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
150 | + return 1; |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | 154 | |
155 | - if ($input->getOption('dry')) { |
|
156 | - if (count($mounts) === 0) { |
|
157 | - $output->writeln('<error>No mounts to be imported</error>'); |
|
158 | - return 1; |
|
159 | - } |
|
160 | - $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
161 | - $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
162 | - $listInput->setOption('output', $input->getOption('output')); |
|
163 | - $listInput->setOption('show-password', true); |
|
164 | - $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
165 | - } else { |
|
166 | - foreach ($mounts as $mount) { |
|
167 | - $storageService->addStorage($mount); |
|
168 | - } |
|
169 | - } |
|
170 | - return 0; |
|
171 | - } |
|
155 | + if ($input->getOption('dry')) { |
|
156 | + if (count($mounts) === 0) { |
|
157 | + $output->writeln('<error>No mounts to be imported</error>'); |
|
158 | + return 1; |
|
159 | + } |
|
160 | + $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
161 | + $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
162 | + $listInput->setOption('output', $input->getOption('output')); |
|
163 | + $listInput->setOption('show-password', true); |
|
164 | + $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
165 | + } else { |
|
166 | + foreach ($mounts as $mount) { |
|
167 | + $storageService->addStorage($mount); |
|
168 | + } |
|
169 | + } |
|
170 | + return 0; |
|
171 | + } |
|
172 | 172 | |
173 | - private function parseData(array $data): StorageConfig { |
|
174 | - $mount = new StorageConfig($data['mount_id']); |
|
175 | - $mount->setMountPoint($data['mount_point']); |
|
176 | - $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
177 | - $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
178 | - $mount->setAuthMechanism($authBackend); |
|
179 | - $mount->setBackendOptions($data['configuration']); |
|
180 | - $mount->setMountOptions($data['options']); |
|
181 | - $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
182 | - $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
183 | - return $mount; |
|
184 | - } |
|
173 | + private function parseData(array $data): StorageConfig { |
|
174 | + $mount = new StorageConfig($data['mount_id']); |
|
175 | + $mount->setMountPoint($data['mount_point']); |
|
176 | + $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
177 | + $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
178 | + $mount->setAuthMechanism($authBackend); |
|
179 | + $mount->setBackendOptions($data['configuration']); |
|
180 | + $mount->setMountOptions($data['options']); |
|
181 | + $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
182 | + $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
183 | + return $mount; |
|
184 | + } |
|
185 | 185 | |
186 | - private function getBackendByClass(string $className) { |
|
187 | - $backends = $this->backendService->getBackends(); |
|
188 | - foreach ($backends as $backend) { |
|
189 | - if ($backend->getStorageClass() === $className) { |
|
190 | - return $backend; |
|
191 | - } |
|
192 | - } |
|
193 | - } |
|
186 | + private function getBackendByClass(string $className) { |
|
187 | + $backends = $this->backendService->getBackends(); |
|
188 | + foreach ($backends as $backend) { |
|
189 | + if ($backend->getStorageClass() === $className) { |
|
190 | + return $backend; |
|
191 | + } |
|
192 | + } |
|
193 | + } |
|
194 | 194 | |
195 | - protected function getStorageService($userId) { |
|
196 | - if (!empty($userId)) { |
|
197 | - $user = $this->userManager->get($userId); |
|
198 | - if (is_null($user)) { |
|
199 | - throw new NoUserException("user $userId not found"); |
|
200 | - } |
|
201 | - $this->userSession->setUser($user); |
|
202 | - return $this->userService; |
|
203 | - } else { |
|
204 | - return $this->globalService; |
|
205 | - } |
|
206 | - } |
|
195 | + protected function getStorageService($userId) { |
|
196 | + if (!empty($userId)) { |
|
197 | + $user = $this->userManager->get($userId); |
|
198 | + if (is_null($user)) { |
|
199 | + throw new NoUserException("user $userId not found"); |
|
200 | + } |
|
201 | + $this->userSession->setUser($user); |
|
202 | + return $this->userService; |
|
203 | + } else { |
|
204 | + return $this->globalService; |
|
205 | + } |
|
206 | + } |
|
207 | 207 | } |
@@ -24,25 +24,25 @@ |
||
24 | 24 | namespace OC\Files\Cache\Wrapper; |
25 | 25 | |
26 | 26 | class CachePermissionsMask extends CacheWrapper { |
27 | - /** |
|
28 | - * @var int |
|
29 | - */ |
|
30 | - protected $mask; |
|
27 | + /** |
|
28 | + * @var int |
|
29 | + */ |
|
30 | + protected $mask; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param \OCP\Files\Cache\ICache $cache |
|
34 | - * @param int $mask |
|
35 | - */ |
|
36 | - public function __construct($cache, $mask) { |
|
37 | - parent::__construct($cache); |
|
38 | - $this->mask = $mask; |
|
39 | - } |
|
32 | + /** |
|
33 | + * @param \OCP\Files\Cache\ICache $cache |
|
34 | + * @param int $mask |
|
35 | + */ |
|
36 | + public function __construct($cache, $mask) { |
|
37 | + parent::__construct($cache); |
|
38 | + $this->mask = $mask; |
|
39 | + } |
|
40 | 40 | |
41 | - protected function formatCacheEntry($entry) { |
|
42 | - if (isset($entry['permissions'])) { |
|
43 | - $entry['scan_permissions'] = $entry['permissions']; |
|
44 | - $entry['permissions'] &= $this->mask; |
|
45 | - } |
|
46 | - return $entry; |
|
47 | - } |
|
41 | + protected function formatCacheEntry($entry) { |
|
42 | + if (isset($entry['permissions'])) { |
|
43 | + $entry['scan_permissions'] = $entry['permissions']; |
|
44 | + $entry['permissions'] &= $this->mask; |
|
45 | + } |
|
46 | + return $entry; |
|
47 | + } |
|
48 | 48 | } |
@@ -33,14 +33,14 @@ |
||
33 | 33 | * @see \Sabre\DAV\Server |
34 | 34 | */ |
35 | 35 | class Server extends \Sabre\DAV\Server { |
36 | - /** @var CachingTree $tree */ |
|
36 | + /** @var CachingTree $tree */ |
|
37 | 37 | |
38 | - /** |
|
39 | - * @see \Sabre\DAV\Server |
|
40 | - */ |
|
41 | - public function __construct($treeOrNode = null) { |
|
42 | - parent::__construct($treeOrNode); |
|
43 | - self::$exposeVersion = false; |
|
44 | - $this->enablePropfindDepthInfinity = true; |
|
45 | - } |
|
38 | + /** |
|
39 | + * @see \Sabre\DAV\Server |
|
40 | + */ |
|
41 | + public function __construct($treeOrNode = null) { |
|
42 | + parent::__construct($treeOrNode); |
|
43 | + self::$exposeVersion = false; |
|
44 | + $this->enablePropfindDepthInfinity = true; |
|
45 | + } |
|
46 | 46 | } |
@@ -29,58 +29,58 @@ |
||
29 | 29 | use OCP\Settings\IIconSection; |
30 | 30 | |
31 | 31 | class PersonalSection implements IIconSection { |
32 | - /** @var IURLGenerator */ |
|
33 | - private $urlGenerator; |
|
34 | - /** @var IL10N */ |
|
35 | - private $l; |
|
32 | + /** @var IURLGenerator */ |
|
33 | + private $urlGenerator; |
|
34 | + /** @var IL10N */ |
|
35 | + private $l; |
|
36 | 36 | |
37 | - public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
38 | - $this->urlGenerator = $urlGenerator; |
|
39 | - $this->l = $l; |
|
40 | - } |
|
37 | + public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
38 | + $this->urlGenerator = $urlGenerator; |
|
39 | + $this->l = $l; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * returns the relative path to an 16*16 icon describing the section. |
|
44 | - * e.g. '/core/img/places/files.svg' |
|
45 | - * |
|
46 | - * @returns string |
|
47 | - * @since 13.0.0 |
|
48 | - */ |
|
49 | - public function getIcon() { |
|
50 | - return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
51 | - } |
|
42 | + /** |
|
43 | + * returns the relative path to an 16*16 icon describing the section. |
|
44 | + * e.g. '/core/img/places/files.svg' |
|
45 | + * |
|
46 | + * @returns string |
|
47 | + * @since 13.0.0 |
|
48 | + */ |
|
49 | + public function getIcon() { |
|
50 | + return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
55 | - * e.g. 'ldap' |
|
56 | - * |
|
57 | - * @returns string |
|
58 | - * @since 9.1 |
|
59 | - */ |
|
60 | - public function getID() { |
|
61 | - return 'sharing'; |
|
62 | - } |
|
53 | + /** |
|
54 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
55 | + * e.g. 'ldap' |
|
56 | + * |
|
57 | + * @returns string |
|
58 | + * @since 9.1 |
|
59 | + */ |
|
60 | + public function getID() { |
|
61 | + return 'sharing'; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
66 | - * integration'. Use the L10N service to translate it. |
|
67 | - * |
|
68 | - * @return string |
|
69 | - * @since 9.1 |
|
70 | - */ |
|
71 | - public function getName() { |
|
72 | - return $this->l->t('Sharing'); |
|
73 | - } |
|
64 | + /** |
|
65 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
66 | + * integration'. Use the L10N service to translate it. |
|
67 | + * |
|
68 | + * @return string |
|
69 | + * @since 9.1 |
|
70 | + */ |
|
71 | + public function getName() { |
|
72 | + return $this->l->t('Sharing'); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @return int whether the form should be rather on the top or bottom of |
|
77 | - * the settings navigation. The sections are arranged in ascending order of |
|
78 | - * the priority values. It is required to return a value between 0 and 99. |
|
79 | - * |
|
80 | - * E.g.: 70 |
|
81 | - * @since 9.1 |
|
82 | - */ |
|
83 | - public function getPriority() { |
|
84 | - return 15; |
|
85 | - } |
|
75 | + /** |
|
76 | + * @return int whether the form should be rather on the top or bottom of |
|
77 | + * the settings navigation. The sections are arranged in ascending order of |
|
78 | + * the priority values. It is required to return a value between 0 and 99. |
|
79 | + * |
|
80 | + * E.g.: 70 |
|
81 | + * @since 9.1 |
|
82 | + */ |
|
83 | + public function getPriority() { |
|
84 | + return 15; |
|
85 | + } |
|
86 | 86 | } |
@@ -29,25 +29,25 @@ |
||
29 | 29 | use OCP\IUserSession; |
30 | 30 | |
31 | 31 | class PersonalSection extends Section { |
32 | - /** @var IUserSession */ |
|
33 | - private $userSession; |
|
32 | + /** @var IUserSession */ |
|
33 | + private $userSession; |
|
34 | 34 | |
35 | - /** @var UserGlobalStoragesService */ |
|
36 | - private $userGlobalStoragesService; |
|
35 | + /** @var UserGlobalStoragesService */ |
|
36 | + private $userGlobalStoragesService; |
|
37 | 37 | |
38 | - /** @var BackendService */ |
|
39 | - private $backendService; |
|
38 | + /** @var BackendService */ |
|
39 | + private $backendService; |
|
40 | 40 | |
41 | - public function __construct( |
|
42 | - IURLGenerator $url, |
|
43 | - IL10N $l, |
|
44 | - IUserSession $userSession, |
|
45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | - BackendService $backendService |
|
47 | - ) { |
|
48 | - parent::__construct($url, $l); |
|
49 | - $this->userSession = $userSession; |
|
50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | - $this->backendService = $backendService; |
|
52 | - } |
|
41 | + public function __construct( |
|
42 | + IURLGenerator $url, |
|
43 | + IL10N $l, |
|
44 | + IUserSession $userSession, |
|
45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | + BackendService $backendService |
|
47 | + ) { |
|
48 | + parent::__construct($url, $l); |
|
49 | + $this->userSession = $userSession; |
|
50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | + $this->backendService = $backendService; |
|
52 | + } |
|
53 | 53 | } |
@@ -29,39 +29,39 @@ |
||
29 | 29 | |
30 | 30 | class ConfigController extends OCSController { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - private $config; |
|
32 | + /** @var IConfig */ |
|
33 | + private $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $appName |
|
37 | - * @param IRequest $request |
|
38 | - * @param IConfig $config |
|
39 | - */ |
|
40 | - public function __construct($appName, |
|
41 | - IRequest $request, |
|
42 | - IConfig $config) { |
|
43 | - parent::__construct($appName, $request); |
|
44 | - $this->config = $config; |
|
45 | - } |
|
35 | + /** |
|
36 | + * @param string $appName |
|
37 | + * @param IRequest $request |
|
38 | + * @param IConfig $config |
|
39 | + */ |
|
40 | + public function __construct($appName, |
|
41 | + IRequest $request, |
|
42 | + IConfig $config) { |
|
43 | + parent::__construct($appName, $request); |
|
44 | + $this->config = $config; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $appid |
|
49 | - * @param string $configkey |
|
50 | - * @param string $value |
|
51 | - * @return DataResponse |
|
52 | - */ |
|
53 | - public function setAppValue($appid, $configkey, $value) { |
|
54 | - $this->config->setAppValue($appid, $configkey, $value); |
|
55 | - return new DataResponse(); |
|
56 | - } |
|
47 | + /** |
|
48 | + * @param string $appid |
|
49 | + * @param string $configkey |
|
50 | + * @param string $value |
|
51 | + * @return DataResponse |
|
52 | + */ |
|
53 | + public function setAppValue($appid, $configkey, $value) { |
|
54 | + $this->config->setAppValue($appid, $configkey, $value); |
|
55 | + return new DataResponse(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $appid |
|
60 | - * @param string $configkey |
|
61 | - * @return DataResponse |
|
62 | - */ |
|
63 | - public function deleteAppValue($appid, $configkey) { |
|
64 | - $this->config->deleteAppValue($appid, $configkey); |
|
65 | - return new DataResponse(); |
|
66 | - } |
|
58 | + /** |
|
59 | + * @param string $appid |
|
60 | + * @param string $configkey |
|
61 | + * @return DataResponse |
|
62 | + */ |
|
63 | + public function deleteAppValue($appid, $configkey) { |
|
64 | + $this->config->deleteAppValue($appid, $configkey); |
|
65 | + return new DataResponse(); |
|
66 | + } |
|
67 | 67 | } |
@@ -30,114 +30,114 @@ |
||
30 | 30 | * @since 8.0.0 |
31 | 31 | */ |
32 | 32 | interface IDateTimeFormatter { |
33 | - /** |
|
34 | - * Formats the date of the given timestamp |
|
35 | - * |
|
36 | - * @param int|\DateTime $timestamp |
|
37 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
38 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
39 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
40 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
41 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
42 | - * The exact format is dependent on the language |
|
43 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
44 | - * @param \OCP\IL10N|null $l The locale to use |
|
45 | - * @return string Formatted date string |
|
46 | - * @since 8.0.0 |
|
47 | - */ |
|
48 | - public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
33 | + /** |
|
34 | + * Formats the date of the given timestamp |
|
35 | + * |
|
36 | + * @param int|\DateTime $timestamp |
|
37 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
38 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
39 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
40 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
41 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
42 | + * The exact format is dependent on the language |
|
43 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
44 | + * @param \OCP\IL10N|null $l The locale to use |
|
45 | + * @return string Formatted date string |
|
46 | + * @since 8.0.0 |
|
47 | + */ |
|
48 | + public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Formats the date of the given timestamp |
|
52 | - * |
|
53 | - * @param int|\DateTime $timestamp |
|
54 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
55 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
56 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
57 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
58 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
59 | - * The exact format is dependent on the language |
|
60 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
61 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
62 | - * @param \OCP\IL10N|null $l The locale to use |
|
63 | - * @return string Formatted relative date string |
|
64 | - * @since 8.0.0 |
|
65 | - */ |
|
66 | - public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
50 | + /** |
|
51 | + * Formats the date of the given timestamp |
|
52 | + * |
|
53 | + * @param int|\DateTime $timestamp |
|
54 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
55 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
56 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
57 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
58 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
59 | + * The exact format is dependent on the language |
|
60 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
61 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
62 | + * @param \OCP\IL10N|null $l The locale to use |
|
63 | + * @return string Formatted relative date string |
|
64 | + * @since 8.0.0 |
|
65 | + */ |
|
66 | + public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Gives the relative date of the timestamp |
|
70 | - * Only works for past dates |
|
71 | - * |
|
72 | - * @param int|\DateTime $timestamp |
|
73 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
74 | - * @param \OCP\IL10N|null $l The locale to use |
|
75 | - * @return string Dates returned are: |
|
76 | - * < 1 month => Today, Yesterday, n days ago |
|
77 | - * < 13 month => last month, n months ago |
|
78 | - * >= 13 month => last year, n years ago |
|
79 | - * @since 8.0.0 |
|
80 | - */ |
|
81 | - public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
68 | + /** |
|
69 | + * Gives the relative date of the timestamp |
|
70 | + * Only works for past dates |
|
71 | + * |
|
72 | + * @param int|\DateTime $timestamp |
|
73 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
74 | + * @param \OCP\IL10N|null $l The locale to use |
|
75 | + * @return string Dates returned are: |
|
76 | + * < 1 month => Today, Yesterday, n days ago |
|
77 | + * < 13 month => last month, n months ago |
|
78 | + * >= 13 month => last year, n years ago |
|
79 | + * @since 8.0.0 |
|
80 | + */ |
|
81 | + public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
82 | 82 | |
83 | - /** |
|
84 | - * Formats the time of the given timestamp |
|
85 | - * |
|
86 | - * @param int|\DateTime $timestamp |
|
87 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
88 | - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
89 | - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
90 | - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
91 | - * short: e.g. 'h:mm a' => '11:42 AM' |
|
92 | - * The exact format is dependent on the language |
|
93 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
94 | - * @param \OCP\IL10N|null $l The locale to use |
|
95 | - * @return string Formatted time string |
|
96 | - * @since 8.0.0 |
|
97 | - */ |
|
98 | - public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
83 | + /** |
|
84 | + * Formats the time of the given timestamp |
|
85 | + * |
|
86 | + * @param int|\DateTime $timestamp |
|
87 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
88 | + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
89 | + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
90 | + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
91 | + * short: e.g. 'h:mm a' => '11:42 AM' |
|
92 | + * The exact format is dependent on the language |
|
93 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
94 | + * @param \OCP\IL10N|null $l The locale to use |
|
95 | + * @return string Formatted time string |
|
96 | + * @since 8.0.0 |
|
97 | + */ |
|
98 | + public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
99 | 99 | |
100 | - /** |
|
101 | - * Gives the relative past time of the timestamp |
|
102 | - * |
|
103 | - * @param int|\DateTime $timestamp |
|
104 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
105 | - * @param \OCP\IL10N|null $l The locale to use |
|
106 | - * @return string Dates returned are: |
|
107 | - * < 60 sec => seconds ago |
|
108 | - * < 1 hour => n minutes ago |
|
109 | - * < 1 day => n hours ago |
|
110 | - * < 1 month => Yesterday, n days ago |
|
111 | - * < 13 month => last month, n months ago |
|
112 | - * >= 13 month => last year, n years ago |
|
113 | - * @since 8.0.0 |
|
114 | - */ |
|
115 | - public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
100 | + /** |
|
101 | + * Gives the relative past time of the timestamp |
|
102 | + * |
|
103 | + * @param int|\DateTime $timestamp |
|
104 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
105 | + * @param \OCP\IL10N|null $l The locale to use |
|
106 | + * @return string Dates returned are: |
|
107 | + * < 60 sec => seconds ago |
|
108 | + * < 1 hour => n minutes ago |
|
109 | + * < 1 day => n hours ago |
|
110 | + * < 1 month => Yesterday, n days ago |
|
111 | + * < 13 month => last month, n months ago |
|
112 | + * >= 13 month => last year, n years ago |
|
113 | + * @since 8.0.0 |
|
114 | + */ |
|
115 | + public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
116 | 116 | |
117 | - /** |
|
118 | - * Formats the date and time of the given timestamp |
|
119 | - * |
|
120 | - * @param int|\DateTime $timestamp |
|
121 | - * @param string $formatDate See formatDate() for description |
|
122 | - * @param string $formatTime See formatTime() for description |
|
123 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
124 | - * @param \OCP\IL10N|null $l The locale to use |
|
125 | - * @return string Formatted date and time string |
|
126 | - * @since 8.0.0 |
|
127 | - */ |
|
128 | - public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
117 | + /** |
|
118 | + * Formats the date and time of the given timestamp |
|
119 | + * |
|
120 | + * @param int|\DateTime $timestamp |
|
121 | + * @param string $formatDate See formatDate() for description |
|
122 | + * @param string $formatTime See formatTime() for description |
|
123 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
124 | + * @param \OCP\IL10N|null $l The locale to use |
|
125 | + * @return string Formatted date and time string |
|
126 | + * @since 8.0.0 |
|
127 | + */ |
|
128 | + public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
129 | 129 | |
130 | - /** |
|
131 | - * Formats the date and time of the given timestamp |
|
132 | - * |
|
133 | - * @param int|\DateTime $timestamp |
|
134 | - * @param string $formatDate See formatDate() for description |
|
135 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
136 | - * @param string $formatTime See formatTime() for description |
|
137 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
138 | - * @param \OCP\IL10N|null $l The locale to use |
|
139 | - * @return string Formatted relative date and time string |
|
140 | - * @since 8.0.0 |
|
141 | - */ |
|
142 | - public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
130 | + /** |
|
131 | + * Formats the date and time of the given timestamp |
|
132 | + * |
|
133 | + * @param int|\DateTime $timestamp |
|
134 | + * @param string $formatDate See formatDate() for description |
|
135 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
136 | + * @param string $formatTime See formatTime() for description |
|
137 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
138 | + * @param \OCP\IL10N|null $l The locale to use |
|
139 | + * @return string Formatted relative date and time string |
|
140 | + * @since 8.0.0 |
|
141 | + */ |
|
142 | + public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
143 | 143 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | * Authentication mechanism or backend has insufficient data |
30 | 30 | */ |
31 | 31 | class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableException { |
32 | - /** |
|
33 | - * StorageNotAvailableException constructor. |
|
34 | - * |
|
35 | - * @param string $message |
|
36 | - * @param int $code |
|
37 | - * @param \Exception|null $previous |
|
38 | - * @since 6.0.0 |
|
39 | - */ |
|
40 | - public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
41 | - parent::__construct($message, $code, $previous); |
|
42 | - } |
|
32 | + /** |
|
33 | + * StorageNotAvailableException constructor. |
|
34 | + * |
|
35 | + * @param string $message |
|
36 | + * @param int $code |
|
37 | + * @param \Exception|null $previous |
|
38 | + * @since 6.0.0 |
|
39 | + */ |
|
40 | + public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | + } |
|
43 | 43 | } |