@@ -30,57 +30,57 @@ |
||
30 | 30 | use OCP\Settings\ISettings; |
31 | 31 | |
32 | 32 | class Mail implements ISettings { |
33 | - /** @var IConfig */ |
|
34 | - private $config; |
|
33 | + /** @var IConfig */ |
|
34 | + private $config; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IConfig $config |
|
38 | - */ |
|
39 | - public function __construct(IConfig $config) { |
|
40 | - $this->config = $config; |
|
41 | - } |
|
36 | + /** |
|
37 | + * @param IConfig $config |
|
38 | + */ |
|
39 | + public function __construct(IConfig $config) { |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return TemplateResponse |
|
45 | - */ |
|
46 | - public function getForm() { |
|
47 | - $parameters = [ |
|
48 | ||
49 | - 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'), |
|
50 | - 'mail_domain' => $this->config->getSystemValue('mail_domain', ''), |
|
51 | - 'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''), |
|
52 | - 'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''), |
|
53 | - 'mail_smtpsecure' => $this->config->getSystemValue('mail_smtpsecure', ''), |
|
54 | - 'mail_smtphost' => $this->config->getSystemValue('mail_smtphost', ''), |
|
55 | - 'mail_smtpport' => $this->config->getSystemValue('mail_smtpport', ''), |
|
56 | - 'mail_smtpauthtype' => $this->config->getSystemValue('mail_smtpauthtype', ''), |
|
57 | - 'mail_smtpauth' => $this->config->getSystemValue('mail_smtpauth', false), |
|
58 | - 'mail_smtpname' => $this->config->getSystemValue('mail_smtpname', ''), |
|
59 | - 'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''), |
|
60 | - ]; |
|
43 | + /** |
|
44 | + * @return TemplateResponse |
|
45 | + */ |
|
46 | + public function getForm() { |
|
47 | + $parameters = [ |
|
48 | ||
49 | + 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'), |
|
50 | + 'mail_domain' => $this->config->getSystemValue('mail_domain', ''), |
|
51 | + 'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''), |
|
52 | + 'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''), |
|
53 | + 'mail_smtpsecure' => $this->config->getSystemValue('mail_smtpsecure', ''), |
|
54 | + 'mail_smtphost' => $this->config->getSystemValue('mail_smtphost', ''), |
|
55 | + 'mail_smtpport' => $this->config->getSystemValue('mail_smtpport', ''), |
|
56 | + 'mail_smtpauthtype' => $this->config->getSystemValue('mail_smtpauthtype', ''), |
|
57 | + 'mail_smtpauth' => $this->config->getSystemValue('mail_smtpauth', false), |
|
58 | + 'mail_smtpname' => $this->config->getSystemValue('mail_smtpname', ''), |
|
59 | + 'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''), |
|
60 | + ]; |
|
61 | 61 | |
62 | - if ($parameters['mail_smtppassword'] !== '') { |
|
63 | - $parameters['mail_smtppassword'] = '********'; |
|
64 | - } |
|
62 | + if ($parameters['mail_smtppassword'] !== '') { |
|
63 | + $parameters['mail_smtppassword'] = '********'; |
|
64 | + } |
|
65 | 65 | |
66 | - return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, ''); |
|
67 | - } |
|
66 | + return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, ''); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return string the section ID, e.g. 'sharing' |
|
71 | - */ |
|
72 | - public function getSection() { |
|
73 | - return 'server'; |
|
74 | - } |
|
69 | + /** |
|
70 | + * @return string the section ID, e.g. 'sharing' |
|
71 | + */ |
|
72 | + public function getSection() { |
|
73 | + return 'server'; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return int whether the form should be rather on the top or bottom of |
|
78 | - * the admin section. The forms are arranged in ascending order of the |
|
79 | - * priority values. It is required to return a value between 0 and 100. |
|
80 | - * |
|
81 | - * E.g.: 70 |
|
82 | - */ |
|
83 | - public function getPriority() { |
|
84 | - return 10; |
|
85 | - } |
|
76 | + /** |
|
77 | + * @return int whether the form should be rather on the top or bottom of |
|
78 | + * the admin section. The forms are arranged in ascending order of the |
|
79 | + * priority values. It is required to return a value between 0 and 100. |
|
80 | + * |
|
81 | + * E.g.: 70 |
|
82 | + */ |
|
83 | + public function getPriority() { |
|
84 | + return 10; |
|
85 | + } |
|
86 | 86 | } |
@@ -32,56 +32,56 @@ |
||
32 | 32 | |
33 | 33 | class Admin implements ISettings { |
34 | 34 | |
35 | - /** @var IniGetWrapper */ |
|
36 | - private $iniWrapper; |
|
35 | + /** @var IniGetWrapper */ |
|
36 | + private $iniWrapper; |
|
37 | 37 | |
38 | - /** @var IRequest */ |
|
39 | - private $request; |
|
38 | + /** @var IRequest */ |
|
39 | + private $request; |
|
40 | 40 | |
41 | - public function __construct(IniGetWrapper $iniWrapper, IRequest $request) { |
|
42 | - $this->iniWrapper = $iniWrapper; |
|
43 | - $this->request = $request; |
|
44 | - } |
|
41 | + public function __construct(IniGetWrapper $iniWrapper, IRequest $request) { |
|
42 | + $this->iniWrapper = $iniWrapper; |
|
43 | + $this->request = $request; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return TemplateResponse |
|
48 | - */ |
|
49 | - public function getForm() { |
|
50 | - $htaccessWorking = (getenv('htaccessWorking') === 'true'); |
|
51 | - $htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess'); |
|
52 | - $userIniWritable = is_writable(\OC::$SERVERROOT.'/.user.ini'); |
|
46 | + /** |
|
47 | + * @return TemplateResponse |
|
48 | + */ |
|
49 | + public function getForm() { |
|
50 | + $htaccessWorking = (getenv('htaccessWorking') === 'true'); |
|
51 | + $htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess'); |
|
52 | + $userIniWritable = is_writable(\OC::$SERVERROOT.'/.user.ini'); |
|
53 | 53 | |
54 | - $upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize'); |
|
55 | - $post_max_size = $this->iniWrapper->getBytes('post_max_size'); |
|
56 | - $maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size)); |
|
54 | + $upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize'); |
|
55 | + $post_max_size = $this->iniWrapper->getBytes('post_max_size'); |
|
56 | + $maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size)); |
|
57 | 57 | |
58 | - $parameters = [ |
|
59 | - 'uploadChangable' => ($htaccessWorking and $htaccessWritable) or $userIniWritable, |
|
60 | - 'uploadMaxFilesize' => $maxUploadFilesize, |
|
61 | - // max possible makes only sense on a 32 bit system |
|
62 | - 'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4, |
|
63 | - 'maxPossibleUploadSize' => Util::humanFileSize(PHP_INT_MAX), |
|
64 | - ]; |
|
58 | + $parameters = [ |
|
59 | + 'uploadChangable' => ($htaccessWorking and $htaccessWritable) or $userIniWritable, |
|
60 | + 'uploadMaxFilesize' => $maxUploadFilesize, |
|
61 | + // max possible makes only sense on a 32 bit system |
|
62 | + 'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4, |
|
63 | + 'maxPossibleUploadSize' => Util::humanFileSize(PHP_INT_MAX), |
|
64 | + ]; |
|
65 | 65 | |
66 | - return new TemplateResponse('files', 'admin', $parameters, ''); |
|
67 | - } |
|
66 | + return new TemplateResponse('files', 'admin', $parameters, ''); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return string the section ID, e.g. 'sharing' |
|
71 | - */ |
|
72 | - public function getSection() { |
|
73 | - return 'server'; |
|
74 | - } |
|
69 | + /** |
|
70 | + * @return string the section ID, e.g. 'sharing' |
|
71 | + */ |
|
72 | + public function getSection() { |
|
73 | + return 'server'; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return int whether the form should be rather on the top or bottom of |
|
78 | - * the admin section. The forms are arranged in ascending order of the |
|
79 | - * priority values. It is required to return a value between 0 and 100. |
|
80 | - * |
|
81 | - * E.g.: 70 |
|
82 | - */ |
|
83 | - public function getPriority() { |
|
84 | - return 5; |
|
85 | - } |
|
76 | + /** |
|
77 | + * @return int whether the form should be rather on the top or bottom of |
|
78 | + * the admin section. The forms are arranged in ascending order of the |
|
79 | + * priority values. It is required to return a value between 0 and 100. |
|
80 | + * |
|
81 | + * E.g.: 70 |
|
82 | + */ |
|
83 | + public function getPriority() { |
|
84 | + return 5; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
@@ -29,41 +29,41 @@ |
||
29 | 29 | |
30 | 30 | class CalDAVSettings implements ISettings { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - private $config; |
|
32 | + /** @var IConfig */ |
|
33 | + private $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * CalDAVSettings constructor. |
|
37 | - * |
|
38 | - * @param IConfig $config |
|
39 | - */ |
|
40 | - public function __construct(IConfig $config) { |
|
41 | - $this->config = $config; |
|
42 | - } |
|
35 | + /** |
|
36 | + * CalDAVSettings constructor. |
|
37 | + * |
|
38 | + * @param IConfig $config |
|
39 | + */ |
|
40 | + public function __construct(IConfig $config) { |
|
41 | + $this->config = $config; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @return TemplateResponse |
|
46 | - */ |
|
47 | - public function getForm() { |
|
48 | - $parameters = [ |
|
49 | - 'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'), |
|
50 | - 'generate_birthday_calendar' => $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'), |
|
51 | - ]; |
|
44 | + /** |
|
45 | + * @return TemplateResponse |
|
46 | + */ |
|
47 | + public function getForm() { |
|
48 | + $parameters = [ |
|
49 | + 'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'), |
|
50 | + 'generate_birthday_calendar' => $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'), |
|
51 | + ]; |
|
52 | 52 | |
53 | - return new TemplateResponse('dav', 'settings-admin-caldav', $parameters); |
|
54 | - } |
|
53 | + return new TemplateResponse('dav', 'settings-admin-caldav', $parameters); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getSection() { |
|
60 | - return 'server'; |
|
61 | - } |
|
56 | + /** |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getSection() { |
|
60 | + return 'server'; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @return int |
|
65 | - */ |
|
66 | - public function getPriority() { |
|
67 | - return 20; |
|
68 | - } |
|
63 | + /** |
|
64 | + * @return int |
|
65 | + */ |
|
66 | + public function getPriority() { |
|
67 | + return 20; |
|
68 | + } |
|
69 | 69 | } |
@@ -31,101 +31,101 @@ discard block |
||
31 | 31 | <p class="settings-hint"><?php p($l->t('It\'s important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the Tips & Tricks section and the documentation for more information.'));?></p> |
32 | 32 | <ul> |
33 | 33 | <?php |
34 | - // is php setup properly to query system environment variables like getenv('PATH') |
|
35 | - if ($_['getenvServerNotWorking']) { |
|
36 | - ?> |
|
34 | + // is php setup properly to query system environment variables like getenv('PATH') |
|
35 | + if ($_['getenvServerNotWorking']) { |
|
36 | + ?> |
|
37 | 37 | <li> |
38 | 38 | <?php p($l->t('PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.')); ?><br> |
39 | 39 | <?php print_unescaped($l->t('Please check the <a target="_blank" rel="noreferrer noopener" href="%s">installation documentation ↗</a> for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.', link_to_docs('admin-php-fpm'))); ?> |
40 | 40 | </li> |
41 | 41 | <?php |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - // is read only config enabled |
|
45 | - if ($_['readOnlyConfigEnabled']) { |
|
46 | - ?> |
|
44 | + // is read only config enabled |
|
45 | + if ($_['readOnlyConfigEnabled']) { |
|
46 | + ?> |
|
47 | 47 | <li> |
48 | 48 | <?php p($l->t('The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); ?> |
49 | 49 | </li> |
50 | 50 | <?php |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - // Are doc blocks accessible? |
|
54 | - if (!$_['isAnnotationsWorking']) { |
|
55 | - ?> |
|
53 | + // Are doc blocks accessible? |
|
54 | + if (!$_['isAnnotationsWorking']) { |
|
55 | + ?> |
|
56 | 56 | <li> |
57 | 57 | <?php p($l->t('PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.')); ?><br> |
58 | 58 | <?php p($l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')); ?> |
59 | 59 | </li> |
60 | 60 | <?php |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - // Is the Transaction isolation level READ_COMMITTED? |
|
64 | - if ($_['invalidTransactionIsolationLevel']) { |
|
65 | - ?> |
|
63 | + // Is the Transaction isolation level READ_COMMITTED? |
|
64 | + if ($_['invalidTransactionIsolationLevel']) { |
|
65 | + ?> |
|
66 | 66 | <li> |
67 | 67 | <?php p($l->t('Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.')); ?> |
68 | 68 | </li> |
69 | 69 | <?php |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - // Warning if memcache is outdated |
|
73 | - foreach ($_['OutdatedCacheWarning'] as $php_module => $data) { |
|
74 | - ?> |
|
72 | + // Warning if memcache is outdated |
|
73 | + foreach ($_['OutdatedCacheWarning'] as $php_module => $data) { |
|
74 | + ?> |
|
75 | 75 | <li> |
76 | 76 | <?php p($l->t('%1$s below version %2$s is installed, for stability and performance reasons it is recommended to update to a newer %1$s version.', $data)); ?> |
77 | 77 | </li> |
78 | 78 | <?php |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - // if module fileinfo available? |
|
82 | - if (!$_['has_fileinfo']) { |
|
83 | - ?> |
|
81 | + // if module fileinfo available? |
|
82 | + if (!$_['has_fileinfo']) { |
|
83 | + ?> |
|
84 | 84 | <li> |
85 | 85 | <?php p($l->t('The PHP module \'fileinfo\' is missing. It is strongly recommended to enable this module to get the best results with MIME type detection.')); ?> |
86 | 86 | </li> |
87 | 87 | <?php |
88 | - } |
|
88 | + } |
|
89 | 89 | |
90 | - // locking configured optimally? |
|
91 | - if ($_['fileLockingType'] === 'none') { |
|
92 | - ?> |
|
90 | + // locking configured optimally? |
|
91 | + if ($_['fileLockingType'] === 'none') { |
|
92 | + ?> |
|
93 | 93 | <li> |
94 | 94 | <?php print_unescaped($l->t('Transactional file locking is disabled, this might lead to issues with race conditions. Enable \'filelocking.enabled\' in config.php to avoid these problems. See the <a target="_blank" rel="noreferrer noopener" href="%s">documentation ↗</a> for more information.', link_to_docs('admin-transactional-locking'))); ?> |
95 | 95 | </li> |
96 | 96 | <?php |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - // is locale working ? |
|
100 | - if (!$_['isLocaleWorking']) { |
|
101 | - ?> |
|
99 | + // is locale working ? |
|
100 | + if (!$_['isLocaleWorking']) { |
|
101 | + ?> |
|
102 | 102 | <li> |
103 | 103 | <?php |
104 | - $locales = 'en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8'; |
|
105 | - p($l->t('System locale can not be set to a one which supports UTF-8.')); |
|
106 | - ?> |
|
104 | + $locales = 'en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8'; |
|
105 | + p($l->t('System locale can not be set to a one which supports UTF-8.')); |
|
106 | + ?> |
|
107 | 107 | <br> |
108 | 108 | <?php |
109 | - p($l->t('This means that there might be problems with certain characters in filenames.')); |
|
110 | - ?> |
|
109 | + p($l->t('This means that there might be problems with certain characters in filenames.')); |
|
110 | + ?> |
|
111 | 111 | <br> |
112 | 112 | <?php |
113 | - p($l->t('It is strongly proposed to install the required packages on your system to support one of the following locales: %s.', [$locales])); |
|
114 | - ?> |
|
113 | + p($l->t('It is strongly proposed to install the required packages on your system to support one of the following locales: %s.', [$locales])); |
|
114 | + ?> |
|
115 | 115 | </li> |
116 | 116 | <?php |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | - if ($_['suggestedOverwriteCliUrl']) { |
|
120 | - ?> |
|
119 | + if ($_['suggestedOverwriteCliUrl']) { |
|
120 | + ?> |
|
121 | 121 | <li> |
122 | 122 | <?php p($l->t('If your installation is not installed at the root of the domain and uses system Cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (Suggested: "%s")', $_['suggestedOverwriteCliUrl'])); ?> |
123 | 123 | </li> |
124 | 124 | <?php |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - if ($_['cronErrors']) { |
|
128 | - ?> |
|
127 | + if ($_['cronErrors']) { |
|
128 | + ?> |
|
129 | 129 | <li> |
130 | 130 | <?php p($l->t('It was not possible to execute the cron job via CLI. The following technical errors have appeared:')); ?> |
131 | 131 | <br> |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | </ol> |
137 | 137 | </li> |
138 | 138 | <?php |
139 | - } |
|
140 | - ?> |
|
139 | + } |
|
140 | + ?> |
|
141 | 141 | <?php if ($_['lastcron'] !== false): |
142 | - $relative_time = relative_modified_date($_['lastcron']); |
|
143 | - $formatter = \OC::$server->getDateTimeFormatter(); |
|
144 | - $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); |
|
145 | - if (time() - $_['lastcron'] > 3600): ?> |
|
142 | + $relative_time = relative_modified_date($_['lastcron']); |
|
143 | + $formatter = \OC::$server->getDateTimeFormatter(); |
|
144 | + $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); |
|
145 | + if (time() - $_['lastcron'] > 3600): ?> |
|
146 | 146 | <li class="crondate" title="<?php p($absolute_time);?>"> |
147 | 147 | <?php p($l->t("Last background job execution ran %s. Something seems wrong.", [$relative_time]));?> |
148 | 148 | <a href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => 'server'])); ?>#backgroundjobs"><?php p($l->t('Check the background job settings')); ?></a> |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | <h2 class="inlineblock"><?php p($l->t('Background jobs'));?></h2> |
31 | 31 | <p class="cronlog inlineblock"> |
32 | 32 | <?php if ($_['lastcron'] !== false): |
33 | - $relative_time = relative_modified_date($_['lastcron']); |
|
33 | + $relative_time = relative_modified_date($_['lastcron']); |
|
34 | 34 | |
35 | - $formatter = \OC::$server->getDateTimeFormatter(); |
|
36 | - $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); |
|
37 | - if (time() - $_['lastcron'] <= 3600): ?> |
|
35 | + $formatter = \OC::$server->getDateTimeFormatter(); |
|
36 | + $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); |
|
37 | + if (time() - $_['lastcron'] <= 3600): ?> |
|
38 | 38 | <span class="status success"></span> |
39 | 39 | <span class="crondate" title="<?php p($absolute_time);?>"> |
40 | 40 | <?php p($l->t("Last job ran %s.", [$relative_time]));?> |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | <?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?> |
46 | 46 | </span> |
47 | 47 | <?php endif; |
48 | - else: ?> |
|
48 | + else: ?> |
|
49 | 49 | <span class="status error"></span> |
50 | 50 | <?php p($l->t("Background job didn’t run yet!")); |
51 | - endif; ?> |
|
51 | + endif; ?> |
|
52 | 52 | </p> |
53 | 53 | <a target="_blank" rel="noreferrer noopener" class="icon-info" |
54 | 54 | title="<?php p($l->t('Open documentation'));?>" |
@@ -58,38 +58,38 @@ discard block |
||
58 | 58 | <p> |
59 | 59 | <input type="radio" name="mode" value="ajax" class="radio" |
60 | 60 | id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] === "ajax") { |
61 | - print_unescaped('checked="checked"'); |
|
62 | - } ?>> |
|
61 | + print_unescaped('checked="checked"'); |
|
62 | + } ?>> |
|
63 | 63 | <label for="backgroundjobs_ajax">AJAX</label><br/> |
64 | 64 | <em><?php p($l->t("Execute one task with each page loaded")); ?></em> |
65 | 65 | </p> |
66 | 66 | <p> |
67 | 67 | <input type="radio" name="mode" value="webcron" class="radio" |
68 | 68 | id="backgroundjobs_webcron" <?php if ($_['backgroundjobs_mode'] === "webcron") { |
69 | - print_unescaped('checked="checked"'); |
|
70 | - } ?>> |
|
69 | + print_unescaped('checked="checked"'); |
|
70 | + } ?>> |
|
71 | 71 | <label for="backgroundjobs_webcron">Webcron</label><br/> |
72 | 72 | <em><?php p($l->t("cron.php is registered at a webcron service to call cron.php every 15 minutes over HTTP.")); ?></em> |
73 | 73 | </p> |
74 | 74 | <p> |
75 | 75 | <input type="radio" name="mode" value="cron" class="radio" |
76 | 76 | id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") { |
77 | - print_unescaped('checked="checked"'); |
|
78 | - } |
|
79 | - if (!$_['cli_based_cron_possible']) { |
|
80 | - print_unescaped('disabled'); |
|
81 | - }?>> |
|
77 | + print_unescaped('checked="checked"'); |
|
78 | + } |
|
79 | + if (!$_['cli_based_cron_possible']) { |
|
80 | + print_unescaped('disabled'); |
|
81 | + }?>> |
|
82 | 82 | <label for="backgroundjobs_cron">Cron</label><br/> |
83 | 83 | <em><?php p($l->t("Use system cron service to call the cron.php file every 15 minutes.")); ?> |
84 | 84 | <?php if($_['cli_based_cron_possible']) { |
85 | - p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); |
|
86 | - } else { |
|
87 | - print_unescaped(str_replace( |
|
88 | - ['{linkstart}', '{linkend}'], |
|
89 | - ['<a href="http://php.net/manual/en/book.posix.php">', ' ↗</a>'], |
|
90 | - $l->t('To run this you need the PHP POSIX extension. See {linkstart}PHP documentation{linkend} for more details.') |
|
91 | - )); |
|
92 | - } ?></em> |
|
85 | + p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); |
|
86 | + } else { |
|
87 | + print_unescaped(str_replace( |
|
88 | + ['{linkstart}', '{linkend}'], |
|
89 | + ['<a href="http://php.net/manual/en/book.posix.php">', ' ↗</a>'], |
|
90 | + $l->t('To run this you need the PHP POSIX extension. See {linkstart}PHP documentation{linkend} for more details.') |
|
91 | + )); |
|
92 | + } ?></em> |
|
93 | 93 | |
94 | 94 | </p> |
95 | 95 | </div> |
96 | 96 | \ No newline at end of file |
@@ -49,359 +49,359 @@ |
||
49 | 49 | use OCP\Util; |
50 | 50 | |
51 | 51 | class Manager implements IManager { |
52 | - /** @var ILogger */ |
|
53 | - private $log; |
|
54 | - /** @var IDBConnection */ |
|
55 | - private $dbc; |
|
56 | - /** @var IL10N */ |
|
57 | - private $l; |
|
58 | - /** @var IConfig */ |
|
59 | - private $config; |
|
60 | - /** @var EncryptionManager */ |
|
61 | - private $encryptionManager; |
|
62 | - /** @var IUserManager */ |
|
63 | - private $userManager; |
|
64 | - /** @var ILockingProvider */ |
|
65 | - private $lockingProvider; |
|
66 | - /** @var IRequest */ |
|
67 | - private $request; |
|
68 | - /** @var IURLGenerator */ |
|
69 | - private $url; |
|
70 | - /** @var AccountManager */ |
|
71 | - private $accountManager; |
|
72 | - /** @var IGroupManager */ |
|
73 | - private $groupManager; |
|
74 | - /** @var IFactory */ |
|
75 | - private $l10nFactory; |
|
76 | - /** @var IAppManager */ |
|
77 | - private $appManager; |
|
78 | - |
|
79 | - /** |
|
80 | - * @param ILogger $log |
|
81 | - * @param IDBConnection $dbc |
|
82 | - * @param IL10N $l |
|
83 | - * @param IConfig $config |
|
84 | - * @param EncryptionManager $encryptionManager |
|
85 | - * @param IUserManager $userManager |
|
86 | - * @param ILockingProvider $lockingProvider |
|
87 | - * @param IRequest $request |
|
88 | - * @param IURLGenerator $url |
|
89 | - * @param AccountManager $accountManager |
|
90 | - * @param IGroupManager $groupManager |
|
91 | - * @param IFactory $l10nFactory |
|
92 | - * @param IAppManager $appManager |
|
93 | - */ |
|
94 | - public function __construct( |
|
95 | - ILogger $log, |
|
96 | - IDBConnection $dbc, |
|
97 | - IL10N $l, |
|
98 | - IConfig $config, |
|
99 | - EncryptionManager $encryptionManager, |
|
100 | - IUserManager $userManager, |
|
101 | - ILockingProvider $lockingProvider, |
|
102 | - IRequest $request, |
|
103 | - IURLGenerator $url, |
|
104 | - AccountManager $accountManager, |
|
105 | - IGroupManager $groupManager, |
|
106 | - IFactory $l10nFactory, |
|
107 | - IAppManager $appManager |
|
108 | - ) { |
|
109 | - $this->log = $log; |
|
110 | - $this->dbc = $dbc; |
|
111 | - $this->l = $l; |
|
112 | - $this->config = $config; |
|
113 | - $this->encryptionManager = $encryptionManager; |
|
114 | - $this->userManager = $userManager; |
|
115 | - $this->lockingProvider = $lockingProvider; |
|
116 | - $this->request = $request; |
|
117 | - $this->url = $url; |
|
118 | - $this->accountManager = $accountManager; |
|
119 | - $this->groupManager = $groupManager; |
|
120 | - $this->l10nFactory = $l10nFactory; |
|
121 | - $this->appManager = $appManager; |
|
122 | - } |
|
123 | - |
|
124 | - /** @var array */ |
|
125 | - protected $sectionClasses = []; |
|
126 | - |
|
127 | - /** @var array */ |
|
128 | - protected $sections = []; |
|
129 | - |
|
130 | - /** |
|
131 | - * @param string $type 'admin' or 'personal' |
|
132 | - * @param string $section Class must implement OCP\Settings\ISection |
|
133 | - * @return void |
|
134 | - */ |
|
135 | - public function registerSection(string $type, string $section) { |
|
136 | - $this->sectionClasses[$section] = $type; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @param string $type 'admin' or 'personal' |
|
141 | - * @return ISection[] |
|
142 | - */ |
|
143 | - protected function getSections(string $type): array { |
|
144 | - if (!isset($this->sections[$type])) { |
|
145 | - $this->sections[$type] = []; |
|
146 | - } |
|
147 | - |
|
148 | - foreach ($this->sectionClasses as $class => $sectionType) { |
|
149 | - try { |
|
150 | - /** @var ISection $section */ |
|
151 | - $section = \OC::$server->query($class); |
|
152 | - } catch (QueryException $e) { |
|
153 | - $this->log->logException($e, ['level' => Util::INFO]); |
|
154 | - continue; |
|
155 | - } |
|
156 | - |
|
157 | - if (!$section instanceof ISection) { |
|
158 | - $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => Util::INFO]); |
|
159 | - continue; |
|
160 | - } |
|
161 | - |
|
162 | - $this->sections[$sectionType][$section->getID()] = $section; |
|
163 | - |
|
164 | - unset($this->sectionClasses[$class]); |
|
165 | - } |
|
166 | - |
|
167 | - return $this->sections[$type]; |
|
168 | - } |
|
169 | - |
|
170 | - /** @var array */ |
|
171 | - protected $settingClasses = []; |
|
172 | - |
|
173 | - /** @var array */ |
|
174 | - protected $settings = []; |
|
175 | - |
|
176 | - /** |
|
177 | - * @param string $type 'admin' or 'personal' |
|
178 | - * @param string $setting Class must implement OCP\Settings\ISetting |
|
179 | - * @return void |
|
180 | - */ |
|
181 | - public function registerSetting(string $type, string $setting) { |
|
182 | - $this->settingClasses[$setting] = $type; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * @param string $type 'admin' or 'personal' |
|
187 | - * @param string $section |
|
188 | - * @return ISettings[] |
|
189 | - */ |
|
190 | - protected function getSettings(string $type, string $section): array { |
|
191 | - if (!isset($this->settings[$type])) { |
|
192 | - $this->settings[$type] = []; |
|
193 | - } |
|
194 | - if (!isset($this->settings[$type][$section])) { |
|
195 | - $this->settings[$type][$section] = []; |
|
196 | - } |
|
197 | - |
|
198 | - foreach ($this->settingClasses as $class => $settingsType) { |
|
199 | - try { |
|
200 | - /** @var ISettings $setting */ |
|
201 | - $setting = \OC::$server->query($class); |
|
202 | - } catch (QueryException $e) { |
|
203 | - $this->log->logException($e, ['level' => Util::INFO]); |
|
204 | - continue; |
|
205 | - } |
|
206 | - |
|
207 | - if (!$setting instanceof ISettings) { |
|
208 | - $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => Util::INFO]); |
|
209 | - continue; |
|
210 | - } |
|
211 | - |
|
212 | - if (!isset($this->settings[$settingsType][$setting->getSection()])) { |
|
213 | - $this->settings[$settingsType][$setting->getSection()] = []; |
|
214 | - } |
|
215 | - $this->settings[$settingsType][$setting->getSection()][] = $setting; |
|
216 | - |
|
217 | - unset($this->settingClasses[$class]); |
|
218 | - } |
|
219 | - |
|
220 | - return $this->settings[$type][$section]; |
|
221 | - } |
|
222 | - |
|
223 | - /** |
|
224 | - * @inheritdoc |
|
225 | - */ |
|
226 | - public function getAdminSections(): array { |
|
227 | - // built-in sections |
|
228 | - $sections = [ |
|
229 | - 0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))], |
|
230 | - 1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
231 | - 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], |
|
232 | - 10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
233 | - 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
234 | - 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
235 | - 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))], |
|
236 | - ]; |
|
237 | - |
|
238 | - $appSections = $this->getSections('admin'); |
|
239 | - |
|
240 | - foreach ($appSections as $section) { |
|
241 | - /** @var ISection $section */ |
|
242 | - if (!isset($sections[$section->getPriority()])) { |
|
243 | - $sections[$section->getPriority()] = []; |
|
244 | - } |
|
245 | - |
|
246 | - $sections[$section->getPriority()][] = $section; |
|
247 | - } |
|
248 | - |
|
249 | - ksort($sections); |
|
250 | - |
|
251 | - return $sections; |
|
252 | - } |
|
253 | - |
|
254 | - /** |
|
255 | - * @param string $section |
|
256 | - * @return ISection[] |
|
257 | - */ |
|
258 | - private function getBuiltInAdminSettings($section): array { |
|
259 | - $forms = []; |
|
260 | - |
|
261 | - if ($section === 'overview') { |
|
262 | - /** @var ISettings $form */ |
|
263 | - $form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
264 | - $forms[$form->getPriority()] = [$form]; |
|
265 | - $form = new Admin\ServerDevNotice(); |
|
266 | - $forms[$form->getPriority()] = [$form]; |
|
267 | - } |
|
268 | - if ($section === 'server') { |
|
269 | - /** @var ISettings $form */ |
|
270 | - $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
271 | - $forms[$form->getPriority()] = [$form]; |
|
272 | - $form = new Admin\Mail($this->config); |
|
273 | - $forms[$form->getPriority()] = [$form]; |
|
274 | - } |
|
275 | - if ($section === 'encryption') { |
|
276 | - /** @var ISettings $form */ |
|
277 | - $form = new Admin\Encryption($this->encryptionManager, $this->userManager); |
|
278 | - $forms[$form->getPriority()] = [$form]; |
|
279 | - } |
|
280 | - if ($section === 'sharing') { |
|
281 | - /** @var ISettings $form */ |
|
282 | - $form = new Admin\Sharing($this->config, $this->l); |
|
283 | - $forms[$form->getPriority()] = [$form]; |
|
284 | - } |
|
285 | - if ($section === 'tips-tricks') { |
|
286 | - /** @var ISettings $form */ |
|
287 | - $form = new Admin\TipsTricks($this->config); |
|
288 | - $forms[$form->getPriority()] = [$form]; |
|
289 | - } |
|
290 | - |
|
291 | - return $forms; |
|
292 | - } |
|
293 | - |
|
294 | - /** |
|
295 | - * @param string $section |
|
296 | - * @return ISection[] |
|
297 | - */ |
|
298 | - private function getBuiltInPersonalSettings($section): array { |
|
299 | - $forms = []; |
|
300 | - |
|
301 | - if ($section === 'personal-info') { |
|
302 | - /** @var ISettings $form */ |
|
303 | - $form = new Personal\PersonalInfo( |
|
304 | - $this->config, |
|
305 | - $this->userManager, |
|
306 | - $this->groupManager, |
|
307 | - $this->accountManager, |
|
308 | - $this->appManager, |
|
309 | - $this->l10nFactory, |
|
310 | - $this->l |
|
311 | - ); |
|
312 | - $forms[$form->getPriority()] = [$form]; |
|
313 | - } |
|
314 | - if($section === 'security') { |
|
315 | - /** @var ISettings $form */ |
|
316 | - $form = new Personal\Security(); |
|
317 | - $forms[$form->getPriority()] = [$form]; |
|
318 | - } |
|
319 | - if ($section === 'additional') { |
|
320 | - /** @var ISettings $form */ |
|
321 | - $form = new Personal\Additional(); |
|
322 | - $forms[$form->getPriority()] = [$form]; |
|
323 | - } |
|
324 | - |
|
325 | - return $forms; |
|
326 | - } |
|
327 | - |
|
328 | - /** |
|
329 | - * @inheritdoc |
|
330 | - */ |
|
331 | - public function getAdminSettings($section): array { |
|
332 | - $settings = $this->getBuiltInAdminSettings($section); |
|
333 | - $appSettings = $this->getSettings('admin', $section); |
|
334 | - |
|
335 | - foreach ($appSettings as $setting) { |
|
336 | - if (!isset($settings[$setting->getPriority()])) { |
|
337 | - $settings[$setting->getPriority()] = []; |
|
338 | - } |
|
339 | - $settings[$setting->getPriority()][] = $setting; |
|
340 | - } |
|
341 | - |
|
342 | - ksort($settings); |
|
343 | - return $settings; |
|
344 | - } |
|
345 | - |
|
346 | - /** |
|
347 | - * @inheritdoc |
|
348 | - */ |
|
349 | - public function getPersonalSections(): array { |
|
350 | - $sections = [ |
|
351 | - 0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))], |
|
352 | - 5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))], |
|
353 | - 15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))], |
|
354 | - ]; |
|
355 | - |
|
356 | - $legacyForms = \OC_App::getForms('personal'); |
|
357 | - if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) { |
|
358 | - $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))]; |
|
359 | - } |
|
360 | - |
|
361 | - $appSections = $this->getSections('personal'); |
|
362 | - |
|
363 | - foreach ($appSections as $section) { |
|
364 | - /** @var ISection $section */ |
|
365 | - if (!isset($sections[$section->getPriority()])) { |
|
366 | - $sections[$section->getPriority()] = []; |
|
367 | - } |
|
368 | - |
|
369 | - $sections[$section->getPriority()][] = $section; |
|
370 | - } |
|
371 | - |
|
372 | - ksort($sections); |
|
373 | - |
|
374 | - return $sections; |
|
375 | - } |
|
376 | - |
|
377 | - /** |
|
378 | - * @param string[] $forms |
|
379 | - * @return bool |
|
380 | - */ |
|
381 | - private function hasLegacyPersonalSettingsToRender(array $forms): bool { |
|
382 | - foreach ($forms as $form) { |
|
383 | - if(trim($form) !== '') { |
|
384 | - return true; |
|
385 | - } |
|
386 | - } |
|
387 | - return false; |
|
388 | - } |
|
389 | - |
|
390 | - /** |
|
391 | - * @inheritdoc |
|
392 | - */ |
|
393 | - public function getPersonalSettings($section): array { |
|
394 | - $settings = $this->getBuiltInPersonalSettings($section); |
|
395 | - $appSettings = $this->getSettings('personal', $section); |
|
396 | - |
|
397 | - foreach ($appSettings as $setting) { |
|
398 | - if (!isset($settings[$setting->getPriority()])) { |
|
399 | - $settings[$setting->getPriority()] = []; |
|
400 | - } |
|
401 | - $settings[$setting->getPriority()][] = $setting; |
|
402 | - } |
|
403 | - |
|
404 | - ksort($settings); |
|
405 | - return $settings; |
|
406 | - } |
|
52 | + /** @var ILogger */ |
|
53 | + private $log; |
|
54 | + /** @var IDBConnection */ |
|
55 | + private $dbc; |
|
56 | + /** @var IL10N */ |
|
57 | + private $l; |
|
58 | + /** @var IConfig */ |
|
59 | + private $config; |
|
60 | + /** @var EncryptionManager */ |
|
61 | + private $encryptionManager; |
|
62 | + /** @var IUserManager */ |
|
63 | + private $userManager; |
|
64 | + /** @var ILockingProvider */ |
|
65 | + private $lockingProvider; |
|
66 | + /** @var IRequest */ |
|
67 | + private $request; |
|
68 | + /** @var IURLGenerator */ |
|
69 | + private $url; |
|
70 | + /** @var AccountManager */ |
|
71 | + private $accountManager; |
|
72 | + /** @var IGroupManager */ |
|
73 | + private $groupManager; |
|
74 | + /** @var IFactory */ |
|
75 | + private $l10nFactory; |
|
76 | + /** @var IAppManager */ |
|
77 | + private $appManager; |
|
78 | + |
|
79 | + /** |
|
80 | + * @param ILogger $log |
|
81 | + * @param IDBConnection $dbc |
|
82 | + * @param IL10N $l |
|
83 | + * @param IConfig $config |
|
84 | + * @param EncryptionManager $encryptionManager |
|
85 | + * @param IUserManager $userManager |
|
86 | + * @param ILockingProvider $lockingProvider |
|
87 | + * @param IRequest $request |
|
88 | + * @param IURLGenerator $url |
|
89 | + * @param AccountManager $accountManager |
|
90 | + * @param IGroupManager $groupManager |
|
91 | + * @param IFactory $l10nFactory |
|
92 | + * @param IAppManager $appManager |
|
93 | + */ |
|
94 | + public function __construct( |
|
95 | + ILogger $log, |
|
96 | + IDBConnection $dbc, |
|
97 | + IL10N $l, |
|
98 | + IConfig $config, |
|
99 | + EncryptionManager $encryptionManager, |
|
100 | + IUserManager $userManager, |
|
101 | + ILockingProvider $lockingProvider, |
|
102 | + IRequest $request, |
|
103 | + IURLGenerator $url, |
|
104 | + AccountManager $accountManager, |
|
105 | + IGroupManager $groupManager, |
|
106 | + IFactory $l10nFactory, |
|
107 | + IAppManager $appManager |
|
108 | + ) { |
|
109 | + $this->log = $log; |
|
110 | + $this->dbc = $dbc; |
|
111 | + $this->l = $l; |
|
112 | + $this->config = $config; |
|
113 | + $this->encryptionManager = $encryptionManager; |
|
114 | + $this->userManager = $userManager; |
|
115 | + $this->lockingProvider = $lockingProvider; |
|
116 | + $this->request = $request; |
|
117 | + $this->url = $url; |
|
118 | + $this->accountManager = $accountManager; |
|
119 | + $this->groupManager = $groupManager; |
|
120 | + $this->l10nFactory = $l10nFactory; |
|
121 | + $this->appManager = $appManager; |
|
122 | + } |
|
123 | + |
|
124 | + /** @var array */ |
|
125 | + protected $sectionClasses = []; |
|
126 | + |
|
127 | + /** @var array */ |
|
128 | + protected $sections = []; |
|
129 | + |
|
130 | + /** |
|
131 | + * @param string $type 'admin' or 'personal' |
|
132 | + * @param string $section Class must implement OCP\Settings\ISection |
|
133 | + * @return void |
|
134 | + */ |
|
135 | + public function registerSection(string $type, string $section) { |
|
136 | + $this->sectionClasses[$section] = $type; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @param string $type 'admin' or 'personal' |
|
141 | + * @return ISection[] |
|
142 | + */ |
|
143 | + protected function getSections(string $type): array { |
|
144 | + if (!isset($this->sections[$type])) { |
|
145 | + $this->sections[$type] = []; |
|
146 | + } |
|
147 | + |
|
148 | + foreach ($this->sectionClasses as $class => $sectionType) { |
|
149 | + try { |
|
150 | + /** @var ISection $section */ |
|
151 | + $section = \OC::$server->query($class); |
|
152 | + } catch (QueryException $e) { |
|
153 | + $this->log->logException($e, ['level' => Util::INFO]); |
|
154 | + continue; |
|
155 | + } |
|
156 | + |
|
157 | + if (!$section instanceof ISection) { |
|
158 | + $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => Util::INFO]); |
|
159 | + continue; |
|
160 | + } |
|
161 | + |
|
162 | + $this->sections[$sectionType][$section->getID()] = $section; |
|
163 | + |
|
164 | + unset($this->sectionClasses[$class]); |
|
165 | + } |
|
166 | + |
|
167 | + return $this->sections[$type]; |
|
168 | + } |
|
169 | + |
|
170 | + /** @var array */ |
|
171 | + protected $settingClasses = []; |
|
172 | + |
|
173 | + /** @var array */ |
|
174 | + protected $settings = []; |
|
175 | + |
|
176 | + /** |
|
177 | + * @param string $type 'admin' or 'personal' |
|
178 | + * @param string $setting Class must implement OCP\Settings\ISetting |
|
179 | + * @return void |
|
180 | + */ |
|
181 | + public function registerSetting(string $type, string $setting) { |
|
182 | + $this->settingClasses[$setting] = $type; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * @param string $type 'admin' or 'personal' |
|
187 | + * @param string $section |
|
188 | + * @return ISettings[] |
|
189 | + */ |
|
190 | + protected function getSettings(string $type, string $section): array { |
|
191 | + if (!isset($this->settings[$type])) { |
|
192 | + $this->settings[$type] = []; |
|
193 | + } |
|
194 | + if (!isset($this->settings[$type][$section])) { |
|
195 | + $this->settings[$type][$section] = []; |
|
196 | + } |
|
197 | + |
|
198 | + foreach ($this->settingClasses as $class => $settingsType) { |
|
199 | + try { |
|
200 | + /** @var ISettings $setting */ |
|
201 | + $setting = \OC::$server->query($class); |
|
202 | + } catch (QueryException $e) { |
|
203 | + $this->log->logException($e, ['level' => Util::INFO]); |
|
204 | + continue; |
|
205 | + } |
|
206 | + |
|
207 | + if (!$setting instanceof ISettings) { |
|
208 | + $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => Util::INFO]); |
|
209 | + continue; |
|
210 | + } |
|
211 | + |
|
212 | + if (!isset($this->settings[$settingsType][$setting->getSection()])) { |
|
213 | + $this->settings[$settingsType][$setting->getSection()] = []; |
|
214 | + } |
|
215 | + $this->settings[$settingsType][$setting->getSection()][] = $setting; |
|
216 | + |
|
217 | + unset($this->settingClasses[$class]); |
|
218 | + } |
|
219 | + |
|
220 | + return $this->settings[$type][$section]; |
|
221 | + } |
|
222 | + |
|
223 | + /** |
|
224 | + * @inheritdoc |
|
225 | + */ |
|
226 | + public function getAdminSections(): array { |
|
227 | + // built-in sections |
|
228 | + $sections = [ |
|
229 | + 0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))], |
|
230 | + 1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
231 | + 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], |
|
232 | + 10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
233 | + 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
234 | + 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
235 | + 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))], |
|
236 | + ]; |
|
237 | + |
|
238 | + $appSections = $this->getSections('admin'); |
|
239 | + |
|
240 | + foreach ($appSections as $section) { |
|
241 | + /** @var ISection $section */ |
|
242 | + if (!isset($sections[$section->getPriority()])) { |
|
243 | + $sections[$section->getPriority()] = []; |
|
244 | + } |
|
245 | + |
|
246 | + $sections[$section->getPriority()][] = $section; |
|
247 | + } |
|
248 | + |
|
249 | + ksort($sections); |
|
250 | + |
|
251 | + return $sections; |
|
252 | + } |
|
253 | + |
|
254 | + /** |
|
255 | + * @param string $section |
|
256 | + * @return ISection[] |
|
257 | + */ |
|
258 | + private function getBuiltInAdminSettings($section): array { |
|
259 | + $forms = []; |
|
260 | + |
|
261 | + if ($section === 'overview') { |
|
262 | + /** @var ISettings $form */ |
|
263 | + $form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
264 | + $forms[$form->getPriority()] = [$form]; |
|
265 | + $form = new Admin\ServerDevNotice(); |
|
266 | + $forms[$form->getPriority()] = [$form]; |
|
267 | + } |
|
268 | + if ($section === 'server') { |
|
269 | + /** @var ISettings $form */ |
|
270 | + $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
271 | + $forms[$form->getPriority()] = [$form]; |
|
272 | + $form = new Admin\Mail($this->config); |
|
273 | + $forms[$form->getPriority()] = [$form]; |
|
274 | + } |
|
275 | + if ($section === 'encryption') { |
|
276 | + /** @var ISettings $form */ |
|
277 | + $form = new Admin\Encryption($this->encryptionManager, $this->userManager); |
|
278 | + $forms[$form->getPriority()] = [$form]; |
|
279 | + } |
|
280 | + if ($section === 'sharing') { |
|
281 | + /** @var ISettings $form */ |
|
282 | + $form = new Admin\Sharing($this->config, $this->l); |
|
283 | + $forms[$form->getPriority()] = [$form]; |
|
284 | + } |
|
285 | + if ($section === 'tips-tricks') { |
|
286 | + /** @var ISettings $form */ |
|
287 | + $form = new Admin\TipsTricks($this->config); |
|
288 | + $forms[$form->getPriority()] = [$form]; |
|
289 | + } |
|
290 | + |
|
291 | + return $forms; |
|
292 | + } |
|
293 | + |
|
294 | + /** |
|
295 | + * @param string $section |
|
296 | + * @return ISection[] |
|
297 | + */ |
|
298 | + private function getBuiltInPersonalSettings($section): array { |
|
299 | + $forms = []; |
|
300 | + |
|
301 | + if ($section === 'personal-info') { |
|
302 | + /** @var ISettings $form */ |
|
303 | + $form = new Personal\PersonalInfo( |
|
304 | + $this->config, |
|
305 | + $this->userManager, |
|
306 | + $this->groupManager, |
|
307 | + $this->accountManager, |
|
308 | + $this->appManager, |
|
309 | + $this->l10nFactory, |
|
310 | + $this->l |
|
311 | + ); |
|
312 | + $forms[$form->getPriority()] = [$form]; |
|
313 | + } |
|
314 | + if($section === 'security') { |
|
315 | + /** @var ISettings $form */ |
|
316 | + $form = new Personal\Security(); |
|
317 | + $forms[$form->getPriority()] = [$form]; |
|
318 | + } |
|
319 | + if ($section === 'additional') { |
|
320 | + /** @var ISettings $form */ |
|
321 | + $form = new Personal\Additional(); |
|
322 | + $forms[$form->getPriority()] = [$form]; |
|
323 | + } |
|
324 | + |
|
325 | + return $forms; |
|
326 | + } |
|
327 | + |
|
328 | + /** |
|
329 | + * @inheritdoc |
|
330 | + */ |
|
331 | + public function getAdminSettings($section): array { |
|
332 | + $settings = $this->getBuiltInAdminSettings($section); |
|
333 | + $appSettings = $this->getSettings('admin', $section); |
|
334 | + |
|
335 | + foreach ($appSettings as $setting) { |
|
336 | + if (!isset($settings[$setting->getPriority()])) { |
|
337 | + $settings[$setting->getPriority()] = []; |
|
338 | + } |
|
339 | + $settings[$setting->getPriority()][] = $setting; |
|
340 | + } |
|
341 | + |
|
342 | + ksort($settings); |
|
343 | + return $settings; |
|
344 | + } |
|
345 | + |
|
346 | + /** |
|
347 | + * @inheritdoc |
|
348 | + */ |
|
349 | + public function getPersonalSections(): array { |
|
350 | + $sections = [ |
|
351 | + 0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))], |
|
352 | + 5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))], |
|
353 | + 15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))], |
|
354 | + ]; |
|
355 | + |
|
356 | + $legacyForms = \OC_App::getForms('personal'); |
|
357 | + if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) { |
|
358 | + $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))]; |
|
359 | + } |
|
360 | + |
|
361 | + $appSections = $this->getSections('personal'); |
|
362 | + |
|
363 | + foreach ($appSections as $section) { |
|
364 | + /** @var ISection $section */ |
|
365 | + if (!isset($sections[$section->getPriority()])) { |
|
366 | + $sections[$section->getPriority()] = []; |
|
367 | + } |
|
368 | + |
|
369 | + $sections[$section->getPriority()][] = $section; |
|
370 | + } |
|
371 | + |
|
372 | + ksort($sections); |
|
373 | + |
|
374 | + return $sections; |
|
375 | + } |
|
376 | + |
|
377 | + /** |
|
378 | + * @param string[] $forms |
|
379 | + * @return bool |
|
380 | + */ |
|
381 | + private function hasLegacyPersonalSettingsToRender(array $forms): bool { |
|
382 | + foreach ($forms as $form) { |
|
383 | + if(trim($form) !== '') { |
|
384 | + return true; |
|
385 | + } |
|
386 | + } |
|
387 | + return false; |
|
388 | + } |
|
389 | + |
|
390 | + /** |
|
391 | + * @inheritdoc |
|
392 | + */ |
|
393 | + public function getPersonalSettings($section): array { |
|
394 | + $settings = $this->getBuiltInPersonalSettings($section); |
|
395 | + $appSettings = $this->getSettings('personal', $section); |
|
396 | + |
|
397 | + foreach ($appSettings as $setting) { |
|
398 | + if (!isset($settings[$setting->getPriority()])) { |
|
399 | + $settings[$setting->getPriority()] = []; |
|
400 | + } |
|
401 | + $settings[$setting->getPriority()][] = $setting; |
|
402 | + } |
|
403 | + |
|
404 | + ksort($settings); |
|
405 | + return $settings; |
|
406 | + } |
|
407 | 407 | } |
@@ -31,102 +31,102 @@ |
||
31 | 31 | use OCP\Settings\ISettings; |
32 | 32 | |
33 | 33 | trait CommonSettingsTrait { |
34 | - /** @var ISettingsManager */ |
|
35 | - private $settingsManager; |
|
36 | - |
|
37 | - /** @var INavigationManager */ |
|
38 | - private $navigationManager; |
|
39 | - |
|
40 | - /** |
|
41 | - * @param string $currentSection |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - private function getNavigationParameters($currentType, $currentSection) { |
|
45 | - $templateParameters = [ |
|
46 | - 'personal' => $this->formatPersonalSections($currentType, $currentSection), |
|
47 | - 'admin' => [] |
|
48 | - ]; |
|
49 | - |
|
50 | - if(\OC_User::isAdminUser(\OC_User::getUser())) { |
|
51 | - $templateParameters['admin'] = $this->formatAdminSections($currentType, $currentSection); |
|
52 | - } |
|
53 | - |
|
54 | - return [ |
|
55 | - 'forms' => $templateParameters |
|
56 | - ]; |
|
57 | - } |
|
58 | - |
|
59 | - protected function formatSections($sections, $currentSection, $type, $currentType) { |
|
60 | - $templateParameters = []; |
|
61 | - /** @var \OCP\Settings\ISection[] $prioritizedSections */ |
|
62 | - foreach($sections as $prioritizedSections) { |
|
63 | - foreach ($prioritizedSections as $section) { |
|
64 | - if($type === 'admin') { |
|
65 | - $settings = $this->settingsManager->getAdminSettings($section->getID()); |
|
66 | - } else if($type === 'personal') { |
|
67 | - $settings = $this->settingsManager->getPersonalSettings($section->getID()); |
|
68 | - } |
|
69 | - if (empty($settings) && !($section->getID() === 'additional' && count(\OC_App::getForms('admin')) > 0)) { |
|
70 | - continue; |
|
71 | - } |
|
72 | - |
|
73 | - $icon = ''; |
|
74 | - if ($section instanceof IIconSection) { |
|
75 | - $icon = $section->getIcon(); |
|
76 | - } |
|
77 | - |
|
78 | - $active = $section->getID() === $currentSection |
|
79 | - && $type === $currentType; |
|
80 | - |
|
81 | - $templateParameters[] = [ |
|
82 | - 'anchor' => $section->getID(), |
|
83 | - 'section-name' => $section->getName(), |
|
84 | - 'active' => $active, |
|
85 | - 'icon' => $icon, |
|
86 | - ]; |
|
87 | - } |
|
88 | - } |
|
89 | - return $templateParameters; |
|
90 | - } |
|
91 | - |
|
92 | - protected function formatPersonalSections($currentType, $currentSections) { |
|
93 | - $sections = $this->settingsManager->getPersonalSections(); |
|
94 | - $templateParameters = $this->formatSections($sections, $currentSections, 'personal', $currentType); |
|
95 | - |
|
96 | - return $templateParameters; |
|
97 | - } |
|
98 | - |
|
99 | - protected function formatAdminSections($currentType, $currentSections) { |
|
100 | - $sections = $this->settingsManager->getAdminSections(); |
|
101 | - $templateParameters = $this->formatSections($sections, $currentSections, 'admin', $currentType); |
|
102 | - |
|
103 | - return $templateParameters; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @param ISettings[] $settings |
|
108 | - * @return array |
|
109 | - */ |
|
110 | - private function formatSettings($settings) { |
|
111 | - $html = ''; |
|
112 | - foreach ($settings as $prioritizedSettings) { |
|
113 | - foreach ($prioritizedSettings as $setting) { |
|
114 | - /** @var \OCP\Settings\ISettings $setting */ |
|
115 | - $form = $setting->getForm(); |
|
116 | - $html .= $form->renderAs('')->render(); |
|
117 | - } |
|
118 | - } |
|
119 | - return ['content' => $html]; |
|
120 | - } |
|
121 | - |
|
122 | - private function getIndexResponse($type, $section) { |
|
123 | - $this->navigationManager->setActiveEntry('settings'); |
|
124 | - $templateParams = []; |
|
125 | - $templateParams = array_merge($templateParams, $this->getNavigationParameters($type, $section)); |
|
126 | - $templateParams = array_merge($templateParams, $this->getSettings($section)); |
|
127 | - |
|
128 | - return new TemplateResponse('settings', 'settings/frame', $templateParams); |
|
129 | - } |
|
130 | - |
|
131 | - abstract protected function getSettings($section); |
|
34 | + /** @var ISettingsManager */ |
|
35 | + private $settingsManager; |
|
36 | + |
|
37 | + /** @var INavigationManager */ |
|
38 | + private $navigationManager; |
|
39 | + |
|
40 | + /** |
|
41 | + * @param string $currentSection |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + private function getNavigationParameters($currentType, $currentSection) { |
|
45 | + $templateParameters = [ |
|
46 | + 'personal' => $this->formatPersonalSections($currentType, $currentSection), |
|
47 | + 'admin' => [] |
|
48 | + ]; |
|
49 | + |
|
50 | + if(\OC_User::isAdminUser(\OC_User::getUser())) { |
|
51 | + $templateParameters['admin'] = $this->formatAdminSections($currentType, $currentSection); |
|
52 | + } |
|
53 | + |
|
54 | + return [ |
|
55 | + 'forms' => $templateParameters |
|
56 | + ]; |
|
57 | + } |
|
58 | + |
|
59 | + protected function formatSections($sections, $currentSection, $type, $currentType) { |
|
60 | + $templateParameters = []; |
|
61 | + /** @var \OCP\Settings\ISection[] $prioritizedSections */ |
|
62 | + foreach($sections as $prioritizedSections) { |
|
63 | + foreach ($prioritizedSections as $section) { |
|
64 | + if($type === 'admin') { |
|
65 | + $settings = $this->settingsManager->getAdminSettings($section->getID()); |
|
66 | + } else if($type === 'personal') { |
|
67 | + $settings = $this->settingsManager->getPersonalSettings($section->getID()); |
|
68 | + } |
|
69 | + if (empty($settings) && !($section->getID() === 'additional' && count(\OC_App::getForms('admin')) > 0)) { |
|
70 | + continue; |
|
71 | + } |
|
72 | + |
|
73 | + $icon = ''; |
|
74 | + if ($section instanceof IIconSection) { |
|
75 | + $icon = $section->getIcon(); |
|
76 | + } |
|
77 | + |
|
78 | + $active = $section->getID() === $currentSection |
|
79 | + && $type === $currentType; |
|
80 | + |
|
81 | + $templateParameters[] = [ |
|
82 | + 'anchor' => $section->getID(), |
|
83 | + 'section-name' => $section->getName(), |
|
84 | + 'active' => $active, |
|
85 | + 'icon' => $icon, |
|
86 | + ]; |
|
87 | + } |
|
88 | + } |
|
89 | + return $templateParameters; |
|
90 | + } |
|
91 | + |
|
92 | + protected function formatPersonalSections($currentType, $currentSections) { |
|
93 | + $sections = $this->settingsManager->getPersonalSections(); |
|
94 | + $templateParameters = $this->formatSections($sections, $currentSections, 'personal', $currentType); |
|
95 | + |
|
96 | + return $templateParameters; |
|
97 | + } |
|
98 | + |
|
99 | + protected function formatAdminSections($currentType, $currentSections) { |
|
100 | + $sections = $this->settingsManager->getAdminSections(); |
|
101 | + $templateParameters = $this->formatSections($sections, $currentSections, 'admin', $currentType); |
|
102 | + |
|
103 | + return $templateParameters; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @param ISettings[] $settings |
|
108 | + * @return array |
|
109 | + */ |
|
110 | + private function formatSettings($settings) { |
|
111 | + $html = ''; |
|
112 | + foreach ($settings as $prioritizedSettings) { |
|
113 | + foreach ($prioritizedSettings as $setting) { |
|
114 | + /** @var \OCP\Settings\ISettings $setting */ |
|
115 | + $form = $setting->getForm(); |
|
116 | + $html .= $form->renderAs('')->render(); |
|
117 | + } |
|
118 | + } |
|
119 | + return ['content' => $html]; |
|
120 | + } |
|
121 | + |
|
122 | + private function getIndexResponse($type, $section) { |
|
123 | + $this->navigationManager->setActiveEntry('settings'); |
|
124 | + $templateParams = []; |
|
125 | + $templateParams = array_merge($templateParams, $this->getNavigationParameters($type, $section)); |
|
126 | + $templateParams = array_merge($templateParams, $this->getSettings($section)); |
|
127 | + |
|
128 | + return new TemplateResponse('settings', 'settings/frame', $templateParams); |
|
129 | + } |
|
130 | + |
|
131 | + abstract protected function getSettings($section); |
|
132 | 132 | } |
@@ -37,118 +37,118 @@ |
||
37 | 37 | use OCP\Settings\ISettings; |
38 | 38 | |
39 | 39 | class Overview implements ISettings { |
40 | - /** @var IDBConnection|Connection */ |
|
41 | - private $db; |
|
42 | - /** @var IRequest */ |
|
43 | - private $request; |
|
44 | - /** @var IConfig */ |
|
45 | - private $config; |
|
46 | - /** @var ILockingProvider */ |
|
47 | - private $lockingProvider; |
|
48 | - /** @var IL10N */ |
|
49 | - private $l; |
|
40 | + /** @var IDBConnection|Connection */ |
|
41 | + private $db; |
|
42 | + /** @var IRequest */ |
|
43 | + private $request; |
|
44 | + /** @var IConfig */ |
|
45 | + private $config; |
|
46 | + /** @var ILockingProvider */ |
|
47 | + private $lockingProvider; |
|
48 | + /** @var IL10N */ |
|
49 | + private $l; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @param IDBConnection $db |
|
53 | - * @param IRequest $request |
|
54 | - * @param IConfig $config |
|
55 | - * @param ILockingProvider $lockingProvider |
|
56 | - * @param IL10N $l |
|
57 | - */ |
|
58 | - public function __construct(IDBConnection $db, |
|
59 | - IRequest $request, |
|
60 | - IConfig $config, |
|
61 | - ILockingProvider $lockingProvider, |
|
62 | - IL10N $l) { |
|
63 | - $this->db = $db; |
|
64 | - $this->request = $request; |
|
65 | - $this->config = $config; |
|
66 | - $this->lockingProvider = $lockingProvider; |
|
67 | - $this->l = $l; |
|
68 | - } |
|
51 | + /** |
|
52 | + * @param IDBConnection $db |
|
53 | + * @param IRequest $request |
|
54 | + * @param IConfig $config |
|
55 | + * @param ILockingProvider $lockingProvider |
|
56 | + * @param IL10N $l |
|
57 | + */ |
|
58 | + public function __construct(IDBConnection $db, |
|
59 | + IRequest $request, |
|
60 | + IConfig $config, |
|
61 | + ILockingProvider $lockingProvider, |
|
62 | + IL10N $l) { |
|
63 | + $this->db = $db; |
|
64 | + $this->request = $request; |
|
65 | + $this->config = $config; |
|
66 | + $this->lockingProvider = $lockingProvider; |
|
67 | + $this->l = $l; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @return TemplateResponse |
|
72 | - */ |
|
73 | - public function getForm() { |
|
74 | - try { |
|
75 | - if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
76 | - $invalidTransactionIsolationLevel = false; |
|
77 | - } else { |
|
78 | - $invalidTransactionIsolationLevel = $this->db->getTransactionIsolation() !== Connection::TRANSACTION_READ_COMMITTED; |
|
79 | - } |
|
80 | - } catch (DBALException $e) { |
|
81 | - // ignore |
|
82 | - $invalidTransactionIsolationLevel = false; |
|
83 | - } |
|
70 | + /** |
|
71 | + * @return TemplateResponse |
|
72 | + */ |
|
73 | + public function getForm() { |
|
74 | + try { |
|
75 | + if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
76 | + $invalidTransactionIsolationLevel = false; |
|
77 | + } else { |
|
78 | + $invalidTransactionIsolationLevel = $this->db->getTransactionIsolation() !== Connection::TRANSACTION_READ_COMMITTED; |
|
79 | + } |
|
80 | + } catch (DBALException $e) { |
|
81 | + // ignore |
|
82 | + $invalidTransactionIsolationLevel = false; |
|
83 | + } |
|
84 | 84 | |
85 | - $envPath = getenv('PATH'); |
|
85 | + $envPath = getenv('PATH'); |
|
86 | 86 | |
87 | - // warn if outdated version of a memcache module is used |
|
88 | - $caches = [ |
|
89 | - 'apcu' => ['name' => $this->l->t('APCu'), 'version' => '4.0.6'], |
|
90 | - 'redis' => ['name' => $this->l->t('Redis'), 'version' => '2.2.5'], |
|
91 | - ]; |
|
92 | - $outdatedCaches = []; |
|
93 | - foreach ($caches as $php_module => $data) { |
|
94 | - $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); |
|
95 | - if ($isOutdated) { |
|
96 | - $outdatedCaches[$php_module] = $data; |
|
97 | - } |
|
98 | - } |
|
87 | + // warn if outdated version of a memcache module is used |
|
88 | + $caches = [ |
|
89 | + 'apcu' => ['name' => $this->l->t('APCu'), 'version' => '4.0.6'], |
|
90 | + 'redis' => ['name' => $this->l->t('Redis'), 'version' => '2.2.5'], |
|
91 | + ]; |
|
92 | + $outdatedCaches = []; |
|
93 | + foreach ($caches as $php_module => $data) { |
|
94 | + $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); |
|
95 | + if ($isOutdated) { |
|
96 | + $outdatedCaches[$php_module] = $data; |
|
97 | + } |
|
98 | + } |
|
99 | 99 | |
100 | - if ($this->lockingProvider instanceof NoopLockingProvider) { |
|
101 | - $fileLockingType = 'none'; |
|
102 | - } else if ($this->lockingProvider instanceof DBLockingProvider) { |
|
103 | - $fileLockingType = 'db'; |
|
104 | - } else { |
|
105 | - $fileLockingType = 'cache'; |
|
106 | - } |
|
100 | + if ($this->lockingProvider instanceof NoopLockingProvider) { |
|
101 | + $fileLockingType = 'none'; |
|
102 | + } else if ($this->lockingProvider instanceof DBLockingProvider) { |
|
103 | + $fileLockingType = 'db'; |
|
104 | + } else { |
|
105 | + $fileLockingType = 'cache'; |
|
106 | + } |
|
107 | 107 | |
108 | - $suggestedOverwriteCliUrl = ''; |
|
109 | - if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
110 | - $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
111 | - if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
112 | - // Set the overwrite URL when it was not set yet. |
|
113 | - $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
114 | - $suggestedOverwriteCliUrl = ''; |
|
115 | - } |
|
116 | - } |
|
108 | + $suggestedOverwriteCliUrl = ''; |
|
109 | + if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
110 | + $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
111 | + if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
112 | + // Set the overwrite URL when it was not set yet. |
|
113 | + $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
114 | + $suggestedOverwriteCliUrl = ''; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - $parameters = [ |
|
119 | - // Diagnosis |
|
120 | - 'readOnlyConfigEnabled' => \OC_Helper::isReadOnlyConfigEnabled(), |
|
121 | - 'isLocaleWorking' => \OC_Util::isSetLocaleWorking(), |
|
122 | - 'isAnnotationsWorking' => \OC_Util::isAnnotationsWorking(), |
|
123 | - 'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true), |
|
124 | - 'has_fileinfo' => \OC_Util::fileInfoLoaded(), |
|
125 | - 'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel, |
|
126 | - 'getenvServerNotWorking' => empty($envPath), |
|
127 | - 'OutdatedCacheWarning' => $outdatedCaches, |
|
128 | - 'fileLockingType' => $fileLockingType, |
|
129 | - 'suggestedOverwriteCliUrl' => $suggestedOverwriteCliUrl, |
|
130 | - 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), |
|
131 | - 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), |
|
132 | - ]; |
|
118 | + $parameters = [ |
|
119 | + // Diagnosis |
|
120 | + 'readOnlyConfigEnabled' => \OC_Helper::isReadOnlyConfigEnabled(), |
|
121 | + 'isLocaleWorking' => \OC_Util::isSetLocaleWorking(), |
|
122 | + 'isAnnotationsWorking' => \OC_Util::isAnnotationsWorking(), |
|
123 | + 'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true), |
|
124 | + 'has_fileinfo' => \OC_Util::fileInfoLoaded(), |
|
125 | + 'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel, |
|
126 | + 'getenvServerNotWorking' => empty($envPath), |
|
127 | + 'OutdatedCacheWarning' => $outdatedCaches, |
|
128 | + 'fileLockingType' => $fileLockingType, |
|
129 | + 'suggestedOverwriteCliUrl' => $suggestedOverwriteCliUrl, |
|
130 | + 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), |
|
131 | + 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), |
|
132 | + ]; |
|
133 | 133 | |
134 | - return new TemplateResponse('settings', 'settings/admin/overview', $parameters, ''); |
|
135 | - } |
|
134 | + return new TemplateResponse('settings', 'settings/admin/overview', $parameters, ''); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * @return string the section ID, e.g. 'sharing' |
|
139 | - */ |
|
140 | - public function getSection() { |
|
141 | - return 'overview'; |
|
142 | - } |
|
137 | + /** |
|
138 | + * @return string the section ID, e.g. 'sharing' |
|
139 | + */ |
|
140 | + public function getSection() { |
|
141 | + return 'overview'; |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * @return int whether the form should be rather on the top or bottom of |
|
146 | - * the admin section. The forms are arranged in ascending order of the |
|
147 | - * priority values. It is required to return a value between 0 and 100. |
|
148 | - * |
|
149 | - * E.g.: 70 |
|
150 | - */ |
|
151 | - public function getPriority() { |
|
152 | - return 10; |
|
153 | - } |
|
144 | + /** |
|
145 | + * @return int whether the form should be rather on the top or bottom of |
|
146 | + * the admin section. The forms are arranged in ascending order of the |
|
147 | + * priority values. It is required to return a value between 0 and 100. |
|
148 | + * |
|
149 | + * E.g.: 70 |
|
150 | + */ |
|
151 | + public function getPriority() { |
|
152 | + return 10; |
|
153 | + } |
|
154 | 154 | } |
@@ -40,67 +40,67 @@ |
||
40 | 40 | use OCP\Settings\ISettings; |
41 | 41 | |
42 | 42 | class Server implements ISettings { |
43 | - /** @var IDBConnection|Connection */ |
|
44 | - private $db; |
|
45 | - /** @var IRequest */ |
|
46 | - private $request; |
|
47 | - /** @var IConfig */ |
|
48 | - private $config; |
|
49 | - /** @var ILockingProvider */ |
|
50 | - private $lockingProvider; |
|
51 | - /** @var IL10N */ |
|
52 | - private $l; |
|
43 | + /** @var IDBConnection|Connection */ |
|
44 | + private $db; |
|
45 | + /** @var IRequest */ |
|
46 | + private $request; |
|
47 | + /** @var IConfig */ |
|
48 | + private $config; |
|
49 | + /** @var ILockingProvider */ |
|
50 | + private $lockingProvider; |
|
51 | + /** @var IL10N */ |
|
52 | + private $l; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param IDBConnection $db |
|
56 | - * @param IRequest $request |
|
57 | - * @param IConfig $config |
|
58 | - * @param ILockingProvider $lockingProvider |
|
59 | - * @param IL10N $l |
|
60 | - */ |
|
61 | - public function __construct(IDBConnection $db, |
|
62 | - IRequest $request, |
|
63 | - IConfig $config, |
|
64 | - ILockingProvider $lockingProvider, |
|
65 | - IL10N $l) { |
|
66 | - $this->db = $db; |
|
67 | - $this->request = $request; |
|
68 | - $this->config = $config; |
|
69 | - $this->lockingProvider = $lockingProvider; |
|
70 | - $this->l = $l; |
|
71 | - } |
|
54 | + /** |
|
55 | + * @param IDBConnection $db |
|
56 | + * @param IRequest $request |
|
57 | + * @param IConfig $config |
|
58 | + * @param ILockingProvider $lockingProvider |
|
59 | + * @param IL10N $l |
|
60 | + */ |
|
61 | + public function __construct(IDBConnection $db, |
|
62 | + IRequest $request, |
|
63 | + IConfig $config, |
|
64 | + ILockingProvider $lockingProvider, |
|
65 | + IL10N $l) { |
|
66 | + $this->db = $db; |
|
67 | + $this->request = $request; |
|
68 | + $this->config = $config; |
|
69 | + $this->lockingProvider = $lockingProvider; |
|
70 | + $this->l = $l; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return TemplateResponse |
|
75 | - */ |
|
76 | - public function getForm() { |
|
77 | - $parameters = [ |
|
78 | - // Background jobs |
|
79 | - 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'), |
|
80 | - 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), |
|
81 | - 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), |
|
82 | - 'cli_based_cron_possible' => function_exists('posix_getpwuid'), |
|
83 | - 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', |
|
84 | - ]; |
|
73 | + /** |
|
74 | + * @return TemplateResponse |
|
75 | + */ |
|
76 | + public function getForm() { |
|
77 | + $parameters = [ |
|
78 | + // Background jobs |
|
79 | + 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'), |
|
80 | + 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), |
|
81 | + 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), |
|
82 | + 'cli_based_cron_possible' => function_exists('posix_getpwuid'), |
|
83 | + 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', |
|
84 | + ]; |
|
85 | 85 | |
86 | - return new TemplateResponse('settings', 'settings/admin/server', $parameters, ''); |
|
87 | - } |
|
86 | + return new TemplateResponse('settings', 'settings/admin/server', $parameters, ''); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @return string the section ID, e.g. 'sharing' |
|
91 | - */ |
|
92 | - public function getSection() { |
|
93 | - return 'server'; |
|
94 | - } |
|
89 | + /** |
|
90 | + * @return string the section ID, e.g. 'sharing' |
|
91 | + */ |
|
92 | + public function getSection() { |
|
93 | + return 'server'; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * @return int whether the form should be rather on the top or bottom of |
|
98 | - * the admin section. The forms are arranged in ascending order of the |
|
99 | - * priority values. It is required to return a value between 0 and 100. |
|
100 | - * |
|
101 | - * E.g.: 70 |
|
102 | - */ |
|
103 | - public function getPriority() { |
|
104 | - return 0; |
|
105 | - } |
|
96 | + /** |
|
97 | + * @return int whether the form should be rather on the top or bottom of |
|
98 | + * the admin section. The forms are arranged in ascending order of the |
|
99 | + * priority values. It is required to return a value between 0 and 100. |
|
100 | + * |
|
101 | + * E.g.: 70 |
|
102 | + */ |
|
103 | + public function getPriority() { |
|
104 | + return 0; |
|
105 | + } |
|
106 | 106 | } |