Plugin-Updates über update_url (0.24.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m50s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m4s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m43s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m1s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m50s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m4s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m43s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m1s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
93cb6b348b
commit
64d9e0bbed
117 changed files with 739 additions and 297 deletions
|
|
@ -7,6 +7,7 @@ use App\Plugins\PluginAccess;
|
|||
use App\Plugins\PluginInstaller;
|
||||
use App\Plugins\PluginManager;
|
||||
use App\Plugins\PluginManifest;
|
||||
use App\Plugins\PluginUpdates;
|
||||
use App\Support\Audit;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
|
|
@ -88,6 +89,37 @@ class Plugins extends Page
|
|||
$this->run(fn () => $plugins->delete($slug, $removeData), 'Plugin gelöscht', $removeData ? 'Das Plugin und seine Daten wurden entfernt.' : 'Die Daten des Plugins sind noch in der Datenbank.');
|
||||
}
|
||||
|
||||
public function checkUpdates(PluginUpdates $updates): void
|
||||
{
|
||||
$results = $updates->check();
|
||||
$available = collect(array_keys($results))->filter(fn (string $slug) => $updates->info($slug)['available'] ?? false)->count();
|
||||
|
||||
Notification::make()->success()
|
||||
->title($results === [] ? 'Keine Plugins mit Update-Adresse' : ($available ? "{$available} Update(s) verfügbar" : 'Alle Plugins sind aktuell'))
|
||||
->send();
|
||||
}
|
||||
|
||||
public function updatePlugin(string $slug, PluginUpdates $updates): void
|
||||
{
|
||||
$this->run(function () use ($slug, $updates) {
|
||||
$manifest = $updates->update($slug);
|
||||
Notification::make()->success()->title("„{$manifest->name}“ ist jetzt auf {$manifest->version}")->send();
|
||||
}, 'Plugin aktualisiert', 'Die neue Fassung ist ab dem nächsten Seitenaufruf aktiv.');
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
$updates = app(PluginUpdates::class);
|
||||
$count = collect(app(PluginManager::class)->all())->filter(fn (PluginManifest $m) => ! $m->core && ($updates->info($m->slug)['available'] ?? false))->count();
|
||||
|
||||
return $count ? (string) $count : null;
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeTooltip(): ?string
|
||||
{
|
||||
return 'Plugin-Updates verfügbar';
|
||||
}
|
||||
|
||||
public function installArchive(PluginInstaller $installer): void
|
||||
{
|
||||
$this->validate(['archive' => ['required', 'file', 'mimes:zip', 'max:51200']], attributes: ['archive' => 'ZIP-Archiv']);
|
||||
|
|
@ -134,6 +166,9 @@ class Plugins extends Page
|
|||
'excluded' => ($ids = app(PluginAccess::class)->excludedRoles($m->slug)) ? Role::query()->whereIn('id', $ids)->orderBy('name')->pluck('name')->all() : [],
|
||||
])->sortBy(fn (array $p) => [$p['manifest']->core ? 0 : 1, $p['manifest']->name])->values(),
|
||||
'uploadsAllowed' => PluginInstaller::uploadsAllowed(),
|
||||
'updates' => collect($plugins->all())->mapWithKeys(fn (PluginManifest $m) => [$m->slug => app(PluginUpdates::class)->info($m->slug)])->filter()->all(),
|
||||
'updatesCheckedAt' => app(PluginUpdates::class)->checkedAt(),
|
||||
'hasUpdateUrls' => collect($plugins->all())->contains(fn (PluginManifest $m) => ! $m->core && $m->updateUrl),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue