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

system.verbs.builtins.radio.backup.restoreAllMonths

on restoreAllMonths (adrReadFileCallback, adrpoststable, adrfiles=nil, adrStatusMsgCallback=nil) {
	<<Changes
		<<1/27/03; 4:10:51 PM by JES
			<<New optional parameter, adrfiles -- if passed in, this is the address of the compiled XML from files.xml. If not, then we read files.xml ourselves.
			<<New optional parameter, adrStatusMsgCallback -- called with the year/month currently being restored.
		<<11/16/02; 12:37:52 PM by DW
			<<Created.
	on statusMsg (s) {
		if adrStatusMsgCallback != nil {
			try {adrStatusMsgCallback^ (s)}}};
	local (files);
	on readfile (path) {
		return (adrReadFileCallback^ (path))};
	if adrfiles == nil { //we need to read files.xml ourselves
		radio.backup.readDirectory (readfile ("files.xml"), @files);
		adrfiles = @files};
	<<scratchpad.files = files
	local (adfile, path);
	for adrfile in adrfiles {
		path = nameof (adrfile^);
		if  path beginswith "posts" {
			local (s = string.delete (path, 1, 6));
			s = string.popSuffix (s);
			statusMsg (s + "...");
			radio.backup.restoreOneMonth (readfile (path), adrpoststable)}}};
bundle { //test code
	on readFileCallback (partialpath) {
		local (f = user.radio.backup.prefs.folder + partialpath);
		return (string (file.readwholefile (f)))};
	<<new (tabletype, @scratchpad.posts)
	restoreAllMonths (@readFileCallback, @scratchpad.posts)}



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.