fixing indent
This commit is contained in:
parent
b2dfdacaa1
commit
8136851010
|
@ -46,8 +46,8 @@ class OC_Setup {
|
||||||
else if($dbtype == 'pgsql')
|
else if($dbtype == 'pgsql')
|
||||||
$dbprettyname = 'PostgreSQL';
|
$dbprettyname = 'PostgreSQL';
|
||||||
else if ($dbtype == 'mssql')
|
else if ($dbtype == 'mssql')
|
||||||
$dbprettyname = 'MS SQL Server';
|
$dbprettyname = 'MS SQL Server';
|
||||||
else
|
else
|
||||||
$dbprettyname = 'Oracle';
|
$dbprettyname = 'Oracle';
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class OC_Setup {
|
||||||
$error[] = array(
|
$error[] = array(
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
'hint' => $e->getHint()
|
'hint' => $e->getHint()
|
||||||
);
|
);
|
||||||
return($error);
|
return($error);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$error[] = array(
|
$error[] = array(
|
||||||
|
@ -154,13 +154,13 @@ class OC_Setup {
|
||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dbtype == 'mssql') {
|
elseif ($dbtype == 'mssql') {
|
||||||
$dbuser = $options['dbuser'];
|
$dbuser = $options['dbuser'];
|
||||||
$dbpass = $options['dbpass'];
|
$dbpass = $options['dbpass'];
|
||||||
$dbname = $options['dbname'];
|
$dbname = $options['dbname'];
|
||||||
$dbhost = $options['dbhost'];
|
$dbhost = $options['dbhost'];
|
||||||
$dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_';
|
$dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_';
|
||||||
|
|
||||||
OC_Config::setValue('dbname', $dbname);
|
OC_Config::setValue('dbname', $dbname);
|
||||||
OC_Config::setValue('dbhost', $dbhost);
|
OC_Config::setValue('dbhost', $dbhost);
|
||||||
OC_Config::setValue('dbuser', $dbuser);
|
OC_Config::setValue('dbuser', $dbuser);
|
||||||
|
@ -176,7 +176,7 @@ class OC_Setup {
|
||||||
);
|
);
|
||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//delete the old sqlite database first, might cause infinte loops otherwise
|
//delete the old sqlite database first, might cause infinte loops otherwise
|
||||||
if(file_exists("$datadir/owncloud.db")) {
|
if(file_exists("$datadir/owncloud.db")) {
|
||||||
|
@ -199,7 +199,7 @@ class OC_Setup {
|
||||||
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
|
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
|
||||||
OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
|
OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
|
||||||
OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
|
OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
|
||||||
|
|
||||||
OC_Group::createGroup('admin');
|
OC_Group::createGroup('admin');
|
||||||
OC_Group::addToGroup($username, 'admin');
|
OC_Group::addToGroup($username, 'admin');
|
||||||
OC_User::login($username, $password);
|
OC_User::login($username, $password);
|
||||||
|
@ -298,7 +298,7 @@ class OC_Setup {
|
||||||
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
|
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
|
||||||
$result = mysql_query($query, $connection);
|
$result = mysql_query($query, $connection);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new DatabaseSetupException($l->t("MySQL user '%s'@'%%' already exists", array($name)),
|
throw new DatabaseSetupException($l->t("MySQL user '%s'@'%%' already exists", array($name)),
|
||||||
$l->t("Drop this user from MySQL."));
|
$l->t("Drop this user from MySQL."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ class OC_Setup {
|
||||||
$result = oci_execute($stmt);
|
$result = oci_execute($stmt);
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
$entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
|
$entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
|
||||||
$entry .= $l->t('Offending command was: "%s", name: %s, password: %s',
|
$entry .= $l->t('Offending command was: "%s", name: %s, password: %s',
|
||||||
array($query, $name, $password)) . '<br />';
|
array($query, $name, $password)) . '<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ class OC_Setup {
|
||||||
$result = oci_execute($stmt);
|
$result = oci_execute($stmt);
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
$entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
|
$entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
|
||||||
$entry .= $l->t('Offending command was: "%s", name: %s, password: %s',
|
$entry .= $l->t('Offending command was: "%s", name: %s, password: %s',
|
||||||
array($query, $name, $password)) . '<br />';
|
array($query, $name, $password)) . '<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
|
@ -611,15 +611,15 @@ class OC_Setup {
|
||||||
private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix) {
|
private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix) {
|
||||||
//check if the database user has admin right
|
//check if the database user has admin right
|
||||||
$masterConnectionInfo = array( "Database" => "master", "UID" => $dbuser, "PWD" => $dbpass);
|
$masterConnectionInfo = array( "Database" => "master", "UID" => $dbuser, "PWD" => $dbpass);
|
||||||
|
|
||||||
$masterConnection = @sqlsrv_connect($dbhost, $masterConnectionInfo);
|
$masterConnection = @sqlsrv_connect($dbhost, $masterConnectionInfo);
|
||||||
if(!$masterConnection) {
|
if(!$masterConnection) {
|
||||||
$entry = null;
|
$entry = null;
|
||||||
if( ($errors = sqlsrv_errors() ) != null) {
|
if( ($errors = sqlsrv_errors() ) != null) {
|
||||||
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
||||||
} else {
|
} else {
|
||||||
$entry = '';
|
$entry = '';
|
||||||
}
|
}
|
||||||
throw new Exception('MS SQL username and/or password not valid: '.$entry);
|
throw new Exception('MS SQL username and/or password not valid: '.$entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,17 +627,17 @@ class OC_Setup {
|
||||||
OC_Config::setValue('dbpassword', $dbpass);
|
OC_Config::setValue('dbpassword', $dbpass);
|
||||||
|
|
||||||
self::mssql_createDBLogin($dbuser, $dbpass, $masterConnection);
|
self::mssql_createDBLogin($dbuser, $dbpass, $masterConnection);
|
||||||
|
|
||||||
self::mssql_createDatabase($dbname, $masterConnection);
|
self::mssql_createDatabase($dbname, $masterConnection);
|
||||||
|
|
||||||
self::mssql_createDBUser($dbuser, $dbname, $masterConnection);
|
self::mssql_createDBUser($dbuser, $dbname, $masterConnection);
|
||||||
|
|
||||||
sqlsrv_close($masterConnection);
|
sqlsrv_close($masterConnection);
|
||||||
|
|
||||||
self::mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix);
|
self::mssql_createDatabaseStructure($dbhost, $dbname, $dbuser, $dbpass, $dbtableprefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function mssql_createDBLogin($name, $password, $connection) {
|
private static function mssql_createDBLogin($name, $password, $connection) {
|
||||||
$query = "SELECT * FROM master.sys.server_principals WHERE name = '".$name."';";
|
$query = "SELECT * FROM master.sys.server_principals WHERE name = '".$name."';";
|
||||||
$result = sqlsrv_query($connection, $query);
|
$result = sqlsrv_query($connection, $query);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
@ -650,7 +650,7 @@ class OC_Setup {
|
||||||
echo($entry);
|
echo($entry);
|
||||||
} else {
|
} else {
|
||||||
$row = sqlsrv_fetch_array($result);
|
$row = sqlsrv_fetch_array($result);
|
||||||
|
|
||||||
if ($row === false) {
|
if ($row === false) {
|
||||||
if ( ($errors = sqlsrv_errors() ) != null) {
|
if ( ($errors = sqlsrv_errors() ) != null) {
|
||||||
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
||||||
|
@ -671,7 +671,7 @@ class OC_Setup {
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ class OC_Setup {
|
||||||
echo($entry);
|
echo($entry);
|
||||||
} else {
|
} else {
|
||||||
$row = sqlsrv_fetch_array($result);
|
$row = sqlsrv_fetch_array($result);
|
||||||
|
|
||||||
if ($row === false) {
|
if ($row === false) {
|
||||||
if ( ($errors = sqlsrv_errors() ) != null) {
|
if ( ($errors = sqlsrv_errors() ) != null) {
|
||||||
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
||||||
|
@ -698,7 +698,7 @@ class OC_Setup {
|
||||||
$entry = '';
|
$entry = '';
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
} else {
|
} else {
|
||||||
if ($row == null) {
|
if ($row == null) {
|
||||||
$query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];";
|
$query = "USE [".$dbname."]; CREATE USER [".$name."] FOR LOGIN [".$name."];";
|
||||||
|
@ -711,7 +711,7 @@ class OC_Setup {
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';";
|
$query = "USE [".$dbname."]; EXEC sp_addrolemember 'db_owner', '".$name."';";
|
||||||
|
@ -726,9 +726,9 @@ class OC_Setup {
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function mssql_createDatabase($dbname, $connection) {
|
private static function mssql_createDatabase($dbname, $connection) {
|
||||||
$query = "CREATE DATABASE IF NOT EXISTS [".$dbname."];";
|
$query = "CREATE DATABASE IF NOT EXISTS [".$dbname."];";
|
||||||
$result = sqlsrv_query($connection, $query);
|
$result = sqlsrv_query($connection, $query);
|
||||||
|
@ -736,12 +736,12 @@ class OC_Setup {
|
||||||
if ( ($errors = sqlsrv_errors() ) != null) {
|
if ( ($errors = sqlsrv_errors() ) != null) {
|
||||||
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
||||||
} else {
|
} else {
|
||||||
$entry = '';
|
$entry = '';
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) {
|
// private static function setupMSSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) {
|
||||||
|
|
||||||
|
@ -760,10 +760,10 @@ class OC_Setup {
|
||||||
$entry = '';
|
$entry = '';
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
} else {
|
} else {
|
||||||
$row = sqlsrv_fetch_array($result);
|
$row = sqlsrv_fetch_array($result);
|
||||||
|
|
||||||
if ($row === false) {
|
if ($row === false) {
|
||||||
if ( ($errors = sqlsrv_errors() ) != null) {
|
if ( ($errors = sqlsrv_errors() ) != null) {
|
||||||
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
$entry='DB Error: "'.print_r(sqlsrv_errors()).'"<br />';
|
||||||
|
@ -771,17 +771,17 @@ class OC_Setup {
|
||||||
$entry = '';
|
$entry = '';
|
||||||
}
|
}
|
||||||
$entry.='Offending command was: '.$query.'<br />';
|
$entry.='Offending command was: '.$query.'<br />';
|
||||||
echo($entry);
|
echo($entry);
|
||||||
} else {
|
} else {
|
||||||
if ($row == null) {
|
if ($row == null) {
|
||||||
OC_DB::createDbFromStructure('db_structure.xml');
|
OC_DB::createDbFromStructure('db_structure.xml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlsrv_close($connection);
|
sqlsrv_close($connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create .htaccess files for apache hosts
|
* create .htaccess files for apache hosts
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue