bugfix when filling the database in first run dialog

This commit is contained in:
Robin 2010-04-25 18:18:04 +02:00
parent 4eddb7b2d3
commit eaf0024c0f
2 changed files with 16 additions and 3 deletions

View File

@ -67,6 +67,7 @@ oc_require_once('lib_files.php');
oc_require_once('lib_log.php'); oc_require_once('lib_log.php');
oc_require_once('lib_config.php'); oc_require_once('lib_config.php');
oc_require_once('lib_user.php'); oc_require_once('lib_user.php');
oc_require_once('lib_ocs.php');
if(OC_USER::isLoggedIn()){ if(OC_USER::isLoggedIn()){
//jail the user in a seperate data folder //jail the user in a seperate data folder

View File

@ -202,9 +202,9 @@ class OC_CONFIG{
self::filldatabase(); self::filldatabase();
} }
}catch(Exception $e){ }catch(Exception $e){
echo 'testin';
$error.='error while trying to fill the database<br/>'; $error.='error while trying to fill the database<br/>';
} }
if(!OC_USER::createuser($_POST['adminlogin'],$_POST['adminpassword']) && !OC_USER::login($_POST['adminlogin'],$_POST['adminpassword'])){ if(!OC_USER::createuser($_POST['adminlogin'],$_POST['adminpassword']) && !OC_USER::login($_POST['adminlogin'],$_POST['adminpassword'])){
$error.='error while trying to create the admin user<br/>'; $error.='error while trying to create the admin user<br/>';
} }
@ -303,7 +303,7 @@ CREATE TABLE 'users' (
); );
"; ";
}elseif($CONFIG_DBTYPE=='mysql'){ }elseif($CONFIG_DBTYPE=='mysql'){
$query="SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\"; $query="SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE IF NOT EXISTS `locks` ( CREATE TABLE IF NOT EXISTS `locks` (
`token` varchar(255) NOT NULL DEFAULT '', `token` varchar(255) NOT NULL DEFAULT '',
@ -351,10 +351,22 @@ UNIQUE (
) )
) ENGINE = MYISAM ; ) ENGINE = MYISAM ;
CREATE TABLE IF NOT EXISTS `groups` (
`group_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`group_name` VARCHAR( 64 ) NOT NULL ,
UNIQUE (
`group_name`
)
) ENGINE = MYISAM ;
CREATE TABLE IF NOT EXISTS `user_group` (
`user_group_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`user_id` VARCHAR( 64 ) NOT NULL ,
`group_id` VARCHAR( 64 ) NOT NULL
) ENGINE = MYISAM ;
"; ";
} }
OC_DB::multiquery($query); OC_DB::multiquery($query);
die();
} }
/** /**