From: Roland Häder Date: Tue, 28 Aug 2018 19:17:33 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c384ba81d77b52e1c0d444eadd72e74b141c55be;p=ctracker.git Continued: - replace old array() style with [] - really no need for array keys as they are auto-generated anyway --- diff --git a/libs/lib_updates.php b/libs/lib_updates.php index a454a86..a51e584 100644 --- a/libs/lib_updates.php +++ b/libs/lib_updates.php @@ -27,7 +27,7 @@ function crackerTrackerInitUpdates () { // Add all $GLOBALS['ctracker_updates'] = [ // Ticket system: - 0 => array( + [ 'CREATE TABLE IF NOT EXISTS `ctracker_ticket` ( `ctracker_ticket` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `ctracker_ticket_remote_addr` varchar(15) NOT NULL, @@ -52,52 +52,52 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . `id` ) ON DELETE CASCADE ) TYPE=InnoDB', - ), + ], // NULL for missing values - 1 => array( + [ "ALTER TABLE `ctracker_data` CHANGE `script_name` `script_name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Full script name'", "UPDATE `ctracker_data` SET `script_name`=NULL WHERE `script_name`=''", "ALTER TABLE `ctracker_data` CHANGE `server_name` `server_name` TINYTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Server''s host name'", "UPDATE `ctracker_data` SET `server_name`=NULL WHERE `server_name`=''", - ), + ], // Also store proxy address - 2 => array( + [ 'ALTER TABLE `ctracker_data` ADD `proxy_addr` VARCHAR(15) NULL DEFAULT NULL AFTER `remote_addr`', 'ALTER TABLE `ctracker_ticket` ADD `ctracker_ticket_proxy_addr` VARCHAR(15) NULL DEFAULT NULL', - ), + ], // Better key for always repeating query - 4 => array( + [ 'ALTER TABLE `ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr`, `last_attempt` DESC )', - ), + ], // HTTP request method - 5 => array( + [ "ALTER TABLE `ctracker_data` ADD `request_method` VARCHAR( 255 ) NULL DEFAULT NULL COMMENT 'HTTP request method' AFTER `referer`, ADD INDEX ( `request_method` )", - ), + ], // Index on count - 6 => array( + [ 'ALTER TABLE `ctracker_data` ADD INDEX `count` (`count`)', - ), + ], // Log also UA after check - 7 => array( + [ "ALTER TABLE `ctracker_data` ADD `check_ua` tinytext COLLATE 'utf8_general_ci' NULL COMMENT 'User agent after check' AFTER `post_data`, CHANGE `check_worm` `check_get` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'GET data after check' AFTER `check_ua`, CHANGE `check_post` `check_post` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'POST data after check' AFTER `check_worm`", - ), + ], // View for request methods - 8 => array( + [ 'CREATE VIEW `view_most_request_methods` AS SELECT SQL_CALC_FOUND_ROWS COUNT(`id`) AS `total_rows`, `request_method` FROM `ctracker_data` GROUP BY `request_method`' - ), + ], ]; }