Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.weblog.publishMonth
on publishMonth (d=clock.now ()) {
<<Changes
<<12/16/01; 9:14:19 AM by DW
<<Created. Touch all the files in the current month.
local (monthFolder);
bundle { //set monthFolder
on getArchiveFilePath (relfolder, d) { //get the path to an archive file for a given date
local (day, month, year, hour, minute, second);
date.get (d, @day, @month, @year, @hour, @minute, @second);
month = string.padWithZeros (month, 2);
day = string.padWithZeros (day, 2);
return (relfolder + year + "/" + month + "/" + day + ".txt")};
local (adrblog = radio.weblog.init ());
local (homeRelPath = adrblog^.prefs.homePageFilePath);
local (homeFileName = string.nthField (homeRelPath, "/", string.countFields (homeRelPath, "/")));
local (relFolder = string.mid (homeRelPath, 1, sizeOf (homeRelPath) - sizeOf (homeFileName)));
monthFolder = file.folderfrompath (radio.file.getAbsolutePath (getArchiveFilePath (relFolder, d)))};
bundle { //touch all the files in the folder, forcing an upstream
local (f);
fileloop (f in monthFolder) {
file.setmodified (f, clock.now ())}}}
<<bundle //test code
<<publishMonth ()
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.