From 51758117a79b6852f662b5ebed98047e10861231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 14 Nov 2023 16:57:32 +0100 Subject: [PATCH 1/2] Migrate database pending bigint conversions check to new API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../composer/composer/autoload_classmap.php | 1 + .../composer/composer/autoload_static.php | 1 + apps/settings/lib/AppInfo/Application.php | 2 + .../lib/Controller/CheckSetupController.php | 56 ----------- .../DatabasePendingBigIntConversions.php | 99 +++++++++++++++++++ .../Controller/CheckSetupControllerTest.php | 29 ------ core/Command/Db/ConvertFilecacheBigInt.php | 8 +- core/js/setupchecks.js | 12 --- core/js/tests/specs/setupchecksSpec.js | 17 ---- 9 files changed, 108 insertions(+), 117 deletions(-) create mode 100644 apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php index 6dbc2518219c8..9480ba0f55760 100644 --- a/apps/settings/composer/composer/autoload_classmap.php +++ b/apps/settings/composer/composer/autoload_classmap.php @@ -78,6 +78,7 @@ 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingColumns' => $baseDir . '/../lib/SetupChecks/DatabaseHasMissingColumns.php', 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingIndices' => $baseDir . '/../lib/SetupChecks/DatabaseHasMissingIndices.php', 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingPrimaryKeys' => $baseDir . '/../lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php', + 'OCA\\Settings\\SetupChecks\\DatabasePendingBigIntConversions' => $baseDir . '/../lib/SetupChecks/DatabasePendingBigIntConversions.php', 'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => $baseDir . '/../lib/SetupChecks/DefaultPhoneRegionSet.php', 'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => $baseDir . '/../lib/SetupChecks/EmailTestSuccessful.php', 'OCA\\Settings\\SetupChecks\\FileLocking' => $baseDir . '/../lib/SetupChecks/FileLocking.php', diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php index c05f58ac45917..b3f7921340860 100644 --- a/apps/settings/composer/composer/autoload_static.php +++ b/apps/settings/composer/composer/autoload_static.php @@ -93,6 +93,7 @@ class ComposerStaticInitSettings 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingColumns' => __DIR__ . '/..' . '/../lib/SetupChecks/DatabaseHasMissingColumns.php', 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingIndices' => __DIR__ . '/..' . '/../lib/SetupChecks/DatabaseHasMissingIndices.php', 'OCA\\Settings\\SetupChecks\\DatabaseHasMissingPrimaryKeys' => __DIR__ . '/..' . '/../lib/SetupChecks/DatabaseHasMissingPrimaryKeys.php', + 'OCA\\Settings\\SetupChecks\\DatabasePendingBigIntConversions' => __DIR__ . '/..' . '/../lib/SetupChecks/DatabasePendingBigIntConversions.php', 'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => __DIR__ . '/..' . '/../lib/SetupChecks/DefaultPhoneRegionSet.php', 'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => __DIR__ . '/..' . '/../lib/SetupChecks/EmailTestSuccessful.php', 'OCA\\Settings\\SetupChecks\\FileLocking' => __DIR__ . '/..' . '/../lib/SetupChecks/FileLocking.php', diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index d96715a9ecaa3..dad002af59cc6 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -53,6 +53,7 @@ use OCA\Settings\SetupChecks\DatabaseHasMissingColumns; use OCA\Settings\SetupChecks\DatabaseHasMissingIndices; use OCA\Settings\SetupChecks\DatabaseHasMissingPrimaryKeys; +use OCA\Settings\SetupChecks\DatabasePendingBigIntConversions; use OCA\Settings\SetupChecks\DefaultPhoneRegionSet; use OCA\Settings\SetupChecks\EmailTestSuccessful; use OCA\Settings\SetupChecks\FileLocking; @@ -166,6 +167,7 @@ public function register(IRegistrationContext $context): void { $context->registerSetupCheck(DatabaseHasMissingColumns::class); $context->registerSetupCheck(DatabaseHasMissingIndices::class); $context->registerSetupCheck(DatabaseHasMissingPrimaryKeys::class); + $context->registerSetupCheck(DatabasePendingBigIntConversions::class); $context->registerSetupCheck(DefaultPhoneRegionSet::class); $context->registerSetupCheck(EmailTestSuccessful::class); $context->registerSetupCheck(FileLocking::class); diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 7bb2c8319c2e3..07ab12426bb0d 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -50,8 +50,6 @@ use GuzzleHttp\Exception\ClientException; use OC; use OC\AppFramework\Http; -use OC\DB\Connection; -use OC\DB\SchemaWrapper; use OC\IntegrityCheck\Checker; use OCP\App\IAppManager; use OCP\AppFramework\Controller; @@ -59,12 +57,10 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; -use OCP\DB\Types; use OCP\EventDispatcher\IEventDispatcher; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IDateTimeFormatter; -use OCP\IDBConnection; use OCP\IL10N; use OCP\IRequest; use OCP\IServerContainer; @@ -91,16 +87,12 @@ class CheckSetupController extends Controller { private $logger; /** @var IEventDispatcher */ private $dispatcher; - /** @var Connection */ - private $db; /** @var ILockingProvider */ private $lockingProvider; /** @var IDateTimeFormatter */ private $dateTimeFormatter; /** @var IniGetWrapper */ private $iniGetWrapper; - /** @var IDBConnection */ - private $connection; /** @var ITempManager */ private $tempManager; /** @var IManager */ @@ -120,11 +112,9 @@ public function __construct($AppName, Checker $checker, LoggerInterface $logger, IEventDispatcher $dispatcher, - Connection $db, ILockingProvider $lockingProvider, IDateTimeFormatter $dateTimeFormatter, IniGetWrapper $iniGetWrapper, - IDBConnection $connection, ITempManager $tempManager, IManager $manager, IAppManager $appManager, @@ -139,11 +129,9 @@ public function __construct($AppName, $this->checker = $checker; $this->logger = $logger; $this->dispatcher = $dispatcher; - $this->db = $db; $this->lockingProvider = $lockingProvider; $this->dateTimeFormatter = $dateTimeFormatter; $this->iniGetWrapper = $iniGetWrapper; - $this->connection = $connection; $this->tempManager = $tempManager; $this->manager = $manager; $this->appManager = $appManager; @@ -528,49 +516,6 @@ protected function isMysqlUsedWithoutUTF8MB4(): bool { return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false); } - protected function hasBigIntConversionPendingColumns(): array { - // copy of ConvertFilecacheBigInt::getColumnsByTable() - $tables = [ - 'activity' => ['activity_id', 'object_id'], - 'activity_mq' => ['mail_id'], - 'authtoken' => ['id'], - 'bruteforce_attempts' => ['id'], - 'federated_reshares' => ['share_id'], - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], - 'filecache_extended' => ['fileid'], - 'files_trash' => ['auto_id'], - 'file_locks' => ['id'], - 'file_metadata' => ['id'], - 'jobs' => ['id'], - 'mimetypes' => ['id'], - 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], - 'share_external' => ['id', 'parent'], - 'storages' => ['numeric_id'], - ]; - - $schema = new SchemaWrapper($this->db); - $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; - $pendingColumns = []; - - foreach ($tables as $tableName => $columns) { - if (!$schema->hasTable($tableName)) { - continue; - } - - $table = $schema->getTable($tableName); - foreach ($columns as $columnName) { - $column = $table->getColumn($columnName); - $isAutoIncrement = $column->getAutoincrement(); - $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; - if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { - $pendingColumns[] = $tableName . '.' . $columnName; - } - } - } - - return $pendingColumns; - } - protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool { $objectStore = $this->config->getSystemValue('objectstore', null); $objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null); @@ -634,7 +579,6 @@ public function check() { 'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(), 'isImagickEnabled' => $this->isImagickEnabled(), 'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(), - 'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(), 'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(), 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(), 'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'), diff --git a/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php new file mode 100644 index 0000000000000..57dcbd689fc74 --- /dev/null +++ b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php @@ -0,0 +1,99 @@ + + * + * @author Côme Chilliet + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +namespace OCA\Settings\SetupChecks; + +use OC\Core\Command\Db\ConvertFilecacheBigInt; +use OC\DB\Connection; +use OC\DB\SchemaWrapper; +use OCP\DB\Types; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\IDBConnection; +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\SetupCheck\ISetupCheck; +use OCP\SetupCheck\SetupResult; + +class DatabasePendingBigIntConversions implements ISetupCheck { + public function __construct( + private IL10N $l10n, + private IURLGenerator $urlGenerator, + private Connection $db, + private IEventDispatcher $dispatcher, + private IDBConnection $connection, + ) { + } + + public function getCategory(): string { + return 'database'; + } + + public function getName(): string { + return $this->l10n->t('Database pending bigint migrations'); + } + + protected function getBigIntConversionPendingColumns(): array { + $tables = ConvertFilecacheBigInt::getColumnsByTable(); + + $schema = new SchemaWrapper($this->db); + $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; + $pendingColumns = []; + + foreach ($tables as $tableName => $columns) { + if (!$schema->hasTable($tableName)) { + continue; + } + + $table = $schema->getTable($tableName); + foreach ($columns as $columnName) { + $column = $table->getColumn($columnName); + $isAutoIncrement = $column->getAutoincrement(); + $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; + if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { + $pendingColumns[] = $tableName . '.' . $columnName; + } + } + } + + return $pendingColumns; + } + + public function run(): SetupResult { + $pendingColumns = $this->getBigIntConversionPendingColumns(); + if (empty($pendingColumns)) { + return SetupResult::success('None'); + } else { + $list = ''; + foreach ($pendingColumns as $pendingColumn) { + $list .= "\n$pendingColumn"; + } + $list .= "\n"; + return SetupResult::info( + $this->l10n->t('Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running "occ db:convert-filecache-bigint" those pending changes could be applied manually. This operation needs to be made while the instance is offline.').$list, + $this->urlGenerator->linkToDocs('admin-bigint-conversion') + ); + } + } +} diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 65ed93523c741..bd3ed270cdd68 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -35,9 +35,7 @@ namespace OCA\Settings\Tests\Controller; use bantu\IniGetWrapper\IniGetWrapper; -use Doctrine\DBAL\Platforms\SqlitePlatform; use OC; -use OC\DB\Connection; use OC\IntegrityCheck\Checker; use OCA\Settings\Controller\CheckSetupController; use OCP\App\IAppManager; @@ -49,7 +47,6 @@ use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IDateTimeFormatter; -use OCP\IDBConnection; use OCP\IL10N; use OCP\IRequest; use OCP\IServerContainer; @@ -88,16 +85,12 @@ class CheckSetupControllerTest extends TestCase { private $checker; /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ private $dispatcher; - /** @var Connection|\PHPUnit\Framework\MockObject\MockObject */ - private $db; /** @var ILockingProvider|\PHPUnit\Framework\MockObject\MockObject */ private $lockingProvider; /** @var IDateTimeFormatter|\PHPUnit\Framework\MockObject\MockObject */ private $dateTimeFormatter; /** @var IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */ private $iniGetWrapper; - /** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */ - private $connection; /** @var ITempManager|\PHPUnit\Framework\MockObject\MockObject */ private $tempManager; /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ @@ -138,13 +131,9 @@ protected function setUp(): void { $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker') ->disableOriginalConstructor()->getMock(); $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); - $this->db = $this->getMockBuilder(Connection::class) - ->disableOriginalConstructor()->getMock(); $this->lockingProvider = $this->getMockBuilder(ILockingProvider::class)->getMock(); $this->dateTimeFormatter = $this->getMockBuilder(IDateTimeFormatter::class)->getMock(); $this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)->getMock(); - $this->connection = $this->getMockBuilder(IDBConnection::class) - ->disableOriginalConstructor()->getMock(); $this->tempManager = $this->getMockBuilder(ITempManager::class)->getMock(); $this->notificationManager = $this->getMockBuilder(IManager::class)->getMock(); $this->appManager = $this->createMock(IAppManager::class); @@ -161,11 +150,9 @@ protected function setUp(): void { $this->checker, $this->logger, $this->dispatcher, - $this->db, $this->lockingProvider, $this->dateTimeFormatter, $this->iniGetWrapper, - $this->connection, $this->tempManager, $this->notificationManager, $this->appManager, @@ -183,7 +170,6 @@ protected function setUp(): void { 'getAppDirsWithDifferentOwner', 'isImagickEnabled', 'areWebauthnExtensionsEnabled', - 'hasBigIntConversionPendingColumns', 'isMysqlUsedWithoutUTF8MB4', 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed', ])->getMock(); @@ -262,11 +248,6 @@ public function testCheck() { ->method('areWebauthnExtensionsEnabled') ->willReturn(false); - $this->checkSetupController - ->expects($this->once()) - ->method('hasBigIntConversionPendingColumns') - ->willReturn([]); - $this->checkSetupController ->expects($this->once()) ->method('isMysqlUsedWithoutUTF8MB4') @@ -307,9 +288,6 @@ public function testCheck() { } return ''; }); - $sqlitePlatform = $this->getMockBuilder(SqlitePlatform::class)->getMock(); - $this->connection->method('getDatabasePlatform') - ->willReturn($sqlitePlatform); $expected = new DataResponse( [ @@ -332,7 +310,6 @@ public function testCheck() { 'appDirsWithDifferentOwner' => [], 'isImagickEnabled' => false, 'areWebauthnExtensionsEnabled' => false, - 'pendingBigIntConversionColumns' => [], 'isMysqlUsedWithoutUTF8MB4' => false, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true, 'reverseProxyGeneratedURL' => 'https://server/index.php', @@ -357,11 +334,9 @@ public function testGetCurlVersion() { $this->checker, $this->logger, $this->dispatcher, - $this->db, $this->lockingProvider, $this->dateTimeFormatter, $this->iniGetWrapper, - $this->connection, $this->tempManager, $this->notificationManager, $this->appManager, @@ -1083,11 +1058,9 @@ public function testIsMysqlUsedWithoutUTF8MB4(string $db, bool $useUTF8MB4, bool $this->checker, $this->logger, $this->dispatcher, - $this->db, $this->lockingProvider, $this->dateTimeFormatter, $this->iniGetWrapper, - $this->connection, $this->tempManager, $this->notificationManager, $this->appManager, @@ -1136,11 +1109,9 @@ public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $m $this->checker, $this->logger, $this->dispatcher, - $this->db, $this->lockingProvider, $this->dateTimeFormatter, $this->iniGetWrapper, - $this->connection, $this->tempManager, $this->notificationManager, $this->appManager, diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index d73058767f2bd..44cd81cd7ebfb 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -54,8 +54,10 @@ protected function configure() { ->setDescription('Convert the ID columns of the filecache to BigInt'); } - protected function getColumnsByTable() { - // also update in CheckSetupController::hasBigIntConversionPendingColumns() + /** + * @return array + */ + public static function getColumnsByTable(): array { return [ 'activity' => ['activity_id', 'object_id'], 'activity_mq' => ['mail_id'], @@ -80,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform; $updates = []; - $tables = $this->getColumnsByTable(); + $tables = static::getColumnsByTable(); foreach ($tables as $tableName => $columns) { if (!$schema->hasTable($tableName)) { continue; diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 24fec85aeb3e0..c947f3c30e742 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -282,18 +282,6 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }) } - if (data.pendingBigIntConversionColumns.length > 0) { - var listOfPendingBigIntConversionColumns = ""; - data.pendingBigIntConversionColumns.forEach(function(element){ - listOfPendingBigIntConversionColumns += '
  • ' + element + '
  • '; - }); - messages.push({ - msg: t('core', 'Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running "occ db:convert-filecache-bigint" those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read {linkstart}the documentation page about this ↗{linkend}.') - .replace('{linkstart}', '') - .replace('{linkend}', '') + '
      ' + listOfPendingBigIntConversionColumns + '
    ', - type: OC.SetupChecks.MESSAGE_TYPE_INFO - }) - } if (data.isSqliteUsed) { messages.push({ msg: t('core', 'SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend.') + ' ' + t('core', 'This is particularly recommended when using the desktop client for file synchronisation.') + ' ' + diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 9020a895af557..5184b3e8c0d80 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -236,7 +236,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -286,7 +285,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -336,7 +334,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -386,7 +383,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -436,7 +432,6 @@ describe('OC.SetupChecks tests', function() { ], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -485,7 +480,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -534,7 +528,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -614,7 +607,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -669,7 +661,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -717,7 +708,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: true, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -769,7 +759,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', @@ -818,7 +807,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', @@ -864,7 +852,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false, reverseProxyGeneratedURL: 'https://server', @@ -913,7 +900,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: false, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -962,7 +948,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: false, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -1010,7 +995,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', @@ -1065,7 +1049,6 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [], isImagickEnabled: true, areWebauthnExtensionsEnabled: true, - pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, reverseProxyGeneratedURL: 'https://server', From 60bc97e543c3358100fa0b4d1d7f0811cc9c0563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 16 Nov 2023 11:55:01 +0100 Subject: [PATCH 2/2] Migrate away from deprecated doctrine/dbal getName function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../lib/SetupChecks/DatabasePendingBigIntConversions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php index 57dcbd689fc74..35143f74e9489 100644 --- a/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php +++ b/apps/settings/lib/SetupChecks/DatabasePendingBigIntConversions.php @@ -25,10 +25,10 @@ */ namespace OCA\Settings\SetupChecks; +use Doctrine\DBAL\Types\BigIntType; use OC\Core\Command\Db\ConvertFilecacheBigInt; use OC\DB\Connection; use OC\DB\SchemaWrapper; -use OCP\DB\Types; use OCP\EventDispatcher\IEventDispatcher; use OCP\IDBConnection; use OCP\IL10N; @@ -71,7 +71,7 @@ protected function getBigIntConversionPendingColumns(): array { $column = $table->getColumn($columnName); $isAutoIncrement = $column->getAutoincrement(); $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; - if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { + if (!($column->getType() instanceof BigIntType) && !$isAutoIncrementOnSqlite) { $pendingColumns[] = $tableName . '.' . $columnName; } }