1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-01-17 14:18:35 +01:00

[core] add bridge not found warning message to frontpage (#3591)

This commit is contained in:
User123698745 2023-08-03 03:10:24 +02:00 committed by GitHub
parent ed97ce8646
commit 7661a78a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -4,12 +4,20 @@ final class FrontpageAction implements ActionInterface
{
public function execute(array $request)
{
$messages = [];
$showInactive = (bool) ($request['show_inactive'] ?? null);
$activeBridges = 0;
$bridgeFactory = new BridgeFactory();
$bridgeClassNames = $bridgeFactory->getBridgeClassNames();
foreach ($bridgeFactory->getMissingEnabledBridges() as $missingEnabledBridge) {
$messages[] = [
'body' => sprintf('Warning : Bridge "%s" not found', $missingEnabledBridge),
'level' => 'warning'
];
}
$formatFactory = new FormatFactory();
$formats = $formatFactory->getFormatNames();
@ -24,7 +32,7 @@ final class FrontpageAction implements ActionInterface
}
return render(__DIR__ . '/../templates/frontpage.html.php', [
'messages' => [],
'messages' => $messages,
'admin_email' => Configuration::getConfig('admin', 'email'),
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
'bridges' => $body,

View File

@ -4,6 +4,7 @@ final class BridgeFactory
{
private $bridgeClassNames = [];
private $enabledBridges = [];
private $missingEnabledBridges = [];
public function __construct()
{
@ -27,6 +28,7 @@ final class BridgeFactory
if ($bridgeClassName) {
$this->enabledBridges[] = $bridgeClassName;
} else {
$this->missingEnabledBridges[] = $enabledBridge;
Logger::info(sprintf('Bridge not found: %s', $enabledBridge));
}
}
@ -69,4 +71,9 @@ final class BridgeFactory
{
return $this->bridgeClassNames;
}
public function getMissingEnabledBridges(): array
{
return $this->missingEnabledBridges;
}
}