Updated installer

Added Website and Game models
Updted config loading

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-12-15 22:10:35 +01:00
commit 5393be4daf
39 changed files with 779 additions and 661 deletions

View file

@ -129,211 +129,6 @@ SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_website')} (
`website_id` TINYINT UNSIGNED NOT NULL,
`code` VARCHAR(64) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`sort_order` TINYINT UNSIGNED NOT NULL,
`default_group_id` TINYINT UNSIGNED NOT NULL,
`is_default` BOOL NOT NULL,
`is_staging` BOOL NOT NULL,
`is_active` BOOL NOT NULL,
PRIMARY KEY (`webste_id`),
UNIQUE (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game_group')} (
`group_id` TINYINT UNSIGNED NOT NULL,
`website_id` TINYINT UNSIGNED NOT NULL,
`code` VARCHAR(64) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`sort_order` TINYINT UNSIGNED NOT NULL,
`is_default` BOOL NOT NULL,
PRIMARY KEY (`group_id`),
INDEX (`webste_id`),
UNIQUE (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game')} (
`game_id` SMALLINT UNSIGNED NOT NULL,
`group_id` TINYINT UNSIGNED NOT NULL,
`website_id` TINYINT UNSIGNED NOT NULL,
`code` VARCHAR(64) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`sort_order` TINYINT UNSIGNED NOT NULL,
`is_default` BOOL NOT NULL,
`is_staging` BOOL NOT NULL,
`is_active` BOOL NOT NULL,
PRIMARY KEY (`group_id`),
INDEX (`webste_id`),
UNIQUE (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
INSERT INTO {$this->getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`)
VALUES
(0, "admin", "Administration", 0, 0, 0, 0, 1),
(1, "default", "Default Website", 1, 1, 1, 0, 1);
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
INSERT INTO {$this->getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`)
VALUES
(0, 0, "admin", "Administration", 0, 0),
(1, 1, "default", "Default Group", 1, 1);
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
INSERT INTO {$this->getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`)
VALUES
(0, 0, 0, "admin", "Administration", 0, 0, 0, 1),
(1, 1, 1, "default", "Default Game", 1, 1, 0, 1);
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_config')} (
`website_id` TINYINT UNSIGNED NOT NULL,
`game_id` TINYINT UNSIGNED NOT NULL,
`config_path` VARCHAR(64) NOT NULL,
`config_value` VARCHAR(255) NOT NULL,
PRIMARY KEY (`website_id`, `game_id`, `config_path`),
INDEX (`website_id`),
INDEX (`game_id`),
INDEX (`config_path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
INSERT IGNORE INTO {$this->getTableName('core_config')} (`webste_id`, `game_id`, `config_path`, `config_value`) VALUES
(1, 1, 'resource/base-income/metal', '20'),
(1, 1, 'resource/base-income/cristal', '10'),
(1, 1, 'resource/base-income/deuterium', '0'),
(1, 1, 'resource/base-income/energy', '0'),
(1, 1, 'resource/initial/fields', '163'),
(1, 1, 'resource/initial/metal', '500'),
(1, 1, 'resource/initial/cristal', '500'),
(1, 1, 'resource/initial/deuterium', '0'),
(1, 1, 'resource/initial/energy', '0'),
(1, 1, 'game/general/name', 'Wootook'),
(1, 1, 'game/general/boards-url', 'http://wootook.org/board/'),
(1, 1, 'game/general/extra-url-title', 'Wootook!'),
(1, 1, 'game/general/extra-url', 'http://wootook.org/'),
(1, 1, 'game/general/active', '1'),
(1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'),
(1, 1, 'game/general/locale', 'fr_FR'),
(1, 1, 'game/resource/multiplier', '1000'),
(1, 1, 'game/speed/general', '2500'),
(1, 1, 'game/speed/fleet', '2500'),
(1, 1, 'game/debris/metal-percent', '30'),
(1, 1, 'game/debris/cristal-percent', '30'),
(1, 1, 'game/debris/deuterium-percent', '0'),
(1, 1, 'game/debris/energy-percent', '0'),
(1, 1, 'game/debris/fleet', '1'),
(1, 1, 'game/debris/defense', '0'),
(1, 1, 'game/noob-protection/active', '0'),
(1, 1, 'game/noob-protection/points-cap', '5000'),
(1, 1, 'game/noob-protection/multiplier', '5'),
(0, 0, 'web/cookie/name', '__wtk'),
(0, 0, 'web/cookie/time', '2592000'),
(0, 0, 'web/cookie/domain', ''),
(0, 0, 'web/cookie/path', ''),
(0, 0, 'engine/options/bbcode', '1'),
(0, 0, 'engine/options/ga', '1'),
(0, 0, 'engine/options/announces', '0'),
(0, 0, 'engine/options/retailer', '0'),
(0, 0, 'engine/options/notes', '0'),
(0, 0, 'engine/options/chat', '0'),
(0, 0, 'engine/options/banner', '0'),
(0, 0, 'engine/options/vacation-min-time', '172800'),
(0, 0, 'game/news/active', '0'),
(0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'),
(0, 0, 'engine/ban/duration', '86400'),
(0, 0, 'engine/bot/active', '0'),
(0, 0, 'engine/bot/name', 'Woot'),
(0, 0, 'engine/bot/email', 'contact@wootook.org'),
--------------------------------------------------------------------------------
-- (0, 0, 'game_speed', '2500'),
-- (0, 0, 'fleet_speed', '2500'),
-- (0, 0, 'resource_multiplier', '1000'),
-- (0, 0, 'metal_basic_income', '20'),
-- (0, 0, 'cristal_basic_income', '10'),
-- (0, 0, 'deuterium_basic_income', '0'),
-- (0, 0, 'energy_basic_income', '0'),
-- (0, 0, 'Fleet_Cdr', '30'),
-- (0, 0, 'Defs_Cdr', '30'),
-- (0, 0, 'initial_fields', '5000'),
-- (0, 0, 'COOKIE_NAME', 'wootook'),
-- (0, 0, 'game_name', 'Wootook'),
-- (0, 0, 'game_disable', '1'),
-- (0, 0, 'close_reason', 'Le jeu est clos pour le moment.'),
(0, 0, 'BuildLabWhileRun', '0'),
-- (0, 0, 'urlaubs_modus_erz', '1'),
-- (0, 0, 'noobprotection', '1'),
-- (0, 0, 'noobprotectiontime', '5000'),
-- (0, 0, 'noobprotectionmulti', '5'),
-- (0, 0, 'forum_url', 'http://wootook.org/board/'),
-- (0, 0, 'OverviewNewsFrame', '1'),
-- (0, 0, 'OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'),
-- (0, 0, 'OverviewExternChat', '0'),
-- (0, 0, 'OverviewExternChatCmd', ''),
-- (0, 0, 'OverviewBanner', '0'),
-- (0, 0, 'OverviewClickBanner', ''),
(0, 0, 'ExtCopyFrame', '0'),
(0, 0, 'ExtCopyOwner', ''),
(0, 0, 'ExtCopyFunct', ''),
-- (0, 0, 'ForumBannerFrame', '0'),
-- (0, 0, 'stat_settings', '1000'),
-- (0, 0, 'link_enable', '0'),
-- (0, 0, 'link_name', ''),
-- (0, 0, 'link_url', ''),
-- (0, 0, 'enable_announces', '1'),
-- (0, 0, 'enable_marchand', '1'),
-- (0, 0, 'enable_notes', '1'),
-- (0, 0, 'bot_name', 'Isaac'),
-- (0, 0, 'bot_adress', 'contact@wootook.org'),
-- (0, 0, 'banner_source_post', '../images/bann.png'),
-- (0, 0, 'ban_duration', '30'),
-- (0, 0, 'enable_bot', '0'),
-- (0, 0, 'enable_bbcode', '1');
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
CREATE TABLE IF NOT EXISTS {$this->getTableName('declared')} (
`declarator` TEXT NOT NULL,
@ -755,8 +550,8 @@ $this->query($sql);
/*
* Galaxy positions generation
*/
$galaxyCount = Wootook::getConfig('default/engine/universe/galaxies');
$systemCount = Wootook::getConfig('default/engine/universe/systems');
$galaxyCount = Wootook::getConfig('engine/universe/galaxies');
$systemCount = Wootook::getConfig('engine/universe/systems');
$sql = <<<SQL_EOF
INSERT INTO {$this->getTableName('galaxy')}

View file

@ -40,124 +40,118 @@
*
*/
$this->setSetupConnection('legacies_setup');
$this->setSetupConnection('core_setup');
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/aks')};
DROP TABLE {$this->getTableName('aks')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/alliance')};
DROP TABLE {$this->getTableName('alliance')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/annonce')};
DROP TABLE {$this->getTableName('annonce')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/banned')};
DROP TABLE {$this->getTableName('banned')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/buddy')};
DROP TABLE {$this->getTableName('buddy')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/chat')};
DROP TABLE {$this->getTableName('chat')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/config')};
DROP TABLE {$this->getTableName('declared')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/declared')};
DROP TABLE {$this->getTableName('errors')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/errors')};
DROP TABLE {$this->getTableName('fleets')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/fleets')};
DROP TABLE {$this->getTableName('galaxy')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/galaxy')};
DROP TABLE {$this->getTableName('iraks')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/iraks')};
DROP TABLE {$this->getTableName('lunas')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/lunas')};
DROP TABLE {$this->getTableName('messages')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/messages')};
DROP TABLE {$this->getTableName('multi')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/multi')};
DROP TABLE {$this->getTableName('notes')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/notes')};
DROP TABLE {$this->getTableName('planets')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/planets')};
DROP TABLE {$this->getTableName('rw')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/rw')};
DROP TABLE {$this->getTableName('statpoints')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/statpoints')};
SQL_EOF;
$this->query($sql);
$sql = <<<SQL_EOF
DROP TABLE {$this->getTableName('legacies/users')};
DROP TABLE {$this->getTableName('users')};
SQL_EOF;
$this->query($sql);