diff options
| author | Sadie Powell <sadie@witchery.services> | 2022-01-12 22:05:59 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2022-01-12 22:08:35 +0000 |
| commit | a631028660d527f509c3b028cfa5f2903a125077 (patch) | |
| tree | 830ba6644bb312af32847db654bfb842ed44a7cd /modules/extra/stats/irc2sql | |
| parent | 4e5fc9797c2ea285e855f808dc65694d1cdba358 (diff) | |
| parent | 04257b9d6ab0fa1a63ade1d2ad0edc2d08eb74ce (diff) | |
Merge branch '2.0' into 2.1.
Diffstat (limited to 'modules/extra/stats/irc2sql')
| -rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.h | 2 | ||||
| -rw-r--r-- | modules/extra/stats/irc2sql/tables.cpp | 93 | ||||
| -rw-r--r-- | modules/extra/stats/irc2sql/utils.cpp | 2 |
4 files changed, 52 insertions, 47 deletions
diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index f0667e2e4..209f8831b 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -1,6 +1,6 @@ /* * - * (C) 2013-2021 Anope Team + * (C) 2013-2022 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. diff --git a/modules/extra/stats/irc2sql/irc2sql.h b/modules/extra/stats/irc2sql/irc2sql.h index 41dfce38d..039839855 100644 --- a/modules/extra/stats/irc2sql/irc2sql.h +++ b/modules/extra/stats/irc2sql/irc2sql.h @@ -1,6 +1,6 @@ /* * - * (C) 2013-2021 Anope Team + * (C) 2013-2022 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. diff --git a/modules/extra/stats/irc2sql/tables.cpp b/modules/extra/stats/irc2sql/tables.cpp index 28110fa9e..45fa301dd 100644 --- a/modules/extra/stats/irc2sql/tables.cpp +++ b/modules/extra/stats/irc2sql/tables.cpp @@ -1,6 +1,6 @@ /* * - * (C) 2013-2021 Anope Team + * (C) 2013-2022 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -25,52 +25,57 @@ void IRC2SQL::CheckTables() this->GetTables(); - if (GeoIPDB.equals_ci("country") && !this->HasTable(prefix + "geoip_country")) - { - query = "CREATE TABLE `" + prefix + "geoip_country` (" - "`start` INT UNSIGNED NOT NULL," - "`end` INT UNSIGNED NOT NULL," - "`countrycode` varchar(2)," - "`countryname` varchar(50)," - "PRIMARY KEY `end` (`end`)," - "KEY `start` (`start`)" - ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; - this->RunQuery(query); - } - if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_blocks")) + if (GeoIPDB.equals_ci("country")) { - query = "CREATE TABLE `" + prefix + "geoip_city_blocks` (" - "`start` INT UNSIGNED NOT NULL," - "`end` INT UNSIGNED NOT NULL," - "`locId` INT UNSIGNED NOT NULL," - "PRIMARY KEY `end` (`end`)," - "KEY `start` (`start`)" - ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; - this->RunQuery(query); - + if (!this->HasTable(prefix + "geoip_country")) + { + query = "CREATE TABLE `" + prefix + "geoip_country` (" + "`start` INT UNSIGNED NOT NULL," + "`end` INT UNSIGNED NOT NULL," + "`countrycode` varchar(2)," + "`countryname` varchar(50)," + "PRIMARY KEY `end` (`end`)," + "KEY `start` (`start`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; + this->RunQuery(query); + } } - if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_location")) + else if (GeoIPDB.equals_ci("city")) { - query = "CREATE TABLE `" + prefix + "geoip_city_location` (" - "`locId` INT UNSIGNED NOT NULL," - "`country` CHAR(2) NOT NULL," - "`region` CHAR(2) NOT NULL," - "`city` VARCHAR(50)," - "`latitude` FLOAT," - "`longitude` FLOAT," - "`areaCode` INT," - "PRIMARY KEY (`locId`)" - ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; - this->RunQuery(query); - } - if (GeoIPDB.equals_ci("city") && !this->HasTable(prefix + "geoip_city_region")) - { query = "CREATE TABLE `" + prefix + "geoip_city_region` (" - "`country` CHAR(2) NOT NULL," - "`region` CHAR(2) NOT NULL," - "`regionname` VARCHAR(100) NOT NULL," - "PRIMARY KEY (`country`,`region`)" - ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; - this->RunQuery(query); + if (!this->HasTable(prefix + "geoip_city_blocks")) + { + query = "CREATE TABLE `" + prefix + "geoip_city_blocks` (" + "`start` INT UNSIGNED NOT NULL," + "`end` INT UNSIGNED NOT NULL," + "`locId` INT UNSIGNED NOT NULL," + "PRIMARY KEY `end` (`end`)," + "KEY `start` (`start`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; + this->RunQuery(query); + } + if (!this->HasTable(prefix + "geoip_city_location")) + { + query = "CREATE TABLE `" + prefix + "geoip_city_location` (" + "`locId` INT UNSIGNED NOT NULL," + "`country` CHAR(2) NOT NULL," + "`region` CHAR(2) NOT NULL," + "`city` VARCHAR(50)," + "`latitude` FLOAT," + "`longitude` FLOAT," + "`areaCode` INT," + "PRIMARY KEY (`locId`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; + this->RunQuery(query); + } + if (!this->HasTable(prefix + "geoip_city_region")) + { query = "CREATE TABLE `" + prefix + "geoip_city_region` (" + "`country` CHAR(2) NOT NULL," + "`region` CHAR(2) NOT NULL," + "`regionname` VARCHAR(100) NOT NULL," + "PRIMARY KEY (`country`,`region`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"; + this->RunQuery(query); + } } if (!this->HasTable(prefix + "server")) { diff --git a/modules/extra/stats/irc2sql/utils.cpp b/modules/extra/stats/irc2sql/utils.cpp index c04b55960..888fc0cb0 100644 --- a/modules/extra/stats/irc2sql/utils.cpp +++ b/modules/extra/stats/irc2sql/utils.cpp @@ -1,6 +1,6 @@ /* * - * (C) 2013-2021 Anope Team + * (C) 2013-2022 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. |
