Skip to content

Commit

Permalink
create default settings when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ol0lll committed Aug 27, 2024
1 parent 7b657fd commit 9d5c288
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions BackendCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,32 @@ public function createTestingDump()
$dbSpec = $sql->getDbSpec();
$dbUrl = $dbSpec['driver'].'://'.$dbSpec['username'].':'.$dbSpec['password'].'@'.$dbSpec['host'].':'.$dbSpec['port'].'/'.$dbSpec['database'];

$default_settings_file = $this->drupalRootDirectory() . '/sites/default/settings.php';

Check failure on line 355 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable "default_settings_file" is not in valid camel caps format

Check failure on line 355 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Concat operator must not be surrounded by spaces
if (!file_exists($default_settings_file)) {

Check failure on line 356 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable "default_settings_file" is not in valid camel caps format
$file_string = <<<EOF

Check failure on line 357 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable &quot;file_string&quot; is not in valid camel caps format
<?php
\$databases['default']['default'] = [
'database' => '{{ database }}',
'username' => '{{ username }}',
'password' => '{{ password }}',
'prefix' => '',
'host' => '{{ host }}',
'port' => '{{ port }}',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => '{{ driver }}',
];
EOF;
$file_string = str_replace(['{{ database }}', '{{ username }}', '{{ password }}', '{{ host }}', '{{ port }}', '{{ driver }}'], [$dbSpec['database'], $dbSpec['username'], $dbSpec['password'], $dbSpec['host'], $dbSpec['port'], $dbSpec['driver']], $file_string);

Check failure on line 370 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable &quot;file_string&quot; is not in valid camel caps format

Check failure on line 370 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable &quot;file_string&quot; is not in valid camel caps format

$default_settings_file_created =

Check failure on line 372 in BackendCommands.php

View workflow job for this annotation

GitHub Actions / PHPCS

Variable &quot;default_settings_file_created&quot; is not in valid camel caps format
file_put_contents($default_settings_file, $file_string);
}

$this->process(['php', 'core/scripts/db-tools.php', 'dump-database-d8-mysql', '--database-url', $dbUrl], $this->drupalRootDirectory());

if (!empty($default_settings_file_created)) {
unlink($default_settings_file);
}
}

/**
Expand Down

0 comments on commit 9d5c288

Please sign in to comment.