Monday, April 04, 2011 at 1:06 AM.

river2Suite.static.afterScan

on afterScan () {
	<<Changes
		<<4/1/11; 7:43:39 PM by DW
			<<If no files were rebuilt, no need to log it. :-)
		<<3/27/11; 1:46:15 PM by DW
			<<New pref adrdata^.prefs.static.flBuildMainUser determines if the static pages for the "main" user gets built. In the next rev of River2 this user is virtually non-existent (maybe totally) so I defaulted this to false. 
		<<3/27/11; 11:37:17 AM by DW
			<<Get time readings.
		<<2/8/11; 8:58:56 AM by DW
			<<Respect flBeautifulIsIndex.
		<<2/4/11; 4:53:31 PM by DW
			<<Build beautiful rivers.
		<<12/5/10; 4:44:28 PM by DW
			<<Build the JSON versions of the news flow.
		<<11/17/10; 2:47:50 PM by DW
			<<Log the static builds.
		<<11/7/10; 4:23:21 PM by DW
			<<Call river2Suite.static.bindReadingListToUser before building static pages for each user. This way a reading list can be associated with a user, and completely determine the feeds the user follows. Makes managing lots of static pages from one River2 server possible just using the outliner to subscribe and unsubscribe.
		<<5/4/10; 10:26:17 AM by DW
			<<Build index.opml and index.js.
		<<5/4/10; 5:47:21 AM by DW
			<<Build the JavaScript include for each user if the feature is enabled.
		<<4/27/10; 10:13:51 AM by DW
			<<Save the OPML file for each user who has the feature enabled.
		<<3/26/10; 8:27:37 AM by DW
			<<Render a static page for each user who has the feature enabled.
		<<3/17/10; 8:22:15 PM by DW
			<<Created. 
	local (adrdata = river2suite.init (), startticks = clock.ticks (), ctfiles = 0, fldebug = false);
	
	on addtimingnote (s) { //debugging code
		if fldebug {
			local (tc = clock.ticks (), secs = string.formatDouble (double (tc - lastticks) / 60, 2));
			op.insert (s + " -- " + secs + " secs.", insertdir); insertdir = down;
			lastticks = clock.ticks ()}};
	if fldebug {
		local (adrtimingoutline = @scratchpad.timingoutline, lastticks = clock.ticks (), insertdir = right);
		new (outlinetype, adrtimingoutline);
		target.set (adrtimingoutline); edit (adrtimingoutline);
		op.setlinetext (string.popfilefromaddress (this))};
	
	if adrdata^.prefs.static.flBuildMainUser { //3/27/11 by DW
		if not adrdata^.prefs.beautifulRiver.flBeautifulIsIndex {
			river2Suite.static.buildOnePage (@river2Website.index); ctfiles++; addtimingnote ("Built plain home page")};
		river2Suite.static.buildOpml (nil); ctfiles++; addtimingnote ("Main OPML"); //build index.opml -- 5/4/10 by DW
		river2Suite.static.buildJavaScriptInclude (nil); ctfiles++; addtimingnote ("Main JavaScript include");
		river2Suite.static.buildJsonNews (nil); ctfiles++; addtimingnote ("Main JSON news");
		river2Suite.static.buildBeautifulRiver (nil); ctfiles++; addtimingnote ("Main beautiful river")}; //2/4/11 by DW
	
	local (updates = adrdata^.stats.updatedFeeds); //3/27/11 by DW
	new (tabletype, @adrdata^.stats.updatedFeeds);
	
	for adruser in @adrdata^.users {
		river2suite.inituser (adruser);
		river2Suite.static.bindReadingListToUser (adruser); //11/7/10 by DW
		if adruser^.prefs.static.enabled {
			if river2Suite.static.userNeedsBuild (adruser, @updates) { //3/27/11 by DW
				local (username = nameof (adruser^));
				if not adruser^.prefs.beautifulRiver.flBeautifulIsIndex {
					river2Suite.static.buildOnePage (@river2Website.index, adruser); ctfiles++; addtimingnote (username + " plain home page")};
				river2Suite.static.buildOpml (adruser); ctfiles++; addtimingnote (username + " OPML"); //4/27/10 by DW
				if adruser^.prefs.static.flBuildJavaScriptInclude {
					river2Suite.static.buildJavaScriptInclude (adruser); ctfiles++; addtimingnote (username + " JavaScript include")}; //5/4/10 by DW
				river2Suite.static.buildJsonNews (adruser); ctfiles++; addtimingnote (username + " JSON news"); //5/4/10 by DW
				river2Suite.static.buildBeautifulRiver (adruser); ctfiles++; addtimingnote (username + " beautiful river")}}}; //2/4/11 by DW
	
	if ctfiles > 0 { //4/1/11 by DW
		log2.add (river2Info.name, "Static", "Built " + ctfiles + " static files.", startticks)}};
bundle { //test code
	afterScan ()}



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.