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

system.verbs.builtins.radio.backup.backupAll

on backupAll () {
	<<Changes
		<<1/23/03; 5:51:20 PM by JES
			<<Store a status message in system.temp.radio.backup.statusMessage for display in the backup/restore page.
		<<11/27/02; 12:09:35 PM by JES
			<<Factored from radio.backup.threadScript.
	radio.backup.init ();
	on statusMsg (s, flStartSubItemList=false, flEndSubItemList=false) {
		system.temp.radio.backup.statusMessage = s;
		if system.temp.radio.backup.flInProgress {
			if flEndSubItemList {
				system.temp.radio.backup.statusHtml = system.temp.radio.backup.statusHtml + "</ul>\r"};
			system.temp.radio.backup.statusHtml = system.temp.radio.backup.statusHtml + "<li>" + s + "\r";
			if flStartSubItemList {
				system.temp.radio.backup.statusHtml = system.temp.radio.backup.statusHtml + "<ul>\r"}}
		else {
			system.temp.radio.backup.statusHtml = ""}};
	try {
		system.temp.radio.backup.lastError = "";
		statusMsg ("Starting full backup on " + clock.now ());
		system.temp.radio.backup.flInProgress = true;
		
		on makeSurePrefsTxtIsThere () {
			local (f = user.radio.backup.prefs.folder + "#prefs.txt");
			file.sureFilePath (f);
			if not file.exists (f) {
				file.writetextfile (f, "#flRender false\r\n")}};
		
		bundle { //ensure prefs.txt
			statusMsg ("Ensuring #prefs.txt exists...");
			makeSurePrefsTxtIsThere ()};
		bundle { //templates
			statusMsg ("Backing up templates...", true);
			radio.backup.backupTemplates (@statusMsg)};
		bundle { //prefs
			statusMsg ("Backing up preferences and subscriptions...", true, true);
			radio.backup.backupAllPrefs (@statusMsg)};
		bundle { //weblog posts
			statusMsg ("Backing up weblog posts...", true, true);
			radio.backup.backupAllMonths (@statusMsg)};
		bundle { //stories
			statusMsg ("Backing up stories...", false, true);
			radio.backup.backupStories ()};
		bundle { //save directory
			statusMsg ("Writing files.xml...");
			radio.backup.writeDirectory ()};
		user.radio.backup.stats.whenLastBackup = clock.now ()}
	else {
		system.temp.radio.backup.lastError = "Can't complete the backup because an error occurred: " + tryerror};
	system.temp.radio.backup.flInProgress = false;
	statusMsg ("Idle.")};
bundle { //test code
	backupAll ()}



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.