‪TYPO3CMS  10.4
AbstractPlatform.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
28 {
32  protected ‪$messageQueue;
33 
37  protected const ‪SCHEMA_NAME_MAX_LENGTH = 64;
38 
39  public function ‪__construct()
40  {
41  $this->messageQueue = new ‪FlashMessageQueue('install-database-check-platform');
42  }
43 
44  public function ‪getMessageQueue(): ‪FlashMessageQueue
45  {
47  }
48 
54  public function ‪getStatus(): ‪FlashMessageQueue
55  {
57  }
58 
65  public static function ‪isValidDatabaseName(string $databaseName): bool
66  {
67  return strlen($databaseName) <= static::SCHEMA_NAME_MAX_LENGTH && preg_match('/^[a-zA-Z0-9\$_]*$/', $databaseName);
68  }
69 
70  protected function ‪checkDatabaseName(‪Connection $connection): void
71  {
72  if (static::isValidDatabaseName($connection->getDatabase())) {
73  return;
74  }
75 
76  $this->messageQueue->enqueue(
77  new ‪FlashMessage(
78  'The given database name must not be longer than ' . static::SCHEMA_NAME_MAX_LENGTH . ' characters'
79  . ' and consist solely of basic latin letters (a-z), digits (0-9), dollar signs ($)'
80  . ' and underscores (_).',
81  'Database name not valid',
83  )
84  );
85  }
86 }
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\getStatus
‪FlashMessageQueue getStatus()
Definition: AbstractPlatform.php:53
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\SCHEMA_NAME_MAX_LENGTH
‪const SCHEMA_NAME_MAX_LENGTH
Definition: AbstractPlatform.php:36
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\checkDatabaseName
‪checkDatabaseName(Connection $connection)
Definition: AbstractPlatform.php:69
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform
Definition: AbstractPlatform.php:28
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform
Definition: AbstractPlatform.php:18
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\isValidDatabaseName
‪static bool isValidDatabaseName(string $databaseName)
Definition: AbstractPlatform.php:64
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\getMessageQueue
‪getMessageQueue()
Definition: AbstractPlatform.php:43
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\PlatformCheckInterface
Definition: PlatformCheckInterface.php:27
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\$messageQueue
‪FlashMessageQueue $messageQueue
Definition: AbstractPlatform.php:31
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:36
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\AbstractPlatform\__construct
‪__construct()
Definition: AbstractPlatform.php:38
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:24
‪TYPO3\CMS\Core\Messaging\FlashMessageQueue
Definition: FlashMessageQueue.php:29
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:31