[event_spartacus] Add code dashboard notifications.

New 'backend_plugins_upgradecount' hook.
Add language constants.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2019-08-10 23:21:56 +02:00
parent 7f14a9c78e
commit 074a63b696
4 changed files with 27 additions and 0 deletions

View File

@ -28,6 +28,9 @@
@define('PLUGIN_EVENT_SPARTACUS_CHECK_EVENT', 'Updates (Ereignis-Plugins)');
@define('PLUGIN_EVENT_SPARTACUS_CHECK_HINT', 'Sie können mehrere Plugins auf einmal installieren indem sie diesen Link in einem neuen Tab öffnen (mittlerer Mausbutton)');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATE', 'Ein Plugin kann aktualisiert werden.');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATES', '%u Plugins können aktualisiert werden.');
@define('PLUGIN_EVENT_SPARTACUS_REPOSITORY_ERROR', '<br />(Der Mirror-Speicherort antwortet mit Fehler %s.)<br />');
@define('PLUGIN_EVENT_SPARTACUS_HEALTHCHECK', '<p>Die Daten des Spartacus-Speicherorts konnte nicht empfangen werden. Prüfe Verfügbarkeit der Quelle...</p>');
@define('PLUGIN_EVENT_SPARTACUS_HEALTHERROR', '<p>Die Prüfung der Verfügbarkeit einer Spartacus-Quelle konnte nicht durchgeführt werden (HTTP-Code %s). Bitte probieren Sie es später wieder.</p>');

View File

@ -28,6 +28,9 @@
@define('PLUGIN_EVENT_SPARTACUS_CHECK_EVENT', 'Updates (Ereignis-Plugins)');
@define('PLUGIN_EVENT_SPARTACUS_CHECK_HINT', 'Sie können mehrere Plugins auf einmal installieren indem sie diesen Link in einem neuen Tab öffnen (mittlerer Mausbutton)');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATE', 'Ein Plugin kann aktualisiert werden.');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATES', '%u Plugins können aktualisiert werden.');
@define('PLUGIN_EVENT_SPARTACUS_REPOSITORY_ERROR', '<br />(Der Mirror-Speicherort antwortet mit Fehler %s.)<br />');
@define('PLUGIN_EVENT_SPARTACUS_HEALTHCHECK', '<p>Die Daten des Spartacus-Speicherorts konnte nicht empfangen werden. Prüfe Verfügbarkeit der Quelle...</p>');
@define('PLUGIN_EVENT_SPARTACUS_HEALTHERROR', '<p>Die Prüfung der Verfügbarkeit einer Spartacus-Quelle konnte nicht durchgeführt werden (HTTP-Code %s). Bitte probieren Sie es später wieder.</p>');

View File

@ -35,6 +35,9 @@
@define('PLUGIN_EVENT_SPARTACUS_CHECK_EVENT', 'Update event plugins');
@define('PLUGIN_EVENT_SPARTACUS_CHECK_HINT', 'You can upgrade multiple plugins at once by opening the update-link in a new tab (middle mouse button)');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATE', 'A plugin can be updated.');
@define('PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATES', '%u plugins can be updated.');
@define('PLUGIN_EVENT_SPARTACUS_TRYCURL', 'Trying to use cURL library as fallback...');
@define('PLUGIN_EVENT_SPARTACUS_CURLFAIL', 'cURL library returned a failure, too.');
@define('PLUGIN_EVENT_SPARTACUS_HEALTFIREWALLED', 'It was not possible to download the required files from the Spartacus repository, but the health of our repository was retrievable. This means your provider uses a content-based firewall and does not allow to fetch PHP code over the web by using mod_security or other reverse proxies. You either need to ask your provider to turn this off, or you cannot use the Spartacus plugin and need to download files manually.');

View File

@ -40,6 +40,8 @@ class serendipity_event_spartacus extends serendipity_event
'backend_pluginlisting_header' => true,
'backend_plugins_upgradecount' => true,
'external_plugin' => true,
'backend_directory_create' => true,
@ -1333,6 +1335,22 @@ class serendipity_event_spartacus extends serendipity_event
}
break;
case 'backend_plugins_upgradecount':
if (serendipity_db_bool($this->get_config('enable_plugins'))) {
$upgradeCount = $this->count_plugin_upgrades();
if ($upgradeCount > 0) {
if ($upgradeCount > 1) {
$eventData = sprintf(PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATES, $upgradeCount);
} else {
$eventData = PLUGIN_EVENT_SPARTACUS_DASHBOARD_UPDATE;
}
$eventData .= ' <a id="upgrade_plugins" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE' . '&amp;' . serendipity_setFormToken('url') . '">'. PLUGIN_EVENT_SPARTACUS_CHECK .'</a>';
return true;
}
}
return false;
break;
case 'backend_templates_fetchlist':
if (serendipity_db_bool($this->get_config('enable_themes'))) {
$eventData = $this->buildTemplateList($this->fetchOnline('template', true), 'template');