Update Repair Actions
Overview
When verification or apply fails, the Update Center can suggest repair actions — links or one-click fixes for common problems.
Repairs are registered at boot and executed through a whitelisted HTTP endpoint.
Built-in repairs
| ID | Description |
|---|---|
storage_link |
Run storage:link |
cache_clear |
Clear app, config, route, and view caches |
config_cache |
Rebuild config cache |
view_cache |
Rebuild view cache |
plugin_migrate |
Run migrations for a plugin (repair_params.slug required) |
Built-in settings deep-link: settings_general → Admin → Settings (general tab).
Register a repair button
add_filter('valpress_update_repair_actions', function (array $actions) {
$actions[] = \App\Update\Reports\RepairAction::repair(
'workflow_repair',
'Run Workflow repair',
['slug' => 'valpress-workflow'],
'workflow_repair_btn',
)->toArray();
return $actions;
});
Or use a route link:
\App\Update\Reports\RepairAction::route(
'Open queue settings',
'admin.settings.index',
['tab' => 'general'],
'open_queue_settings',
);
Register a repair handler
add_filter('valpress_update_repair_handlers', function (array $handlers) {
$handlers['workflow_repair'] = function (array $params) {
Artisan::call('migrate', [
'--path' => 'public/plugins/valpress-workflow/database/migrations',
'--force' => true,
]);
return [
'success' => true,
'message' => 'Workflow tables created.',
];
};
return $handlers;
});
Handlers must return:
['success' => bool, 'message' => string]
HTTP API
POST /admin/updates/repair (requires manage_options)
{
"repair_id": "plugin_migrate",
"repair_params": { "slug": "valpress-workflow" }
}
The Update Center JavaScript calls this endpoint for buttons with a repair_id field.
Security
- Only registered handler IDs can execute
- No arbitrary shell commands from user input
- Plugin migrate is scoped to
public/plugins/{slug}/database/migrations