mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #41134 from nextcloud/feat/migrate-more-setup-checks
Migrate checks to new SetupCheck API
This commit is contained in:
commit
84d2a9b3d0
15 changed files with 589 additions and 916 deletions
|
|
@ -75,14 +75,22 @@ return array(
|
|||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\CheckUserCertificates' => $baseDir . '/../lib/SetupChecks/CheckUserCertificates.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => $baseDir . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => $baseDir . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => $baseDir . '/../lib/SetupChecks/FileLocking.php',
|
||||
'OCA\\Settings\\SetupChecks\\InternetConnectivity' => $baseDir . '/../lib/SetupChecks/InternetConnectivity.php',
|
||||
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => $baseDir . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
|
||||
'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => $baseDir . '/../lib/SetupChecks/MemcacheConfigured.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => $baseDir . '/../lib/SetupChecks/PhpDefaultCharset.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => $baseDir . '/../lib/SetupChecks/PhpFreetypeSupport.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => $baseDir . '/../lib/SetupChecks/PhpGetEnv.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpModules' => $baseDir . '/../lib/SetupChecks/PhpModules.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutdated' => $baseDir . '/../lib/SetupChecks/PhpOutdated.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => $baseDir . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
'OCA\\Settings\\SetupChecks\\RandomnessSecure' => $baseDir . '/../lib/SetupChecks/RandomnessSecure.php',
|
||||
'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => $baseDir . '/../lib/SetupChecks/ReadOnlyConfig.php',
|
||||
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => $baseDir . '/../lib/SetupChecks/SupportedDatabase.php',
|
||||
'OCA\\Settings\\SetupChecks\\SystemIs64bit' => $baseDir . '/../lib/SetupChecks/SystemIs64bit.php',
|
||||
'OCA\\Settings\\SetupChecks\\TransactionIsolation' => $baseDir . '/../lib/SetupChecks/TransactionIsolation.php',
|
||||
'OCA\\Settings\\UserMigration\\AccountMigrator' => $baseDir . '/../lib/UserMigration/AccountMigrator.php',
|
||||
'OCA\\Settings\\UserMigration\\AccountMigratorException' => $baseDir . '/../lib/UserMigration/AccountMigratorException.php',
|
||||
'OCA\\Settings\\WellKnown\\ChangePasswordHandler' => $baseDir . '/../lib/WellKnown/ChangePasswordHandler.php',
|
||||
|
|
|
|||
|
|
@ -90,14 +90,22 @@ class ComposerStaticInitSettings
|
|||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\CheckUserCertificates' => __DIR__ . '/..' . '/../lib/SetupChecks/CheckUserCertificates.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => __DIR__ . '/..' . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => __DIR__ . '/..' . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => __DIR__ . '/..' . '/../lib/SetupChecks/FileLocking.php',
|
||||
'OCA\\Settings\\SetupChecks\\InternetConnectivity' => __DIR__ . '/..' . '/../lib/SetupChecks/InternetConnectivity.php',
|
||||
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => __DIR__ . '/..' . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
|
||||
'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => __DIR__ . '/..' . '/../lib/SetupChecks/MemcacheConfigured.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpDefaultCharset.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpFreetypeSupport.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpGetEnv.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpModules' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpModules.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutdated' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutdated.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
'OCA\\Settings\\SetupChecks\\RandomnessSecure' => __DIR__ . '/..' . '/../lib/SetupChecks/RandomnessSecure.php',
|
||||
'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => __DIR__ . '/..' . '/../lib/SetupChecks/ReadOnlyConfig.php',
|
||||
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => __DIR__ . '/..' . '/../lib/SetupChecks/SupportedDatabase.php',
|
||||
'OCA\\Settings\\SetupChecks\\SystemIs64bit' => __DIR__ . '/..' . '/../lib/SetupChecks/SystemIs64bit.php',
|
||||
'OCA\\Settings\\SetupChecks\\TransactionIsolation' => __DIR__ . '/..' . '/../lib/SetupChecks/TransactionIsolation.php',
|
||||
'OCA\\Settings\\UserMigration\\AccountMigrator' => __DIR__ . '/..' . '/../lib/UserMigration/AccountMigrator.php',
|
||||
'OCA\\Settings\\UserMigration\\AccountMigratorException' => __DIR__ . '/..' . '/../lib/UserMigration/AccountMigratorException.php',
|
||||
'OCA\\Settings\\WellKnown\\ChangePasswordHandler' => __DIR__ . '/..' . '/../lib/WellKnown/ChangePasswordHandler.php',
|
||||
|
|
|
|||
|
|
@ -50,14 +50,22 @@ use OCA\Settings\Search\SectionSearch;
|
|||
use OCA\Settings\Search\UserSearch;
|
||||
use OCA\Settings\SetupChecks\CheckUserCertificates;
|
||||
use OCA\Settings\SetupChecks\DefaultPhoneRegionSet;
|
||||
use OCA\Settings\SetupChecks\EmailTestSuccessful;
|
||||
use OCA\Settings\SetupChecks\FileLocking;
|
||||
use OCA\Settings\SetupChecks\InternetConnectivity;
|
||||
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
|
||||
use OCA\Settings\SetupChecks\MemcacheConfigured;
|
||||
use OCA\Settings\SetupChecks\PhpDefaultCharset;
|
||||
use OCA\Settings\SetupChecks\PhpFreetypeSupport;
|
||||
use OCA\Settings\SetupChecks\PhpGetEnv;
|
||||
use OCA\Settings\SetupChecks\PhpModules;
|
||||
use OCA\Settings\SetupChecks\PhpOutdated;
|
||||
use OCA\Settings\SetupChecks\PhpOutputBuffering;
|
||||
use OCA\Settings\SetupChecks\RandomnessSecure;
|
||||
use OCA\Settings\SetupChecks\ReadOnlyConfig;
|
||||
use OCA\Settings\SetupChecks\SupportedDatabase;
|
||||
use OCA\Settings\SetupChecks\SystemIs64bit;
|
||||
use OCA\Settings\SetupChecks\TransactionIsolation;
|
||||
use OCA\Settings\UserMigration\AccountMigrator;
|
||||
use OCA\Settings\WellKnown\ChangePasswordHandler;
|
||||
use OCA\Settings\WellKnown\SecurityTxtHandler;
|
||||
|
|
@ -149,14 +157,22 @@ class Application extends App implements IBootstrap {
|
|||
});
|
||||
$context->registerSetupCheck(CheckUserCertificates::class);
|
||||
$context->registerSetupCheck(DefaultPhoneRegionSet::class);
|
||||
$context->registerSetupCheck(EmailTestSuccessful::class);
|
||||
$context->registerSetupCheck(FileLocking::class);
|
||||
$context->registerSetupCheck(InternetConnectivity::class);
|
||||
$context->registerSetupCheck(LegacySSEKeyFormat::class);
|
||||
$context->registerSetupCheck(MemcacheConfigured::class);
|
||||
$context->registerSetupCheck(PhpDefaultCharset::class);
|
||||
$context->registerSetupCheck(PhpModules::class);
|
||||
$context->registerSetupCheck(PhpFreetypeSupport::class);
|
||||
$context->registerSetupCheck(PhpGetEnv::class);
|
||||
$context->registerSetupCheck(PhpOutdated::class);
|
||||
$context->registerSetupCheck(PhpOutputBuffering::class);
|
||||
$context->registerSetupCheck(RandomnessSecure::class);
|
||||
$context->registerSetupCheck(ReadOnlyConfig::class);
|
||||
$context->registerSetupCheck(SupportedDatabase::class);
|
||||
$context->registerSetupCheck(SystemIs64bit::class);
|
||||
$context->registerSetupCheck(TransactionIsolation::class);
|
||||
|
||||
$context->registerUserMigrator(AccountMigrator::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ namespace OCA\Settings\Controller;
|
|||
|
||||
use bantu\IniGetWrapper\IniGetWrapper;
|
||||
use DirectoryIterator;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\TransactionIsolationLevel;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use OC;
|
||||
use OC\AppFramework\Http;
|
||||
|
|
@ -58,8 +56,6 @@ use OC\DB\MissingIndexInformation;
|
|||
use OC\DB\MissingPrimaryKeyInformation;
|
||||
use OC\DB\SchemaWrapper;
|
||||
use OC\IntegrityCheck\Checker;
|
||||
use OC\Lock\NoopLockingProvider;
|
||||
use OC\Lock\DBLockingProvider;
|
||||
use OC\MemoryInfo;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
|
@ -84,7 +80,6 @@ use OCP\IURLGenerator;
|
|||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Notification\IManager;
|
||||
use OCP\Security\Bruteforce\IThrottler;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\SetupCheck\ISetupCheckManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -112,8 +107,6 @@ class CheckSetupController extends Controller {
|
|||
private $dateTimeFormatter;
|
||||
/** @var MemoryInfo */
|
||||
private $memoryInfo;
|
||||
/** @var ISecureRandom */
|
||||
private $secureRandom;
|
||||
/** @var IniGetWrapper */
|
||||
private $iniGetWrapper;
|
||||
/** @var IDBConnection */
|
||||
|
|
@ -131,27 +124,26 @@ class CheckSetupController extends Controller {
|
|||
private ISetupCheckManager $setupCheckManager;
|
||||
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
IClientService $clientService,
|
||||
IURLGenerator $urlGenerator,
|
||||
IL10N $l10n,
|
||||
Checker $checker,
|
||||
LoggerInterface $logger,
|
||||
IEventDispatcher $dispatcher,
|
||||
Connection $db,
|
||||
ILockingProvider $lockingProvider,
|
||||
IDateTimeFormatter $dateTimeFormatter,
|
||||
MemoryInfo $memoryInfo,
|
||||
ISecureRandom $secureRandom,
|
||||
IniGetWrapper $iniGetWrapper,
|
||||
IDBConnection $connection,
|
||||
IThrottler $throttler,
|
||||
ITempManager $tempManager,
|
||||
IManager $manager,
|
||||
IAppManager $appManager,
|
||||
IServerContainer $serverContainer,
|
||||
ISetupCheckManager $setupCheckManager,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
IClientService $clientService,
|
||||
IURLGenerator $urlGenerator,
|
||||
IL10N $l10n,
|
||||
Checker $checker,
|
||||
LoggerInterface $logger,
|
||||
IEventDispatcher $dispatcher,
|
||||
Connection $db,
|
||||
ILockingProvider $lockingProvider,
|
||||
IDateTimeFormatter $dateTimeFormatter,
|
||||
MemoryInfo $memoryInfo,
|
||||
IniGetWrapper $iniGetWrapper,
|
||||
IDBConnection $connection,
|
||||
IThrottler $throttler,
|
||||
ITempManager $tempManager,
|
||||
IManager $manager,
|
||||
IAppManager $appManager,
|
||||
IServerContainer $serverContainer,
|
||||
ISetupCheckManager $setupCheckManager,
|
||||
) {
|
||||
parent::__construct($AppName, $request);
|
||||
$this->config = $config;
|
||||
|
|
@ -166,7 +158,6 @@ class CheckSetupController extends Controller {
|
|||
$this->lockingProvider = $lockingProvider;
|
||||
$this->dateTimeFormatter = $dateTimeFormatter;
|
||||
$this->memoryInfo = $memoryInfo;
|
||||
$this->secureRandom = $secureRandom;
|
||||
$this->iniGetWrapper = $iniGetWrapper;
|
||||
$this->connection = $connection;
|
||||
$this->tempManager = $tempManager;
|
||||
|
|
@ -198,28 +189,6 @@ class CheckSetupController extends Controller {
|
|||
return $this->manager->isFairUseOfFreePushService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a local memcache is installed or not
|
||||
* @return bool
|
||||
*/
|
||||
private function isMemcacheConfigured() {
|
||||
return $this->config->getSystemValue('memcache.local', null) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether PHP can generate "secure" pseudorandom integers
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isRandomnessSecure() {
|
||||
try {
|
||||
$this->secureRandom->generate(1);
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public for the sake of unit-testing
|
||||
*
|
||||
|
|
@ -485,14 +454,6 @@ Raw output
|
|||
return $recommendations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the required FreeType functions are present
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasFreeTypeSupport() {
|
||||
return function_exists('imagettfbbox') && function_exists('imagettftext');
|
||||
}
|
||||
|
||||
protected function hasMissingIndexes(): array {
|
||||
$indexInfo = new MissingIndexInformation();
|
||||
|
||||
|
|
@ -564,50 +525,6 @@ Raw output
|
|||
return str_contains($this->config->getSystemValue('dbtype'), 'sqlite');
|
||||
}
|
||||
|
||||
protected function isReadOnlyConfig(): bool {
|
||||
return \OC_Helper::isReadOnlyConfigEnabled();
|
||||
}
|
||||
|
||||
protected function wasEmailTestSuccessful(): bool {
|
||||
// Handle the case that the configuration was set before the check was introduced or it was only set via command line and not from the UI
|
||||
if ($this->config->getAppValue('core', 'emailTestSuccessful', '') === '' && $this->config->getSystemValue('mail_domain', '') === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The mail test was unsuccessful or the config was changed using the UI without verifying with a testmail, hence return false
|
||||
if ($this->config->getAppValue('core', 'emailTestSuccessful', '') === '0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function hasValidTransactionIsolationLevel(): bool {
|
||||
try {
|
||||
if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->db->getTransactionIsolation() === TransactionIsolationLevel::READ_COMMITTED;
|
||||
} catch (Exception $e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function hasFileinfoInstalled(): bool {
|
||||
return \OC_Util::fileInfoLoaded();
|
||||
}
|
||||
|
||||
protected function hasWorkingFileLocking(): bool {
|
||||
return !($this->lockingProvider instanceof NoopLockingProvider);
|
||||
}
|
||||
|
||||
protected function hasDBFileLocking(): bool {
|
||||
return ($this->lockingProvider instanceof DBLockingProvider);
|
||||
}
|
||||
|
||||
protected function getSuggestedOverwriteCliURL(): string {
|
||||
$currentOverwriteCliUrl = $this->config->getSystemValue('overwrite.cli.url', '');
|
||||
$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
|
||||
|
|
@ -715,14 +632,6 @@ Raw output
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function is64bit(): bool {
|
||||
if (PHP_INT_SIZE < 8) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function isMysqlUsedWithoutUTF8MB4(): bool {
|
||||
return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false);
|
||||
}
|
||||
|
|
@ -817,23 +726,12 @@ Raw output
|
|||
public function check() {
|
||||
return new DataResponse(
|
||||
[
|
||||
'isGetenvServerWorking' => !empty(getenv('PATH')),
|
||||
'isReadOnlyConfig' => $this->isReadOnlyConfig(),
|
||||
'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(),
|
||||
'wasEmailTestSuccessful' => $this->wasEmailTestSuccessful(),
|
||||
'hasFileinfoInstalled' => $this->hasFileinfoInstalled(),
|
||||
'hasWorkingFileLocking' => $this->hasWorkingFileLocking(),
|
||||
'hasDBFileLocking' => $this->hasDBFileLocking(),
|
||||
'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(),
|
||||
'cronInfo' => $this->getLastCronInfo(),
|
||||
'cronErrors' => $this->getCronErrors(),
|
||||
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(),
|
||||
'isBruteforceThrottled' => $this->throttler->getAttempts($this->request->getRemoteAddress()) !== 0,
|
||||
'bruteforceRemoteAddress' => $this->request->getRemoteAddress(),
|
||||
'isMemcacheConfigured' => $this->isMemcacheConfigured(),
|
||||
'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'),
|
||||
'isRandomnessSecure' => $this->isRandomnessSecure(),
|
||||
'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'),
|
||||
'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(),
|
||||
'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(),
|
||||
'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
|
||||
|
|
@ -842,7 +740,6 @@ Raw output
|
|||
'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
|
||||
'OpcacheSetupRecommendations' => $this->getOpcacheSetupRecommendations(),
|
||||
'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
|
||||
'hasFreeTypeSupport' => $this->hasFreeTypeSupport(),
|
||||
'missingPrimaryKeys' => $this->hasMissingPrimaryKeys(),
|
||||
'missingIndexes' => $this->hasMissingIndexes(),
|
||||
'missingColumns' => $this->hasMissingColumns(),
|
||||
|
|
@ -852,7 +749,6 @@ Raw output
|
|||
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
|
||||
'isImagickEnabled' => $this->isImagickEnabled(),
|
||||
'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(),
|
||||
'is64bit' => $this->is64bit(),
|
||||
'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
|
||||
'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
|
||||
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
|
||||
|
|
|
|||
76
apps/settings/lib/SetupChecks/EmailTestSuccessful.php
Normal file
76
apps/settings/lib/SetupChecks/EmailTestSuccessful.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class EmailTestSuccessful implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Email test');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'config';
|
||||
}
|
||||
|
||||
protected function wasEmailTestSuccessful(): bool {
|
||||
// Handle the case that the configuration was set before the check was introduced or it was only set via command line and not from the UI
|
||||
if ($this->config->getAppValue('core', 'emailTestSuccessful', '') === '' && $this->config->getSystemValue('mail_domain', '') === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The mail test was unsuccessful or the config was changed using the UI without verifying with a testmail, hence return false
|
||||
if ($this->config->getAppValue('core', 'emailTestSuccessful', '') === '0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->wasEmailTestSuccessful()) {
|
||||
return SetupResult::success($this->l10n->t('Email test was successfully sent'));
|
||||
} else {
|
||||
// If setup check could link to settings pages, this one should link to OC.generateUrl('/settings/admin')
|
||||
return SetupResult::info(
|
||||
$this->l10n->t('You have not set or verified your email server configuration, yet. Please head over to the "Basic settings" in order to set them. Afterwards, use the "Send email" button below the form to verify your settings.'),
|
||||
$this->urlGenerator->linkToDocs('admin-email')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
apps/settings/lib/SetupChecks/FileLocking.php
Normal file
78
apps/settings/lib/SetupChecks/FileLocking.php
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OC\Lock\DBLockingProvider;
|
||||
use OC\Lock\NoopLockingProvider;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class FileLocking implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private ILockingProvider $lockingProvider,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('File locking');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'system';
|
||||
}
|
||||
|
||||
protected function hasWorkingFileLocking(): bool {
|
||||
return !($this->lockingProvider instanceof NoopLockingProvider);
|
||||
}
|
||||
|
||||
protected function hasDBFileLocking(): bool {
|
||||
return ($this->lockingProvider instanceof DBLockingProvider);
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if (!$this->hasWorkingFileLocking()) {
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('Transactional file locking is disabled, this might lead to issues with race conditions. Enable "filelocking.enabled" in config.php to avoid these problems.'),
|
||||
$this->urlGenerator->linkToDocs('admin-transactional-locking')
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->hasDBFileLocking()) {
|
||||
return SetupResult::info(
|
||||
$this->l10n->t('The database is used for transactional file locking. To enhance performance, please configure memcache, if available.'),
|
||||
$this->urlGenerator->linkToDocs('admin-transactional-locking')
|
||||
);
|
||||
}
|
||||
|
||||
return SetupResult::success();
|
||||
}
|
||||
}
|
||||
60
apps/settings/lib/SetupChecks/MemcacheConfigured.php
Normal file
60
apps/settings/lib/SetupChecks/MemcacheConfigured.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class MemcacheConfigured implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Memcache');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'system';
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->config->getSystemValue('memcache.local', null) !== null) {
|
||||
return SetupResult::success($this->l10n->t('Configured'));
|
||||
} else {
|
||||
return SetupResult::info(
|
||||
$this->l10n->t('No memory cache has been configured. To enhance performance, please configure a memcache, if available.'),
|
||||
$this->urlGenerator->linkToDocs('admin-performance')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
63
apps/settings/lib/SetupChecks/PhpFreetypeSupport.php
Normal file
63
apps/settings/lib/SetupChecks/PhpFreetypeSupport.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IL10N;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class PhpFreetypeSupport implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Freetype');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the required FreeType functions are present
|
||||
*/
|
||||
protected function hasFreeTypeSupport(): bool {
|
||||
return function_exists('imagettfbbox') && function_exists('imagettftext');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->hasFreeTypeSupport()) {
|
||||
return SetupResult::success($this->l10n->t('Supported'));
|
||||
} else {
|
||||
return SetupResult::info(
|
||||
$this->l10n->t('Your PHP does not have FreeType support, resulting in breakage of profile pictures and the settings interface.'),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
apps/settings/lib/SetupChecks/PhpGetEnv.php
Normal file
55
apps/settings/lib/SetupChecks/PhpGetEnv.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Daniel Kesselberg <mail@danielkesselberg.de>
|
||||
*
|
||||
* @author Daniel Kesselberg <mail@danielkesselberg.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/>.
|
||||
*
|
||||
*/
|
||||
namespace OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class PhpGetEnv implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('PHP getenv');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'php';
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if (!empty(getenv('PATH'))) {
|
||||
return SetupResult::success();
|
||||
} else {
|
||||
return SetupResult::warning($this->l10n->t('PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.'), $this->urlGenerator->linkToDocs('admin-php-fpm'));
|
||||
}
|
||||
}
|
||||
}
|
||||
63
apps/settings/lib/SetupChecks/RandomnessSecure.php
Normal file
63
apps/settings/lib/SetupChecks/RandomnessSecure.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class RandomnessSecure implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private ISecureRandom $secureRandom,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Random generator');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'security';
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
try {
|
||||
$this->secureRandom->generate(1);
|
||||
} catch (\Exception $ex) {
|
||||
return SetupResult::error(
|
||||
$this->l10n->t('No suitable source for randomness found by PHP which is highly discouraged for security reasons.'),
|
||||
$this->urlGenerator->linkToDocs('admin-security')
|
||||
);
|
||||
}
|
||||
return SetupResult::success($this->l10n->t('Secure'));
|
||||
}
|
||||
}
|
||||
67
apps/settings/lib/SetupChecks/SystemIs64bit.php
Normal file
67
apps/settings/lib/SetupChecks/SystemIs64bit.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class SystemIs64bit implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Architecture');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'system';
|
||||
}
|
||||
|
||||
protected function is64bit(): bool {
|
||||
if (PHP_INT_SIZE < 8) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->is64bit()) {
|
||||
return SetupResult::success($this->l10n->t('64-bit'));
|
||||
} else {
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('It seems like you are running a 32-bit PHP version. Nextcloud needs 64-bit to run well. Please upgrade your OS and PHP to 64-bit!'),
|
||||
$this->urlGenerator->linkToDocs('admin-system-requirements')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
75
apps/settings/lib/SetupChecks/TransactionIsolation.php
Normal file
75
apps/settings/lib/SetupChecks/TransactionIsolation.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @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 OCA\Settings\SetupChecks;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\TransactionIsolationLevel;
|
||||
use OC\DB\Connection;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class TransactionIsolation implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IDBConnection $connection,
|
||||
private Connection $db,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Database transaction isolation level');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'database';
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
try {
|
||||
if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE) {
|
||||
return SetupResult::success();
|
||||
}
|
||||
|
||||
if ($this->db->getTransactionIsolation() === TransactionIsolationLevel::READ_COMMITTED) {
|
||||
return SetupResult::success('Read committed');
|
||||
} else {
|
||||
return SetupResult::error(
|
||||
$this->l10n->t('Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.'),
|
||||
$this->urlGenerator->linkToDocs('admin-db-transaction')
|
||||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('Was not able to get transaction isolation level: %s', $e->getMessage())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,6 @@ use OC;
|
|||
use OC\DB\Connection;
|
||||
use OC\IntegrityCheck\Checker;
|
||||
use OC\MemoryInfo;
|
||||
use OC\Security\SecureRandom;
|
||||
use OCA\Settings\Controller\CheckSetupController;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Http;
|
||||
|
|
@ -100,8 +99,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
private $dateTimeFormatter;
|
||||
/** @var MemoryInfo|MockObject */
|
||||
private $memoryInfo;
|
||||
/** @var SecureRandom|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $secureRandom;
|
||||
/** @var IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $iniGetWrapper;
|
||||
/** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */
|
||||
|
|
@ -154,7 +151,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->memoryInfo = $this->getMockBuilder(MemoryInfo::class)
|
||||
->setMethods(['isMemoryLimitSufficient',])
|
||||
->getMock();
|
||||
$this->secureRandom = $this->getMockBuilder(SecureRandom::class)->getMock();
|
||||
$this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)->getMock();
|
||||
$this->connection = $this->getMockBuilder(IDBConnection::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
@ -178,7 +174,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->lockingProvider,
|
||||
$this->dateTimeFormatter,
|
||||
$this->memoryInfo,
|
||||
$this->secureRandom,
|
||||
$this->iniGetWrapper,
|
||||
$this->connection,
|
||||
$this->throttler,
|
||||
|
|
@ -189,18 +184,11 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->setupCheckManager,
|
||||
])
|
||||
->setMethods([
|
||||
'isReadOnlyConfig',
|
||||
'wasEmailTestSuccessful',
|
||||
'hasValidTransactionIsolationLevel',
|
||||
'hasFileinfoInstalled',
|
||||
'hasWorkingFileLocking',
|
||||
'hasDBFileLocking',
|
||||
'getLastCronInfo',
|
||||
'getSuggestedOverwriteCliURL',
|
||||
'getCurlVersion',
|
||||
'isPhpOutdated',
|
||||
'getOpcacheSetupRecommendations',
|
||||
'hasFreeTypeSupport',
|
||||
'hasMissingIndexes',
|
||||
'hasMissingPrimaryKeys',
|
||||
'isSqliteUsed',
|
||||
|
|
@ -208,7 +196,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'getAppDirsWithDifferentOwner',
|
||||
'isImagickEnabled',
|
||||
'areWebauthnExtensionsEnabled',
|
||||
'is64bit',
|
||||
'hasBigIntConversionPendingColumns',
|
||||
'isMysqlUsedWithoutUTF8MB4',
|
||||
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed',
|
||||
|
|
@ -228,34 +215,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->dirsToRemove = [];
|
||||
}
|
||||
|
||||
public function testIsMemcacheConfiguredFalse() {
|
||||
$this->config->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('memcache.local', null)
|
||||
->willReturn(null);
|
||||
|
||||
$this->assertFalse(
|
||||
self::invokePrivate(
|
||||
$this->checkSetupController,
|
||||
'isMemcacheConfigured'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testIsMemcacheConfiguredTrue() {
|
||||
$this->config->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('memcache.local', null)
|
||||
->willReturn('SomeProvider');
|
||||
|
||||
$this->assertTrue(
|
||||
self::invokePrivate(
|
||||
$this->checkSetupController,
|
||||
'isMemcacheConfigured'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForwardedForHeadersWorking
|
||||
*
|
||||
|
|
@ -367,9 +326,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
->expects($this->once())
|
||||
->method('getOpcacheSetupRecommendations')
|
||||
->willReturn(['recommendation1', 'recommendation2']);
|
||||
$this->checkSetupController
|
||||
->method('hasFreeTypeSupport')
|
||||
->willReturn(false);
|
||||
$this->checkSetupController
|
||||
->method('hasMissingIndexes')
|
||||
->willReturn([]);
|
||||
|
|
@ -379,30 +335,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->checkSetupController
|
||||
->method('isSqliteUsed')
|
||||
->willReturn(false);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('isReadOnlyConfig')
|
||||
->willReturn(false);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('wasEmailTestSuccessful')
|
||||
->willReturn(false);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('hasValidTransactionIsolationLevel')
|
||||
->willReturn(true);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('hasFileinfoInstalled')
|
||||
->willReturn(true);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('hasWorkingFileLocking')
|
||||
->willReturn(true);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('hasDBFileLocking')
|
||||
->willReturn(true);
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('getSuggestedOverwriteCliURL')
|
||||
|
|
@ -438,11 +370,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
->method('areWebauthnExtensionsEnabled')
|
||||
->willReturn(false);
|
||||
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('is64bit')
|
||||
->willReturn(false);
|
||||
|
||||
$this->checkSetupController
|
||||
->expects($this->once())
|
||||
->method('hasBigIntConversionPendingColumns')
|
||||
|
|
@ -494,13 +421,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
|
||||
$expected = new DataResponse(
|
||||
[
|
||||
'isGetenvServerWorking' => true,
|
||||
'isReadOnlyConfig' => false,
|
||||
'wasEmailTestSuccessful' => false,
|
||||
'hasValidTransactionIsolationLevel' => true,
|
||||
'hasFileinfoInstalled' => true,
|
||||
'hasWorkingFileLocking' => true,
|
||||
'hasDBFileLocking' => true,
|
||||
'suggestedOverwriteCliURL' => '',
|
||||
'cronInfo' => [
|
||||
'diffInSeconds' => 123,
|
||||
|
|
@ -508,10 +428,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'backgroundJobsUrl' => 'https://example.org',
|
||||
],
|
||||
'cronErrors' => [],
|
||||
'isMemcacheConfigured' => true,
|
||||
'memcacheDocs' => 'http://docs.example.org/server/go.php?to=admin-performance',
|
||||
'isRandomnessSecure' => self::invokePrivate($this->checkSetupController, 'isRandomnessSecure'),
|
||||
'securityDocs' => 'https://docs.example.org/server/8.1/admin_manual/configuration_server/hardening.html',
|
||||
'isUsedTlsLibOutdated' => '',
|
||||
'forwardedForHeadersWorking' => false,
|
||||
'reverseProxyDocs' => 'reverse-proxy-doc-link',
|
||||
|
|
@ -520,7 +436,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'codeIntegrityCheckerDocumentation' => 'http://docs.example.org/server/go.php?to=admin-code-integrity',
|
||||
'OpcacheSetupRecommendations' => ['recommendation1', 'recommendation2'],
|
||||
'isSettimelimitAvailable' => true,
|
||||
'hasFreeTypeSupport' => false,
|
||||
'isSqliteUsed' => false,
|
||||
'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion',
|
||||
'missingIndexes' => [],
|
||||
|
|
@ -530,7 +445,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'appDirsWithDifferentOwner' => [],
|
||||
'isImagickEnabled' => false,
|
||||
'areWebauthnExtensionsEnabled' => false,
|
||||
'is64bit' => false,
|
||||
'pendingBigIntConversionColumns' => [],
|
||||
'isMysqlUsedWithoutUTF8MB4' => false,
|
||||
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true,
|
||||
|
|
@ -562,7 +476,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->lockingProvider,
|
||||
$this->dateTimeFormatter,
|
||||
$this->memoryInfo,
|
||||
$this->secureRandom,
|
||||
$this->iniGetWrapper,
|
||||
$this->connection,
|
||||
$this->throttler,
|
||||
|
|
@ -1291,7 +1204,6 @@ Array
|
|||
$this->lockingProvider,
|
||||
$this->dateTimeFormatter,
|
||||
$this->memoryInfo,
|
||||
$this->secureRandom,
|
||||
$this->iniGetWrapper,
|
||||
$this->connection,
|
||||
$this->throttler,
|
||||
|
|
@ -1347,7 +1259,6 @@ Array
|
|||
$this->lockingProvider,
|
||||
$this->dateTimeFormatter,
|
||||
$this->memoryInfo,
|
||||
$this->secureRandom,
|
||||
$this->iniGetWrapper,
|
||||
$this->connection,
|
||||
$this->throttler,
|
||||
|
|
|
|||
|
|
@ -180,41 +180,6 @@
|
|||
var afterCall = function(data, statusText, xhr) {
|
||||
var messages = [];
|
||||
if (xhr.status === 200 && data) {
|
||||
if (!data.isGetenvServerWorking) {
|
||||
messages.push({
|
||||
msg: t('core', 'PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.') + ' ' +
|
||||
t('core', 'Please check the {linkstart}installation documentation ↗{linkend} for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.')
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-php-fpm') + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
if (data.isReadOnlyConfig) {
|
||||
messages.push({
|
||||
msg: t('core', '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.'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
});
|
||||
}
|
||||
if (!data.wasEmailTestSuccessful) {
|
||||
messages.push({
|
||||
msg: t('core', 'You have not set or verified your email server configuration, yet. Please head over to the {mailSettingsStart}Basic settings{mailSettingsEnd} in order to set them. Afterwards, use the "Send email" button below the form to verify your settings.',)
|
||||
.replace('{mailSettingsStart}', '<a href="' + OC.generateUrl('/settings/admin') + '">')
|
||||
.replace('{mailSettingsEnd}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
});
|
||||
}
|
||||
if (!data.hasValidTransactionIsolationLevel) {
|
||||
messages.push({
|
||||
msg: t('core', 'Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
});
|
||||
}
|
||||
if(!data.hasFileinfoInstalled) {
|
||||
messages.push({
|
||||
msg: t('core', 'The PHP module "fileinfo" is missing. It is strongly recommended to enable this module to get the best results with MIME type detection.'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
});
|
||||
}
|
||||
if (data.isBruteforceThrottled) {
|
||||
messages.push({
|
||||
msg: t('core', 'Your remote address was identified as "{remoteAddress}" and is bruteforce throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly. Further information can be found in the {linkstart}documentation ↗{linkend}.', { remoteAddress: data.bruteforceRemoteAddress })
|
||||
|
|
@ -223,22 +188,6 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
});
|
||||
}
|
||||
if(!data.hasWorkingFileLocking) {
|
||||
messages.push({
|
||||
msg: t('core', '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 {linkstart}documentation ↗{linkend} for more information.')
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking') + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
if(data.hasDBFileLocking) {
|
||||
messages.push({
|
||||
msg: t('core', 'The database is used for transactional file locking. To enhance performance, please configure memcache, if available. See the {linkstart}documentation ↗{linkend} for more information.')
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking') + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
});
|
||||
}
|
||||
if (data.suggestedOverwriteCliURL !== '') {
|
||||
messages.push({
|
||||
msg: t('core', 'Please make sure to set the "overwrite.cli.url" option in your config.php file to the URL that your users mainly use to access this Nextcloud. Suggestion: "{suggestedOverwriteCliURL}". Otherwise there might be problems with the URL generation via cron. (It is possible though that the suggested URL is not the URL that your users mainly use to access this Nextcloud. Best is to double check this in any case.)', {suggestedOverwriteCliURL: data.suggestedOverwriteCliURL}),
|
||||
|
|
@ -275,22 +224,6 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
});
|
||||
}
|
||||
if(!data.isMemcacheConfigured) {
|
||||
messages.push({
|
||||
msg: t('core', 'No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the {linkstart}documentation ↗{linkend}.')
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.memcacheDocs + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
});
|
||||
}
|
||||
if(!data.isRandomnessSecure) {
|
||||
messages.push({
|
||||
msg: t('core', 'No suitable source for randomness found by PHP which is highly discouraged for security reasons. Further information can be found in the {linkstart}documentation ↗{linkend}.')
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.securityDocs + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
});
|
||||
}
|
||||
if(data.isUsedTlsLibOutdated) {
|
||||
messages.push({
|
||||
msg: data.isUsedTlsLibOutdated,
|
||||
|
|
@ -341,12 +274,6 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
if (!data.hasFreeTypeSupport) {
|
||||
messages.push({
|
||||
msg: t('core', 'Your PHP does not have FreeType support, resulting in breakage of profile pictures and the settings interface.'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
})
|
||||
}
|
||||
if (data.missingIndexes.length > 0) {
|
||||
var listOfMissingIndexes = "";
|
||||
data.missingIndexes.forEach(function(element){
|
||||
|
|
@ -401,17 +328,6 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
})
|
||||
}
|
||||
if (!data.is64bit) {
|
||||
messages.push({
|
||||
msg: t(
|
||||
'core',
|
||||
'It seems like you are running a 32-bit PHP version. Nextcloud needs 64-bit to run well. Please upgrade your OS and PHP to 64-bit! For further details read {linkstart}the documentation page ↗{linkend} about this.'
|
||||
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-system-requirements') + '">')
|
||||
.replace('{linkend}', '</a>'),
|
||||
),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
})
|
||||
}
|
||||
if (data.imageMagickLacksSVGSupport) {
|
||||
messages.push({
|
||||
msg: t('core', 'Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.'),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue