messageQueue = new FlashMessageQueue('install-database-check-platform'); } public function getMessageQueue(): FlashMessageQueue { return $this->messageQueue; } /** * Get all status information as array with status objects */ public function getStatus(): FlashMessageQueue { return $this->messageQueue; } /** * Validate the database name */ public static function isValidDatabaseName(string $databaseName): bool { return strlen($databaseName) <= static::SCHEMA_NAME_MAX_LENGTH && preg_match('/^[a-zA-Z0-9\$_]*$/', $databaseName); } protected function checkDatabaseName(Connection $connection): void { if (static::isValidDatabaseName((string)$connection->getDatabase())) { return; } $this->messageQueue->enqueue( new FlashMessage( 'The given database name must not be longer than ' . static::SCHEMA_NAME_MAX_LENGTH . ' characters' . ' and consist solely of basic latin letters (a-z), digits (0-9), dollar signs ($)' . ' and underscores (_).', 'Database name not valid', ContextualFeedbackSeverity::ERROR ) ); } }