Skip to content

Commit

Permalink
Internal: Name properly variable in migration about style themes - re…
Browse files Browse the repository at this point in the history
…fs BT#21621
  • Loading branch information
AngelFQC committed Jun 29, 2024
1 parent cf2def1 commit 4cffd26
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/CoreBundle/Migrations/Schema/V200/Version20231110194300.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;

final class Version20231110194300 extends AbstractMigrationChamilo
Expand All @@ -17,12 +18,9 @@ public function getDescription(): string
return 'Copy custom theme folder to assets and update webpack.config';
}

public function up(Schema $schema): void
private function getDefaultThemeNames(): array
{
$kernel = $this->container->get('kernel');
$rootPath = $kernel->getProjectDir();

$customThemesFolders = [
return [
'academica',
'chamilo',
'chamilo_red',
Expand Down Expand Up @@ -52,6 +50,14 @@ public function up(Schema $schema): void
'simplex',
'tasty_olive',
];
}

public function up(Schema $schema): void
{
$kernel = $this->container->get('kernel');
$rootPath = $kernel->getProjectDir();

$defaulThemesFolders = $this->getDefaultThemeNames();

$sourceDir = $rootPath.'/app/Resources/public/css/themes';
$destinationDir = $rootPath.'/assets/css/themes/';
Expand All @@ -67,7 +73,7 @@ public function up(Schema $schema): void
foreach ($finder as $folder) {
$folderName = $folder->getRelativePathname();

if (!\in_array($folderName, $customThemesFolders, true)) {
if (!\in_array($folderName, $defaulThemesFolders, true)) {
$sourcePath = $folder->getRealPath();
$destinationPath = $destinationDir.$folderName;

Expand Down

0 comments on commit 4cffd26

Please sign in to comment.