Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
3338eede
Commit
3338eede
authored
Nov 26, 2014
by
Joas Schilling
Browse files
Correctly namespace DatabaseSetupException
parent
a2457b5f
Changes
6
Hide whitespace changes
Inline
Side-by-side
lib/private/databasesetupexception.php
0 → 100644
View file @
3338eede
<?php
/**
* Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
OC
;
class
DatabaseSetupException
extends
HintException
{
}
lib/private/setup.php
View file @
3338eede
...
...
@@ -8,9 +8,6 @@
use
OCP\IConfig
;
class
DatabaseSetupException
extends
\
OC\HintException
{
}
class
OC_Setup
{
/** @var IConfig */
protected
$config
;
...
...
@@ -195,7 +192,7 @@ class OC_Setup {
try
{
$dbSetup
->
initialize
(
$options
);
$dbSetup
->
setupDatabase
(
$username
);
}
catch
(
DatabaseSetupException
$e
)
{
}
catch
(
\
OC\
DatabaseSetupException
$e
)
{
$error
[]
=
array
(
'error'
=>
$e
->
getMessage
(),
'hint'
=>
$e
->
getHint
()
...
...
lib/private/setup/mssql.php
View file @
3338eede
...
...
@@ -17,7 +17,7 @@ class MSSQL extends AbstractDatabase {
}
else
{
$entry
=
''
;
}
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'MS SQL username and/or password not valid: %s'
,
array
(
$entry
)),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'MS SQL username and/or password not valid: %s'
,
array
(
$entry
)),
$this
->
trans
->
t
(
'You need to enter either an existing account or the administrator.'
));
}
...
...
lib/private/setup/mysql.php
View file @
3338eede
...
...
@@ -9,7 +9,7 @@ class MySQL extends AbstractDatabase {
//check if the database user has admin right
$connection
=
@
mysql_connect
(
$this
->
dbhost
,
$this
->
dbuser
,
$this
->
dbpassword
);
if
(
!
$connection
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'MySQL/MariaDB username and/or password not valid'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'MySQL/MariaDB username and/or password not valid'
),
$this
->
trans
->
t
(
'You need to enter either an existing account or the administrator.'
));
}
//user already specified in config
...
...
@@ -96,13 +96,13 @@ class MySQL extends AbstractDatabase {
$query
=
"CREATE USER '
$name
'@'localhost' IDENTIFIED BY '
$password
'"
;
$result
=
mysql_query
(
$query
,
$connection
);
if
(
!
$result
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
"MySQL/MariaDB user '%s'@'localhost' exists already."
,
array
(
$name
)),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
"MySQL/MariaDB user '%s'@'localhost' exists already."
,
array
(
$name
)),
$this
->
trans
->
t
(
"Drop this user from MySQL/MariaDB"
,
array
(
$name
)));
}
$query
=
"CREATE USER '
$name
'@'%' IDENTIFIED BY '
$password
'"
;
$result
=
mysql_query
(
$query
,
$connection
);
if
(
!
$result
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
"MySQL/MariaDB user '%s'@'%%' already exists"
,
array
(
$name
)),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
"MySQL/MariaDB user '%s'@'%%' already exists"
,
array
(
$name
)),
$this
->
trans
->
t
(
"Drop this user from MySQL/MariaDB."
));
}
}
...
...
lib/private/setup/oci.php
View file @
3338eede
...
...
@@ -45,14 +45,14 @@ class OCI extends AbstractDatabase {
if
(
!
$connection
)
{
$errorMessage
=
$this
->
getLastError
();
if
(
$errorMessage
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle connection could not be established'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle connection could not be established'
),
$errorMessage
.
' Check environment: ORACLE_HOME='
.
getenv
(
'ORACLE_HOME'
)
.
' ORACLE_SID='
.
getenv
(
'ORACLE_SID'
)
.
' LD_LIBRARY_PATH='
.
getenv
(
'LD_LIBRARY_PATH'
)
.
' NLS_LANG='
.
getenv
(
'NLS_LANG'
)
.
' tnsnames.ora is '
.
(
is_readable
(
getenv
(
'ORACLE_HOME'
)
.
'/network/admin/tnsnames.ora'
)
?
''
:
'not '
)
.
'readable'
);
}
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle username and/or password not valid'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle username and/or password not valid'
),
'Check environment: ORACLE_HOME='
.
getenv
(
'ORACLE_HOME'
)
.
' ORACLE_SID='
.
getenv
(
'ORACLE_SID'
)
.
' LD_LIBRARY_PATH='
.
getenv
(
'LD_LIBRARY_PATH'
)
...
...
@@ -124,7 +124,7 @@ class OCI extends AbstractDatabase {
}
$connection
=
@
oci_connect
(
$this
->
dbuser
,
$this
->
dbpassword
,
$easy_connect_string
);
if
(
!
$connection
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle username and/or password not valid'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'Oracle username and/or password not valid'
),
$this
->
trans
->
t
(
'You need to enter either an existing account or the administrator.'
));
}
$query
=
"SELECT count(*) FROM user_tables WHERE table_name = :un"
;
...
...
lib/private/setup/postgresql.php
View file @
3338eede
...
...
@@ -27,7 +27,7 @@ class PostgreSQL extends AbstractDatabase {
$connection
=
@
pg_connect
(
$connection_string
);
if
(
!
$connection
)
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'PostgreSQL username and/or password not valid'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'PostgreSQL username and/or password not valid'
),
$this
->
trans
->
t
(
'You need to enter either an existing account or the administrator.'
));
}
$e_user
=
pg_escape_string
(
$this
->
dbuser
);
...
...
@@ -80,7 +80,7 @@ class PostgreSQL extends AbstractDatabase {
$connection_string
=
"host='
$e_host
' dbname='
$e_dbname
' user='
$e_user
' port='
$port
' password='
$e_password
'"
;
$connection
=
@
pg_connect
(
$connection_string
);
if
(
!
$connection
)
{
throw
new
\
DatabaseSetupException
(
$this
->
trans
->
t
(
'PostgreSQL username and/or password not valid'
),
throw
new
\
OC
\DatabaseSetupException
(
$this
->
trans
->
t
(
'PostgreSQL username and/or password not valid'
),
$this
->
trans
->
t
(
'You need to enter either an existing account or the administrator.'
));
}
$query
=
"select count(*) FROM pg_class WHERE relname='"
.
$this
->
tableprefix
.
"users' limit 1"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment