![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/migrations/ |
<?php declare(strict_types=1); namespace Mautic\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\CoreBundle\Doctrine\AbstractMauticMigration; /** * Move config files that contain local config to a folder outside the application data. */ final class Versionzz20230929183000 extends AbstractMauticMigration { public function preUp(Schema $schema): void { [$appConfigDir] = $this->getConfigDirs(); $matches = glob($appConfigDir.'/*local.php'); $this->skipIf( 0 == count($matches), 'There are no local config files to migrate. Skipping the migration.' ); } public function up(Schema $schema): void { $pathsHelper = $this->container->get('mautic.helper.paths'); $appConfigDir = $pathsHelper->getRootPath().'/app/config'; $localConfigDir = $pathsHelper->getVendorRootPath().'/config'; $matches = glob($appConfigDir.'/*local.php'); foreach ($matches as $file) { rename($file, $localConfigDir.'/'.pathinfo($file, PATHINFO_BASENAME)); } } /** * @return string[] */ public function getConfigDirs(): array { $pathsHelper = $this->container->get('mautic.helper.paths'); $appConfigDir = $pathsHelper->getRootPath().'/app/config'; $localConfigDir = $pathsHelper->getVendorRootPath().'/config'; return [$appConfigDir, $localConfigDir]; } }