Conditions | 1 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
31 | def get_database_setting(client, name, file): |
||
32 | """ |
||
33 | Parsing a single database variable from the wp-config.php file |
||
34 | https://stackoverflow.com/questions/63493645/extract-database-name-from-a-wp-config-php-file |
||
35 | :param client: String |
||
36 | :param name: String |
||
37 | :param file: String |
||
38 | :return: |
||
39 | """ |
||
40 | return mode.run_command( |
||
41 | helper.get_command(client, 'sed') + f' -n "s/define( *\'{name}\', *\'\([^\']*\)\'.*/\\1/p" {file}', |
||
42 | client, |
||
43 | True |
||
44 | ).replace('\n', '') |
||
45 | |||
46 |