repod/lib/AppInfo/Application.php
Michel Roux 318530da00
All checks were successful
repod / nextcloud-25 (push) Successful in 59s
repod / nextcloud-27 (push) Successful in 41s
repod / nodejs (push) Successful in 1m54s
Auto enable gpoddersync
2023-07-03 16:17:00 +02:00

40 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\RePod\AppInfo;
use OCP\App\IAppManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\IUserSession;
class Application extends App implements IBootstrap
{
public const APP_ID = 'repod';
private const GPODDERSYNC_ID = 'gpoddersync';
public function __construct() {
parent::__construct(self::APP_ID);
}
public function boot(IBootContext $context): void {
/** @psalm-suppress DeprecatedInterface */
$appContainer = $context->getAppContainer();
/** @var IAppManager $appManager */
$appManager = $appContainer->get(IAppManager::class);
/** @var IUserSession $userSession */
$userSession = $appContainer->get(IUserSession::class);
$gpoddersync = $appManager->isEnabledForUser(self::GPODDERSYNC_ID, $userSession->getUser());
if (!$gpoddersync) {
$appManager->enableApp(self::GPODDERSYNC_ID);
}
}
public function register(IRegistrationContext $context): void {
}
}