diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-12-04 18:43:02 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-12-05 13:42:31 +0100 |
commit | 17b2827bbf20691dc59721a9c61a225c5fb4e0de (patch) | |
tree | 9d063cd85220c49e9558700b8624379ffa2b3e01 /settings/Controller | |
parent | f57e334f8395e3b5c046b6d28480d798453e4866 (diff) | |
download | nextcloud-server-17b2827bbf20691dc59721a9c61a225c5fb4e0de.tar.gz nextcloud-server-17b2827bbf20691dc59721a9c61a225c5fb4e0de.zip |
Add setup check for pending bigint conversion
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index 4211b9b4c6c..92c2b1b47db 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -34,11 +34,13 @@ use bantu\IniGetWrapper\IniGetWrapper; use DirectoryIterator; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Platforms\SqlitePlatform; +use Doctrine\DBAL\Types\Type; use GuzzleHttp\Exception\ClientException; use OC; use OC\AppFramework\Http; use OC\DB\Connection; use OC\DB\MissingIndexInformation; +use OC\DB\SchemaWrapper; use OC\IntegrityCheck\Checker; use OC\Lock\NoopLockingProvider; use OC\MemoryInfo; @@ -603,6 +605,39 @@ Raw output return $recommendedPHPModules; } + protected function hasBigIntConversionPendingColumns(): array { + // copy of ConvertFilecacheBigInt::getColumnsByTable() + $tables = [ + 'activity' => ['activity_id', 'object_id'], + 'activity_mq' => ['mail_id'], + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], + 'mimetypes' => ['id'], + 'storages' => ['numeric_id'], + ]; + + $schema = new SchemaWrapper($this->db); + $isSqlite = $this->db->getDatabasePlatform() instanceof SqlitePlatform; + $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() !== Type::BIGINT && !$isAutoIncrementOnSqlite) { + $pendingColumns[] = $tableName . '.' . $columnName; + } + } + } + + return $pendingColumns; + } + /** * @return DataResponse */ @@ -643,6 +678,7 @@ Raw output 'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(), 'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(), 'recommendedPHPModules' => $this->hasRecommendedPHPModules(), + 'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(), ] ); } |