public static function findConfig() { self::$foundConf = false; $done = false; $lookDir = self::$currentDir; while (!$done) { $tryPath = $lookDir . '/' . self::confName; if (!file_exists($tryPath)) { // go one level up in the directory tree $tmpDir = dirname($lookDir); // if there is no level above, we have not found any if ($tmpDir == $lookDir) { return false; } $lookDir = $tmpDir; } else { self::$confPath = $tryPath; self::$rootDir = $lookDir; self::$relativeDir = substr(getcwd(), strlen(self::$rootDir) + 1); self::$foundConf = true; return true; } } }