Skip to content

Commit

Permalink
Account for D11 changes (#5928)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Mar 23, 2024
1 parent a937d4c commit a7f9dcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
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');
}
}

0 comments on commit a7f9dcb

Please sign in to comment.