diff --git a/lib/private/config.php b/lib/private/config.php
index 7bf3863e2a6d035442411508ef7de0fc98d06d69..f0548442ab55200236b2297c33a7bb6989152971 100644
--- a/lib/private/config.php
+++ b/lib/private/config.php
@@ -138,7 +138,7 @@ class Config {
 
 		// Include file and merge config
 		foreach ($configFiles as $file) {
-			if(!@touch($file) && $file === $this->configFilePath) {
+			if($file === $this->configFilePath && !@touch($file)) {
 				// Writing to the main config might not be possible, e.g. if the wrong
 				// permissions are set (likely on a new installation)
 				continue;