diff --git a/src/Biopen/CoreBundle/Command/MigrationCommand.php b/src/Biopen/CoreBundle/Command/MigrationCommand.php index a81cbfc7fc354df5bea60ad8b7e4531ce15b5a0b..2653cc7214aa1c2cc4cceb3b782bc2887a99c9e6 100644 --- a/src/Biopen/CoreBundle/Command/MigrationCommand.php +++ b/src/Biopen/CoreBundle/Command/MigrationCommand.php @@ -48,6 +48,18 @@ class MigrationCommand extends GoGoAbstractCommand } $asyncService = $this->getContainer()->get('biopen.async'); + if (count($this->commands) > $migrationState->getCommandsIndex()) { + $commandsToRun = array_slice($this->commands, $migrationState->getCommandsIndex()); + foreach($dbs as $db) { + foreach($commandsToRun as $command) { + $asyncService->callCommand($command, [], $db); + } + } + $this->log(count($commandsToRun) . " commands to run"); + } else { + $this->log("No commands to run"); + } + if (count($this->messages) > $migrationState->getMessagesIndex()) { $messagesToAdd = array_slice($this->messages, $migrationState->getMessagesIndex()); foreach($dbs as $db) { @@ -62,6 +74,7 @@ class MigrationCommand extends GoGoAbstractCommand } $migrationState->setMigrationIndex(count($this->migrations)); + $migrationState->setCommandsIndex(count($this->commands)); $migrationState->setMessagesIndex(count($this->messages)); $em->flush(); } @@ -72,16 +85,22 @@ class MigrationCommand extends GoGoAbstractCommand return $process->start(); } - // --------------------------------------------------------------- - // DO NOT REMOVE A SINGLE ELEMENT OF THIS ARRAY, ONLY ADD NEW ONES - // --------------------------------------------------------------- + // ----------------------------------------------------------------- + // DO NOT REMOVE A SINGLE ELEMENT OF THOSE ARRAYS, ONLY ADD NEW ONES + // ----------------------------------------------------------------- public $migrations = [ // March 2019 // "db.Category.renameCollection('CategoryGroup')", // "db.Option.renameCollection('Category')" ]; + public $commands = [ + // v2.3.1 + "app:elements:updateJson all" + ]; + public $messages = [ + // v2.3.0 "Un champ <b>Image (url)</b> est maintenant disponible dans la confiugration du formulaire !", "Vous pouvez désormais customizer la popup qui s'affiche au survol d'un marqueur. Allez dans Personnalisation -> Marqueur / Popup", "Nouvelle option pour le menu (Personnalisation -> La Carte -> onglet Menu) : afficher à côté de chaque catégories le nombre d'élements disponible pour cette catégorie" diff --git a/src/Biopen/CoreBundle/DataFixtures/MongoDB/LoadMigrationCommand.php b/src/Biopen/CoreBundle/DataFixtures/MongoDB/LoadMigrationCommand.php index 7519d1a263997510246f3798c39ddd3fa0b33a70..56971085217e94f0fe1034a3b1caeba6e565ee0d 100755 --- a/src/Biopen/CoreBundle/DataFixtures/MongoDB/LoadMigrationCommand.php +++ b/src/Biopen/CoreBundle/DataFixtures/MongoDB/LoadMigrationCommand.php @@ -17,6 +17,7 @@ class LoadMigrationState implements FixtureInterface $migrationState = new MigrationState(); $migrationCommand = new MigrationCommand(); $migrationState->setMigrationIndex(count($migrationCommand->migrations)); + $migrationState->setCommandsIndex(count($migrationCommand->commands)); $migrationState->setMessagesIndex(count($migrationCommand->messages)); $manager->persist($migrationState); $manager->flush(); diff --git a/src/Biopen/CoreBundle/Document/MigrationState.php b/src/Biopen/CoreBundle/Document/MigrationState.php index be2022860860cc153b3c2a3048097070687f6745..09a1524ad8336290a750e4c6a0c7bc97b6c0b548 100644 --- a/src/Biopen/CoreBundle/Document/MigrationState.php +++ b/src/Biopen/CoreBundle/Document/MigrationState.php @@ -18,6 +18,11 @@ class MigrationState */ private $migrationIndex = 0; + /** + * @MongoDB\Field(type="int") + */ + private $commandsIndex = 0; + /** * @MongoDB\Field(type="int") */ @@ -76,4 +81,27 @@ class MigrationState { return $this->messagesIndex; } + + /** + * Set commandsIndex + * + * @param int $commandsIndex + * @return $this + */ + public function setCommandsIndex($commandsIndex) + { + $this->commandsIndex = $commandsIndex; + return $this; + } + + /** + * Get commandsIndex + * + * @return int $commandsIndex + */ + public function getCommandsIndex() + { + if (!$this->commandsIndex) $this->commandsIndex = 0; + return $this->commandsIndex; + } } diff --git a/src/Biopen/GeoDirectoryBundle/Command/UpdateElementsJsonCommand.php b/src/Biopen/GeoDirectoryBundle/Command/UpdateElementsJsonCommand.php index fa810395342d2f604307a504ce29ca43006357d3..77660b941217edf2b662057d59b1b39fbebe3004 100755 --- a/src/Biopen/GeoDirectoryBundle/Command/UpdateElementsJsonCommand.php +++ b/src/Biopen/GeoDirectoryBundle/Command/UpdateElementsJsonCommand.php @@ -38,7 +38,6 @@ class UpdateElementsJsonCommand extends GoGoAbstractCommand $count = $elements->count(); $this->log('Generating json representation for ' . $count . ' elements...'); - $this->log($input->getArgument('ids')); $elemntJsonService = $this->getContainer()->get('biopen.element_json_generator'); $i = 0;