diff --git a/contrib/admin/main.php b/contrib/admin/main.php index f4a78545..7e746eb3 100644 --- a/contrib/admin/main.php +++ b/contrib/admin/main.php @@ -139,12 +139,12 @@ class AdminPage extends Extension { private function dbdump(Page $page) { $matches = array(); - preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches); - $software = $matches[1]; - $username = $matches[2]; - $password = $matches[3]; - $hostname = $matches[4]; - $database = $matches[5]; + preg_match("#^(?P\w+)\:(?:user=(?P\w+)(?:;|$)|password=(?P\w+)(?:;|$)|host=(?P[\w\.\-]+)(?:;|$)|dbname=(?P[\w_]+)(?:;|$))+#", DATABASE_DSN, $matches); + $software = $matches['proto']; + $username = $matches['user']; + $password = $matches['password']; + $hostname = $matches['host']; + $database = $matches['dbname']; // TODO: Support more than just MySQL.. switch($software) {