‪TYPO3CMS  11.5
Sqlite.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 
25 
30 {
39  {
40  $defaultConnection = GeneralUtility::makeInstance(ConnectionPool::class)
41  ->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
42  if (strpos($defaultConnection->getServerVersion(), 'sqlite') !== 0) {
44  }
45 
46  $this->‪checkDefaultDatabaseCharset($defaultConnection);
47  $this->‪checkDefaultDatabaseServerCharset($defaultConnection);
48  $this->‪checkDatabaseName($defaultConnection);
49 
51  }
57  public function ‪checkDefaultDatabaseCharset(‪Connection $connection): void
58  {
59  // TODO: Implement getDefaultDatabaseCharset() method.
60  }
61 
67  public function ‪checkDefaultDatabaseServerCharset(‪Connection $connection): void
68  {
69  // TODO: Implement getDefaultDatabaseServerCharset() method.
70  }
71 
80  public static function ‪isValidDatabaseName(string $databaseName): bool
81  {
82  return (bool)preg_match('/^[A-Za-z_\/][a-zA-Z0-9\$\/_.-]*$/', $databaseName);
83  }
84 
85  protected function ‪checkDatabaseName(‪Connection $connection): void
86  {
87  if (static::isValidDatabaseName((string)$connection->getDatabase())) {
88  return;
89  }
90 
91  $this->messageQueue->enqueue(
92  new ‪FlashMessage(
93  'The given database name must consist solely of basic latin letters (a-z), digits (0-9)'
94  . ' and underscores (_).',
95  'Database name not valid',
97  )
98  );
99  }
100 }
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite\checkDefaultDatabaseCharset
‪checkDefaultDatabaseCharset(Connection $connection)
Definition: Sqlite.php:57
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite
Definition: Sqlite.php:30
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite\isValidDatabaseName
‪static bool isValidDatabaseName(string $databaseName)
Definition: Sqlite.php:80
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite\checkDatabaseName
‪checkDatabaseName(Connection $connection)
Definition: Sqlite.php:85
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite\getStatus
‪FlashMessageQueue getStatus()
Definition: Sqlite.php:38
‪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\$messageQueue
‪FlashMessageQueue $messageQueue
Definition: AbstractPlatform.php:31
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:38
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:26
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Messaging\FlashMessageQueue
Definition: FlashMessageQueue.php:29
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck\Platform\Sqlite\checkDefaultDatabaseServerCharset
‪checkDefaultDatabaseServerCharset(Connection $connection)
Definition: Sqlite.php:67
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:31