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

system.verbs.builtins.radio.backup.verifyAllMonths

on verifyAllMonths (adrErrorCallback=nil) {
	<<Changes
		<<11/30/02; 4:29:34 PM by JES
			<<Created. Verify all months' weblog archive RSS files.
	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);
	
	local (flerror = false);
	on error (s) { //call the error callback
		flerror = true;
		if adrErrorCallback != nil {
			return (adrErrorCallback^ (s))}};
	on doyear (year) {
		local (month);
		for month = 1 to 12 {
			if year == startyear {
				if month < startmonth {
					continue}};
			if year == endyear {
				if month > endmonth {
					break}};
			local (errormessage);
			if not radio.backup.verifyOneMonth (year, month, @errormessage) {
				if not error (errormessage) {
					return (false)}}}; //tell the caller to stop after an error
		return (true)}; //there may have been an error, but we don't want to stop yet
	for year = startyear to endyear {
		if not doyear (year) {
			return (false)}}; //the error callback returned false, telling us to stop
	
	return (not flerror)};
bundle { //test code
	on errorCallback (s) {
		dialog.alert (s);
		return (false)};
	verifyAllMonths (@errorCallback)}



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.