Wednesday, February 16, 2011 at 12:00 AM.
river2Suite.static.writeFile
on writeFile (relpath, s, adruser=nil) {
<<Changes
<<2/12/11; 1:48:49 PM by DW
<<Instead of taking a file as a path, take a relative path, and we compute the file.
<<11/9/10; 8:05:06 AM by DW
<<Created. Write the file, then if the user defined callbacks, flow the content through them.
local (adrdata = river2suite.init (), f);
f = adrdata^.prefs.static.folder + relpath;
file.surefilepath (f);
file.writewholefile (f, s);
bundle { //mirror to S3, 2/12/11 by DW
if adrdata^.prefs.static.flSynchToS3 {
local (path = adrdata^.prefs.static.s3path + string.replaceall (relpath, file.getpathchar (), "/"));
adrdata^.stats.static.ctWritesToS3++;
try {
s3.newobject (path, s)}
else {
adrdata^.stats.static.ctS3Errors++;
adrdata^.stats.static.whenLastS3Error = clock.now ()}}};
if adruser != nil {
local (adrscript);
for adrscript in @adruser^.callbacks.afterStaticFileWrite {
while typeof (adrscript^) == addresstype {
adrscript = adrscript^};
try {
adrscript^ (f, s)}}}}
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.