added installing nel db

This commit is contained in:
Botanic 2013-10-22 22:03:33 -07:00
parent b830995450
commit 1c5480a0e0

View file

@ -75,22 +75,22 @@
-- -----------------------------------------------------------------------------------------------------------------------
-- -----------------------------------------------------------------------------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_log` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_support_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_info` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`email` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`forwarded` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`support_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_log` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_support_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_info` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`email` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`forwarded` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`support_group` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` ;
-- -----------------------------------------------------
@ -464,6 +464,122 @@
$dbl->executeWithoutParams($sql);
print "The Lib & Web database were correctly installed! <br />";
//SETUP THE SHARD DB
$dbs = new DBLayer("install", "shard");
$sql = "
CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['shard']['name'] ."`;
USE `". $cfg['db']['shard']['name'] . "`;
CREATE TABLE IF NOT EXISTS `domain` (
`domain_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`domain_name` varchar(32) NOT NULL DEFAULT '',
`status` enum('ds_close','ds_dev','ds_restricted','ds_open') NOT NULL DEFAULT 'ds_dev',
`patch_version` int(10) unsigned NOT NULL DEFAULT '0',
`backup_patch_url` varchar(255) DEFAULT NULL,
`patch_urls` text,
`login_address` varchar(255) NOT NULL DEFAULT '',
`session_manager_address` varchar(255) NOT NULL DEFAULT '',
`ring_db_name` varchar(255) NOT NULL DEFAULT '',
`web_host` varchar(255) NOT NULL DEFAULT '',
`web_host_php` varchar(255) NOT NULL DEFAULT '',
`description` varchar(200) DEFAULT NULL,
PRIMARY KEY (`domain_id`),
UNIQUE KEY `name_idx` (`domain_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
INSERT INTO `domain` (`domain_id`, `domain_name`, `status`, `patch_version`, `backup_patch_url`, `patch_urls`, `login_address`, `session_manager_address`, `ring_db_name`, `web_host`, `web_host_php`, `description`) VALUES
(12, 'ryzom_open', 'ds_open', 610, 'http://127.0.0.1:23001', NULL, '127.0.0.1:49998', '127.0.0.1:49999', 'ring_open', '127.0.0.1:30000', '127.0.0.1:40916', 'Open Domain');
CREATE TABLE IF NOT EXISTS `permission` (
`UId` int(10) unsigned NOT NULL DEFAULT '0',
`ClientApplication` char(64) NOT NULL DEFAULT 'ryzom',
`ShardId` int(10) NOT NULL DEFAULT '-1',
`AccessPrivilege` set('OPEN','DEV','RESTRICTED') NOT NULL DEFAULT 'OPEN',
`prim` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`prim`),
KEY `UIDIndex` (`UId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `shard` (
`ShardId` int(10) NOT NULL DEFAULT '0',
`domain_id` int(11) unsigned NOT NULL DEFAULT '0',
`WsAddr` varchar(64) DEFAULT NULL,
`NbPlayers` int(10) unsigned DEFAULT '0',
`Name` varchar(255) DEFAULT 'unknown shard',
`Online` tinyint(1) unsigned DEFAULT '0',
`ClientApplication` varchar(64) DEFAULT 'ryzom',
`Version` varchar(64) NOT NULL DEFAULT '',
`PatchURL` varchar(255) NOT NULL DEFAULT '',
`DynPatchURL` varchar(255) NOT NULL DEFAULT '',
`FixedSessionId` int(11) unsigned NOT NULL DEFAULT '0',
`State` enum('ds_close','ds_dev','ds_restricted','ds_open') NOT NULL DEFAULT 'ds_dev',
`MOTD` text NOT NULL,
`prim` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`prim`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all shards informations for login system' AUTO_INCREMENT=31 ;
INSERT INTO `shard` (`ShardId`, `domain_id`, `WsAddr`, `NbPlayers`, `Name`, `Online`, `ClientApplication`, `Version`, `PatchURL`, `DynPatchURL`, `FixedSessionId`, `State`, `MOTD`, `prim`) VALUES
(302, 12, '127.0.0.1', 0, 'Open Shard', 0, 'ryzom_open', '', '', '', 0, 'ds_dev', '', 30);
CREATE TABLE IF NOT EXISTS `user` (
`UId` int(10) NOT NULL AUTO_INCREMENT,
`Login` varchar(64) NOT NULL DEFAULT '',
`Password` varchar(13) DEFAULT NULL,
`ShardId` int(10) NOT NULL DEFAULT '-1',
`State` enum('Offline','Online') NOT NULL DEFAULT 'Offline',
`Privilege` varchar(255) NOT NULL DEFAULT '',
`GroupName` varchar(255) NOT NULL DEFAULT '',
`FirstName` varchar(255) NOT NULL DEFAULT '',
`LastName` varchar(255) NOT NULL DEFAULT '',
`Birthday` varchar(32) NOT NULL DEFAULT '',
`Gender` tinyint(1) unsigned NOT NULL DEFAULT '0',
`Country` char(2) NOT NULL DEFAULT '',
`Email` varchar(255) NOT NULL DEFAULT '',
`Address` varchar(255) NOT NULL DEFAULT '',
`City` varchar(100) NOT NULL DEFAULT '',
`PostalCode` varchar(10) NOT NULL DEFAULT '',
`USState` char(2) NOT NULL DEFAULT '',
`Chat` char(2) NOT NULL DEFAULT '0',
`BetaKeyId` int(10) unsigned NOT NULL DEFAULT '0',
`CachedCoupons` varchar(255) NOT NULL DEFAULT '',
`ProfileAccess` varchar(45) DEFAULT NULL,
`Level` int(2) NOT NULL DEFAULT '0',
`CurrentFunds` int(4) NOT NULL DEFAULT '0',
`IdBilling` varchar(255) NOT NULL DEFAULT '',
`Community` char(2) NOT NULL DEFAULT '--',
`Newsletter` tinyint(1) NOT NULL DEFAULT '1',
`Account` varchar(64) NOT NULL DEFAULT '',
`ChoiceSubLength` tinyint(2) NOT NULL DEFAULT '0',
`CurrentSubLength` varchar(255) NOT NULL DEFAULT '0',
`ValidIdBilling` int(4) NOT NULL DEFAULT '0',
`GMId` int(4) NOT NULL DEFAULT '0',
`ExtendedPrivilege` varchar(128) NOT NULL DEFAULT '',
`ToolsGroup` varchar(20) NOT NULL DEFAULT '',
`Unsubscribe` date NOT NULL DEFAULT '0000-00-00',
`SubDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`SubIp` varchar(20) NOT NULL DEFAULT '',
`SecurePassword` varchar(32) NOT NULL DEFAULT '',
`LastInvoiceEmailCheck` date NOT NULL DEFAULT '0000-00-00',
`FromSource` varchar(8) NOT NULL DEFAULT '',
`ValidMerchantCode` varchar(13) NOT NULL DEFAULT '',
`PBC` tinyint(1) NOT NULL DEFAULT '0',
`ApiKeySeed` varchar(8) DEFAULT NULL,
PRIMARY KEY (`UId`),
KEY `LoginIndex` (`Login`),
KEY `GroupIndex` (`GroupName`),
KEY `ToolsGroup` (`ToolsGroup`),
KEY `CurrentSubLength` (`CurrentSubLength`),
KEY `Community` (`Community`),
KEY `Email` (`Email`),
KEY `GMId` (`GMId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users informations for login system' AUTO_INCREMENT=1 ;
GRANT ALL ON `" . $cfg['db']['shard']['name'] ."`.* TO `" . $cfg['db']['shard']['user'] ."`@localhost;
";
$dbs->executeWithoutParams($sql);
print "The shard database was correctly installed! <br />";
//Now create an admin account!
$hashpass = crypt("admin", Users::generateSALT());
$params = array(
@ -485,6 +601,7 @@
}
//copy config.default.php to config.php!
if (!file_exists('../config.php')) {
if (!copy('../config.default.php', '../config.php')) {
echo "failed to copy ../config.php ...\n";