aboutsummaryrefslogtreecommitdiffstats
path: root/lib/config.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-06-10 11:42:20 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2013-06-10 11:42:20 -0400
commitb7b6075d55abdf656128c0044d6649c976e40a00 (patch)
tree6c10c522476a3b5789a81d6275f198ddc3b5aaa9 /lib/config.php
parente0359b0b24a2fbc490fa1c96ee722ef82a191c04 (diff)
downloadnextcloud-server-b7b6075d55abdf656128c0044d6649c976e40a00.tar.gz
nextcloud-server-b7b6075d55abdf656128c0044d6649c976e40a00.zip
Fix potential glob error
Diffstat (limited to 'lib/config.php')
-rw-r--r--lib/config.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/config.php b/lib/config.php
index a6095296453..4003339ea5c 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -122,21 +122,17 @@ class Config {
* Reads the config file and saves it to the cache
*/
private function readData() {
- // read all file in config dir ending by config.php
- $configFiles = glob($this->configDir.'*.config.php');
-
- //Filter only regular files
- $configFiles = array_filter($configFiles, 'is_file');
-
- //Sort array naturally :
- natsort($configFiles);
-
- // Add default config
- array_unshift($configFiles, $this->configFilename);
-
- //Include file and merge config
+ // Default config
+ $configFiles = array($this->configFilename);
+ // Add all files in the config dir ending with config.php
+ $extra = glob($this->configDir.'*.config.php');
+ if (is_array($extra)) {
+ natsort($extra);
+ $configFiles = array_merge($configFiles, $extra);
+ }
+ // Include file and merge config
foreach ($configFiles as $file) {
- if (!file_exists($file)) {
+ if (!is_file($file)) {
continue;
}
unset($CONFIG);