Let's make (git) history!

This commit is contained in:
2018-11-03 17:12:20 +01:00
commit 3bfebfe8a8
212 changed files with 11970 additions and 0 deletions

35
setup/config Normal file
View File

@ -0,0 +1,35 @@
wikiname NameOfWiki
wikipath /
templatepath /path/to/template
logfile /path/to/template/logfile
csspath /static/style.css
query_limit 200
session_max_lifetime 600
connectionstring /path/to/sqlite.db
anon_username anonymouse
max_pagename_length 256
fs_cache_dir /var/tmp/qswiki/
linkindex ?action=show&page=index
linkrecent ?action=recent
linkrecentsort wiki?action=recent&limit={limit}&offset={offset}&sort={sort}
linkallpages ?action=allpages
linkallcats ?action=allcategories
linkshere wiki?action=linkshere&page={page}
linkpage wiki?action=show&page={page}
linkrevision wiki?action=show&page={page}&revision={revisionid}
linkhistory ?action=recent&page={page}
linkhistorysort wiki?action=recent&page={page}&limit={limit}&offset={offset}&sort={sort}
linkedit wiki?action=edit&page={page}
linksettings wiki?action=settings&page={page}
linkdelete wiki?action=delete&page={page}
linklogin wiki?action=login
linklogout wiki?action=logout&token=%s
linkcategory wiki?action=showcat&category={category}
loginurl wiki?action=login&submit=1&page={page}
actionurl wiki?action=%s&page={page}
settingsurl wiki?action=settings&page={page}
deletionurl wiki?action=delete&page={page}
refreshsessionurl wiki?action=refreshsession
adminregisterurl wiki?action=adminregister
userchangepwurl wiki?action=userchangepw
anon_permissions can_read,can_global_history,can_page_history,can_see_page_list,can_see_category_list,can_see_links_here,can_search

48
setup/sqlite.sql Normal file
View File

@ -0,0 +1,48 @@
CREATE TABLE page(id INTEGER PRIMARY KEY, name varchar(256), lastrevision integer, visible integer DEFAULT 1);
CREATE TABLE user(id INTEGER PRIMARY KEY,username varchar(64),
password blob, salt blob, permissions integer);
CREATE TABLE session(id INTEGER PRIMARY KEY, csrf_token varchar(32),
creationtime date, userid integer , token varchar(32));
CREATE TABLE permissions(id INTEGER PRIMARY KEY, permissions integer,
userid integer REFERENCES user(id), page integer REFERENCES page(id ) );
CREATE TABLE revision
(
id INTEGER PRIMARY KEY,
author integer REFERENCES user(id),
comment text,
content text,
creationtime date,
page integer REFERENCES page(id ),
revisionid integer
);
CREATE TABLE loginattempt
(
id INTEGER PRIMARY KEY,
ip varchar(16),
count integer
);
CREATE TABLE category(id INTEGER PRIMARY KEY, name varchar(255));
CREATE TABLE categorymember(id INTEGER PRIMARY KEY, category REFERENCES category(id), page REFERENCES page (id));
CREATE INDEX revisionid ON revision (revisionid DESC);
CREATE INDEX pagename ON page (name)
;
CREATE INDEX token ON session (token)
;
CREATE TRIGGER search_ai AFTER INSERT ON revision BEGIN
DELETE FROM search WHERE page = new.page;
INSERT INTO search(rowid, content, page) VALUES (new.id, new.content, new.page);
END;
CREATE TRIGGER search_au AFTER UPDATE ON revision BEGIN
DELETE FROM search WHERE page = old.page;
INSERT INTO search(rowid, content, page) VALUES (new.id, new.content, new.page);
END;
CREATE VIRTUAL TABLE search USING fts5(content, page UNINDEXED, content=revision,content_rowid=id)
/* search(content,page) */;
CREATE TABLE IF NOT EXISTS 'search_data'(id INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'search_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS 'search_docsize'(id INTEGER PRIMARY KEY, sz BLOB);
CREATE TABLE IF NOT EXISTS 'search_config'(k PRIMARY KEY, v) WITHOUT ROWID;
CREATE TRIGGER search_ad AFTER DELETE ON revision BEGIN
INSERT INTO search(search, rowid, content, page) VALUES('delete', old.id, old.content, old.page);
END;