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
83444d9c
Commit
83444d9c
authored
11 years ago
by
Bart Visscher
Browse files
Options
Downloads
Patches
Plain Diff
camelCase class properties
parent
9f5b7657
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/config.php
+15
-16
15 additions, 16 deletions
lib/config.php
with
15 additions
and
16 deletions
lib/config.php
+
15
−
16
View file @
83444d9c
...
@@ -44,15 +44,15 @@ class Config {
...
@@ -44,15 +44,15 @@ class Config {
// associative array key => value
// associative array key => value
protected
$cache
=
array
();
protected
$cache
=
array
();
protected
$config
_d
ir
;
protected
$config
D
ir
;
protected
$config
_f
ilename
;
protected
$config
F
ilename
;
protected
$debug
_m
ode
;
protected
$debug
M
ode
;
public
function
__construct
(
$config
_d
ir
,
$debug
_m
ode
)
{
public
function
__construct
(
$config
D
ir
,
$debug
M
ode
)
{
$this
->
config
_d
ir
=
$config
_d
ir
;
$this
->
config
D
ir
=
$config
D
ir
;
$this
->
debug
_m
ode
=
$debug
_m
ode
;
$this
->
debug
M
ode
=
$debug
M
ode
;
$this
->
config
_f
ilename
=
$this
->
config
_d
ir
.
'config.php'
;
$this
->
config
F
ilename
=
$this
->
config
D
ir
.
'config.php'
;
$this
->
readData
();
$this
->
readData
();
}
}
/**
/**
...
@@ -123,19 +123,19 @@ class Config {
...
@@ -123,19 +123,19 @@ class Config {
*/
*/
private
function
readData
()
{
private
function
readData
()
{
// read all file in config dir ending by config.php
// read all file in config dir ending by config.php
$config
_f
iles
=
glob
(
$this
->
config
_d
ir
.
'*.config.php'
);
$config
F
iles
=
glob
(
$this
->
config
D
ir
.
'*.config.php'
);
//Filter only regular files
//Filter only regular files
$config
_f
iles
=
array_filter
(
$config
_f
iles
,
'is_file'
);
$config
F
iles
=
array_filter
(
$config
F
iles
,
'is_file'
);
//Sort array naturally :
//Sort array naturally :
natsort
(
$config
_f
iles
);
natsort
(
$config
F
iles
);
// Add default config
// Add default config
array_unshift
(
$config
_f
iles
,
$this
->
config
_f
ilename
);
array_unshift
(
$config
F
iles
,
$this
->
config
F
ilename
);
//Include file and merge config
//Include file and merge config
foreach
(
$config
_f
iles
as
$file
)
{
foreach
(
$config
F
iles
as
$file
)
{
if
(
!
file_exists
(
$file
)
)
{
if
(
!
file_exists
(
$file
)
)
{
continue
;
continue
;
}
}
...
@@ -156,16 +156,15 @@ class Config {
...
@@ -156,16 +156,15 @@ class Config {
private
function
writeData
()
{
private
function
writeData
()
{
// Create a php file ...
// Create a php file ...
$content
=
"<?php
\n
"
;
$content
=
"<?php
\n
"
;
if
(
$this
->
debug
_m
ode
)
{
if
(
$this
->
debug
M
ode
)
{
$content
.
=
"define('DEBUG',true);
\n
"
;
$content
.
=
"define('DEBUG',true);
\n
"
;
}
}
$content
.
=
'$CONFIG = '
;
$content
.
=
'$CONFIG = '
;
$content
.
=
var_export
(
$this
->
cache
,
true
);
$content
.
=
var_export
(
$this
->
cache
,
true
);
$content
.
=
";
\n
"
;
$content
.
=
";
\n
"
;
//var_dump($content, $this);
// Write the file
// Write the file
$result
=@
file_put_contents
(
$this
->
config
_f
ilename
,
$content
);
$result
=@
file_put_contents
(
$this
->
config
F
ilename
,
$content
);
if
(
!
$result
)
{
if
(
!
$result
)
{
throw
new
HintException
(
throw
new
HintException
(
"Can't write into config directory 'config'"
,
"Can't write into config directory 'config'"
,
...
@@ -173,6 +172,6 @@ class Config {
...
@@ -173,6 +172,6 @@ class Config {
.
' to the config directory in owncloud'
);
.
' to the config directory in owncloud'
);
}
}
// Prevent others not to read the config
// Prevent others not to read the config
@
chmod
(
$this
->
config
_f
ilename
,
0640
);
@
chmod
(
$this
->
config
F
ilename
,
0640
);
}
}
}
}
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