restore tool - mostly working

This commit is contained in:
Andy Miller
2025-10-18 12:14:52 -06:00
parent 796c61e66d
commit 39aa026f3f
3 changed files with 13 additions and 9 deletions

View File

@@ -393,11 +393,19 @@ class AdminPlugin extends Plugin
$manifestFiles = $manager->hasSnapshots() ? [true] : [];
}
$tools = $event['tools'];
Grav::instance()['log']->debug('[Admin] Tools before restore grav: ' . implode(',', array_keys($tools)));
if ($manifestFiles) {
$event['tools']['restore-grav'] = [['admin.super'], 'PLUGIN_ADMIN.RESTORE_GRAV'];
$tools['restore-grav'] = [['admin.super'], 'PLUGIN_ADMIN.RESTORE_GRAV'];
Grav::instance()['log']->debug('[Admin] Restore Grav tool enabled');
}
$event['tools'] = $tools;
Grav::instance()['log']->debug('[Admin] Tools after register: ' . implode(',', array_keys($tools)));
} catch (\Throwable $e) {
// ignore availability errors, snapshots tool will simply stay hidden
Grav::instance()['log']->warning('[Admin] Restore Grav detection failed: ' . $e->getMessage());
}
}