Debugging Radio's nightly backups

Even though I have backups enabled on my copy of Radio, they have never worked since day 1. I was always a bit irritated that it did not, but didn't know enough about Radio to know what to look at and try to fix it.

In this Radio discussion thread, Fernando Alves asked about the same backup error that I've been getting every day. Armed with the knowledge of Radio's internals that I gained from writing my "Monthly Archives Links" macro (plus a few others), I decided to take a crack at figuring out what was wrong. I found the problem and posted my findings on the discussion forum, which is repeated below:

I attempted to trace what the backup process is actually doing. It fails *very* early in the process, because one of the first things the backup process should do after initialization is create the subdirectories to store the backup files in (and this is not happening).

I noticed that the backup process uses a temp table to record various things. What I found interesting is that there was a message in system.temp.radio.backup.lastError:

"Can't complete the backup because an error occurred: Can't call "backupTemplates" because there are too many parameters."

Backing up the templates is the first thing the backup process does, which would explain why the failure is total. I looked into the template backup routines, and I think I found the error.

In system.verbs.builtins.radio.backup.backupAll, look for the line that says � bundle //templates. Open that bundle if it is not already, and look at the second line within that bundle:

radio.backup.backupTemplates (@statusMsg)

Notice that this macro call is passing one parameter.

Now look at the macro that is being called - system.verbs.builtins.radio.backup.backupTemplates. The problem shows up on the very first line:

on backupTemplates ()

This macro takes no parameters, so passing it one *will* cause an error.

Looking at the code, if I had to take a stab at fixing the problem, I would recommend removing the parameter from the macro call in radio.backup.backupAll, so that it looked like this:

radio.backup.backupTemplates ()

Just to be safe, I'd rather let the pros at Radio Userland make the call on how this should be fixed.

The next day, I decided to test my findings, and I reported them in the discussion forum as well:

I decided to test the findings in my previous post and see if I could do a manual backup.

Within the Radio app, in the script at system.verbs.builtins.radio.backup.backupAll, I opened the bundle at the line � bundle //templates. The second line within that bundle contained the following line: radio.backup.backupTemplates (@statusMsg)

I changed that line to read:

radio.backup.backupTemplates ()

and clicked on the Compile button.

I then performed a manual backup using the Backup/Restore page at http://127.0.0.1:5335/system/pages/backup. I could not locate a link to the Backup/Restore page on the Desktop Website. Is there one? Should there be one? I'd vote for a link on the Nightly Backups preferences page (http://127.0.0.1:5335/system/pages/prefs?page=2.16).

The manual backup completed successfully. In the \www\backups directory, I now have subdirectories (\posts, \prefs, \stories, and \templates), and there are files present in each of these subdirectories.

One gripe - the Backup/Restore page said that my files were backed up, and that the backup was verified, but nothing was written to the Events Log to indicate that this really happened.

I did check the status at system.temp.radio.backup.lastError - this field is now blank (indicating that the last backup was successful).

My request to Radio Userland's programmers:

1. Please fix the error in the backup code.

2. Add a link to the Backup/Restore page on the Nightly Backups prefs page.

3. Log manual backups and backup verification on the Events log.

I have not tested any restore operations, so I don't know if they function correctly or not.