diff --git a/SQL/database_changelog.txt.rej b/SQL/database_changelog.txt.rej index 1b201ec4aa..79665db49c 100644 --- a/SQL/database_changelog.txt.rej +++ b/SQL/database_changelog.txt.rej @@ -1,15 +1,29 @@ diff a/SQL/database_changelog.txt b/SQL/database_changelog.txt (rejected hunks) -@@ -1,10 +1,10 @@ +@@ -1,10 +1,24 @@ Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255. --The latest database version is 3.1; The query to update the schema revision table is: -+The latest database version is 3.0; The query to update the schema revision table is: +-The latest database version is 3.2; The query to update the schema revision table is: ++The latest database version is 3.3; The query to update the schema revision table is: --UPDATE `schema_revision` SET major = 3, minor = 1 LIMIT 1; -+INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 0); +-INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 2); ++INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 3); or --UPDATE `SS13_schema_revision` SET major = 3, minor = 1 LIMIT 1; -+INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 0); +-INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 2); ++INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 3); ++ ++---------------------------------------------------- ++In any query remember to add a prefix to the table names if you use one. ++---------------------------------------------------- ++ ++25 August 2017, by Jordie0608 ++ ++Modified tables 'connection_log', 'legacy_population', 'library', 'messages' and 'player' to add additional 'round_id' tracking in various forms and 'server_ip' and 'server_port' to the table 'messages'. ++ ++ALTER TABLE `connection_log` ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`; ++ALTER TABLE `legacy_population` ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`; ++ALTER TABLE `library` ADD COLUMN `round_id_created` INT(11) UNSIGNED NOT NULL AFTER `deleted`; ++ALTER TABLE `messages` ADD COLUMN `server_ip` INT(10) UNSIGNED NOT NULL AFTER `server`, ADD COLUMN `server_port` SMALLINT(5) UNSIGNED NOT NULL AFTER `server_ip`, ADD COLUMN `round_id` INT(11) UNSIGNED NOT NULL AFTER `server_port`; ++ALTER TABLE `player` ADD COLUMN `firstseen_round_id` INT(11) UNSIGNED NOT NULL AFTER `firstseen`, ADD COLUMN `lastseen_round_id` INT(11) UNSIGNED NOT NULL AFTER `lastseen`; ---------------------------------------------------- diff --git a/SQL/tgstation_schema.sql b/SQL/tgstation_schema.sql index 4c76e1f275..72973fb124 100644 --- a/SQL/tgstation_schema.sql +++ b/SQL/tgstation_schema.sql @@ -112,6 +112,7 @@ CREATE TABLE `connection_log` ( `datetime` datetime DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, `ckey` varchar(45) DEFAULT NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(45) DEFAULT NULL, @@ -204,6 +205,7 @@ CREATE TABLE `legacy_population` ( `time` datetime NOT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -224,6 +226,7 @@ CREATE TABLE `library` ( `ckey` varchar(32) NOT NULL DEFAULT 'LEGACY', `datetime` datetime NOT NULL, `deleted` tinyint(1) unsigned DEFAULT NULL, + `round_id_created` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `deleted_idx` (`deleted`), KEY `idx_lib_id_del` (`id`,`deleted`), @@ -247,6 +250,9 @@ CREATE TABLE `messages` ( `text` varchar(2048) NOT NULL, `timestamp` datetime NOT NULL, `server` varchar(32) DEFAULT NULL, + `server_ip` int(10) unsigned NOT NULL, + `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, `secret` tinyint(1) unsigned NOT NULL, `lasteditor` varchar(32) DEFAULT NULL, `edits` text, @@ -267,7 +273,9 @@ DROP TABLE IF EXISTS `player`; CREATE TABLE `player` ( `ckey` varchar(32) NOT NULL, `firstseen` datetime NOT NULL, + `firstseen_round_id` int(11) unsigned NOT NULL, `lastseen` datetime NOT NULL, + `lastseen_round_id` int(11) unsigned NOT NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(32) NOT NULL, `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', diff --git a/SQL/tgstation_schema_prefixed.sql b/SQL/tgstation_schema_prefixed.sql index f717bf96ad..8cbca053cc 100644 --- a/SQL/tgstation_schema_prefixed.sql +++ b/SQL/tgstation_schema_prefixed.sql @@ -112,6 +112,7 @@ CREATE TABLE `SS13_connection_log` ( `datetime` datetime DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, `ckey` varchar(45) DEFAULT NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(45) DEFAULT NULL, @@ -200,6 +201,7 @@ CREATE TABLE `SS13_legacy_population` ( `time` datetime NOT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -220,6 +222,7 @@ CREATE TABLE `SS13_library` ( `ckey` varchar(32) NOT NULL DEFAULT 'LEGACY', `datetime` datetime NOT NULL, `deleted` tinyint(1) unsigned DEFAULT NULL, + `round_id_created` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `deleted_idx` (`deleted`), KEY `idx_lib_id_del` (`id`,`deleted`), @@ -243,6 +246,9 @@ CREATE TABLE `SS13_messages` ( `text` varchar(2048) NOT NULL, `timestamp` datetime NOT NULL, `server` varchar(32) DEFAULT NULL, + `server_ip` int(10) unsigned NOT NULL, + `server_port` smallint(5) unsigned NOT NULL, + `round_id` int(11) unsigned NOT NULL, `secret` tinyint(1) unsigned NOT NULL, `lasteditor` varchar(32) DEFAULT NULL, `edits` text, @@ -263,7 +269,9 @@ DROP TABLE IF EXISTS `SS13_player`; CREATE TABLE `SS13_player` ( `ckey` varchar(32) NOT NULL, `firstseen` datetime NOT NULL, + `firstseen_round_id` int(11) unsigned NOT NULL, `lastseen` datetime NOT NULL, + `lastseen_round_id` int(11) unsigned NOT NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(32) NOT NULL, `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', diff --git a/code/_compile_options.dm.rej b/code/_compile_options.dm.rej new file mode 100644 index 0000000000..842c24b746 --- /dev/null +++ b/code/_compile_options.dm.rej @@ -0,0 +1,11 @@ +diff a/code/_compile_options.dm b/code/_compile_options.dm (rejected hunks) +@@ -69,7 +69,7 @@ + #error You need version 511 or higher + #endif + +-//Update this whenever the db schema changes ++//Update this whenever the db schema changes + //make sure you add an update to the schema_version stable in the db changelog + #define DB_MAJOR_VERSION 3 +-#define DB_MINOR_VERSION 2 ++#define DB_MINOR_VERSION 3 diff --git a/code/controllers/subsystem/blackbox.dm.rej b/code/controllers/subsystem/blackbox.dm.rej new file mode 100644 index 0000000000..d592a3b30b --- /dev/null +++ b/code/controllers/subsystem/blackbox.dm.rej @@ -0,0 +1,10 @@ +diff a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm (rejected hunks) +@@ -35,7 +35,7 @@ SUBSYSTEM_DEF(blackbox) + if(M.client) + playercount += 1 + var/admincount = GLOB.admins.len +- var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]')") ++ var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port, round_id) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]')") + query_record_playercount.Execute() + + if(config.use_exp_tracking) diff --git a/code/modules/admin/sql_message_system.dm b/code/modules/admin/sql_message_system.dm index 532bb2d16d..b42fe93eef 100644 --- a/code/modules/admin/sql_message_system.dm +++ b/code/modules/admin/sql_message_system.dm @@ -44,7 +44,7 @@ secret = 0 else return - var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')") + var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, server_ip, server_port, round_id, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]','[secret]')") if(!query_create_message.warn_execute()) return if(logged) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 637c3e2bec..29236d580d 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -447,7 +447,7 @@ GLOBAL_LIST(external_rsc_urls) new_player = 1 account_join_date = sanitizeSQL(findJoinDate()) - var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `firstseen`, `lastseen`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', Now(), Now(), INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])") + var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])") if(!query_add_player.Execute()) return if(!account_join_date) @@ -473,12 +473,12 @@ GLOBAL_LIST(external_rsc_urls) if(query_datediff.NextRow()) account_age = text2num(query_datediff.item[1]) if(!new_player) - var/datum/DBQuery/query_log_player = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET lastseen = Now(), ip = INET_ATON('[sql_ip]'), computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]', accountjoindate = [account_join_date ? "'[account_join_date]'" : "NULL"] WHERE ckey = '[sql_ckey]'") + var/datum/DBQuery/query_log_player = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET lastseen = Now(), lastseen_round_id = '[GLOB.round_id]', ip = INET_ATON('[sql_ip]'), computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]', accountjoindate = [account_join_date ? "'[account_join_date]'" : "NULL"] WHERE ckey = '[sql_ckey]'") if(!query_log_player.Execute()) return if(!account_join_date) account_join_date = "Error" - var/datum/DBQuery/query_log_connection = SSdbcore.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')),'[world.port]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')") + var/datum/DBQuery/query_log_connection = SSdbcore.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`round_id`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')),'[world.port]','[GLOB.round_id]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')") query_log_connection.Execute() if(new_player) player_age = -1 diff --git a/code/modules/client/client_procs.dm.rej b/code/modules/client/client_procs.dm.rej index 2b656938c4..ef40816c28 100644 --- a/code/modules/client/client_procs.dm.rej +++ b/code/modules/client/client_procs.dm.rej @@ -1,10 +1,10 @@ diff a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm (rejected hunks) -@@ -73,7 +73,7 @@ - return +@@ -353,7 +353,7 @@ GLOBAL_LIST(external_rsc_urls) - //Logs all hrefs, except chat pings -- if(href_list["proc"] != "ping") -+ if(!(href_list["_src_"] == "chat" && href_list["proc"] == "ping" && LAZYLEN(href_list) == 2)) - WRITE_FILE(GLOB.world_href_log, "[time_stamp(show_ds = TRUE)] [src] (usr:[usr]) || [hsrc ? "[hsrc] " : ""][href]
") - - // Admin PM + /client/Del() + if(credits) +- QDEL_LIST(credits) ++ QDEL_LIST(credits) + log_access("Logout: [key_name(src)]") + if(holder) + adminGreet(1) diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 5e7c385416..99127cd595 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -419,7 +419,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums var/sqlauthor = sanitizeSQL(scanner.cache.author) var/sqlcontent = sanitizeSQL(scanner.cache.dat) var/sqlcategory = sanitizeSQL(upload_category) - var/datum/DBQuery/query_library_upload = SSdbcore.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now())") + var/datum/DBQuery/query_library_upload = SSdbcore.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime, round_id_created) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now(), '[GLOB.round_id]')") if(!query_library_upload.Execute()) alert("Database error encountered uploading to Archive") return