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