Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.theme.updateThemes
on updateThemes (themeFolder = radio.theme.getThemesFolder (), directoryOpmlUrl = radio.data.cloudUrls.themesDirectoryOpml) {
<<Changes
<<5/14/02; 6:03:22 PM by JES
<<If the directoryOpmlUrl is the empty string, return without doing anything.
<<12/30/01; 11:20:18 PM by JES
<<Created. Synchronize the installed Themes with the Themes supplied by UserLand.
if sizeOf (directoryOpmlUrl) == 0 {
return (false)};
on getThemesTable (folder) {
local (t); new (tableType, @t);
local (f);
fileloop (f in folder) {
if file.isVisible (f) {
local (fname = file.fileFromPath (f));
t.[fname] = file.modified (f)}};
return (t)};
local (ticks = clock.ticks ());
local (currentThemes = getThemesTable (themeFolder));
radio.utilities.synchronizeFolder (themeFolder, directoryOpmlUrl, false); //false == don't delete files that aren't in the opml
local (afterUpdateThemes = getThemesTable (themeFolder));
local (ctNewThemes = 0, ctUpdatedThemes = 0);
local (adr);
for adr in @afterUpdateThemes {
local (fname = nameOf (adr^));
if defined (currentThemes.[fname]) {
if adr^ != currentThemes.[fname] {
ctUpdatedThemes++}}
else {
ctNewThemes++}};
if user.radio.prefs.flLogThemeUpdates {
radio.log.add ("Update Themes", "New Themes: " + ctNewThemes + ". Updated Themes: " + ctUpdatedThemes + ".", ticks)}};
bundle { //debugging
updateThemes ()}
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.