X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions%2Fext-network.php;h=2284ecbfe5f4dda371d15fb449d1bc338675bfe0;hp=d851330541ddc97abab74ae596e805640415cd31;hb=3f7f0051c91c54cb691303b9d49fb9cd1a7a4e8c;hpb=9f9d88d5c69948a0306c3d362b42793ae59c8553 diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index d851330541..2284ecbfe5 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -85,98 +85,98 @@ switch (getExtensionMode()) { `network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET', `network_charset` VARCHAR(20) NOT NULL DEFAULT 'UTF-8', `network_require_id_card` ENUM('Y','N') NOT NULL DEFAULT 'N', -UNIQUE (`network_short_name`), -PRIMARY KEY (`network_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Network data'"); +PRIMARY KEY (`network_id`), +UNIQUE (`network_short_name`)", + 'Network data'); // Types the network provider is supporting (e.g. Forced-Banner and so on) // @TODO network_type_handle is an internal name and needs documentation addDropTableSql('network_types'); - addCreateTableSql('network_types', "( + addCreateTableSql('network_types', " `network_type_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_handle` VARCHAR(255) NOT NULL DEFAULT '', `network_type_api_url` VARCHAR(255) NOT NULL DEFAULT '', `network_type_click_url` VARCHAR(255) NOT NULL DEFAULT '', `network_type_banner_url` VARCHAR(255) NULL DEFAULT NULL, -UNIQUE `provider_type` (`network_id`,`network_type_handle`), -PRIMARY KEY (`network_type_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Types provideable by networks'"); +PRIMARY KEY (`network_type_id`), +UNIQUE `provider_type` (`network_id`,`network_type_handle`)", + 'Types provideable by networks'); // HTTP parameters (names) for URLs addDropTableSql('network_request_params'); - addCreateTableSql('network_request_params', "( + addCreateTableSql('network_request_params', " `network_param_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `request_param_key` VARCHAR(20) NOT NULL DEFAULT 'invalid', `request_param_value` VARCHAR(20) NOT NULL DEFAULT 'invalid', `request_param_default` VARCHAR(255) NULL DEFAULT NULL, +PRIMARY KEY (`network_param_id`), UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`request_param_key`), -UNIQUE `provider_type_value` (`network_id`,`network_type_id`,`request_param_value`), -PRIMARY KEY (`network_param_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Request parameters for GET/POST request'"); +UNIQUE `provider_type_value` (`network_id`,`network_type_id`,`request_param_value`),", + 'Request parameters for GET/POST request'); // Error status codes addDropTableSql('network_error_codes'); - addCreateTableSql('network_error_codes', "( + addCreateTableSql('network_error_codes', " `network_type_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_code_value` VARCHAR(50) NOT NULL DEFAULT '', `network_type_code_type` VARCHAR(100) NOT NULL DEFAULT 'INVALID_TYPE', +PRIMARY KEY (`network_type_code_id`), UNIQUE `code_type` (`network_type_code_value`,`network_type_id`), -INDEX (`network_type_id`), -PRIMARY KEY (`network_type_code_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Error codes for all types'"); +INDEX (`network_type_id`)", + 'Error codes for all types'); // Code types (internal table) addDropTableSql('network_error_types'); - addCreateTableSql('network_error_types', "( + addCreateTableSql('network_error_types', " `network_code_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_code` VARCHAR(100) NOT NULL DEFAULT 'INVALID_CODE', -UNIQUE (`network_code`), -PRIMARY KEY (`network_code_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Error types, generic data, DO NOT ALTER!'"); +PRIMARY KEY (`network_code_id`), +UNIQUE (`network_code`)", + 'Error types, generic data, DO NOT ALTER!'); // Valid translation keys (we hate hard-coded arrays, you see?) addDropTableSql('network_translations'); - addCreateTableSql('network_translations', "( + addCreateTableSql('network_translations', " `network_translation_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_translation_name` VARCHAR(100) NOT NULL DEFAULT '', -UNIQUE (`network_translation_name`), -PRIMARY KEY (`network_translation_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Translations for array keys, generic data, DO NOT ALTER!'"); +PRIMARY KEY (`network_translation_id`), +UNIQUE (`network_translation_name`)", + 'Translations for array keys, generic data, DO NOT ALTER!'); // Array-Element translation tables per type/provider addDropTableSql('network_api_translation'); - addCreateTableSql('network_api_translation', "( + addCreateTableSql('network_api_translation', " `network_api_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_api_index` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, `sort` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +PRIMARY KEY (`network_api_id`), UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_api_index`), -INDEX (`sort`), -PRIMARY KEY (`network_api_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Translation of API responses, generic data, DO NOT ALTER!'"); +INDEX (`sort`)", + 'Translation of API responses, generic data, DO NOT ALTER!'); // Data from the webmaster (you!) addDropTableSql('network_config'); - addCreateTableSql('network_config', "( + addCreateTableSql('network_config', " `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_affiliate_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_api_password` VARCHAR(255) NOT NULL DEFAULT '', `network_site_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_query_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_active` ENUM('Y','N') NOT NULL DEFAULT 'Y', +PRIMARY KEY (`network_id`), UNIQUE `network_affiliate` (`network_id`,`network_affiliate_id`), -UNIQUE `affiliate_site` (`network_affiliate_id`,`network_site_id`), -PRIMARY KEY (`network_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Configuration data from the webmaster (you!)'"); +UNIQUE `affiliate_site` (`network_affiliate_id`,`network_site_id`)", + 'Configuration data from the webmaster (you!)'); // Configuration data for e.g. reload-time addDropTableSql('network_types_config'); - addCreateTableSql('network_types_config', "( + addCreateTableSql('network_types_config', " `network_data_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, @@ -185,35 +185,35 @@ PRIMARY KEY (`network_id`) `min_remain_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `min_payment` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, `allow_erotic` VARCHAR(10) NOT NULL DEFAULT '', -UNIQUE `provider_type` (`network_id`,`network_type_id`), -PRIMARY KEY (`network_data_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Configuration data for every type (e.g. reload-time)'"); +PRIMARY KEY (`network_data_id`), +UNIQUE `provider_type` (`network_id`,`network_type_id`)", + 'Configuration data for every type (e.g. reload-time)'); // Cache for queried APIs. Re-check depends on config // `network_cache_refresh` in seconds or if set to zero, full day // divided by query amount. addDropTableSql('network_cache'); - addCreateTableSql('network_cache', "( + addCreateTableSql('network_cache', " `network_cache_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_cache_data` MEDIUMBLOB, `network_cache_timestamp` TIMESTAMP NULL DEFAULT NULL, -UNIQUE `provider_type` (`network_id`,`network_type_id`), -PRIMARY KEY (`network_cache_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Cache for all queried APIs'"); +PRIMARY KEY (`network_cache_id`), +UNIQUE `provider_type` (`network_id`,`network_type_id`)", + 'Cache for all queried APIs'); // Reload locks for several types addDropTableSql('network_reloads'); - addCreateTableSql('network_reloads', "( + addCreateTableSql('network_reloads', " `network_reload_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_reload_lock` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, `network_inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -UNIQUE `provider_type` (`network_id`,`network_type_id`), -PRIMARY KEY (`network_reload_id`) -) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Reload locks'"); +PRIMARY KEY (`network_reload_id`), +UNIQUE `provider_type` (`network_id`,`network_type_id`)", + 'Reload locks'); // Insert API response array translations, these will be used for calling the right filter function addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES