// 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,
`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`'
- ),
+ ],
];
}