* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009, 2010 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
// SQL commands to run (surfbar URLs)
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_urls`');
+ addDropTableSql('surfbar_urls');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_urls` (
`url_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`url_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`url_id`),
UNIQUE KEY `userid_url` (`url_userid`,`url`),
INDEX `status_userid` (`url_status`,`url_userid`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Surfbar URLs'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar URLs'");
// Reload locks
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_locks`');
+ addDropTableSql('surfbar_locks');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_locks` (
`locks_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`locks_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`locks_id`),
UNIQUE KEY `userid_url` (`locks_userid`,`locks_url_id`),
INDEX (`locks_url_id`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Surfbar reload locks'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar reload locks'");
// Surfbar salts
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_salts`');
+ addDropTableSql('surfbar_salts');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_salts` (
`salts_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`salts_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`salts_id`),
UNIQUE KEY `salts_userid_url` (`salts_userid`,`salts_url_id`),
INDEX (`salts_url_id`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Surfbar last used salts'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar last used salts'");
// Statistics
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_stats`');
+ addDropTableSql('surfbar_stats');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_stats` (
`stats_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`stats_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`stats_id`),
UNIQUE KEY `userid_url` (`stats_userid`,`stats_url_id`),
INDEX (`stats_url_id`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Surfbar Statistics'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar Statistics'");
// Member actions pending on status
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_actions`');
+ addDropTableSql('surfbar_actions');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_surfbar_actions` (
`actions_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`actions_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL,
`actions_new_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL,
PRIMARY KEY (`actions_id`),
UNIQUE KEY `status_action` (`actions_status`,`actions_action`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Surfbar Member Actions'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar Member Actions'");
// Member actions
addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','RETREAT','DELETED')");
addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','BOOKNOW','PENDING')");
// Config entries
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_pay_model` ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_static_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_static_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_static_time` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_static_lock` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(60*5)."");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT 10");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(60*6)."");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_autostart` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_migrate_urls` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_total_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_daily_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_yester_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_weekly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_monthly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_stats_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 30");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_purge_deleted` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*7)."");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_purge_migrated` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*3)."");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_pause_mode` ENUM('INTERNAL','EXERNAL') NOT NULL DEFAULT 'INTERNAL'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_pause_url` VARCHAR(255) NOT NULL DEFAULT ''");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_notify_limits` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_notify_admin_unlock` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_warn_low_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 100");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_low_interval` BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_migrate_order` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_notification_mode` ENUM('INSTANT','RESET') NOT NULL DEFAULT 'INSTANT'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `surfbar_guest_login_form` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_pay_model', "ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'");
+ addConfigAddSql('surfbar_static_reward', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000");
+ addConfigAddSql('surfbar_static_costs', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
+ addConfigAddSql('surfbar_static_time', "SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60");
+ addConfigAddSql('surfbar_static_lock', "SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(60*5)."");
+ addConfigAddSql('surfbar_dynamic_percent', "FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000");
+ addConfigAddSql('surfbar_max_order', "INT(7) UNSIGNED NOT NULL DEFAULT 10");
+ addConfigAddSql('surfbar_restart_time', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(60*6)."");
+ addConfigAddSql('surfbar_autostart', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_migrate_urls', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_total_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addConfigAddSql('surfbar_daily_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addConfigAddSql('surfbar_yester_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addConfigAddSql('surfbar_weekly_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addConfigAddSql('surfbar_monthly_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addConfigAddSql('surfbar_stats_reload', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 30");
+ addConfigAddSql('surfbar_purge_deleted', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*7)."");
+ addConfigAddSql('surfbar_purge_migrated', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*3)."");
+ addConfigAddSql('surfbar_pause_mode', "ENUM('INTERNAL','EXERNAL') NOT NULL DEFAULT 'INTERNAL'");
+ addConfigAddSql('surfbar_pause_url', "VARCHAR(255) NOT NULL DEFAULT ''");
+ addConfigAddSql('surfbar_notify_limits', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_notify_admin_unlock', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_warn_low_points', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 100");
+ addConfigAddSql('surfbar_low_interval', "BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}");
+ addConfigAddSql('surfbar_migrate_order', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addConfigAddSql('surfbar_notification_mode', "ENUM('INSTANT','RESET') NOT NULL DEFAULT 'INSTANT'");
+ addConfigAddSql('surfbar_guest_login_form', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
// Extend user data
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `surfbar_low_notified` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
case 'remove': // Do stuff when removing extension
// SQL commands to run
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_actions`');
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_locks`');
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_salts`');
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_stats`');
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_surfbar_urls`');
+ addDropTableSql('surfbar_actions');
+ addDropTableSql('surfbar_locks');
+ addDropTableSql('surfbar_salts');
+ addDropTableSql('surfbar_stats');
+ addDropTableSql('surfbar_urls');
addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='surfbar'");
addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='surfbar'");
case 'modify': // When the extension got modified
break;
- case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ case 'test': // For testing purposes
break;
case 'init': // Do stuff when extension is initialized