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
37dbf484
Commit
37dbf484
authored
13 years ago
by
Daniel Köb
Committed by
Robin Appelman
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Connect to the newly created database when checking if it needs to be filled.
parent
0ba472c1
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
+22
-9
22 additions, 9 deletions
lib/setup.php
with
22 additions
and
9 deletions
lib/setup.php
+
22
−
9
View file @
37dbf484
...
@@ -189,16 +189,29 @@ class OC_Setup {
...
@@ -189,16 +189,29 @@ class OC_Setup {
self
::
pg_createDatabase
(
$dbname
,
$dbuser
,
$connection
);
self
::
pg_createDatabase
(
$dbname
,
$dbuser
,
$connection
);
}
}
//fill the database if needed
// the connection to dbname=postgres is not needed anymore
$query
=
"select count(*) FROM pg_class WHERE relname='
{
$dbtableprefix
}
users' limit 1"
;
$result
=
pg_query
(
$connection
,
$query
);
if
(
$result
){
$row
=
pg_fetch_row
(
$result
);
}
if
(
!
$result
or
$row
[
0
]
==
0
)
{
OC_DB
::
createDbFromStructure
(
'db_structure.xml'
);
}
pg_close
(
$connection
);
pg_close
(
$connection
);
// connect to the ownCloud database (dbname=$dbname) an check if it needs to be filled
$dbuser
=
OC_CONFIG
::
getValue
(
'dbuser'
);
$dbpass
=
OC_CONFIG
::
getValue
(
'dbpassword'
);
$connection_string
=
"host=
$dbhost
dbname=
$dbname
user=
$dbuser
password=
$dbpass
"
;
$connection
=
@
pg_connect
(
$connection_string
);
if
(
!
$connection
)
{
$error
[]
=
array
(
'error'
=>
'PostgreSQL username and/or password not valid'
,
'hint'
=>
'You need to enter either an existing account or the administrator.'
);
}
else
{
$query
=
"select count(*) FROM pg_class WHERE relname='
{
$dbtableprefix
}
users' limit 1"
;
$result
=
pg_query
(
$connection
,
$query
);
if
(
$result
)
{
$row
=
pg_fetch_row
(
$result
);
}
if
(
!
$result
or
$row
[
0
]
==
0
)
{
OC_DB
::
createDbFromStructure
(
'db_structure.xml'
);
}
}
}
}
}
}
else
{
else
{
...
...
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