diff --git a/migration/20.10/migrateModulesConfig.php b/migration/20.10/migrateModulesConfig.php index 443bdf7311051fa452564fec2e6e63cd690d6a08..8a75bbd5da12cd36d78a893d43e8ae3b8c85530a 100755 --- a/migration/20.10/migrateModulesConfig.php +++ b/migration/20.10/migrateModulesConfig.php @@ -9,7 +9,7 @@ $migrated = 0; $customs = scandir('custom'); foreach ($customs as $custom) { - if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + if (in_array($custom, ['custom.json', 'custom.xml', '.', '..'])) { continue; } diff --git a/migration/20.10/migrateNotificationsConfig.php b/migration/20.10/migrateNotificationsConfig.php index 0af44700f7350484e5d290034883160d3d3a05ac..301e0869b23b94dfe870af649918f488e13ce20d 100755 --- a/migration/20.10/migrateNotificationsConfig.php +++ b/migration/20.10/migrateNotificationsConfig.php @@ -9,7 +9,7 @@ $migrated = 0; $customs = scandir('custom'); foreach ($customs as $custom) { - if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + if (in_array($custom, ['custom.json', 'custom.xml', '.', '..'])) { continue; } @@ -61,6 +61,7 @@ foreach ($customs as $custom) { foreach ($notifications as $notification) { \Notification\models\NotificationScheduleModel::createScriptNotification(['notification_sid' => $notification['notification_sid'], 'notification_id' => $notification['notification_id']]); } + printf("Si les scripts de notifications sont lancés dans la crontab, il faut modifier les chemins. Tous les scripts sont dans le dossier : bin/notification/scripts/ \n"); $migrated++; } diff --git a/migration/20.10/migrateNotificationsProperties.php b/migration/20.10/migrateNotificationsProperties.php index 96b18129efd173e68f671c7ca59df9c12a2d40c1..11a40b138398f70d83fcbe67cbc1b0b2de0b80b4 100644 --- a/migration/20.10/migrateNotificationsProperties.php +++ b/migration/20.10/migrateNotificationsProperties.php @@ -7,7 +7,7 @@ chdir('../..'); $customs = scandir('custom'); $migrated = 0; foreach ($customs as $custom) { - if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + if (in_array($custom, ['custom.json', 'custom.xml', '.', '..'])) { continue; } diff --git a/migration/20.10/migrateRemoteSignatureBookConfig.php b/migration/20.10/migrateRemoteSignatureBookConfig.php index 2c46aa33bad885cf50c905c9054579b73cedf08d..9506d5fc8dca05477a13b8087730be5c9612074e 100755 --- a/migration/20.10/migrateRemoteSignatureBookConfig.php +++ b/migration/20.10/migrateRemoteSignatureBookConfig.php @@ -9,7 +9,7 @@ $migrated = 0; $customs = scandir('custom'); foreach ($customs as $custom) { - if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + if (in_array($custom, ['custom.json', 'custom.xml', '.', '..'])) { continue; } @@ -53,6 +53,8 @@ foreach ($customs as $custom) { fwrite($fp, $res); } + createScript(); + $migrated++; } } @@ -73,3 +75,33 @@ function formatXml($simpleXMLElement) return $xmlDocument->saveXML(); } + +function createScript() +{ + $corePath = str_replace('migration/20.10', '', __DIR__); + $config = $corePath . \SrcCore\models\CoreConfigModel::getConfigPath(); + + if (!empty($GLOBALS['customId'])) { + $folderScript = $corePath.'custom/'.$GLOBALS['customId'].'/bin/signatureBook/scripts/'; + if (!file_exists($folderScript)) { + mkdir($folderScript, 0777, true); + } + $scriptPath = $folderScript . 'retrieveMailFromExternalSignatoryBook.sh'; + } else { + $scriptPath = $corePath.'bin/signatureBook/scripts/retrieveMailFromExternalSignatoryBook.sh'; + } + $fileToOpen = fopen($scriptPath, 'w+'); + + fwrite($fileToOpen, '#!/bin/sh'); + fwrite($fileToOpen, "\n"); + fwrite($fileToOpen, 'cd ' . $corePath . 'bin/signatureBook/'); + fwrite($fileToOpen, "\n"); + fwrite($fileToOpen, 'filePath=\''.$corePath.'bin/signatureBook/process_mailsFromSignatoryBook.php\''); + fwrite($fileToOpen, "\n"); + fwrite($fileToOpen, 'php $filePath -c ' . $config); + fwrite($fileToOpen, "\n"); + fclose($fileToOpen); + shell_exec('chmod +x '. $scriptPath); + + printf("Si le script process_mailsFromSignatoryBook.php est lancé dans la crontab, il faut modifier le chemin comme ceci : " . $scriptPath . "\n"); +}