Fix: Mailbox Stats über Dovecot mit config/mailpool.php

main v1.0.50
boban 2025-10-26 17:13:25 +01:00
parent 1bf41063ae
commit f99790b1a5
1 changed files with 2 additions and 167 deletions

View File

@ -85,101 +85,6 @@ class UpdateCard extends Component
$this->recomputeUi();
}
// public function pollUpdate(): void
// {
// $this->refreshLowLevelState();
//
// $started = (int) Cache::get($this->cacheStartedAtKey, 0);
// if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
// $this->running = false;
// $this->rc ??= 0; // failsafe: als erfolgreich werten
// }
//
// if (!$this->running) {
// Cache::forget($this->cacheStartedAtKey);
//
// $this->reloadVersionsAndStatus();
// $this->recompute();
//
// if ($this->rc === 0 && !$this->postActionsDone) {
// // Restarts DE-coupled
// @shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
// $this->postActionsDone = true;
//
// $ver = $this->displayCurrent ?? 'aktuelle Version';
// $this->progressLine = '';
// $this->dispatch('toast', type: 'success', title: 'Update erfolgreich',
// text: "MailWolt wurde auf {$ver} aktualisiert.", badge: 'System', duration: 4000);
// $this->dispatch('reload-page', delay: 5000);
// } elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// $this->postActionsDone = true;
// $this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
// $this->dispatch('toast', type: 'error', title: 'Update fehlgeschlagen',
// text: $this->progressLine ?: 'Bitte /var/log/mailwolt-update.log prüfen', badge: 'System', duration: -1);
// }
//
// $this->state = 'idle';
// }
//
// $this->recomputeUi();
// }
// public function pollUpdate(): void
// {
// // 1) aktuellen Wrapper-Status einlesen
// $this->refreshLowLevelState();
//
// // 2) Failsafe
// $started = (int)Cache::get($this->cacheStartedAtKey, 0);
// if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
// $this->running = false;
// $this->rc ??= 0; // wenn unklar, als erfolgreich werten
// }
//
// // 3) Abschluss?
// if (!$this->running) {
// Cache::forget($this->cacheStartedAtKey);
//
// // Nachlauf: Versionen & Vergleich neu aufbauen
// $this->reloadVersionsAndStatus();
// $this->recompute();
//
// if ($this->rc === 0 && !$this->postActionsDone) {
// // Dienste neu starten (asynchron)
// @shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
// $this->postActionsDone = true;
//
// $ver = $this->displayCurrent ?? 'aktuelle Version';
// $this->progressLine = '';
// $this->dispatch('reload-page', delay: 5000);
// $this->dispatch('toast',
// type: 'success',
// title: 'Update erfolgreich',
// text: "MailWolt wurde auf {$ver} aktualisiert.",
// badge: 'System',
// duration: 4000
// );
// } elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// // Fehlerfall
// $this->postActionsDone = true;
// $this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
// $this->dispatch('toast',
// type: 'error',
// title: 'Update fehlgeschlagen',
// text: $this->progressLine ?: 'Bitte Logs prüfen: /var/log/mailwolt-update.log',
// badge: 'System',
// duration: 0
// );
// }
//
// $this->state = 'idle';
// }
//
// // UI bei jedem Poll neu ableiten
// $this->recomputeUi();
// }
public function pollUpdate(): void
{
// 1) aktuellen Wrapper-Status einlesen
@ -328,13 +233,11 @@ class UpdateCard extends Component
protected function refreshLowLevelState(): void
{
$state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
$this->running = ($state === 'running');
$rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
$this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
// läuft nur, solange KEINE rc vorliegt
$this->running = ($state === 'running' && $this->rc === null);
$this->progressLine = $this->tailUpdateLog();
}
@ -395,74 +298,6 @@ class UpdateCard extends Component
}
}
// public function pollUpdate(): void
// {
// // 1) aktuellen Wrapper-Status einlesen
// $this->refreshLowLevelState();
//
// // 2) Failsafe
// $started = (int)Cache::get($this->cacheStartedAtKey, 0);
// if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
// $this->running = false;
// $this->rc ??= 0; // wenn unklar, als erfolgreich werten
// }
//
// // 3) Abschluss?
// if (!$this->running) {
// Cache::forget($this->cacheStartedAtKey);
//
// // Nachlauf: Versionen & Vergleich neu aufbauen
// $this->reloadVersionsAndStatus();
// $this->recompute();
//
// if ($this->rc === 0 && !$this->postActionsDone) {
// // Dienste neu starten (asynchron)
// @shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
// $this->postActionsDone = true;
//
// $ver = $this->displayCurrent ?? 'aktuelle Version';
// $this->progressLine = '';
// $this->dispatch('reload-page', delay: 5000);
// $this->dispatch('toast',
// type: 'success',
// title: 'Update erfolgreich',
// text: "MailWolt wurde auf {$ver} aktualisiert.",
// badge: 'System',
// duration: 4000
// );
// } elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// // Fehlerfall
// $this->postActionsDone = true;
// $this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
// $this->dispatch('toast',
// type: 'error',
// title: 'Update fehlgeschlagen',
// text: $this->progressLine ?: 'Bitte Logs prüfen: /var/log/mailwolt-update.log',
// badge: 'System',
// duration: 0
// );
// }
//
// $this->state = 'idle';
// }
//
// // UI bei jedem Poll neu ableiten
// $this->recomputeUi();
// }
// protected function refreshLowLevelState(): void
// {
// $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
// $this->running = ($state === 'running');
//
// $rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
// $this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
//
// $this->progressLine = $this->tailUpdateLog();
// }
//namespace App\Livewire\Ui\System;
//
//use Illuminate\Support\Facades\Artisan;