Add OCP interface for SetupCheckManager

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/32550/head
Côme Chilliet 2023-10-09 17:49:03 +07:00
parent bd37067821
commit efa2dfa641
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
6 changed files with 48 additions and 3 deletions

@ -85,6 +85,7 @@ 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;
#[IgnoreOpenAPI]
@ -127,7 +128,7 @@ class CheckSetupController extends Controller {
private $appManager;
/** @var IServerContainer */
private $serverContainer;
private OC\SetupCheck\SetupCheckManager $setupCheckManager;
private ISetupCheckManager $setupCheckManager;
public function __construct($AppName,
IRequest $request,
@ -150,7 +151,7 @@ class CheckSetupController extends Controller {
IManager $manager,
IAppManager $appManager,
IServerContainer $serverContainer,
OC\SetupCheck\SetupCheckManager $setupCheckManager
ISetupCheckManager $setupCheckManager,
) {
parent::__construct($AppName, $request);
$this->config = $config;

@ -602,6 +602,7 @@ return array(
'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => $baseDir . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\SetupCheck\\ISetupCheck' => $baseDir . '/lib/public/SetupCheck/ISetupCheck.php',
'OCP\\SetupCheck\\ISetupCheckManager' => $baseDir . '/lib/public/SetupCheck/ISetupCheckManager.php',
'OCP\\SetupCheck\\SetupResult' => $baseDir . '/lib/public/SetupCheck/SetupResult.php',
'OCP\\Share' => $baseDir . '/lib/public/Share.php',
'OCP\\Share\\Events\\BeforeShareCreatedEvent' => $baseDir . '/lib/public/Share/Events/BeforeShareCreatedEvent.php',

@ -635,6 +635,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\SetupCheck\\ISetupCheck' => __DIR__ . '/../../..' . '/lib/public/SetupCheck/ISetupCheck.php',
'OCP\\SetupCheck\\ISetupCheckManager' => __DIR__ . '/../../..' . '/lib/public/SetupCheck/ISetupCheckManager.php',
'OCP\\SetupCheck\\SetupResult' => __DIR__ . '/../../..' . '/lib/public/SetupCheck/SetupResult.php',
'OCP\\Share' => __DIR__ . '/../../..' . '/lib/public/Share.php',
'OCP\\Share\\Events\\BeforeShareCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/Share/Events/BeforeShareCreatedEvent.php',

@ -149,6 +149,7 @@ use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Security\VerificationToken\VerificationToken;
use OC\Session\CryptoWrapper;
use OC\SetupCheck\SetupCheckManager;
use OC\Share20\ProviderFactory;
use OC\Share20\ShareDisableChecker;
use OC\Share20\ShareHelper;
@ -247,6 +248,7 @@ use OCP\Security\ISecureRandom;
use OCP\Security\ITrustedDomainHelper;
use OCP\Security\RateLimiting\ILimiter;
use OCP\Security\VerificationToken\IVerificationToken;
use OCP\SetupCheck\ISetupCheckManager;
use OCP\Share\IShareHelper;
use OCP\SpeechToText\ISpeechToTextManager;
use OCP\SystemTag\ISystemTagManager;
@ -1430,6 +1432,8 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerAlias(IOCMProvider::class, OCMProvider::class);
$this->registerAlias(ISetupCheckManager::class, SetupCheckManager::class);
$this->connectDispatcher();
}

@ -29,8 +29,9 @@ namespace OC\SetupCheck;
use OC\AppFramework\Bootstrap\Coordinator;
use OCP\Server;
use OCP\SetupCheck\ISetupCheck;
use OCP\SetupCheck\ISetupCheckManager;
class SetupCheckManager {
class SetupCheckManager implements ISetupCheckManager {
private Coordinator $coordinator;
public function __construct(Coordinator $coordinator) {

@ -0,0 +1,37 @@
<?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 AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCP\SetupCheck;
/**
* @since 28.0.0
*/
interface ISetupCheckManager {
/**
* @since 28.0.0
* @return array<string,array<string,SetupResult>> Result of each check, first level key is category, second level key is title
*/
public function runAll(): array;
}