Warning: session_start(): open(/var/lib/php/sessions/sess_k7fftjpbl83q4ee0oa47vaddfv, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
// TODO: fix problem of not loading any concepts on start...
!include #1016871 // main is not run
module SnippetsDB {
bool withText, quickUpdate;
transient ReliableSingleThread rst = new(r updateMe);
start {
updateInterval = quickUpdate ? 60 : 3600;
autoDownloadText = withText;
useDBOf(#1016871);
addDirToDontBackupList(dbDir());
onConceptsChange(rst);
fullUpdateAtStart = false;
snippetsDB_init();
indexConceptField(CSnippet, 'type);
}
visualize {
ret centerBoldLabel(jLiveValueLabel(dm_calculatedLiveValue(this, S,
func -> S { n2(countConcepts(CSnippet), "snippet") })));
}
enhanceFrame {
addTitlePopupMenuItem(f, "Full download", r-thread enter { fullDownload(); });
dm_boolFieldMenuItem(f, 'withText, onSet := r { autoDownloadText = withText });
dm_boolFieldMenuItem(f, 'quickUpdate);
}
// API for other modules
L snippetsOfType(S type) {
ret sortedByFieldDesc('snippetID, conceptsWhere(CSnippet, +type));
}
L allSnippets() { ret list(CSnippet); }
S getSnippetText(S snippetID) enter {
ret main.getSnippetText(snippetID);
}
}