@@ -29,12 +29,12 @@ |
||
29 | 29 | $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api'); |
30 | 30 | |
31 | 31 | if ($isEnabled) { |
32 | - // Make sure the routes are loaded |
|
33 | - \OC_App::loadApp('cloud_federation_api'); |
|
34 | - $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | - header('Content-Type: application/json'); |
|
36 | - echo json_encode($capabilities->getCapabilities()['ocm']); |
|
32 | + // Make sure the routes are loaded |
|
33 | + \OC_App::loadApp('cloud_federation_api'); |
|
34 | + $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | + header('Content-Type: application/json'); |
|
36 | + echo json_encode($capabilities->getCapabilities()['ocm']); |
|
37 | 37 | } else { |
38 | - header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | - exit("501 Not Implemented"); |
|
38 | + header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | + exit("501 Not Implemented"); |
|
40 | 40 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | class GroupMapping extends AbstractMapping { |
31 | 31 | |
32 | - /** |
|
33 | - * returns the DB table name which holds the mappings |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - protected function getTableName(bool $includePrefix = true) { |
|
37 | - $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | - return $p . 'ldap_group_mapping'; |
|
39 | - } |
|
32 | + /** |
|
33 | + * returns the DB table name which holds the mappings |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + protected function getTableName(bool $includePrefix = true) { |
|
37 | + $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | + return $p . 'ldap_group_mapping'; |
|
39 | + } |
|
40 | 40 | } |
@@ -30,46 +30,46 @@ |
||
30 | 30 | |
31 | 31 | class UploadFile implements IFile { |
32 | 32 | |
33 | - /** @var File */ |
|
34 | - private $file; |
|
33 | + /** @var File */ |
|
34 | + private $file; |
|
35 | 35 | |
36 | - public function __construct(File $file) { |
|
37 | - $this->file = $file; |
|
38 | - } |
|
36 | + public function __construct(File $file) { |
|
37 | + $this->file = $file; |
|
38 | + } |
|
39 | 39 | |
40 | - public function put($data) { |
|
41 | - return $this->file->put($data); |
|
42 | - } |
|
40 | + public function put($data) { |
|
41 | + return $this->file->put($data); |
|
42 | + } |
|
43 | 43 | |
44 | - public function get() { |
|
45 | - return $this->file->get(); |
|
46 | - } |
|
44 | + public function get() { |
|
45 | + return $this->file->get(); |
|
46 | + } |
|
47 | 47 | |
48 | - public function getContentType() { |
|
49 | - return $this->file->getContentType(); |
|
50 | - } |
|
48 | + public function getContentType() { |
|
49 | + return $this->file->getContentType(); |
|
50 | + } |
|
51 | 51 | |
52 | - public function getETag() { |
|
53 | - return $this->file->getETag(); |
|
54 | - } |
|
52 | + public function getETag() { |
|
53 | + return $this->file->getETag(); |
|
54 | + } |
|
55 | 55 | |
56 | - public function getSize() { |
|
57 | - return $this->file->getSize(); |
|
58 | - } |
|
56 | + public function getSize() { |
|
57 | + return $this->file->getSize(); |
|
58 | + } |
|
59 | 59 | |
60 | - public function delete() { |
|
61 | - $this->file->delete(); |
|
62 | - } |
|
60 | + public function delete() { |
|
61 | + $this->file->delete(); |
|
62 | + } |
|
63 | 63 | |
64 | - public function getName() { |
|
65 | - return $this->file->getName(); |
|
66 | - } |
|
64 | + public function getName() { |
|
65 | + return $this->file->getName(); |
|
66 | + } |
|
67 | 67 | |
68 | - public function setName($name) { |
|
69 | - $this->file->setName($name); |
|
70 | - } |
|
68 | + public function setName($name) { |
|
69 | + $this->file->setName($name); |
|
70 | + } |
|
71 | 71 | |
72 | - public function getLastModified() { |
|
73 | - return $this->file->getLastModified(); |
|
74 | - } |
|
72 | + public function getLastModified() { |
|
73 | + return $this->file->getLastModified(); |
|
74 | + } |
|
75 | 75 | } |
@@ -30,68 +30,68 @@ |
||
30 | 30 | |
31 | 31 | class UploadFolder implements ICollection { |
32 | 32 | |
33 | - /** @var Directory */ |
|
34 | - private $node; |
|
35 | - /** @var CleanupService */ |
|
36 | - private $cleanupService; |
|
37 | - |
|
38 | - public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | - $this->node = $node; |
|
40 | - $this->cleanupService = $cleanupService; |
|
41 | - } |
|
42 | - |
|
43 | - public function createFile($name, $data = null) { |
|
44 | - // TODO: verify name - should be a simple number |
|
45 | - $this->node->createFile($name, $data); |
|
46 | - } |
|
47 | - |
|
48 | - public function createDirectory($name) { |
|
49 | - throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | - } |
|
51 | - |
|
52 | - public function getChild($name) { |
|
53 | - if ($name === '.file') { |
|
54 | - return new FutureFile($this->node, '.file'); |
|
55 | - } |
|
56 | - return new UploadFile($this->node->getChild($name)); |
|
57 | - } |
|
58 | - |
|
59 | - public function getChildren() { |
|
60 | - $tmpChildren = $this->node->getChildren(); |
|
61 | - |
|
62 | - $children = []; |
|
63 | - $children[] = new FutureFile($this->node, '.file'); |
|
64 | - |
|
65 | - foreach ($tmpChildren as $child) { |
|
66 | - $children[] = new UploadFile($child); |
|
67 | - } |
|
68 | - |
|
69 | - return $children; |
|
70 | - } |
|
71 | - |
|
72 | - public function childExists($name) { |
|
73 | - if ($name === '.file') { |
|
74 | - return true; |
|
75 | - } |
|
76 | - return $this->node->childExists($name); |
|
77 | - } |
|
78 | - |
|
79 | - public function delete() { |
|
80 | - $this->node->delete(); |
|
81 | - |
|
82 | - // Background cleanup job is not needed anymore |
|
83 | - $this->cleanupService->removeJob($this->getName()); |
|
84 | - } |
|
85 | - |
|
86 | - public function getName() { |
|
87 | - return $this->node->getName(); |
|
88 | - } |
|
89 | - |
|
90 | - public function setName($name) { |
|
91 | - throw new Forbidden('Permission denied to rename this folder'); |
|
92 | - } |
|
93 | - |
|
94 | - public function getLastModified() { |
|
95 | - return $this->node->getLastModified(); |
|
96 | - } |
|
33 | + /** @var Directory */ |
|
34 | + private $node; |
|
35 | + /** @var CleanupService */ |
|
36 | + private $cleanupService; |
|
37 | + |
|
38 | + public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | + $this->node = $node; |
|
40 | + $this->cleanupService = $cleanupService; |
|
41 | + } |
|
42 | + |
|
43 | + public function createFile($name, $data = null) { |
|
44 | + // TODO: verify name - should be a simple number |
|
45 | + $this->node->createFile($name, $data); |
|
46 | + } |
|
47 | + |
|
48 | + public function createDirectory($name) { |
|
49 | + throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | + } |
|
51 | + |
|
52 | + public function getChild($name) { |
|
53 | + if ($name === '.file') { |
|
54 | + return new FutureFile($this->node, '.file'); |
|
55 | + } |
|
56 | + return new UploadFile($this->node->getChild($name)); |
|
57 | + } |
|
58 | + |
|
59 | + public function getChildren() { |
|
60 | + $tmpChildren = $this->node->getChildren(); |
|
61 | + |
|
62 | + $children = []; |
|
63 | + $children[] = new FutureFile($this->node, '.file'); |
|
64 | + |
|
65 | + foreach ($tmpChildren as $child) { |
|
66 | + $children[] = new UploadFile($child); |
|
67 | + } |
|
68 | + |
|
69 | + return $children; |
|
70 | + } |
|
71 | + |
|
72 | + public function childExists($name) { |
|
73 | + if ($name === '.file') { |
|
74 | + return true; |
|
75 | + } |
|
76 | + return $this->node->childExists($name); |
|
77 | + } |
|
78 | + |
|
79 | + public function delete() { |
|
80 | + $this->node->delete(); |
|
81 | + |
|
82 | + // Background cleanup job is not needed anymore |
|
83 | + $this->cleanupService->removeJob($this->getName()); |
|
84 | + } |
|
85 | + |
|
86 | + public function getName() { |
|
87 | + return $this->node->getName(); |
|
88 | + } |
|
89 | + |
|
90 | + public function setName($name) { |
|
91 | + throw new Forbidden('Permission denied to rename this folder'); |
|
92 | + } |
|
93 | + |
|
94 | + public function getLastModified() { |
|
95 | + return $this->node->getLastModified(); |
|
96 | + } |
|
97 | 97 | } |
@@ -29,27 +29,27 @@ |
||
29 | 29 | |
30 | 30 | class PublicOwnerWrapper extends Wrapper { |
31 | 31 | |
32 | - /** @var string */ |
|
33 | - private $owner; |
|
34 | - |
|
35 | - /** |
|
36 | - * @param array $arguments ['storage' => $storage, 'owner' => $owner] |
|
37 | - * |
|
38 | - * $storage: The storage the permissions mask should be applied on |
|
39 | - * $owner: The owner to use in case no owner is found |
|
40 | - */ |
|
41 | - public function __construct($arguments) { |
|
42 | - parent::__construct($arguments); |
|
43 | - $this->owner = $arguments['owner']; |
|
44 | - } |
|
45 | - |
|
46 | - public function getOwner($path) { |
|
47 | - $owner = parent::getOwner($path); |
|
48 | - |
|
49 | - if ($owner === null || $owner === false) { |
|
50 | - return $this->owner; |
|
51 | - } |
|
52 | - |
|
53 | - return $owner; |
|
54 | - } |
|
32 | + /** @var string */ |
|
33 | + private $owner; |
|
34 | + |
|
35 | + /** |
|
36 | + * @param array $arguments ['storage' => $storage, 'owner' => $owner] |
|
37 | + * |
|
38 | + * $storage: The storage the permissions mask should be applied on |
|
39 | + * $owner: The owner to use in case no owner is found |
|
40 | + */ |
|
41 | + public function __construct($arguments) { |
|
42 | + parent::__construct($arguments); |
|
43 | + $this->owner = $arguments['owner']; |
|
44 | + } |
|
45 | + |
|
46 | + public function getOwner($path) { |
|
47 | + $owner = parent::getOwner($path); |
|
48 | + |
|
49 | + if ($owner === null || $owner === false) { |
|
50 | + return $this->owner; |
|
51 | + } |
|
52 | + |
|
53 | + return $owner; |
|
54 | + } |
|
55 | 55 | } |
@@ -31,81 +31,81 @@ |
||
31 | 31 | * @since 20.0.0 |
32 | 32 | */ |
33 | 33 | interface IAppConfig { |
34 | - /** |
|
35 | - * Get all keys stored for this app |
|
36 | - * |
|
37 | - * @return string[] the keys stored for the app |
|
38 | - * @since 20.0.0 |
|
39 | - */ |
|
40 | - public function getAppKeys(): array ; |
|
34 | + /** |
|
35 | + * Get all keys stored for this app |
|
36 | + * |
|
37 | + * @return string[] the keys stored for the app |
|
38 | + * @since 20.0.0 |
|
39 | + */ |
|
40 | + public function getAppKeys(): array ; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Writes a new app wide value |
|
44 | - * |
|
45 | - * @param string $key the key of the value, under which will be saved |
|
46 | - * @param string $value the value that should be stored |
|
47 | - * @return void |
|
48 | - * @since 20.0.0 |
|
49 | - */ |
|
50 | - public function setAppValue(string $key, string $value): void; |
|
42 | + /** |
|
43 | + * Writes a new app wide value |
|
44 | + * |
|
45 | + * @param string $key the key of the value, under which will be saved |
|
46 | + * @param string $value the value that should be stored |
|
47 | + * @return void |
|
48 | + * @since 20.0.0 |
|
49 | + */ |
|
50 | + public function setAppValue(string $key, string $value): void; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Looks up an app wide defined value |
|
54 | - * |
|
55 | - * @param string $key the key of the value, under which it was saved |
|
56 | - * @param string $default the default value to be returned if the value isn't set |
|
57 | - * @return string the saved value |
|
58 | - * @since 20.0.0 |
|
59 | - */ |
|
60 | - public function getAppValue(string $key, string $default = ''): string; |
|
52 | + /** |
|
53 | + * Looks up an app wide defined value |
|
54 | + * |
|
55 | + * @param string $key the key of the value, under which it was saved |
|
56 | + * @param string $default the default value to be returned if the value isn't set |
|
57 | + * @return string the saved value |
|
58 | + * @since 20.0.0 |
|
59 | + */ |
|
60 | + public function getAppValue(string $key, string $default = ''): string; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Delete an app wide defined value |
|
64 | - * |
|
65 | - * @param string $key the key of the value, under which it was saved |
|
66 | - * @return void |
|
67 | - * @since 20.0.0 |
|
68 | - */ |
|
69 | - public function deleteAppValue(string $key): void; |
|
62 | + /** |
|
63 | + * Delete an app wide defined value |
|
64 | + * |
|
65 | + * @param string $key the key of the value, under which it was saved |
|
66 | + * @return void |
|
67 | + * @since 20.0.0 |
|
68 | + */ |
|
69 | + public function deleteAppValue(string $key): void; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Removes all keys in appconfig belonging to the app |
|
73 | - * |
|
74 | - * @return void |
|
75 | - * @since 20.0.0 |
|
76 | - */ |
|
77 | - public function deleteAppValues(): void; |
|
71 | + /** |
|
72 | + * Removes all keys in appconfig belonging to the app |
|
73 | + * |
|
74 | + * @return void |
|
75 | + * @since 20.0.0 |
|
76 | + */ |
|
77 | + public function deleteAppValues(): void; |
|
78 | 78 | |
79 | - /** |
|
80 | - * Set a user defined value |
|
81 | - * |
|
82 | - * @param string $userId the userId of the user that we want to store the value under |
|
83 | - * @param string $key the key under which the value is being stored |
|
84 | - * @param string $value the value that you want to store |
|
85 | - * @param string $preCondition only update if the config value was previously the value passed as $preCondition |
|
86 | - * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met |
|
87 | - * @throws \UnexpectedValueException when trying to store an unexpected value |
|
88 | - * @since 20.0.0 |
|
89 | - */ |
|
90 | - public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void; |
|
79 | + /** |
|
80 | + * Set a user defined value |
|
81 | + * |
|
82 | + * @param string $userId the userId of the user that we want to store the value under |
|
83 | + * @param string $key the key under which the value is being stored |
|
84 | + * @param string $value the value that you want to store |
|
85 | + * @param string $preCondition only update if the config value was previously the value passed as $preCondition |
|
86 | + * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met |
|
87 | + * @throws \UnexpectedValueException when trying to store an unexpected value |
|
88 | + * @since 20.0.0 |
|
89 | + */ |
|
90 | + public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void; |
|
91 | 91 | |
92 | - /** |
|
93 | - * Shortcut for getting a user defined value |
|
94 | - * |
|
95 | - * @param string $userId the userId of the user that we want to store the value under |
|
96 | - * @param string $key the key under which the value is being stored |
|
97 | - * @param mixed $default the default value to be returned if the value isn't set |
|
98 | - * @return string |
|
99 | - * @since 20.0.0 |
|
100 | - */ |
|
101 | - public function getUserValue(string $userId, string $key, string $default = ''): string; |
|
92 | + /** |
|
93 | + * Shortcut for getting a user defined value |
|
94 | + * |
|
95 | + * @param string $userId the userId of the user that we want to store the value under |
|
96 | + * @param string $key the key under which the value is being stored |
|
97 | + * @param mixed $default the default value to be returned if the value isn't set |
|
98 | + * @return string |
|
99 | + * @since 20.0.0 |
|
100 | + */ |
|
101 | + public function getUserValue(string $userId, string $key, string $default = ''): string; |
|
102 | 102 | |
103 | - /** |
|
104 | - * Delete a user value |
|
105 | - * |
|
106 | - * @param string $userId the userId of the user that we want to store the value under |
|
107 | - * @param string $key the key under which the value is being stored |
|
108 | - * @since 20.0.0 |
|
109 | - */ |
|
110 | - public function deleteUserValue(string $userId, string $key): void; |
|
103 | + /** |
|
104 | + * Delete a user value |
|
105 | + * |
|
106 | + * @param string $userId the userId of the user that we want to store the value under |
|
107 | + * @param string $key the key under which the value is being stored |
|
108 | + * @since 20.0.0 |
|
109 | + */ |
|
110 | + public function deleteUserValue(string $userId, string $key): void; |
|
111 | 111 | } |
@@ -29,22 +29,22 @@ |
||
29 | 29 | use OCP\IInitialStateService; |
30 | 30 | |
31 | 31 | class InitialState implements IInitialState { |
32 | - /** @var IInitialStateService */ |
|
33 | - private $state; |
|
32 | + /** @var IInitialStateService */ |
|
33 | + private $state; |
|
34 | 34 | |
35 | - /** @var string */ |
|
36 | - private $appName; |
|
35 | + /** @var string */ |
|
36 | + private $appName; |
|
37 | 37 | |
38 | - public function __construct(IInitialStateService $state, string $appName) { |
|
39 | - $this->state = $state; |
|
40 | - $this->appName = $appName; |
|
41 | - } |
|
38 | + public function __construct(IInitialStateService $state, string $appName) { |
|
39 | + $this->state = $state; |
|
40 | + $this->appName = $appName; |
|
41 | + } |
|
42 | 42 | |
43 | - public function provideInitialState(string $key, $data): void { |
|
44 | - $this->state->provideInitialState($this->appName, $key, $data); |
|
45 | - } |
|
43 | + public function provideInitialState(string $key, $data): void { |
|
44 | + $this->state->provideInitialState($this->appName, $key, $data); |
|
45 | + } |
|
46 | 46 | |
47 | - public function provideLazyInitialState(string $key, \Closure $closure): void { |
|
48 | - $this->state->provideLazyInitialState($this->appName, $key, $closure); |
|
49 | - } |
|
47 | + public function provideLazyInitialState(string $key, \Closure $closure): void { |
|
48 | + $this->state->provideLazyInitialState($this->appName, $key, $closure); |
|
49 | + } |
|
50 | 50 | } |
@@ -25,28 +25,28 @@ |
||
25 | 25 | */ |
26 | 26 | |
27 | 27 | if (!extension_loaded('intl')) { |
28 | - echo 'Intl extension is required to run this script.'; |
|
29 | - exit(1); |
|
28 | + echo 'Intl extension is required to run this script.'; |
|
29 | + exit(1); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | require '../3rdparty/autoload.php'; |
33 | 33 | |
34 | 34 | $locales = array_map(static function (string $localeCode) { |
35 | - return [ |
|
36 | - 'code' => $localeCode, |
|
37 | - 'name' => Locale::getDisplayName($localeCode, 'en') |
|
38 | - ]; |
|
35 | + return [ |
|
36 | + 'code' => $localeCode, |
|
37 | + 'name' => Locale::getDisplayName($localeCode, 'en') |
|
38 | + ]; |
|
39 | 39 | }, ResourceBundle::getLocales('')); |
40 | 40 | |
41 | 41 | $locales = array_filter($locales, static function (array $locale) { |
42 | - return is_array(Punic\Data::explodeLocale($locale['code'])); |
|
42 | + return is_array(Punic\Data::explodeLocale($locale['code'])); |
|
43 | 43 | }); |
44 | 44 | |
45 | 45 | $locales = array_values($locales); |
46 | 46 | |
47 | 47 | if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
48 | - echo 'Failed to update locales.json'; |
|
49 | - exit(1); |
|
48 | + echo 'Failed to update locales.json'; |
|
49 | + exit(1); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | echo 'Updated locales.json. Don\'t forget to commit the result.'; |
@@ -26,11 +26,11 @@ |
||
26 | 26 | use OCP\Capabilities\ICapability; |
27 | 27 | |
28 | 28 | class Capabilities implements ICapability { |
29 | - public function getCapabilities(): array { |
|
30 | - return [ |
|
31 | - 'files' => [ |
|
32 | - 'comments' => true, |
|
33 | - ] |
|
34 | - ]; |
|
35 | - } |
|
29 | + public function getCapabilities(): array { |
|
30 | + return [ |
|
31 | + 'files' => [ |
|
32 | + 'comments' => true, |
|
33 | + ] |
|
34 | + ]; |
|
35 | + } |
|
36 | 36 | } |