} // Sleep for 5 seconds for debugging purposes if (!ONLINE) { http_response_code(503); } // Set proper response code if site is in offline mode $credentials = json_decode(file_get_contents(CONFIG_DIR . 'credentials.conf'), true); // Load database credentials foreach ($credentials as $name => $credential) { if (isset($credential['driver'])) { if (in_array($credential['driver'], Database::Drivers())) { if ($credential['driver'] == 'internal') { Database::ConnectFile(INTERNAL_DIR . 'lightwork.db'); } else { if (isset($credential['file'])) { Database::ConnectFile($credential['file'], $credential['driver']); } else { if (isset($credential['host'])) { Database::Connect($credential['user'], $credential['password'], $credential['database'], $credential['host'], $credential['port'], $credential['driver'], $credential['charset']); } else { if (isset($credential['socket'])) { Database::ConnectSocket($credential['user'], $credential['password'], $credential['database'], $credential['socket'], $credential['driver'], $credential['charset']); } else { Lightwork::Log('Could not find fitting driver using current database configuration.', Lightwork::LOG_FATAL_ERROR); } } } } } else { Lightwork::Log('Tried to use unsupported database driver!', Lightwork::LOG_FATAL_ERROR); }