Conditions | 3 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
32 | def parse_database_credentials(db_credentials): |
||
33 | """ |
||
34 | Parsing database credentials to needed format |
||
35 | :param db_credentials: Dictionary |
||
36 | :return: Dictionary |
||
37 | """ |
||
38 | # |
||
39 | # Distinguish between database config scheme of TYPO3 v8+ and TYPO3 v7- |
||
40 | # |
||
41 | if 'Connections' in db_credentials: |
||
42 | _db_config = db_credentials['Connections']['Default'] |
||
43 | _db_config['name'] = _db_config['dbname'] |
||
44 | else: |
||
45 | _db_config = db_credentials |
||
46 | _db_config['user'] = _db_config['username'] |
||
47 | _db_config['name'] = _db_config['database'] |
||
48 | |||
49 | if 'port' not in _db_config: |
||
50 | _db_config['port'] = 3306 |
||
51 | |||
52 | return _db_config |
||
53 |