Monday, November 08, 2010 at 12:04 AM.

	<<11/13/02; 4:56:23 PM by DW

radio.backup.init ();
if {
	local (flBackup = false);
	local (day, month, year, hour, minute, second);
	date.get ( (), @day, @month, @year, @hour, @minute, @second);
	if (hour == and (minute == {
		local (lastday, lastmonth, lastyear, lasthour, lastminute, lastsecond);
		date.get (, @lastday, @lastmonth, @lastyear, @lasthour, @lastminute, @lastsecond);
		if lastday != day { //only do the updates once per day
			flBackup = true}}
	else { //check to see if it's been more than 24 hours since the last backup
		if date.yesterday ( ()) > {
			flBackup = true}};
	if flBackup { //it's time to do a complete backup/verify = ();
		local (flError = false, startticks = clock.ticks ());
		on errorCallback (errormsg) { //log an error in the events page, and email the error message to the user
			radio.log.add ("Nightly Backup", errormsg, startticks);
			local (mailtext);
			on add (s) {
				mailtext = mailtext + (s + "\r\n");};
			add ("Radio UserLand's nightly backup failed because there was an error verifying the backup:");
			add ("");
			add (errormsg);
			tcp.sendMail (user.prefs.mailAddress, "Radio UserLand nightly backup error", mailtext);
			return (false)};
		radio.backup.backupAndVerify (@errorCallback);
		if not flError { //log backup/verification success
			radio.log.add ("Nightly Backup", "Nightly backup and verification of weblog posts, templates, stories, preferences and aggregator subscriptions completed successfully.", startticks)}}}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.