Merge tips & tricks section into setup checks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
c4a2632d95
commit
4a0b7aaf6c
|
@ -198,6 +198,22 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
})
|
||||
}
|
||||
if (data.isSqliteUsed) {
|
||||
messages.push({
|
||||
msg: t(
|
||||
'core',
|
||||
'SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend.'
|
||||
) + ' ' + t('core', 'This is particularly recommended when using the desktop client for file synchronisation.') + ' ' +
|
||||
t(
|
||||
'core',
|
||||
'To migrate to another database use the command line tool: \'occ db:convert-type\', or see the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation ↗</a>.',
|
||||
{
|
||||
docLink: data.databaseConversionDocumentation,
|
||||
}
|
||||
),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
})
|
||||
}
|
||||
} else {
|
||||
messages.push({
|
||||
msg: t('core', 'Error occurred while checking server setup'),
|
||||
|
@ -305,7 +321,7 @@
|
|||
xhr.getResponseHeader('Referrer-Policy').toLowerCase() !== 'strict-origin' &&
|
||||
xhr.getResponseHeader('Referrer-Policy').toLowerCase() !== 'strict-origin-when-cross-origin')) {
|
||||
messages.push({
|
||||
msg: t('core', 'The "{header}" HTTP header is not set to "{val1}", "{val2}", "{val3}" or "{val4}". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" href="{link}">W3C Recommendation</a>.',
|
||||
msg: t('core', 'The "{header}" HTTP header is not set to "{val1}", "{val2}", "{val3}" or "{val4}". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" href="{link}">W3C Recommendation ↗</a>.',
|
||||
{
|
||||
header: 'Referrer-Policy',
|
||||
val1: 'no-referrer',
|
||||
|
@ -337,7 +353,7 @@
|
|||
var messages = [];
|
||||
|
||||
if (xhr.status === 200) {
|
||||
var tipsUrl = OC.generateUrl('settings/admin/tips-tricks');
|
||||
var tipsUrl = oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-security');
|
||||
if(OC.getProtocol() === 'https') {
|
||||
// Extract the value of 'Strict-Transport-Security'
|
||||
var transportSecurityValidity = xhr.getResponseHeader('Strict-Transport-Security');
|
||||
|
@ -353,13 +369,13 @@
|
|||
var minimumSeconds = 15552000;
|
||||
if(isNaN(transportSecurityValidity) || transportSecurityValidity <= (minimumSeconds - 1)) {
|
||||
messages.push({
|
||||
msg: t('core', 'The "Strict-Transport-Security" HTTP header is not set to at least "{seconds}" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a href="{docUrl}" rel="noreferrer noopener">security tips</a>.', {'seconds': minimumSeconds, docUrl: tipsUrl}),
|
||||
msg: t('core', 'The "Strict-Transport-Security" HTTP header is not set to at least "{seconds}" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a href="{docUrl}" rel="noreferrer noopener">security tips ↗</a>.', {'seconds': minimumSeconds, docUrl: tipsUrl}),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
} else {
|
||||
messages.push({
|
||||
msg: t('core', 'Accessing site insecurely via HTTP. You are strongly adviced to set up your server to require HTTPS instead, as described in the <a href="{docUrl}">security tips</a>.', {docUrl: tipsUrl}),
|
||||
msg: t('core', 'Accessing site insecurely via HTTP. You are strongly adviced to set up your server to require HTTPS instead, as described in the <a href="{docUrl}">security tips ↗</a>.', {docUrl: tipsUrl}),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
|
|
|
@ -100,7 +100,9 @@ window.oc_config = {
|
|||
window.oc_appconfig = {
|
||||
core: {}
|
||||
};
|
||||
window.oc_defaults = {};
|
||||
window.oc_defaults = {
|
||||
docPlaceholderUrl: 'https://docs.example.org/PLACEHOLDER'
|
||||
};
|
||||
|
||||
/* jshint camelcase: true */
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
msg: 'The "X-Permitted-Cross-Domain-Policies" HTTP header is not set to "none". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
}, {
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation</a>.',
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
}
|
||||
]);
|
||||
|
@ -702,7 +702,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
result.done(function( data, s, x ){
|
||||
expect(data).toEqual([
|
||||
{
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation</a>.',
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
}
|
||||
]);
|
||||
|
@ -728,7 +728,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
result.done(function( data, s, x ){
|
||||
expect(data).toEqual([
|
||||
{
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation</a>.',
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
}
|
||||
]);
|
||||
|
@ -754,7 +754,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
result.done(function( data, s, x ){
|
||||
expect(data).toEqual([
|
||||
{
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation</a>.',
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
}
|
||||
]);
|
||||
|
@ -780,7 +780,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
result.done(function( data, s, x ){
|
||||
expect(data).toEqual([
|
||||
{
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation</a>.',
|
||||
msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the <a href="https://www.w3.org/TR/referrer-policy/" rel="noreferrer noopener">W3C Recommendation ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
}
|
||||
]);
|
||||
|
@ -808,7 +808,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
|
||||
async.done(function( data, s, x ){
|
||||
expect(data).toEqual([{
|
||||
msg: 'Accessing site insecurely via HTTP. You are strongly adviced to set up your server to require HTTPS instead, as described in the <a href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.',
|
||||
msg: 'Accessing site insecurely via HTTP. You are strongly adviced to set up your server to require HTTPS instead, as described in the <a href="https://docs.example.org/admin-security">security tips ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
}]);
|
||||
done();
|
||||
|
@ -855,7 +855,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
|
||||
async.done(function( data, s, x ){
|
||||
expect(data).toEqual([{
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.',
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="https://docs.example.org/admin-security">security tips ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
}]);
|
||||
done();
|
||||
|
@ -881,7 +881,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
|
||||
async.done(function( data, s, x ){
|
||||
expect(data).toEqual([{
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.',
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="https://docs.example.org/admin-security">security tips ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
}]);
|
||||
done();
|
||||
|
@ -907,7 +907,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
|
||||
async.done(function( data, s, x ){
|
||||
expect(data).toEqual([{
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.',
|
||||
msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a rel="noreferrer noopener" href="https://docs.example.org/admin-security">security tips ↗</a>.',
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
}]);
|
||||
done();
|
||||
|
|
|
@ -907,7 +907,6 @@ return array(
|
|||
'OC\\Settings\\Admin\\Server' => $baseDir . '/lib/private/Settings/Admin/Server.php',
|
||||
'OC\\Settings\\Admin\\ServerDevNotice' => $baseDir . '/lib/private/Settings/Admin/ServerDevNotice.php',
|
||||
'OC\\Settings\\Admin\\Sharing' => $baseDir . '/lib/private/Settings/Admin/Sharing.php',
|
||||
'OC\\Settings\\Admin\\TipsTricks' => $baseDir . '/lib/private/Settings/Admin/TipsTricks.php',
|
||||
'OC\\Settings\\Application' => $baseDir . '/settings/Application.php',
|
||||
'OC\\Settings\\BackgroundJobs\\VerifyUserData' => $baseDir . '/settings/BackgroundJobs/VerifyUserData.php',
|
||||
'OC\\Settings\\Controller\\AdminSettingsController' => $baseDir . '/settings/Controller/AdminSettingsController.php',
|
||||
|
|
|
@ -937,7 +937,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
|||
'OC\\Settings\\Admin\\Server' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Server.php',
|
||||
'OC\\Settings\\Admin\\ServerDevNotice' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/ServerDevNotice.php',
|
||||
'OC\\Settings\\Admin\\Sharing' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/Sharing.php',
|
||||
'OC\\Settings\\Admin\\TipsTricks' => __DIR__ . '/../../..' . '/lib/private/Settings/Admin/TipsTricks.php',
|
||||
'OC\\Settings\\Application' => __DIR__ . '/../../..' . '/settings/Application.php',
|
||||
'OC\\Settings\\BackgroundJobs\\VerifyUserData' => __DIR__ . '/../../..' . '/settings/BackgroundJobs/VerifyUserData.php',
|
||||
'OC\\Settings\\Controller\\AdminSettingsController' => __DIR__ . '/../../..' . '/settings/Controller/AdminSettingsController.php',
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
* @author Lukas Reschke <lukas@statuscode.ch>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OC\Settings\Admin;
|
||||
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
class TipsTricks implements ISettings {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm() {
|
||||
$databaseOverload = (strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false);
|
||||
|
||||
$parameters = [
|
||||
'databaseOverload' => $databaseOverload,
|
||||
];
|
||||
|
||||
return new TemplateResponse('settings', 'settings/admin/tipstricks', $parameters, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the section ID, e.g. 'sharing'
|
||||
*/
|
||||
public function getSection() {
|
||||
return 'tips-tricks';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int whether the form should be rather on the top or bottom of
|
||||
* the admin section. The forms are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
*
|
||||
* E.g.: 70
|
||||
*/
|
||||
public function getPriority() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -232,7 +232,6 @@ class Manager implements IManager {
|
|||
10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
|
||||
45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
|
||||
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
|
||||
99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
|
||||
];
|
||||
|
||||
$appSections = $this->getSections('admin');
|
||||
|
@ -282,11 +281,6 @@ class Manager implements IManager {
|
|||
$form = new Admin\Sharing($this->config, $this->l);
|
||||
$forms[$form->getPriority()] = [$form];
|
||||
}
|
||||
if ($section === 'tips-tricks') {
|
||||
/** @var ISettings $form */
|
||||
$form = new Admin\TipsTricks($this->config);
|
||||
$forms[$form->getPriority()] = [$form];
|
||||
}
|
||||
|
||||
return $forms;
|
||||
}
|
||||
|
|
|
@ -428,6 +428,10 @@ Raw output
|
|||
return $indexInfo->getListOfMissingIndexes();
|
||||
}
|
||||
|
||||
protected function isSqliteUsed() {
|
||||
return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataResponse
|
||||
*/
|
||||
|
@ -451,6 +455,8 @@ Raw output
|
|||
'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
|
||||
'hasFreeTypeSupport' => $this->hasFreeTypeSupport(),
|
||||
'hasMissingIndexes' => $this->hasMissingIndexes(),
|
||||
'isSqliteUsed' => $this->isSqliteUsed(),
|
||||
'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1314,8 +1314,18 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
|
|||
}
|
||||
}
|
||||
|
||||
#security-warning > ul {
|
||||
color: $color-error;
|
||||
#security-warning {
|
||||
a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
& > ul {
|
||||
color: $color-error;
|
||||
}
|
||||
|
||||
.extra-top-margin {
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
#admin-tips li {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<div id="security-warning" class="section">
|
||||
<h2><?php p($l->t('Security & setup warnings'));?></h2>
|
||||
<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>
|
||||
<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 linked documentation for more information.'));?></p>
|
||||
<ul>
|
||||
<?php
|
||||
// is php setup properly to query system environment variables like getenv('PATH')
|
||||
|
@ -173,6 +173,10 @@
|
|||
<?php print_unescaped($l->t('Please double check the <a target="_blank" rel="noreferrer noopener" href="%s">installation guides ↗</a>, and check for any errors or warnings in the <a href="%s">log</a>.', [link_to_docs('admin-install'), \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => 'logging'])] )); ?>
|
||||
</p>
|
||||
|
||||
<p class="extra-top-margin">
|
||||
<?php print_unescaped($l->t('Check the security of your Nextcloud over <a target="_blank" rel="noreferrer noopener" href="%s">our security scan ↗</a>.', ['https://scan.nextcloud.com']));?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @var \OCP\IL10N $l */
|
||||
/** @var array $_ */
|
||||
|
||||
?>
|
||||
|
||||
<div class="section" id="admin-tips">
|
||||
<h2><?php p($l->t('Tips & tricks'));?></h2>
|
||||
<p class="settings-hint"><?php p($l->t('There are a lot of features and config switches available to optimally customize and use this instance. Here are some pointers for more information.')); ?></p>
|
||||
<ul>
|
||||
<?php
|
||||
// SQLite database performance issue
|
||||
if ($_['databaseOverload']) {
|
||||
?>
|
||||
<li>
|
||||
<?php p($l->t('SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend.')); ?><br>
|
||||
<?php p($l->t('This is particularly recommended when using the desktop client for file synchronisation.')); ?><br>
|
||||
<?php print_unescaped($l->t('To migrate to another database use the command line tool: \'occ db:convert-type\', or see the <a target="_blank" rel="noreferrer noopener" href="%s">documentation ↗</a>.', link_to_docs('admin-db-conversion') )); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-backup')); ?>"><?php p($l->t('How to do backups'));?> ↗</a></li>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-performance')); ?>"><?php p($l->t('Performance tuning'));?> ↗</a></li>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-config')); ?>"><?php p($l->t('Improving the config.php'));?> ↗</a></li>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('developer-theming')); ?>"><?php p($l->t('Theming'));?> ↗</a></li>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="https://scan.nextcloud.com"><?php p($l->t('Check the security of your Nextcloud over our security scan'));?> ↗</a></li>
|
||||
<li><a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-security')); ?>"><?php p($l->t('Hardening and security guidance'));?> ↗</a></li>
|
||||
</ul>
|
||||
</div>
|
|
@ -22,10 +22,9 @@
|
|||
*/
|
||||
namespace Tests\Settings\Controller;
|
||||
|
||||
use OC\Settings\Admin\TipsTricks;
|
||||
use OC\Settings\Admin\ServerDevNotice;
|
||||
use OC\Settings\Controller\AdminSettingsController;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\IRequest;
|
||||
use OCP\Settings\IManager;
|
||||
|
@ -88,7 +87,7 @@ class AdminSettingsControllerTest extends TestCase {
|
|||
->expects($this->once())
|
||||
->method('getAdminSettings')
|
||||
->with('test')
|
||||
->willReturn([5 => new TipsTricks($this->getMockBuilder(IConfig::class)->getMock())]);
|
||||
->willReturn([5 => new ServerDevNotice()]);
|
||||
|
||||
$expected = new TemplateResponse('settings', 'settings/frame', ['forms' => ['personal' => [], 'admin' => []], 'content' => '']);
|
||||
$this->assertEquals($expected, $this->adminSettingsController->index('test'));
|
||||
|
|
|
@ -103,7 +103,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->logger,
|
||||
$this->dispatcher,
|
||||
])
|
||||
->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes'])->getMock();
|
||||
->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock();
|
||||
}
|
||||
|
||||
public function testIsInternetConnectionWorkingDisabledViaConfig() {
|
||||
|
@ -332,12 +332,19 @@ class CheckSetupControllerTest extends TestCase {
|
|||
->method('linkToDocs')
|
||||
->with('admin-php-opcache')
|
||||
->willReturn('http://docs.example.org/server/go.php?to=admin-php-opcache');
|
||||
$this->urlGenerator->expects($this->at(5))
|
||||
->method('linkToDocs')
|
||||
->with('admin-db-conversion')
|
||||
->willReturn('http://docs.example.org/server/go.php?to=admin-db-conversion');
|
||||
$this->checkSetupController
|
||||
->method('hasFreeTypeSupport')
|
||||
->willReturn(false);
|
||||
$this->checkSetupController
|
||||
->method('hasMissingIndexes')
|
||||
->willReturn([]);
|
||||
$this->checkSetupController
|
||||
->method('isSqliteUsed')
|
||||
->willReturn(false);
|
||||
|
||||
$expected = new DataResponse(
|
||||
[
|
||||
|
@ -361,6 +368,8 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'isSettimelimitAvailable' => true,
|
||||
'hasFreeTypeSupport' => false,
|
||||
'hasMissingIndexes' => [],
|
||||
'isSqliteUsed' => false,
|
||||
'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion',
|
||||
]
|
||||
);
|
||||
$this->assertEquals($expected, $this->checkSetupController->check());
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
|
||||
*
|
||||
* @author Lukas Reschke <lukas@statuscode.ch>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Test\Settings\Admin;
|
||||
|
||||
use OC\Settings\Admin\TipsTricks;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use Test\TestCase;
|
||||
|
||||
class TipsTrickTest extends TestCase {
|
||||
/** @var TipsTricks */
|
||||
private $admin;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
|
||||
|
||||
$this->admin = new TipsTricks(
|
||||
$this->config
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetFormWithExcludedGroupsWithSQLite() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('dbtype')
|
||||
->willReturn('sqlite');
|
||||
|
||||
$expected = new TemplateResponse(
|
||||
'settings',
|
||||
'settings/admin/tipstricks',
|
||||
[
|
||||
'databaseOverload' => true,
|
||||
],
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->admin->getForm());
|
||||
}
|
||||
|
||||
public function testGetFormWithExcludedGroupsWithoutSQLite() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('dbtype')
|
||||
->willReturn('mysql');
|
||||
|
||||
$expected = new TemplateResponse(
|
||||
'settings',
|
||||
'settings/admin/tipstricks',
|
||||
[
|
||||
'databaseOverload' => false,
|
||||
],
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->admin->getForm());
|
||||
}
|
||||
|
||||
public function testGetSection() {
|
||||
$this->assertSame('tips-tricks', $this->admin->getSection());
|
||||
}
|
||||
|
||||
public function testGetPriority() {
|
||||
$this->assertSame(0, $this->admin->getPriority());
|
||||
}
|
||||
}
|
|
@ -115,7 +115,7 @@ class ManagerTest extends TestCase {
|
|||
|
||||
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
|
||||
|
||||
$this->url->expects($this->exactly(7))
|
||||
$this->url->expects($this->exactly(6))
|
||||
->method('imagePath')
|
||||
->willReturnMap([
|
||||
['settings', 'admin.svg', '0'],
|
||||
|
@ -133,7 +133,6 @@ class ManagerTest extends TestCase {
|
|||
45 => [new Section('encryption', 'Encryption', 0, '3')],
|
||||
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
|
||||
98 => [new Section('additional', 'Additional settings', 0, '1')],
|
||||
99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')],
|
||||
], $this->manager->getAdminSections());
|
||||
}
|
||||
|
||||
|
@ -167,7 +166,7 @@ class ManagerTest extends TestCase {
|
|||
->method('t')
|
||||
->will($this->returnArgument(0));
|
||||
|
||||
$this->url->expects($this->exactly(7))
|
||||
$this->url->expects($this->exactly(6))
|
||||
->method('imagePath')
|
||||
->willReturnMap([
|
||||
['settings', 'admin.svg', '0'],
|
||||
|
@ -184,7 +183,6 @@ class ManagerTest extends TestCase {
|
|||
10 => [new Section('security', 'Security', 0, '3')],
|
||||
45 => [new Section('encryption', 'Encryption', 0, '3')],
|
||||
98 => [new Section('additional', 'Additional settings', 0, '1')],
|
||||
99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')],
|
||||
], $this->manager->getAdminSections());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue