mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 06:08:27 +01:00
[core] add bridge not found warning message to frontpage (#3591)
This commit is contained in:
parent
ed97ce8646
commit
7661a78a43
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user