System: Configuration: Backups migrate to MVC - #10098
Conversation
| $areas = [ | ||
| 'bridges' => gettext('Bridge Devices'), | ||
| 'gifs' => gettext('GIF Devices'), | ||
| 'interfaces' => gettext('Interfaces'), | ||
| 'laggs' => gettext('LAGG Devices'), | ||
| 'ppps' => gettext('Point-to-Point Devices'), | ||
| 'rrddata' => gettext('RRD Data'), | ||
| 'vlans' => gettext('VLAN Devices'), | ||
| 'wireless' => gettext('Wireless Devices'), | ||
| ]; |
There was a problem hiding this comment.
we have to discuss where we want to anchor this
|
@fichtner Somewhere between 5e781d8 and 7a6a581 cron remote backup broke. Any ideas? I thought it was me after incorporating your feedback, but it's not. 2026-04-08T10:29:00 Error configd.py action system remote backup not found for user nobody I am also tagging you because of 26.1.6 |
|
On 26.1.5 or master? On master this could potentially interfere c491376fdd3 |
Yes, that's 8 hours I am never getting back :( |
|
I know how you feel. If you think reverting the commit fixes your issue can you follow up here so we can reopen? #10075 I wasn't going to release this soon anyway. Thanks, |
Yes, that was it. I am blind. Please do that. Thanks :) |
dd73f01 to
6a157b9
Compare
| } | ||
| $name = "config-" . $hostname . "-" . date("YmdHis") . ".xml"; | ||
| $tmpfile = tempnam(sys_get_temp_dir(), 'opn_bck_'); | ||
| $rrd_arg = empty($this->request->getPost('donotbackuprrd')) ? "rrd" : "norrd"; |
There was a problem hiding this comment.
You don't know this but we were talking about deprecating this part of the backup functionality for a while now to ease the MVC migration while at it.
There was a problem hiding this comment.
I like rrd :(
Anyway, I like your top secret information. Let me know if there is anything else.
I would also appreciate it if you tried to break the new code :)
There was a problem hiding this comment.
just the backups into the config.xml really
unfortunately schedules are quite tight at least until after next week
There was a problem hiding this comment.
just the backups into the config.xml really
Yes, I understood that but still :)
unfortunately schedules are quite tight at least until after next week
Of course, take your time. In any case, this is in working condition and probably fine by MVC standards. Surely there are improvements to be made, but I will make a small commit today and let it sit fot a bit. Let's see if there is some kind of major feedback that requires rebuilding it from scratch, and if not, I will focus on the minor stuff.
|
@fichtner Make copilot review this too :) |
|
careful what you wish for ;) |
|
Always fun wasting Azure compute :) I can live with the consequences... |
There was a problem hiding this comment.
Pull request overview
This PR migrates the “System: Configuration: Backups” page from the legacy PHP implementation (diag_backup.php) to an MVC-based UI with corresponding API endpoints and backend configd actions/scripts, while also introducing model-backed settings for backup count and remote backup push time.
Changes:
- Replace the legacy backup/restore page with a new MVC UI (
/ui/core/backup) plus new API endpoints for settings, download, restore, and provider setup. - Add configd actions and new backend scripts for exporting/downloading and restoring configurations.
- Introduce a new
OPNsense\Core\Backupmodel (including migration) and wire remote-backup scheduling to a configurable push time.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/www/diag_backup.php | Removes legacy backup/restore implementation (replaced by MVC). |
| src/opnsense/service/conf/actions.d/actions_system.conf | Adds configd actions for xmlrpc options, config export, and config restore. |
| src/opnsense/scripts/system/backup_restore.php | New configd-invoked restore implementation for full and area restores. |
| src/opnsense/scripts/system/backup_download.php | New configd-invoked exporter for config.xml (optionally with RRD). |
| src/opnsense/mvc/app/views/OPNsense/Core/backup.volt | New MVC UI for local backup, remote backup, and restore. |
| src/opnsense/mvc/app/models/OPNsense/Core/Migrations/M1_0_2.php | Migrates legacy system.backupcount into the new model container. |
| src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml | Updates menu entry to point to /ui/core/backup. |
| src/opnsense/mvc/app/models/OPNsense/Core/Backup.xml | Defines model-backed backup settings (backupcount, pushtime). |
| src/opnsense/mvc/app/models/OPNsense/Core/Backup.php | Adds the MVC model class for backup settings. |
| src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml | Updates ACL patterns to cover new UI and API endpoints. |
| src/opnsense/mvc/app/library/OPNsense/Core/Config.php | Adds backup-size helper; extends backupCount lookup to new model location. |
| src/opnsense/mvc/app/controllers/OPNsense/Core/forms/backup_remote.xml | Adds remote backup “Push Time” form definition. |
| src/opnsense/mvc/app/controllers/OPNsense/Core/forms/backup_local.xml | Adds local “Backup Count” form definition. |
| src/opnsense/mvc/app/controllers/OPNsense/Core/BackupController.php | Adds MVC page controller to render the new backup UI with providers/areas. |
| src/opnsense/mvc/app/controllers/OPNsense/Core/Api/BackupController.php | Adds API endpoints for settings, config download/export, restore, provider setup. |
| src/etc/inc/plugins.inc.d/core.inc | Updates remote backup cron scheduling to use configured push time. |
| plist | Installs new MVC files and scripts; removes legacy diag_backup.php. |
Comments suppressed due to low confidence (1)
src/opnsense/mvc/app/library/OPNsense/Core/Config.php:720
- backupCount() no longer accepts a legacy config value of 0 (previously allowed via >= 0). If a system has system->backupcount="0" (e.g. manual edit/older config) this now falls back to 100, which can unexpectedly increase disk usage. Either keep 0 as a valid value for the legacy key, or explicitly migrate/normalize legacy 0 to the new model’s semantics.
$this->statusIsValid && isset($this->simplexml->system->backupcount)
&& intval($this->simplexml->system->backupcount) >= 1
) {
return intval($this->simplexml->system->backupcount);
} else {
return 100;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
66a775d to
a1c906c
Compare
a1c906c to
f55935b
Compare
Closes #10084
Closes #9529
Closes #8422
Closes #9516
Let the fun begin :)
UI photos:
Click to see all photos