Internal: Migration: Verify var/theme exists before migrate it

pull/5649/head
Angel Fernando Quiroz Campos 1 year ago
parent 3b82ae9549
commit f957829c8f
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 15
      src/CoreBundle/Migrations/Schema/V200/Version20240704185300.php

@ -30,20 +30,29 @@ class Version20240704185300 extends AbstractMigrationChamilo
$finder = new Finder();
$filesystem = new Filesystem();
if (!$filesystem->exists($themeDirectory)) {
return;
}
$finder->directories()->in($themeDirectory)->depth('== 0');
foreach ($finder as $entry) {
if ($entry->isDir()) {
error_log(
$this->write(
sprintf(
"Moving theme directory: %s to %s",
$entry->getRealPath(),
$themesDirectory.'/'
$themesDirectory.DIRECTORY_SEPARATOR
)
);
$filesystem->rename($entry->getRealPath(), $themesDirectory.'/'.$entry->getRelativePathname());
$filesystem->rename(
$entry->getRealPath(),
$themesDirectory.DIRECTORY_SEPARATOR.$entry->getRelativePathname(),
true
);
}
}
$filesystem->remove($themeDirectory);
}
}

Loading…
Cancel
Save