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

system.verbs.builtins.radio.backup.backupAllMonths

on backupAllMonths (adrStatusMsgCallback=nil) {
	<<Changes
		<<1/23/03; 7:05:38 PM by JES
			<<New optional parameter, adrStatusMsgCallback -- called with the name of the file currently being backed up.
		<<11/12/02; 5:18:01 PM by DW
			<<Created.
	local (adrblog = radio.weblog.init ());
	
	local (firstdate = clock.now ());
	bundle { //determine firstdate
		local (adr);
		for adr in @adrblog^.posts {
			if adr^.when < firstdate {
				firstdate = adr^.when}}};
	
	local (lastdate = date (0));
	bundle { //determine lastdate
		local (adr);
		for adr in @adrblog^.posts {
			if adr^.when > lastdate {
				lastdate = adr^.when}}};
	
	local (day, month, year, hour, minute, second);
	date.get (firstdate, @day, @month, @year, @hour, @minute, @second);
	local (startyear = year, startmonth = month);
	
	date.get (lastdate, @day, @month, @year, @hour, @minute, @second);
	local (endyear = year, endmonth = month);
	
	on doyear (year) {
		local (month);
		for month = 1 to 12 {
			if year == startyear {
				if month < startmonth {
					continue}};
			if year == endyear {
				if month > endmonth {
					break}};
			<<msg (year + "/" + string.padwithzeros (month, 2))
			if adrStatusMsgCallback != nil {
				try {adrStatusMsgCallback^ ("posts for " + year + "/" + string.padwithzeros (month, 2) + "...")}};
			radio.backup.backupOneMonth (year, month)}};
	for year = startyear to endyear {
		doyear (year)}};
bundle { //test code
	backupAllMonths ()}



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.