Skip to content

Commit

Permalink
Pass the filesystem as dependency and remove the Contao 3 migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Dec 7, 2020
1 parent 51fb5c7 commit 5034731
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 192 deletions.
98 changes: 0 additions & 98 deletions core-bundle/src/Migration/Version303/Version330Update.php

This file was deleted.

81 changes: 0 additions & 81 deletions core-bundle/src/Migration/Version305/Version350Update.php

This file was deleted.

10 changes: 8 additions & 2 deletions core-bundle/src/Migration/Version408/Version480Update.php
Expand Up @@ -29,14 +29,20 @@ class Version480Update extends AbstractMigration
*/
private $connection;

/**
* @var Filesystem
*/
private $filesystem;

/**
* @var string
*/
private $projectDir;

public function __construct(Connection $connection, string $projectDir)
public function __construct(Connection $connection, Filesystem $filesystem, string $projectDir)
{
$this->connection = $connection;
$this->filesystem = $filesystem;
$this->projectDir = $projectDir;
}

Expand Down Expand Up @@ -154,7 +160,7 @@ public function run(): MigrationResult

// Convert the important part to relative values as fractions
while (false !== ($file = $statement->fetch(\PDO::FETCH_OBJ))) {
if (!(new Filesystem())->exists($this->projectDir.'/'.$file->path) || is_dir($this->projectDir.'/'.$file->path)) {
if (!$this->filesystem->exists($this->projectDir.'/'.$file->path) || is_dir($this->projectDir.'/'.$file->path)) {
continue;
}

Expand Down
9 changes: 1 addition & 8 deletions core-bundle/src/Resources/config/migrations.yml
Expand Up @@ -4,14 +4,6 @@ services:

Contao\CoreBundle\Migration\MigrationCollection: ~

Contao\CoreBundle\Migration\Version303\Version330Update:
arguments:
- '@database_connection'

Contao\CoreBundle\Migration\Version305\Version350Update:
arguments:
- '@database_connection'

Contao\CoreBundle\Migration\Version400\Version400Update:
arguments:
- '@database_connection'
Expand Down Expand Up @@ -52,6 +44,7 @@ services:
Contao\CoreBundle\Migration\Version408\Version480Update:
arguments:
- '@database_connection'
- '@filesystem'
- '%kernel.project_dir%'

Contao\CoreBundle\Migration\Version409\CeAccessMigration:
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Expand Up @@ -27,9 +27,6 @@ parameters:
# Ignore the missing TL_SCRIPT constant in the InitializeController class
- '#Constant TL_SCRIPT not found\.#'

# Ignore the missing array_insert function in the Version330Update class
- '#Function array_insert not found\.#'

# Ignore backwards compatibility layers when preferring lowest dependencies
- '#Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required\.#'

Expand Down

0 comments on commit 5034731

Please sign in to comment.