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

on publishArchivePages (adrblog=radio.weblog.init ()) {
	<<Publish all archive pages for a weblog. Return the number of days published.
		<<2/22/01; 12:25:57 PM by PBS
		<<2/22/01; 5:03:45 PM by JES
			<<If FTP mirroring is enabled, upload all the archive files in a single FTP session, instead of in separate sessions for each file.
		<<2/23/01; 3:47:25 PM by JES
			<<Open FTP connections with flMessages set to false.
	local (adrPosts = @adrblog^.posts);
	local (adrPost);
	local (lastDay, lastMonth, lastYear);
	local (ctDays = 0);
	local (adrconnection);
	if adrblog^.prefs.ftp.enabled {
		with adrblog^.prefs.ftp {
			adrconnection = tcp.ftp.openConnection (server, username, password, false)}};
	for adrPost in adrPosts {
		local (day, month, year, hour, minute, second);
		date.get (adrPost^.when, @day, @month, @year, @hour, @minute, @second);
		if day == lastDay and month == lastMonth and year == lastYear { //same as previous day, continue
		radio.weblog.publish (adrblog, d:adrPost^.when, adrconnection:adrconnection); //publish this day
		lastDay = day;
		lastMonth = month;
		lastYear = year};
	if adrblog^.prefs.ftp.enabled {
		tcp.ftp.closeConnection (adrconnection)};
	return (ctDays)}
<<bundle //test code
	<<radio.weblog.publishArchivePages ()

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.