@@ -26,61 +26,61 @@ |
||
26 | 26 | |
27 | 27 | interface ILDAPGroupPlugin { |
28 | 28 | |
29 | - /** |
|
30 | - * Check if plugin implements actions |
|
31 | - * @return int |
|
32 | - * |
|
33 | - * Returns the supported actions as int to be |
|
34 | - * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | - */ |
|
36 | - public function respondToActions(); |
|
29 | + /** |
|
30 | + * Check if plugin implements actions |
|
31 | + * @return int |
|
32 | + * |
|
33 | + * Returns the supported actions as int to be |
|
34 | + * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | + */ |
|
36 | + public function respondToActions(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $gid |
|
40 | - * @return string|null The group DN if group creation was successful. |
|
41 | - */ |
|
42 | - public function createGroup($gid); |
|
38 | + /** |
|
39 | + * @param string $gid |
|
40 | + * @return string|null The group DN if group creation was successful. |
|
41 | + */ |
|
42 | + public function createGroup($gid); |
|
43 | 43 | |
44 | - /** |
|
45 | - * delete a group |
|
46 | - * @param string $gid gid of the group to delete |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public function deleteGroup($gid); |
|
44 | + /** |
|
45 | + * delete a group |
|
46 | + * @param string $gid gid of the group to delete |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public function deleteGroup($gid); |
|
50 | 50 | |
51 | - /** |
|
52 | - * Add a user to a group |
|
53 | - * @param string $uid Name of the user to add to group |
|
54 | - * @param string $gid Name of the group in which add the user |
|
55 | - * @return bool |
|
56 | - * |
|
57 | - * Adds a user to a group. |
|
58 | - */ |
|
59 | - public function addToGroup($uid, $gid); |
|
51 | + /** |
|
52 | + * Add a user to a group |
|
53 | + * @param string $uid Name of the user to add to group |
|
54 | + * @param string $gid Name of the group in which add the user |
|
55 | + * @return bool |
|
56 | + * |
|
57 | + * Adds a user to a group. |
|
58 | + */ |
|
59 | + public function addToGroup($uid, $gid); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Removes a user from a group |
|
63 | - * @param string $uid Name of the user to remove from group |
|
64 | - * @param string $gid Name of the group from which remove the user |
|
65 | - * @return bool |
|
66 | - * |
|
67 | - * removes the user from a group. |
|
68 | - */ |
|
69 | - public function removeFromGroup($uid, $gid); |
|
61 | + /** |
|
62 | + * Removes a user from a group |
|
63 | + * @param string $uid Name of the user to remove from group |
|
64 | + * @param string $gid Name of the group from which remove the user |
|
65 | + * @return bool |
|
66 | + * |
|
67 | + * removes the user from a group. |
|
68 | + */ |
|
69 | + public function removeFromGroup($uid, $gid); |
|
70 | 70 | |
71 | - /** |
|
72 | - * get the number of all users matching the search string in a group |
|
73 | - * @param string $gid |
|
74 | - * @param string $search |
|
75 | - * @return int|false |
|
76 | - */ |
|
77 | - public function countUsersInGroup($gid, $search = ''); |
|
71 | + /** |
|
72 | + * get the number of all users matching the search string in a group |
|
73 | + * @param string $gid |
|
74 | + * @param string $search |
|
75 | + * @return int|false |
|
76 | + */ |
|
77 | + public function countUsersInGroup($gid, $search = ''); |
|
78 | 78 | |
79 | - /** |
|
80 | - * get an array with group details |
|
81 | - * @param string $gid |
|
82 | - * @return array|false |
|
83 | - */ |
|
84 | - public function getGroupDetails($gid); |
|
79 | + /** |
|
80 | + * get an array with group details |
|
81 | + * @param string $gid |
|
82 | + * @return array|false |
|
83 | + */ |
|
84 | + public function getGroupDetails($gid); |
|
85 | 85 | |
86 | 86 | } |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <div class="ldapWizardControls"> |
2 | - <span class="ldap_saving hidden"><?php p($l->t('Saving'));?> <img class="wizSpinner" src="<?php p(image_path('core', 'loading.gif')); ?>"/></span> |
|
2 | + <span class="ldap_saving hidden"><?php p($l->t('Saving')); ?> <img class="wizSpinner" src="<?php p(image_path('core', 'loading.gif')); ?>"/></span> |
|
3 | 3 | <span class="ldap_config_state_indicator"></span> <span class="ldap_config_state_indicator_sign"></span> |
4 | 4 | <button class="ldap_action_back invisible" name="ldap_action_back" |
5 | 5 | type="button"> |
6 | - <?php p($l->t('Back'));?> |
|
6 | + <?php p($l->t('Back')); ?> |
|
7 | 7 | </button> |
8 | 8 | <button class="ldap_action_continue primary" name="ldap_action_continue" type="button"> |
9 | - <?php p($l->t('Continue'));?> |
|
9 | + <?php p($l->t('Continue')); ?> |
|
10 | 10 | </button> |
11 | 11 | <a href="<?php p(link_to_docs('admin-ldap')); ?>" |
12 | 12 | target="_blank" rel="noreferrer noopener"> |
13 | 13 | <img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>" |
14 | 14 | style="height:1.75ex" /> |
15 | - <span class="ldap_grey"><?php p($l->t('Help'));?></span> |
|
15 | + <span class="ldap_grey"><?php p($l->t('Help')); ?></span> |
|
16 | 16 | </a> |
17 | 17 | </div> |
@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | interface IReporter { |
32 | 32 | |
33 | - /** |
|
34 | - * Report an (unhandled) exception |
|
35 | - * |
|
36 | - * @since 13.0.0 |
|
37 | - * @param Exception|Throwable $exception |
|
38 | - * @param array $context |
|
39 | - */ |
|
40 | - public function report($exception, array $context = []); |
|
33 | + /** |
|
34 | + * Report an (unhandled) exception |
|
35 | + * |
|
36 | + * @since 13.0.0 |
|
37 | + * @param Exception|Throwable $exception |
|
38 | + * @param array $context |
|
39 | + */ |
|
40 | + public function report($exception, array $context = []); |
|
41 | 41 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $res['group'] = []; |
88 | 88 | $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
89 | 89 | $res['group']['expire_date']['enabled'] = true; |
90 | - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
90 | + $res['default_permissions'] = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | //Federated sharing |
@@ -35,91 +35,91 @@ |
||
35 | 35 | */ |
36 | 36 | class Capabilities implements ICapability { |
37 | 37 | |
38 | - /** @var IConfig */ |
|
39 | - private $config; |
|
40 | - |
|
41 | - public function __construct(IConfig $config) { |
|
42 | - $this->config = $config; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Return this classes capabilities |
|
47 | - * |
|
48 | - * @return array |
|
49 | - */ |
|
50 | - public function getCapabilities() { |
|
51 | - $res = []; |
|
52 | - |
|
53 | - if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
54 | - $res['api_enabled'] = false; |
|
55 | - $res['public'] = ['enabled' => false]; |
|
56 | - $res['user'] = ['send_mail' => false]; |
|
57 | - $res['resharing'] = false; |
|
58 | - } else { |
|
59 | - $res['api_enabled'] = true; |
|
60 | - |
|
61 | - $public = []; |
|
62 | - $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
63 | - if ($public['enabled']) { |
|
64 | - $public['password'] = []; |
|
65 | - $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
66 | - |
|
67 | - if ($public['password']['enforced']) { |
|
68 | - $public['password']['askForOptionalPassword'] = false; |
|
69 | - } else { |
|
70 | - $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
71 | - } |
|
72 | - |
|
73 | - $public['expire_date'] = []; |
|
74 | - $public['multiple_links'] = true; |
|
75 | - $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
76 | - if ($public['expire_date']['enabled']) { |
|
77 | - $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
78 | - $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
79 | - } |
|
80 | - |
|
81 | - $public['expire_date_internal'] = []; |
|
82 | - $public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
83 | - if ($public['expire_date_internal']['enabled']) { |
|
84 | - $public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
85 | - $public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
86 | - } |
|
87 | - |
|
88 | - $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
89 | - $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
90 | - $public['upload_files_drop'] = $public['upload']; |
|
91 | - } |
|
92 | - $res['public'] = $public; |
|
93 | - |
|
94 | - $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
95 | - |
|
96 | - $res['user']['send_mail'] = false; |
|
97 | - $res['user']['expire_date']['enabled'] = true; |
|
98 | - |
|
99 | - // deprecated in favour of 'group', but we need to keep it for now |
|
100 | - // in order to stay compatible with older clients |
|
101 | - $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
102 | - |
|
103 | - $res['group'] = []; |
|
104 | - $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
105 | - $res['group']['expire_date']['enabled'] = true; |
|
106 | - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
107 | - } |
|
108 | - |
|
109 | - //Federated sharing |
|
110 | - $res['federation'] = [ |
|
111 | - 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
112 | - 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
113 | - 'expire_date' => ['enabled' => true] |
|
114 | - ]; |
|
115 | - |
|
116 | - // Sharee searches |
|
117 | - $res['sharee'] = [ |
|
118 | - 'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false) |
|
119 | - ]; |
|
120 | - |
|
121 | - return [ |
|
122 | - 'files_sharing' => $res, |
|
123 | - ]; |
|
124 | - } |
|
38 | + /** @var IConfig */ |
|
39 | + private $config; |
|
40 | + |
|
41 | + public function __construct(IConfig $config) { |
|
42 | + $this->config = $config; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Return this classes capabilities |
|
47 | + * |
|
48 | + * @return array |
|
49 | + */ |
|
50 | + public function getCapabilities() { |
|
51 | + $res = []; |
|
52 | + |
|
53 | + if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
54 | + $res['api_enabled'] = false; |
|
55 | + $res['public'] = ['enabled' => false]; |
|
56 | + $res['user'] = ['send_mail' => false]; |
|
57 | + $res['resharing'] = false; |
|
58 | + } else { |
|
59 | + $res['api_enabled'] = true; |
|
60 | + |
|
61 | + $public = []; |
|
62 | + $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
63 | + if ($public['enabled']) { |
|
64 | + $public['password'] = []; |
|
65 | + $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
66 | + |
|
67 | + if ($public['password']['enforced']) { |
|
68 | + $public['password']['askForOptionalPassword'] = false; |
|
69 | + } else { |
|
70 | + $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes'); |
|
71 | + } |
|
72 | + |
|
73 | + $public['expire_date'] = []; |
|
74 | + $public['multiple_links'] = true; |
|
75 | + $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
76 | + if ($public['expire_date']['enabled']) { |
|
77 | + $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
78 | + $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
79 | + } |
|
80 | + |
|
81 | + $public['expire_date_internal'] = []; |
|
82 | + $public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
83 | + if ($public['expire_date_internal']['enabled']) { |
|
84 | + $public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
85 | + $public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
86 | + } |
|
87 | + |
|
88 | + $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
89 | + $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
90 | + $public['upload_files_drop'] = $public['upload']; |
|
91 | + } |
|
92 | + $res['public'] = $public; |
|
93 | + |
|
94 | + $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
95 | + |
|
96 | + $res['user']['send_mail'] = false; |
|
97 | + $res['user']['expire_date']['enabled'] = true; |
|
98 | + |
|
99 | + // deprecated in favour of 'group', but we need to keep it for now |
|
100 | + // in order to stay compatible with older clients |
|
101 | + $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
102 | + |
|
103 | + $res['group'] = []; |
|
104 | + $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
105 | + $res['group']['expire_date']['enabled'] = true; |
|
106 | + $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL); |
|
107 | + } |
|
108 | + |
|
109 | + //Federated sharing |
|
110 | + $res['federation'] = [ |
|
111 | + 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
112 | + 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
113 | + 'expire_date' => ['enabled' => true] |
|
114 | + ]; |
|
115 | + |
|
116 | + // Sharee searches |
|
117 | + $res['sharee'] = [ |
|
118 | + 'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false) |
|
119 | + ]; |
|
120 | + |
|
121 | + return [ |
|
122 | + 'files_sharing' => $res, |
|
123 | + ]; |
|
124 | + } |
|
125 | 125 | } |
@@ -23,18 +23,18 @@ |
||
23 | 23 | * |
24 | 24 | */ |
25 | 25 | |
26 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
27 | -require_once __DIR__ . '/../lib/base.php'; |
|
26 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
27 | +require_once __DIR__.'/../lib/base.php'; |
|
28 | 28 | |
29 | 29 | header('Content-type: application/xml'); |
30 | 30 | |
31 | 31 | $request = \OC::$server->getRequest(); |
32 | 32 | |
33 | -$url = $request->getServerProtocol() . '://' . substr($request->getServerHost() . $request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
33 | +$url = $request->getServerProtocol().'://'.substr($request->getServerHost().$request->getRequestUri(), 0, -17).'ocs/v1.php/'; |
|
34 | 34 | |
35 | 35 | $writer = new XMLWriter(); |
36 | 36 | $writer->openURI('php://output'); |
37 | -$writer->startDocument('1.0','UTF-8'); |
|
37 | +$writer->startDocument('1.0', 'UTF-8'); |
|
38 | 38 | $writer->setIndent(true); |
39 | 39 | $writer->startElement('providers'); |
40 | 40 | $writer->startElement('provider'); |
@@ -27,17 +27,17 @@ |
||
27 | 27 | * @since 13.0.0 |
28 | 28 | */ |
29 | 29 | interface ICachedMountFileInfo extends ICachedMountInfo { |
30 | - /** |
|
31 | - * Return the path for the file within the cached mount |
|
32 | - * |
|
33 | - * @return string |
|
34 | - * @since 13.0.0 |
|
35 | - */ |
|
36 | - public function getInternalPath(); |
|
30 | + /** |
|
31 | + * Return the path for the file within the cached mount |
|
32 | + * |
|
33 | + * @return string |
|
34 | + * @since 13.0.0 |
|
35 | + */ |
|
36 | + public function getInternalPath(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - * @since 13.0.0 |
|
41 | - */ |
|
42 | - public function getPath(); |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + * @since 13.0.0 |
|
41 | + */ |
|
42 | + public function getPath(); |
|
43 | 43 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @inheritdoc |
30 | 30 | */ |
31 | 31 | public function like($x, $y, $type = null) { |
32 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
32 | + return parent::like($x, $y, $type)." ESCAPE '\\'"; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function iLike($x, $y, $type = null) { |
@@ -24,14 +24,14 @@ |
||
24 | 24 | namespace OC\DB\QueryBuilder\ExpressionBuilder; |
25 | 25 | |
26 | 26 | class SqliteExpressionBuilder extends ExpressionBuilder { |
27 | - /** |
|
28 | - * @inheritdoc |
|
29 | - */ |
|
30 | - public function like($x, $y, $type = null) { |
|
31 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
32 | - } |
|
27 | + /** |
|
28 | + * @inheritdoc |
|
29 | + */ |
|
30 | + public function like($x, $y, $type = null) { |
|
31 | + return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
32 | + } |
|
33 | 33 | |
34 | - public function iLike($x, $y, $type = null) { |
|
35 | - return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
36 | - } |
|
34 | + public function iLike($x, $y, $type = null) { |
|
35 | + return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
36 | + } |
|
37 | 37 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | try { |
72 | 72 | $mount = $this->globalService->getStorage($mountId); |
73 | 73 | } catch (NotFoundException $e) { |
74 | - $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>'); |
|
74 | + $output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>'); |
|
75 | 75 | return 404; |
76 | 76 | } |
77 | 77 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | foreach ($configInput as $configOption) { |
107 | 107 | if (!strpos($configOption, '=')) { |
108 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
108 | + $output->writeln('<error>Invalid mount configuration option "'.$configOption.'"</error>'); |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | list($key, $value) = explode('=', $configOption, 2); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // FIXME: convert storage exceptions to StorageNotAvailableException |
138 | 138 | $storage->setStatus( |
139 | 139 | StorageNotAvailableException::STATUS_ERROR, |
140 | - get_class($e) . ': ' . $e->getMessage() |
|
140 | + get_class($e).': '.$e->getMessage() |
|
141 | 141 | ); |
142 | 142 | } |
143 | 143 | } |
@@ -38,109 +38,109 @@ |
||
38 | 38 | use Symfony\Component\Console\Output\OutputInterface; |
39 | 39 | |
40 | 40 | class Verify extends Base { |
41 | - /** |
|
42 | - * @var GlobalStoragesService |
|
43 | - */ |
|
44 | - protected $globalService; |
|
41 | + /** |
|
42 | + * @var GlobalStoragesService |
|
43 | + */ |
|
44 | + protected $globalService; |
|
45 | 45 | |
46 | - public function __construct(GlobalStoragesService $globalService) { |
|
47 | - parent::__construct(); |
|
48 | - $this->globalService = $globalService; |
|
49 | - } |
|
46 | + public function __construct(GlobalStoragesService $globalService) { |
|
47 | + parent::__construct(); |
|
48 | + $this->globalService = $globalService; |
|
49 | + } |
|
50 | 50 | |
51 | - protected function configure() { |
|
52 | - $this |
|
53 | - ->setName('files_external:verify') |
|
54 | - ->setDescription('Verify mount configuration') |
|
55 | - ->addArgument( |
|
56 | - 'mount_id', |
|
57 | - InputArgument::REQUIRED, |
|
58 | - 'The id of the mount to check' |
|
59 | - )->addOption( |
|
60 | - 'config', |
|
61 | - 'c', |
|
62 | - InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
63 | - 'Additional config option to set before checking in key=value pairs, required for certain auth backends such as login credentails' |
|
64 | - ); |
|
65 | - parent::configure(); |
|
66 | - } |
|
51 | + protected function configure() { |
|
52 | + $this |
|
53 | + ->setName('files_external:verify') |
|
54 | + ->setDescription('Verify mount configuration') |
|
55 | + ->addArgument( |
|
56 | + 'mount_id', |
|
57 | + InputArgument::REQUIRED, |
|
58 | + 'The id of the mount to check' |
|
59 | + )->addOption( |
|
60 | + 'config', |
|
61 | + 'c', |
|
62 | + InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
63 | + 'Additional config option to set before checking in key=value pairs, required for certain auth backends such as login credentails' |
|
64 | + ); |
|
65 | + parent::configure(); |
|
66 | + } |
|
67 | 67 | |
68 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
69 | - $mountId = $input->getArgument('mount_id'); |
|
70 | - $configInput = $input->getOption('config'); |
|
68 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
69 | + $mountId = $input->getArgument('mount_id'); |
|
70 | + $configInput = $input->getOption('config'); |
|
71 | 71 | |
72 | - try { |
|
73 | - $mount = $this->globalService->getStorage($mountId); |
|
74 | - } catch (NotFoundException $e) { |
|
75 | - $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>'); |
|
76 | - return 404; |
|
77 | - } |
|
72 | + try { |
|
73 | + $mount = $this->globalService->getStorage($mountId); |
|
74 | + } catch (NotFoundException $e) { |
|
75 | + $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>'); |
|
76 | + return 404; |
|
77 | + } |
|
78 | 78 | |
79 | - $this->updateStorageStatus($mount, $configInput, $output); |
|
79 | + $this->updateStorageStatus($mount, $configInput, $output); |
|
80 | 80 | |
81 | - $this->writeArrayInOutputFormat($input, $output, [ |
|
82 | - 'status' => StorageNotAvailableException::getStateCodeName($mount->getStatus()), |
|
83 | - 'code' => $mount->getStatus(), |
|
84 | - 'message' => $mount->getStatusMessage() |
|
85 | - ]); |
|
86 | - return 0; |
|
87 | - } |
|
81 | + $this->writeArrayInOutputFormat($input, $output, [ |
|
82 | + 'status' => StorageNotAvailableException::getStateCodeName($mount->getStatus()), |
|
83 | + 'code' => $mount->getStatus(), |
|
84 | + 'message' => $mount->getStatusMessage() |
|
85 | + ]); |
|
86 | + return 0; |
|
87 | + } |
|
88 | 88 | |
89 | - private function manipulateStorageConfig(StorageConfig $storage) { |
|
90 | - /** @var AuthMechanism */ |
|
91 | - $authMechanism = $storage->getAuthMechanism(); |
|
92 | - $authMechanism->manipulateStorageConfig($storage); |
|
93 | - /** @var Backend */ |
|
94 | - $backend = $storage->getBackend(); |
|
95 | - $backend->manipulateStorageConfig($storage); |
|
96 | - } |
|
89 | + private function manipulateStorageConfig(StorageConfig $storage) { |
|
90 | + /** @var AuthMechanism */ |
|
91 | + $authMechanism = $storage->getAuthMechanism(); |
|
92 | + $authMechanism->manipulateStorageConfig($storage); |
|
93 | + /** @var Backend */ |
|
94 | + $backend = $storage->getBackend(); |
|
95 | + $backend->manipulateStorageConfig($storage); |
|
96 | + } |
|
97 | 97 | |
98 | - private function updateStorageStatus(StorageConfig &$storage, $configInput, OutputInterface $output) { |
|
99 | - try { |
|
100 | - try { |
|
101 | - $this->manipulateStorageConfig($storage); |
|
102 | - } catch (InsufficientDataForMeaningfulAnswerException $e) { |
|
103 | - if (count($configInput) === 0) { // extra config options might solve the error |
|
104 | - throw $e; |
|
105 | - } |
|
106 | - } |
|
98 | + private function updateStorageStatus(StorageConfig &$storage, $configInput, OutputInterface $output) { |
|
99 | + try { |
|
100 | + try { |
|
101 | + $this->manipulateStorageConfig($storage); |
|
102 | + } catch (InsufficientDataForMeaningfulAnswerException $e) { |
|
103 | + if (count($configInput) === 0) { // extra config options might solve the error |
|
104 | + throw $e; |
|
105 | + } |
|
106 | + } |
|
107 | 107 | |
108 | - foreach ($configInput as $configOption) { |
|
109 | - if (!strpos($configOption, '=')) { |
|
110 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
111 | - return; |
|
112 | - } |
|
113 | - list($key, $value) = explode('=', $configOption, 2); |
|
114 | - $storage->setBackendOption($key, $value); |
|
115 | - } |
|
108 | + foreach ($configInput as $configOption) { |
|
109 | + if (!strpos($configOption, '=')) { |
|
110 | + $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
111 | + return; |
|
112 | + } |
|
113 | + list($key, $value) = explode('=', $configOption, 2); |
|
114 | + $storage->setBackendOption($key, $value); |
|
115 | + } |
|
116 | 116 | |
117 | - /** @var Backend */ |
|
118 | - $backend = $storage->getBackend(); |
|
119 | - // update status (can be time-consuming) |
|
120 | - $storage->setStatus( |
|
121 | - \OCA\Files_External\MountConfig::getBackendStatus( |
|
122 | - $backend->getStorageClass(), |
|
123 | - $storage->getBackendOptions(), |
|
124 | - false |
|
125 | - ) |
|
126 | - ); |
|
127 | - } catch (InsufficientDataForMeaningfulAnswerException $e) { |
|
128 | - $status = $e->getCode() ? $e->getCode() : StorageNotAvailableException::STATUS_INDETERMINATE; |
|
129 | - $storage->setStatus( |
|
130 | - $status, |
|
131 | - $e->getMessage() |
|
132 | - ); |
|
133 | - } catch (StorageNotAvailableException $e) { |
|
134 | - $storage->setStatus( |
|
135 | - $e->getCode(), |
|
136 | - $e->getMessage() |
|
137 | - ); |
|
138 | - } catch (\Exception $e) { |
|
139 | - // FIXME: convert storage exceptions to StorageNotAvailableException |
|
140 | - $storage->setStatus( |
|
141 | - StorageNotAvailableException::STATUS_ERROR, |
|
142 | - get_class($e) . ': ' . $e->getMessage() |
|
143 | - ); |
|
144 | - } |
|
145 | - } |
|
117 | + /** @var Backend */ |
|
118 | + $backend = $storage->getBackend(); |
|
119 | + // update status (can be time-consuming) |
|
120 | + $storage->setStatus( |
|
121 | + \OCA\Files_External\MountConfig::getBackendStatus( |
|
122 | + $backend->getStorageClass(), |
|
123 | + $storage->getBackendOptions(), |
|
124 | + false |
|
125 | + ) |
|
126 | + ); |
|
127 | + } catch (InsufficientDataForMeaningfulAnswerException $e) { |
|
128 | + $status = $e->getCode() ? $e->getCode() : StorageNotAvailableException::STATUS_INDETERMINATE; |
|
129 | + $storage->setStatus( |
|
130 | + $status, |
|
131 | + $e->getMessage() |
|
132 | + ); |
|
133 | + } catch (StorageNotAvailableException $e) { |
|
134 | + $storage->setStatus( |
|
135 | + $e->getCode(), |
|
136 | + $e->getMessage() |
|
137 | + ); |
|
138 | + } catch (\Exception $e) { |
|
139 | + // FIXME: convert storage exceptions to StorageNotAvailableException |
|
140 | + $storage->setStatus( |
|
141 | + StorageNotAvailableException::STATUS_ERROR, |
|
142 | + get_class($e) . ': ' . $e->getMessage() |
|
143 | + ); |
|
144 | + } |
|
145 | + } |
|
146 | 146 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this |
50 | 50 | ->setIdentifier($invalidId) |
51 | 51 | ->setStorageClass('\OC\Files\Storage\FailedStorage') |
52 | - ->setText('Unknown storage backend ' . $invalidId); |
|
52 | + ->setText('Unknown storage backend '.$invalidId); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
65 | - $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | + $storage->setBackendOption('exception', new \Exception('Unknown storage backend "'.$this->invalidId.'"', StorageNotAvailableException::STATUS_ERROR)); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -34,33 +34,33 @@ |
||
34 | 34 | */ |
35 | 35 | class InvalidBackend extends Backend { |
36 | 36 | |
37 | - /** @var string Invalid backend id */ |
|
38 | - private $invalidId; |
|
37 | + /** @var string Invalid backend id */ |
|
38 | + private $invalidId; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructs a new InvalidBackend with the id of the invalid backend |
|
42 | - * for display purposes |
|
43 | - * |
|
44 | - * @param string $invalidId id of the backend that did not exist |
|
45 | - */ |
|
46 | - public function __construct($invalidId) { |
|
47 | - $this->invalidId = $invalidId; |
|
48 | - $this |
|
49 | - ->setIdentifier($invalidId) |
|
50 | - ->setStorageClass('\OC\Files\Storage\FailedStorage') |
|
51 | - ->setText('Unknown storage backend ' . $invalidId); |
|
52 | - } |
|
40 | + /** |
|
41 | + * Constructs a new InvalidBackend with the id of the invalid backend |
|
42 | + * for display purposes |
|
43 | + * |
|
44 | + * @param string $invalidId id of the backend that did not exist |
|
45 | + */ |
|
46 | + public function __construct($invalidId) { |
|
47 | + $this->invalidId = $invalidId; |
|
48 | + $this |
|
49 | + ->setIdentifier($invalidId) |
|
50 | + ->setStorageClass('\OC\Files\Storage\FailedStorage') |
|
51 | + ->setText('Unknown storage backend ' . $invalidId); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Returns the invalid backend id |
|
56 | - * |
|
57 | - * @return string invalid backend id |
|
58 | - */ |
|
59 | - public function getInvalidId() { |
|
60 | - return $this->invalidId; |
|
61 | - } |
|
54 | + /** |
|
55 | + * Returns the invalid backend id |
|
56 | + * |
|
57 | + * @return string invalid backend id |
|
58 | + */ |
|
59 | + public function getInvalidId() { |
|
60 | + return $this->invalidId; |
|
61 | + } |
|
62 | 62 | |
63 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | - $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | - } |
|
63 | + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
64 | + $storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR)); |
|
65 | + } |
|
66 | 66 | } |