diff --git a/migration/19.04/migrate.sh b/migration/19.04/migrate.sh index 02acf704f1ff7e8901d439f8bbda4a22b6530f1d..fbe4c9e77fbf35edffe956d9b16a1192350fd01f 100755 --- a/migration/19.04/migrate.sh +++ b/migration/19.04/migrate.sh @@ -1,4 +1,5 @@ #!/bin/sh php ./migrateSendmail.php php ./migrateExport.php +php ./migrateFeature.php diff --git a/migration/19.04/migrateFeature.php b/migration/19.04/migrateFeature.php new file mode 100644 index 0000000000000000000000000000000000000000..a2ebe5d4cd7d1d9c568ef9902962011cec33fd09 --- /dev/null +++ b/migration/19.04/migrateFeature.php @@ -0,0 +1,46 @@ +<?php + +require '../../vendor/autoload.php'; + +chdir('../..'); + +$migrated = 0; +$customs = scandir('custom'); +foreach ($customs as $custom) { + if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + continue; + } + + \SrcCore\models\DatabasePDO::reset(); + new \SrcCore\models\DatabasePDO(['customId' => $custom]); + + $xmlfile = null; + $path = "custom/{$custom}/apps/maarch_entreprise/xml/features.xml"; + if (file_exists($path)) { + $xmlfile = simplexml_load_file($path); + } else { + $xmlfile = simplexml_load_file("apps/maarch_entreprise/xml/features.xml"); + } + + if ($xmlfile) { + $keepDest = (string)$xmlfile->FEATURES->dest_to_copy_during_redirection; + + if (!empty($keepDest) && $keepDest == 'true') { + \Parameter\models\ParameterModel::create([ + 'id' => 'keepDestForRedirection', + 'description' => 'Si activé (1), mets le destinataire en copie de la liste de diffusion lors d\'une action de redirection', + 'param_value_int' => 1 + ]); + } else { + \Parameter\models\ParameterModel::create([ + 'id' => 'keepDestForRedirection', + 'description' => 'Si activé (1), mets le destinataire en copie de la liste de diffusion lors d\'une action de redirection', + 'param_value_int' => 0 + ]); + } + + $migrated++; + } +} + +printf($migrated . " custom(s) avec un fichier features.xml trouvé(s) et migré(s).\n");