Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
36dbb8ed
Commit
36dbb8ed
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
prefix the mysql user name to avoid collissions
parent
299d7bc3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/setup.php
+11
-4
11 additions, 4 deletions
lib/setup.php
with
11 additions
and
4 deletions
lib/setup.php
+
11
−
4
View file @
36dbb8ed
...
@@ -97,13 +97,20 @@ class OC_SETUP {
...
@@ -97,13 +97,20 @@ class OC_SETUP {
else
{
else
{
$query
=
"SELECT user FROM mysql.user WHERE user='
$dbuser
'"
;
//this should be enough to check for admin rights in mysql
$query
=
"SELECT user FROM mysql.user WHERE user='
$dbuser
'"
;
//this should be enough to check for admin rights in mysql
if
(
mysql_query
(
$query
,
$connection
))
{
if
(
mysql_query
(
$query
,
$connection
))
{
self
::
createDBUser
(
$username
,
$password
,
$connection
);
//use the admin login data for the new database user
//use the admin login data for the new database user
OC_CONFIG
::
setValue
(
'dbuser'
,
$username
);
OC_CONFIG
::
setValue
(
'dbpassword'
,
$password
);
//add prefix to the mysql user name to prevent collissions
$dbusername
=
'oc_mysql_'
.
$username
;
//hash the password so we don't need to store the admin config in the config file
$dbpassowrd
=
md5
(
time
()
.
$password
);
self
::
createDBUser
(
$dbusername
,
$dbpassowrd
,
$connection
);
OC_CONFIG
::
setValue
(
'dbuser'
,
$dbusername
);
OC_CONFIG
::
setValue
(
'dbpassword'
,
$dbpassowrd
);
//create the database
//create the database
self
::
createDatabase
(
$dbname
,
$username
,
$connection
);
self
::
createDatabase
(
$dbname
,
$
db
username
,
$connection
);
}
}
else
{
else
{
OC_CONFIG
::
setValue
(
'dbuser'
,
$dbuser
);
OC_CONFIG
::
setValue
(
'dbuser'
,
$dbuser
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment