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

system.verbs.apps.WebStar.commands.doNightlyTasks

<<docs: user.websites.frontier.netScripting.webStarCommands
webstar.commands.init ();
local (frontierfolder = file.folderFromPath (Frontier.getProgramPath ()));
local (wstasksfolder = frontierfolder + "WebSTAR Tasks:");
local (wsfolder = file.folderFromPath (sys.getAppPath (WebSTAR.id)));
on quitWebstar () {
	if sys.appIsRunning (WebSTAR.id) {
		WebSTAR.appinfo.path = sys.getAppPath (WebSTAR.id);
		WebSTAR.quit ();
		clock.waitSeconds (2)}};
if user.webstar.nightlyRestart {
	quitWebstar ()};
local (lastlogfile = "");
if user.webstar.nightlyLogRoll {
	local (f = wsfolder + "WebSTAR.log");
	quitWebstar ();
	if file.exists (f) {
		local (archivefolder = wstasksfolder + "Saved Logfiles:");
		lastlogfile = archivefolder + "WebSTAR.log." + date.shortString (clock.now ());
		file.copy (f, lastlogfile);
		file.delete (f)}};
if not sys.appIsRunning (WebSTAR.id) {
	WebSTAR.launch ()};
WebSTAR.bringToFront ();
if user.webstar.nightlyLogDigest {
	if lastlogfile != "" {
		new (tabletype, @user.webstar.urls); <<start the count over every day
		webstar.commands.digestLog (lastlogfile);
		webstar.commands.writeReport (wsfolder + "logDigest.html")}};
if user.webstar.nightlyMirror {
	local (aliasesfolder = wstasksfolder + "Mirror Aliases:", f);
	file.sureFolder (aliasesfolder);
	fileloop (f in aliasesfolder) {
		if file.isAlias (f) {
			local (targetfolder = file.followAlias (f));
			if file.isFolder (targetfolder) {
				on filter (f) {
					local (fname = file.fileFromPath (f));
					if file.type (f) == 'APPL' { <<don't mirror apps
						return (false)};
					if file.isAlias (f) { <<don't mirror aliases
						return (false)};
					case fname {
						"Saved Logfiles:";
						"Mirror Aliases:";
						"WebSTAR Settings";
						"WebSTAR.log";
						"WebSTAR.Messages" {
							return (false)}};
					msg (fname);
					return (true)};
				local (appfolder = file.folderFromPath (WebSTAR.appinfo.path));
				file.reconcileFolder (appfolder, targetfolder, @filter)}}}};
msg ("");
filemenu.save ()



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.