Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for D11 changes #5928

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Commands/config/ConfigImportCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ public function doImport($storage_comparer): void
do {
$config_importer->doSyncStep($step, $context);
if (isset($context['message'])) {
$this->logger()->notice(str_replace('Synchronizing', 'Synchronized', (string)$context['message']));
$this->logger()->notice(
str_replace('Synchronizing', 'Synchronized', (string)$context['message'])
);
}
} while ($context['finished'] < 1);
}
Expand All @@ -280,7 +282,6 @@ public function doImport($storage_comparer): void
$message = 'The import failed due to the following reasons:' . "\n";
$message .= implode("\n", $config_importer->getErrors());

watchdog_exception('config_import', $e);
throw new \Exception($message, $e->getCode(), $e);
} finally {
// Importing config might trigger batch operations (such as when installing and uninstalling modules).
Expand Down
24 changes: 12 additions & 12 deletions src/Commands/sql/sanitize/SanitizeSessionsCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ public function __construct(protected Connection $database)
parent::__construct();
}

/**
* @return mixed
*/
public function getDatabase()
{
return $this->database;
}


/**
* Sanitize sessions from the DB.
*/
#[CLI\Hook(type: HookManager::POST_COMMAND_HOOK, target: SanitizeCommands::SANITIZE)]
public function sanitize($result, CommandData $commandData): void
{
$this->getDatabase()->truncate('sessions')->execute();
$this->logger()->success(dt('Sessions table truncated.'));
if ($this->applies()) {
$this->database->truncate('sessions')->execute();
$this->logger()->success(dt('Sessions table truncated.'));
}
}

#[CLI\Hook(type: HookManager::ON_EVENT, target: SanitizeCommands::CONFIRMS)]
public function messages(&$messages, InputInterface $input): void
{
$messages[] = dt('Truncate sessions table.');
if ($this->applies()) {
$messages[] = dt('Truncate sessions table.');
}
}

private function applies(): bool
{
return $this->database->schema()->tableExists('sessions');
}
}