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:
parent
ed97ce8646
commit
7661a78a43
@ -4,12 +4,20 @@ final class FrontpageAction implements ActionInterface
|
|||||||
{
|
{
|
||||||
public function execute(array $request)
|
public function execute(array $request)
|
||||||
{
|
{
|
||||||
|
$messages = [];
|
||||||
$showInactive = (bool) ($request['show_inactive'] ?? null);
|
$showInactive = (bool) ($request['show_inactive'] ?? null);
|
||||||
$activeBridges = 0;
|
$activeBridges = 0;
|
||||||
|
|
||||||
$bridgeFactory = new BridgeFactory();
|
$bridgeFactory = new BridgeFactory();
|
||||||
$bridgeClassNames = $bridgeFactory->getBridgeClassNames();
|
$bridgeClassNames = $bridgeFactory->getBridgeClassNames();
|
||||||
|
|
||||||
|
foreach ($bridgeFactory->getMissingEnabledBridges() as $missingEnabledBridge) {
|
||||||
|
$messages[] = [
|
||||||
|
'body' => sprintf('Warning : Bridge "%s" not found', $missingEnabledBridge),
|
||||||
|
'level' => 'warning'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$formatFactory = new FormatFactory();
|
$formatFactory = new FormatFactory();
|
||||||
$formats = $formatFactory->getFormatNames();
|
$formats = $formatFactory->getFormatNames();
|
||||||
|
|
||||||
@ -24,7 +32,7 @@ final class FrontpageAction implements ActionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return render(__DIR__ . '/../templates/frontpage.html.php', [
|
return render(__DIR__ . '/../templates/frontpage.html.php', [
|
||||||
'messages' => [],
|
'messages' => $messages,
|
||||||
'admin_email' => Configuration::getConfig('admin', 'email'),
|
'admin_email' => Configuration::getConfig('admin', 'email'),
|
||||||
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
|
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
|
||||||
'bridges' => $body,
|
'bridges' => $body,
|
||||||
|
@ -4,6 +4,7 @@ final class BridgeFactory
|
|||||||
{
|
{
|
||||||
private $bridgeClassNames = [];
|
private $bridgeClassNames = [];
|
||||||
private $enabledBridges = [];
|
private $enabledBridges = [];
|
||||||
|
private $missingEnabledBridges = [];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -27,6 +28,7 @@ final class BridgeFactory
|
|||||||
if ($bridgeClassName) {
|
if ($bridgeClassName) {
|
||||||
$this->enabledBridges[] = $bridgeClassName;
|
$this->enabledBridges[] = $bridgeClassName;
|
||||||
} else {
|
} else {
|
||||||
|
$this->missingEnabledBridges[] = $enabledBridge;
|
||||||
Logger::info(sprintf('Bridge not found: %s', $enabledBridge));
|
Logger::info(sprintf('Bridge not found: %s', $enabledBridge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,4 +71,9 @@ final class BridgeFactory
|
|||||||
{
|
{
|
||||||
return $this->bridgeClassNames;
|
return $this->bridgeClassNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMissingEnabledBridges(): array
|
||||||
|
{
|
||||||
|
return $this->missingEnabledBridges;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user