50 lines
2.0 KiB
PHP
50 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Install/Uninstall Handler for BSN Wertungsbox
|
|
*/
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Installer\InstallerAdapter;
|
|
|
|
class PlgSystemBsn_WertungsboxInstallerScript
|
|
{
|
|
public function postflight(string $type, InstallerAdapter $parent): bool
|
|
{
|
|
if ($type === 'install' || $type === 'update') {
|
|
require_once __DIR__ . '/bsn_wertungsbox.php';
|
|
$plugin = new PlgSystemBsn_Wertungsbox($parent->getParent(), []);
|
|
$ok = $plugin->installFields();
|
|
|
|
if ($type === 'install') {
|
|
if ($ok) {
|
|
echo '<div style="background:#e8f5e9;padding:1rem;border-left:4px solid #4caf50;margin:1rem 0">';
|
|
echo '<strong>✅ BSN Wertungsbox installiert!</strong><br>';
|
|
echo '19 Custom Fields wurden angelegt.<br><br>';
|
|
echo '→ <strong>Nächster Schritt:</strong> Plugin aktivieren (System → Plugins)<br>';
|
|
echo '→ Dann Kategorien für die Wertungsbox auswählen (Plugin-Einstellungen)<br>';
|
|
echo '</div>';
|
|
} else {
|
|
echo '<div style="background:#fff3e0;padding:1rem;border-left:4px solid #ff9800;margin:1rem 0">';
|
|
echo '<strong>⚠️ Plugin installiert, aber Custom Fields konnten nicht angelegt werden.</strong><br>';
|
|
echo 'Bitte manuell prüfen: Inhalt → Felder</div>';
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function uninstall(InstallerAdapter $parent): bool
|
|
{
|
|
require_once __DIR__ . '/bsn_wertungsbox.php';
|
|
$plugin = new PlgSystemBsn_Wertungsbox($parent->getParent(), []);
|
|
$plugin->uninstallFields();
|
|
|
|
echo '<div style="background:#fff3e0;padding:1rem;border-left:4px solid:#ff9800;margin:1rem 0">';
|
|
echo '<strong>🗑 BSN Wertungsbox deinstalliert.</strong><br>';
|
|
echo 'Custom Fields + Werte wurden entfernt. Artikel-Inhalte sind unverändert.</div>';
|
|
|
|
return true;
|
|
}
|
|
}
|