diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-12-04 18:43:02 +0100 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2018-12-05 17:53:42 +0000 |
commit | 9838c91a5cf74d5e8dcd8debfccb8bc3c13a016f (patch) | |
tree | c07cbdf805c977f6ac5523cb004246ff6b4cce64 /settings/Controller/CheckSetupController.php | |
parent | bdeaff0790eb8aae3e2942b1af42e4ccde83e9ba (diff) | |
download | nextcloud-server-9838c91a5cf74d5e8dcd8debfccb8bc3c13a016f.tar.gz nextcloud-server-9838c91a5cf74d5e8dcd8debfccb8bc3c13a016f.zip |
Add setup check for pending bigint conversion
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings/Controller/CheckSetupController.php')
-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(), ] ); } |