major=1;\r
minor=11;\r
}\r
+ if(major==1 && minor==11)\r
+ {\r
+ ConvertDB0111To0112();\r
+ major=1;\r
+ minor=12;\r
+ }\r
}\r
else\r
{\r
- db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,11);");\r
+ db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,12);");\r
}\r
\r
- db->Execute("UPDATE tblDBVersion SET Major=1, Minor=11;");\r
+ db->Execute("UPDATE tblDBVersion SET Major=1, Minor=12;");\r
\r
db->Execute("CREATE TABLE IF NOT EXISTS tblOption(\\r
Option TEXT UNIQUE,\\r
OptionValue TEXT NOT NULL,\\r
- OptionDescription TEXT\\r
+ OptionDescription TEXT,\\r
+ Section TEXT,\\r
+ SortOrder INTEGER,\\r
+ ValidValues TEXT\\r
);");\r
\r
db->Execute("CREATE TABLE IF NOT EXISTS tblLocalIdentity(\\r
LocalTrustListTrust INTEGER CHECK(LocalTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\\r
PeerTrustListTrust INTEGER CHECK(PeerTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\\r
AddedMethod TEXT,\\r
- Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false'\\r
+ Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false',\\r
+ PurgeDate DATETIME\\r
);");\r
\r
db->Execute("CREATE TABLE IF NOT EXISTS tblIdentityRequests(\\r
Date DATETIME\\r
);");\r
\r
+ // A temporary table that will hold a local identity id of the last identity who was loaded in the trust list page\r
+ db->Execute("CREATE TEMPORARY TABLE IF NOT EXISTS tmpLocalIdentityPeerTrustPage(\\r
+ LocalIdentityID INTEGER\\r
+ );");\r
+\r
// low / high / message count for each board\r
db->Execute("CREATE VIEW IF NOT EXISTS vwBoardStats AS \\r
SELECT tblBoard.BoardID AS 'BoardID', IFNULL(MIN(MessageID),0) AS 'LowMessageID', IFNULL(MAX(MessageID),0) AS 'HighMessageID', COUNT(MessageID) AS 'MessageCount' \\r
db->Execute("UPDATE tblDBVersion SET Major=1, Minor=11;");\r
}\r
\r
+void ConvertDB0111To0112()\r
+{\r
+ /*\r
+ Add Section, SortOrder, ValidValues to tblOption\r
+ Add PurgeDate to tblIdentity\r
+ */\r
+ SQLite3DB::DB *db=SQLite3DB::DB::Instance();\r
+\r
+ db->Execute("ALTER TABLE tblOption ADD COLUMN Section TEXT;");\r
+ db->Execute("ALTER TABLE tblOption ADD COLUMN SortOrder INTEGER;");\r
+ db->Execute("ALTER TABLE tblOption ADD COLUMN ValidValues TEXT;");\r
+\r
+ db->Execute("ALTER TABLE tblIdentity ADD COLUMN PurgeDate DATETIME;");\r
+\r
+ db->Execute("UPDATE tblDBVersion SET Major=1, Minor=12;");\r
+}\r
+\r
void SetupDefaultOptions()\r
{\r
// OptionValue should always be inserted as a string, even if the option really isn't a string - just to keep the field data type consistent\r
std::ostringstream tempstr; // must set tempstr to "" between db inserts\r
SQLite3DB::DB *db=SQLite3DB::DB::Instance();\r
SQLite3DB::Statement st=db->Prepare("INSERT INTO tblOption(Option,OptionValue,OptionDescription) VALUES(?,?,?);");\r
+ SQLite3DB::Statement upd=db->Prepare("UPDATE tblOption SET Section=?, SortOrder=?, ValidValues=? WHERE Option=?;");\r
+ int order=0;\r
\r
// LogLevel\r
tempstr.str("");\r
st.Bind(2,"The maximum logging level that will be written to file. 0=Fatal Errors, 1=Errors, 2=Warnings, 3=Informational Messages, 4=Debug Messages. Higher levels will include all messages from the previous levels.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Program");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"0|0 - Fatal Errors|1|1 - Errors|2|2 - Warnings|3|3 - Informational Messages|4|4 - Debug Messages");\r
+ upd.Bind(3,"LogLevel");\r
+ upd.Step();\r
+ upd.Reset();\r
+\r
+ st.Bind(0,"VacuumOnStartup");\r
+ st.Bind(1,"false");\r
+ st.Bind(2,"VACUUM the database every time FMS starts. This will defragment the free space in the database and create a smaller database file. Vacuuming the database can be CPU and disk intensive.");\r
+ st.Step();\r
+ st.Reset();\r
+ upd.Bind(0,"Program");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"VacuumOnStartup");\r
+ upd.Step();\r
+ upd.Reset();\r
+\r
+ st.Bind(0,"MessageBase");\r
+ st.Bind(1,"fms");\r
+ st.Bind(2,"A unique string shared by all clients who want to communicate with each other. This should not be changed unless you want to create your own separate communications network.");\r
+ st.Step();\r
+ st.Reset();\r
+ upd.Bind(0,"Program");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MessageBase");\r
+ upd.Step();\r
+ upd.Reset();\r
+\r
+ // StartNNTP\r
+ st.Bind(0,"StartNNTP");\r
+ st.Bind(1,"true");\r
+ st.Bind(2,"Start NNTP server.");\r
+ st.Step();\r
+ st.Reset();\r
+ upd.Bind(0,"NNTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"StartNNTP");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
// NNTPListenPort\r
st.Bind(0,"NNTPListenPort");\r
st.Bind(2,"The port that the NNTP service will listen for incoming connections.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"NNTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"NNTPListenPort");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
// NNTPBindAddresses\r
st.Bind(0,"NNTPBindAddresses");\r
st.Bind(2,"A comma separated list of valid IPv4 or IPv6 addresses/hostnames that the NNTP service will try to bind to.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"NNTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"NNTPBindAddresses");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"NNTPAllowPost");\r
st.Bind(1,"true");\r
st.Bind(2,"Allow posting messages from NNTP. Setting to false will make the newsgroups read only.");\r
st.Step();\r
st.Reset();\r
-\r
- // StartNNTP\r
- st.Bind(0,"StartNNTP");\r
- st.Bind(1,"true");\r
- st.Bind(2,"Start NNTP server.");\r
- st.Step();\r
- st.Reset();\r
+ upd.Bind(0,"NNTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"NNTPAllowPost");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"StartHTTP");\r
st.Bind(1,"true");\r
st.Bind(2,"Start HTTP server. WARNING: If you turn this off, you won't be able to access the administration pages.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"HTTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"StartHTTP");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"HTTPListenPort");\r
st.Bind(1,"8080");\r
st.Bind(2,"Port HTTP server will listen on.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"HTTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"HTTPListenPort");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"HTTPAccessControl");\r
st.Bind(1,"-0.0.0.0/0,+127.0.0.1");\r
st.Bind(2,"Comma separated list of addresses and/or subnet masks that are allowed access to the administration pages. Default is localhost only. + allows a host, - denies a host.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"HTTP Server");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"HTTPAccessControl");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
// StartFreenetUpdater\r
st.Bind(0,"StartFreenetUpdater");\r
st.Bind(2,"Set to true to start the Freenet Updater thread and connect to Freenet. Set to false to prevent communication with Freenet.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Freenet Connection");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"StartFreenetUpdater");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
// FCPHost\r
st.Bind(0,"FCPHost");\r
st.Bind(2,"Host name or address of Freenet node.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Freenet Connection");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"FCPHost");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
// FCPPort\r
st.Bind(0,"FCPPort");\r
st.Bind(2,"The port that Freenet is listening for FCP connections on.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Freenet Connection");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"FCPPort");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"FProxyPort");\r
st.Bind(1,"8888");\r
st.Bind(2,"The port that Freenet is listening for http connections on.");\r
st.Step();\r
st.Reset();\r
-\r
- st.Bind(0,"MessageBase");\r
- st.Bind(1,"fms");\r
- st.Bind(2,"A unique string shared by all clients who want to communicate with each other. This should not be changed unless you want to create your own separate communications network.");\r
- st.Step();\r
- st.Reset();\r
+ upd.Bind(0,"Freenet Connection");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"FProxyPort");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxIdentityRequests");\r
st.Bind(1,"5");\r
st.Bind(2,"Maximum number of concurrent requests for new Identity xml files");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxIdentityRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxIdentityIntroductionRequests");\r
st.Bind(1,"5");\r
st.Bind(2,"Maximum number of concurrent identities requesting IdentityIntroduction xml files. Each identity may have multiple requests pending.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxIdentityIntroductionRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxIntroductionPuzzleRequests");\r
st.Bind(1,"5");\r
st.Bind(2,"Maximum number of concurrent requests for new IntroductionPuzzle xml files");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxIntroductionPuzzleRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxTrustListRequests");\r
st.Bind(1,"5");\r
st.Bind(2,"Maximum number of concurrent requests for new Trust Lists");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxTrustListRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxMessageListRequests");\r
st.Bind(1,"5");\r
st.Bind(2,"Maximum number of concurrent requests for new Message Lists");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxMessageListRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxMessageRequests");\r
st.Bind(1,"20");\r
st.Bind(2,"Maximum number of concurrent requests for new Messages");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxMessageRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
+\r
+ st.Bind(0,"MaxBoardListRequests");\r
+ st.Bind(1,"5");\r
+ st.Bind(2,"The maximum number of concurrent requests for new Board Lists. Set to 0 to disable.");\r
+ st.Step();\r
+ st.Reset();\r
+ upd.Bind(0,"Requests");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxBoardListRequests");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MinLocalMessageTrust");\r
st.Bind(1,"50");\r
st.Bind(2,"Specifies a local message trust level that a peer must have before its messages will be downloaded.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Trust");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MinLocalMessageTrust");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MinPeerMessageTrust");\r
st.Bind(1,"30");\r
st.Bind(2,"Specifies a peer message trust level that a peer must have before its messages will be downloaded.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Trust");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MinPeerMessageTrust");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MinLocalTrustListTrust");\r
st.Bind(1,"50");\r
st.Bind(2,"Specifies a local trust list trust level that a peer must have before its trust list will be included in the weighted average. Any peers below this number will be excluded from the results.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Trust");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MinLocalTrustListTrust");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MinPeerTrustListTrust");\r
st.Bind(1,"30");\r
st.Bind(2,"Specifies a peer trust list trust level that a peer must have before its trust list will be included in the weighted average. Any peers below this number will be excluded from the results.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Trust");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MinPeerTrustListTrust");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"LocalTrustOverridesPeerTrust");\r
st.Bind(1,"false");\r
st.Bind(2,"Set to true if you want your local trust levels to override the peer levels when determining which identities you will poll.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Trust");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"LocalTrustOverridesPeerTrust");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MessageDownloadMaxDaysBackward");\r
st.Bind(1,"5");\r
st.Bind(2,"The maximum number of days backward that messages will be downloaded from each identity");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MessageDownloadMaxDaysBackward");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MessageListDaysBackward");\r
st.Bind(1,"5");\r
st.Bind(2,"The number of days backward that messages you have inserted will appear in your MessageLists");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MessageListDaysBackward");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxPeerMessagesPerDay");\r
st.Bind(1,"200");\r
st.Bind(2,"The maximum number of messages you will download from each peer on a given day.");\r
st.Step();\r
st.Reset();\r
-\r
- st.Bind(0,"MaxBoardListRequests");\r
- st.Bind(1,"5");\r
- st.Bind(2,"The maximum number of concurrent requests for new Board Lists. Set to 0 to disable.");\r
- st.Step();\r
- st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxPeerMessagesPerDay");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"MaxBoardsPerMessage");\r
st.Bind(1,"8");\r
st.Bind(2,"The maximum number of boards a received message may be sent to. Boards over this limit will be ignored.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"MaxBoardsPerMessage");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"SaveMessagesFromNewBoards");\r
st.Bind(1,"true");\r
st.Bind(2,"Set to true to automatically save messages posted to new boards. Set to false to ignore messages to new boards.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"SaveMessagesFromNewBoards");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"ChangeMessageTrustOnReply");\r
st.Bind(1,"0");\r
st.Bind(2,"How much the local message trust level of an identity should change when you reply to one of their messages.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"ChangeMessageTrustOnReply");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"AddNewPostFromIdentities");\r
st.Bind(1,"false");\r
st.Bind(2,"Set to true to automatically create new identities when you send a message using a new name. If you set this to false, posting messages will fail until you manually create the identity.");\r
st.Step();\r
st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2,"true|true|false|false");\r
+ upd.Bind(3,"AddNewPostFromIdentities");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
st.Bind(0,"DeleteMessagesOlderThan");\r
st.Bind(1,"180");\r
st.Bind(2,"Automatically delete messages older than this many days.");\r
st.Step();\r
st.Reset();\r
-\r
- st.Bind(0,"VacuumOnStartup");\r
- st.Bind(1,"false");\r
- st.Bind(2,"VACUUM the database every time FMS starts. This will defragment the free space in the database and create a smaller database file. Vacuuming the database can be CPU and disk intensive.");\r
- st.Step();\r
- st.Reset();\r
+ upd.Bind(0,"Messages");\r
+ upd.Bind(1,order++);\r
+ upd.Bind(2);\r
+ upd.Bind(3,"DeleteMessagesOlderThan");\r
+ upd.Step();\r
+ upd.Reset();\r
\r
}\r
\r