| |
| /pliant/appli/forum/database.pli |
| |
| 1 |
submodule "/pliant/storage/database.pli" | |
| 2 |
module "/pliant/admin/file.pli" | |
| 3 |
public | |
| 4 |
| |
| 5 |
| |
| 6 |
type ForumMessage | |
| 7 |
field Str user ; field DateTime datetime | |
| 8 |
field Str encoding | |
| 9 |
field Str message | |
| 10 |
field Str report | |
| 11 |
| |
| 12 |
type ForumPatchSection | |
| 13 |
field Str release | |
| 14 |
| |
| 15 |
type ForumDebate | |
| 16 |
field Str path | |
| 17 |
field Str subpath | |
| 18 |
field Str subject | |
| 19 |
field Str title | |
| 20 |
field Str abstract | |
| 21 |
field Str status | |
| 22 |
field Set:Str maintainer | |
| 23 |
field Set:ForumMessage message | |
| 24 |
field Str last_author | |
| 25 |
field DateTime last_message | |
| 26 |
field Int patch_count <- 0 | |
| 27 |
field DateTime last_patch | |
| 28 |
field Set:ForumPatchSection patch_section | |
| 29 |
| |
| 30 |
type ForumSubject | |
| 31 |
field Str label | |
| 32 |
field Str order | |
| 33 |
| |
| 34 |
type ForumStatus | |
| 35 |
field Str label | |
| 36 |
field Float archive_delay <- 7*86400 | |
| 37 |
field Str order | |
| 38 |
field Str display_all_label | |
| 39 |
| |
| 40 |
type ForumSubscriber | |
| 41 |
field Str mailbox | |
| 42 |
field Char frequency <- " " | |
| 43 |
| |
| 44 |
type Forum | |
| 45 |
field Str path | |
| 46 |
field Str site | |
| 47 |
field Str url | |
| 48 |
field Str from <- "<forum@nowhere>" | |
| 49 |
field Str read post maintainer | |
| 50 |
field Str title | |
| 51 |
field Str abstract | |
| 52 |
field Str reference_path | |
| 53 |
field Str live_path | |
| 54 |
field Str official_path | |
| 55 |
field Str patch_servers | |
| 56 |
field Set:ForumSubject subject | |
| 57 |
field Set:ForumStatus status | |
| 58 |
field Set:ForumDebate debate | |
| 59 |
field Set:ForumSubscriber subscriber | |
| 60 |
field DateTime last_hourly_report | |
| 61 |
field DateTime last_daily_report | |
| 62 |
field DateTime last_weekly_report | |
| 63 |
| |
| 64 |
type ForumDatabase | |
| 65 |
field Set:Forum forum | |
| 66 |
| |
| 67 |
(gvar Database:ForumDatabase forum_database) load "security:/forum.pdb" mount "/pliant/forum" | |
| 68 |
| |
| 69 |
| |
| 70 |
method d update path | |
| 71 |
arg_rw Data:ForumDebate d ; arg Str path | |
| 72 |
var Str u := "" | |
| 73 |
var DateTime dt := undefined | |
| 74 |
each m d:message | |
| 75 |
u := m user ; dt := m datetime | |
| 76 |
d last_author := u ; d last_message := dt | |
| 77 |
file_tree_cleanup path | |
| 78 |
var DateTime dt := undefined | |
| 79 |
var Array:FileInfo files := file_list path standard+recursive | |
| 80 |
for (var Int i) 0 files:size-1 | |
| 81 |
if dt=undefined or dt<files:i:datetime | |
| 82 |
dt := files:i:datetime | |
| 83 |
d patch_count := files size | |
| 84 |
d last_patch := dt | |
| 85 |
| |
| 86 |
method d timestamp -> dt | |
| 87 |
arg Data:ForumDebate d ; arg DateTime dt | |
| 88 |
if d:last_message=defined and d:last_patch=defined | |
| 89 |
dt := shunt d:last_message>d:last_patch d:last_message d:last_patch | |
| 90 |
eif d:last_message=defined | |
| 91 |
dt := d last_message | |
| 92 |
eif d:last_patch=defined | |
| 93 |
dt := d last_patch | |
| 94 |
else | |
| 95 |
dt := datetime 3000 1 1 0 0 0 0 | |
| 96 |
| |
| 97 |
function forum_path f d subpath -> p | |
| 98 |
arg Data:Forum f ; arg Data:ForumDebate d ; arg Str subpath p | |
| 99 |
if d:path<>"" | |
| 100 |
return d:path+(subpath 1 subpath:len) | |
| 101 |
p := f:path+d:subpath+keyof:d+subpath | |
| |