Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 287 files
5 changes: 5 additions & 0 deletions build/stubs/SensitiveParameter.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

#[\Attribute(Attribute::TARGET_PARAMETER)]
class SensitiveParameter {
}
3 changes: 0 additions & 3 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,12 @@
'OC\\DB\\MissingColumnInformation' => $baseDir . '/lib/private/DB/MissingColumnInformation.php',
'OC\\DB\\MissingIndexInformation' => $baseDir . '/lib/private/DB/MissingIndexInformation.php',
'OC\\DB\\MissingPrimaryKeyInformation' => $baseDir . '/lib/private/DB/MissingPrimaryKeyInformation.php',
'OC\\DB\\MySQLMigrator' => $baseDir . '/lib/private/DB/MySQLMigrator.php',
'OC\\DB\\MySqlTools' => $baseDir . '/lib/private/DB/MySqlTools.php',
'OC\\DB\\OCSqlitePlatform' => $baseDir . '/lib/private/DB/OCSqlitePlatform.php',
'OC\\DB\\ObjectParameter' => $baseDir . '/lib/private/DB/ObjectParameter.php',
'OC\\DB\\OracleConnection' => $baseDir . '/lib/private/DB/OracleConnection.php',
'OC\\DB\\OracleMigrator' => $baseDir . '/lib/private/DB/OracleMigrator.php',
'OC\\DB\\PgSqlTools' => $baseDir . '/lib/private/DB/PgSqlTools.php',
'OC\\DB\\PostgreSqlMigrator' => $baseDir . '/lib/private/DB/PostgreSqlMigrator.php',
'OC\\DB\\PreparedStatement' => $baseDir . '/lib/private/DB/PreparedStatement.php',
'OC\\DB\\QueryBuilder\\CompositeExpression' => $baseDir . '/lib/private/DB/QueryBuilder/CompositeExpression.php',
'OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder' => $baseDir . '/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php',
Expand Down Expand Up @@ -1594,7 +1592,6 @@
'OC\\Repair\\RepairDavShares' => $baseDir . '/lib/private/Repair/RepairDavShares.php',
'OC\\Repair\\RepairInvalidShares' => $baseDir . '/lib/private/Repair/RepairInvalidShares.php',
'OC\\Repair\\RepairMimeTypes' => $baseDir . '/lib/private/Repair/RepairMimeTypes.php',
'OC\\Repair\\SqliteAutoincrement' => $baseDir . '/lib/private/Repair/SqliteAutoincrement.php',
'OC\\RichObjectStrings\\Validator' => $baseDir . '/lib/private/RichObjectStrings/Validator.php',
'OC\\Route\\CachingRouter' => $baseDir . '/lib/private/Route/CachingRouter.php',
'OC\\Route\\Route' => $baseDir . '/lib/private/Route/Route.php',
Expand Down
3 changes: 0 additions & 3 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,12 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\DB\\MissingColumnInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingColumnInformation.php',
'OC\\DB\\MissingIndexInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingIndexInformation.php',
'OC\\DB\\MissingPrimaryKeyInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingPrimaryKeyInformation.php',
'OC\\DB\\MySQLMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/MySQLMigrator.php',
'OC\\DB\\MySqlTools' => __DIR__ . '/../../..' . '/lib/private/DB/MySqlTools.php',
'OC\\DB\\OCSqlitePlatform' => __DIR__ . '/../../..' . '/lib/private/DB/OCSqlitePlatform.php',
'OC\\DB\\ObjectParameter' => __DIR__ . '/../../..' . '/lib/private/DB/ObjectParameter.php',
'OC\\DB\\OracleConnection' => __DIR__ . '/../../..' . '/lib/private/DB/OracleConnection.php',
'OC\\DB\\OracleMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/OracleMigrator.php',
'OC\\DB\\PgSqlTools' => __DIR__ . '/../../..' . '/lib/private/DB/PgSqlTools.php',
'OC\\DB\\PostgreSqlMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/PostgreSqlMigrator.php',
'OC\\DB\\PreparedStatement' => __DIR__ . '/../../..' . '/lib/private/DB/PreparedStatement.php',
'OC\\DB\\QueryBuilder\\CompositeExpression' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/CompositeExpression.php',
'OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php',
Expand Down Expand Up @@ -1627,7 +1625,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Repair\\RepairDavShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairDavShares.php',
'OC\\Repair\\RepairInvalidShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairInvalidShares.php',
'OC\\Repair\\RepairMimeTypes' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairMimeTypes.php',
'OC\\Repair\\SqliteAutoincrement' => __DIR__ . '/../../..' . '/lib/private/Repair/SqliteAutoincrement.php',
'OC\\RichObjectStrings\\Validator' => __DIR__ . '/../../..' . '/lib/private/RichObjectStrings/Validator.php',
'OC\\Route\\CachingRouter' => __DIR__ . '/../../..' . '/lib/private/Route/CachingRouter.php',
'OC\\Route\\Route' => __DIR__ . '/../../..' . '/lib/private/Route/Route.php',
Expand Down
5 changes: 0 additions & 5 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Schema;
Expand Down Expand Up @@ -600,10 +599,6 @@ private function getMigrator() {
return new SQLiteMigrator($this, $config, $dispatcher);
} elseif ($platform instanceof OraclePlatform) {
return new OracleMigrator($this, $config, $dispatcher);
} elseif ($platform instanceof MySQLPlatform) {
return new MySQLMigrator($this, $config, $dispatcher);
} elseif ($platform instanceof PostgreSQL94Platform) {
return new PostgreSqlMigrator($this, $config, $dispatcher);
} else {
return new Migrator($this, $config, $dispatcher);
}
Expand Down
22 changes: 11 additions & 11 deletions lib/private/DB/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaDiff;
use Doctrine\DBAL\Types\StringType;
Expand Down Expand Up @@ -75,7 +74,7 @@ public function generateChangeScript(Schema $targetSchema) {
$schemaDiff = $this->getDiff($targetSchema, $this->connection);

$script = '';
$sqls = $schemaDiff->toSql($this->connection->getDatabasePlatform());
$sqls = $this->connection->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff);
foreach ($sqls as $sql) {
$script .= $this->convertStatementToScript($sql);
}
Expand All @@ -95,18 +94,20 @@ public function createSchema() {
}
return preg_match($filterExpression, $asset) === 1;
});
return $this->connection->getSchemaManager()->createSchema();
return $this->connection->createSchemaManager()->introspectSchema();
}

/**
* @return SchemaDiff
*/
protected function getDiff(Schema $targetSchema, Connection $connection) {
// adjust varchar columns with a length higher then getVarcharMaxLength to clob
// Adjust STRING columns with a length higher than 4000 to TEXT (clob)
// for consistency between the supported databases and
// old vs. new installations.
foreach ($targetSchema->getTables() as $table) {
foreach ($table->getColumns() as $column) {
if ($column->getType() instanceof StringType) {
if ($column->getLength() > $connection->getDatabasePlatform()->getVarcharMaxLength()) {
if ($column->getLength() > 4000) {
$column->setType(Type::getType('text'));
$column->setLength(null);
}
Expand All @@ -122,7 +123,7 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
}
return preg_match($filterExpression, $asset) === 1;
});
$sourceSchema = $connection->getSchemaManager()->createSchema();
$sourceSchema = $connection->createSchemaManager()->introspectSchema();

// remove tables we don't know about
foreach ($sourceSchema->getTables() as $table) {
Expand All @@ -137,9 +138,8 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
}
}

/** @psalm-suppress InternalMethod */
$comparator = new Comparator();
return $comparator->compare($sourceSchema, $targetSchema);
$comparator = $connection->createSchemaManager()->createComparator();
return $comparator->compareSchemas($sourceSchema, $targetSchema);
}

/**
Expand All @@ -155,7 +155,7 @@ protected function applySchema(Schema $targetSchema, Connection $connection = nu
if (!$connection->getDatabasePlatform() instanceof MySQLPlatform) {
$connection->beginTransaction();
}
$sqls = $schemaDiff->toSql($connection->getDatabasePlatform());
$sqls = $connection->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff);
$step = 0;
foreach ($sqls as $sql) {
$this->emit($sql, $step++, count($sqls));
Expand All @@ -178,7 +178,7 @@ protected function convertStatementToScript($statement) {
}

protected function getFilterExpression() {
return '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/';
return '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_'), '/') . '/';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷

}

protected function emit(string $sql, int $step, int $max): void {
Expand Down
50 changes: 0 additions & 50 deletions lib/private/DB/MySQLMigrator.php

This file was deleted.

Loading