From fd4adfc977251b82af089d197bf01939b2159b73 Mon Sep 17 00:00:00 2001 From: moctardiouf Date: Thu, 25 Apr 2024 18:28:42 +0200 Subject: [PATCH 1/8] PHRAS-4056 change imagemagick version and config file path (#4500) * PHRAS-4056 change imagemagick version and config file path * PHRAS-4056 uncomment ImageMagick policy lines * PHRAS-4056 fix line break * PHRAS-4056 increase ImageMagick default config policy values --- .env | 14 +++++------ docker/phraseanet/worker/entrypoint.sh | 32 ++++++++++++++++++-------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.env b/.env index 7dcc469877..f07a86b58a 100644 --- a/.env +++ b/.env @@ -908,25 +908,25 @@ PHRASEANET_SSH_PRIVATE_KEY= # --- ImageMagick default policy override setting ---------------------------------------------------------------------- # @run -IMAGEMAGICK_POLICY_VERSION=6 +IMAGEMAGICK_POLICY_VERSION=7 # @run -IMAGEMAGICK_POLICY_WIDTH=16KP +IMAGEMAGICK_POLICY_WIDTH=48KP # @run -IMAGEMAGICK_POLICY_HEIGHT=16KP +IMAGEMAGICK_POLICY_HEIGHT=48KPP # @run -IMAGEMAGICK_POLICY_MAP=512MiB +IMAGEMAGICK_POLICY_MAP=2048MiB # @run -IMAGEMAGICK_POLICY_MEMORY=256MiB +IMAGEMAGICK_POLICY_MEMORY=2048MiB # @run -IMAGEMAGICK_POLICY_AREA=128MB +IMAGEMAGICK_POLICY_AREA=4096MB # @run -IMAGEMAGICK_POLICY_DISK=1GiB +IMAGEMAGICK_POLICY_DISK=6GiB # @run IMAGEMAGICK_POLICY_TEMPORARY_PATH=/tmp diff --git a/docker/phraseanet/worker/entrypoint.sh b/docker/phraseanet/worker/entrypoint.sh index 15ba65f1bb..4fdf1b827f 100755 --- a/docker/phraseanet/worker/entrypoint.sh +++ b/docker/phraseanet/worker/entrypoint.sh @@ -32,27 +32,39 @@ echo `date +"%Y-%m-%d %H:%M:%S"` " - chown app:app on cache/ repository" # logs \ # www - if [ -d "plugins/" ];then chown -R app:app plugins echo `date +"%Y-%m-%d %H:%M:%S"` " - chown app:app on plugins/ repository" fi -if [ -f /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml ]; then +if [ -f /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml ]; then if [ ! -d $IMAGEMAGICK_POLICY_TEMPORARY_PATH ]; then echo "$IMAGEMAGICK_POLICY_TEMPORARY_PATH does not exist lets create it" mkdir -p $IMAGEMAGICK_POLICY_TEMPORARY_PATH fi - sed -i "s/domain=\"resource\" name=\"memory\" value=\".*\"/domain=\"resource\" name=\"memory\" value=\"$IMAGEMAGICK_POLICY_MEMORY\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/domain=\"resource\" name=\"map\" value=\".*\"/domain=\"resource\" name=\"map\" value=\"$IMAGEMAGICK_POLICY_MAP\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/domain=\"resource\" name=\"width\" value=\".*\"/domain=\"resource\" name=\"width\" value=\"$IMAGEMAGICK_POLICY_WIDTH\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/domain=\"resource\" name=\"height\" value=\".*\"/domain=\"resource\" name=\"height\" value=\"$IMAGEMAGICK_POLICY_HEIGHT\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/domain=\"resource\" name=\"disk\" value=\".*\"/domain=\"resource\" name=\"disk\" value=\"$IMAGEMAGICK_POLICY_DISK\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/domain=\"resource\" name=\"area\" value=\".*\"/domain=\"resource\" name=\"area\" value=\"$IMAGEMAGICK_POLICY_AREA\"/g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml - sed -i "s/.*domain=\"resource\" name=\"temporary-path\" value=\".*//g" /etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"memory\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"map\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"width\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"height\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"disk\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"area\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i '/domain=\"resource\" name=\"temporary-path\"/s///g' /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"memory\" value=\".*\"/domain=\"resource\" name=\"memory\" value=\"$IMAGEMAGICK_POLICY_MEMORY\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"map\" value=\".*\"/domain=\"resource\" name=\"map\" value=\"$IMAGEMAGICK_POLICY_MAP\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"width\" value=\".*\"/domain=\"resource\" name=\"width\" value=\"$IMAGEMAGICK_POLICY_WIDTH\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"height\" value=\".*\"/domain=\"resource\" name=\"height\" value=\"$IMAGEMAGICK_POLICY_HEIGHT\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"disk\" value=\".*\"/domain=\"resource\" name=\"disk\" value=\"$IMAGEMAGICK_POLICY_DISK\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/domain=\"resource\" name=\"area\" value=\".*\"/domain=\"resource\" name=\"area\" value=\"$IMAGEMAGICK_POLICY_AREA\"/g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml + sed -i "s/.*domain=\"resource\" name=\"temporary-path\" value=\".*//g" /usr/local/etc/ImageMagick-$IMAGEMAGICK_POLICY_VERSION/policy.xml fi - if [[ $NEWRELIC_ENABLED = "true" ]]; then echo `date +"%Y-%m-%d %H:%M:%S"` " - NewRelic daemon and PHP agent setup." sed -i -e "s/REPLACE_WITH_REAL_KEY/$NEWRELIC_LICENSE_KEY/" \ From f2744ce5e50f5b5ae4cb35d6bf43938888b8e775 Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:05:59 +0300 Subject: [PATCH 2/8] do not store keys in arrays, delete immediatly (#4495) --- lib/Alchemy/Phrasea/Cache/RedisCache.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Cache/RedisCache.php index 32bebef9b9..267e45abbe 100644 --- a/lib/Alchemy/Phrasea/Cache/RedisCache.php +++ b/lib/Alchemy/Phrasea/Cache/RedisCache.php @@ -142,14 +142,11 @@ public function deleteMulti(array $keys) public function removeByPattern($pattern) { - $keysToremove = []; $iterator = null; while(false !== ($keys = $this->_redis->scan($iterator, $pattern))) { - $keysToremove = array_merge($keysToremove, $keys); + $this->_redis->del($keys); } - $this->_redis->del($keysToremove); - return true; } From da5a47f566a0469305c129b89ae9f79806862091 Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Mon, 29 Apr 2024 12:24:58 +0200 Subject: [PATCH 3/8] PHRAS-3416 phraseanet localization (#4504) --- resources/locales/messages.de.xlf | 6 +++--- resources/locales/messages.en.xlf | 6 +++--- resources/locales/messages.fr.xlf | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/locales/messages.de.xlf b/resources/locales/messages.de.xlf index 6f856526b4..844e4af54c 100644 --- a/resources/locales/messages.de.xlf +++ b/resources/locales/messages.de.xlf @@ -1462,9 +1462,9 @@ Zurück zur Sammelkörbe Liste WorkZone/Browser/Basket.html.twig - + Background Color - Hintergrundfarbe + Hintergrundfarbe (z.B: #FFFFFF) Media/Subdef/Image.php @@ -9862,7 +9862,7 @@ admin::workermanager:tab:workerinfo: change status to canceled - Als "abbrechen" markieren + Die gestartete Jobs als "Abbrechen" markieren, die seit... admin/worker-manager/worker_info.html.twig diff --git a/resources/locales/messages.en.xlf b/resources/locales/messages.en.xlf index 3e865c9400..6f180623d9 100644 --- a/resources/locales/messages.en.xlf +++ b/resources/locales/messages.en.xlf @@ -1463,9 +1463,9 @@ Back to baskets list WorkZone/Browser/Basket.html.twig - + Background Color - Background color + Background color (ex: #FFFFFF) Media/Subdef/Image.php @@ -9864,7 +9864,7 @@ admin::workermanager:tab:workerinfo: change status to canceled - Mark as "cancel" + Mark as "Cancel" the jobs started since... admin/worker-manager/worker_info.html.twig diff --git a/resources/locales/messages.fr.xlf b/resources/locales/messages.fr.xlf index 43118e2c15..f0bd245974 100644 --- a/resources/locales/messages.fr.xlf +++ b/resources/locales/messages.fr.xlf @@ -1462,9 +1462,9 @@ Retour à la liste des paniers WorkZone/Browser/Basket.html.twig - + Background Color - Couleur de fond + Couleur de fond (ex: #FFFFFF) Media/Subdef/Image.php @@ -9863,7 +9863,7 @@ Si vous recevez cet e-mail sans l'avoir sollicité, merci de l'ignorer ou de le admin::workermanager:tab:workerinfo: change status to canceled - Marquer "Annuler" + Marquer "Annuler" les travaux démarrés depuis... admin/worker-manager/worker_info.html.twig From 71c01df0272d89f5b242aca73f2e87f8624dd22a Mon Sep 17 00:00:00 2001 From: Arthur M <4rthem@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:11:59 +0200 Subject: [PATCH 4/8] PHRAS-4042 fix webvtt sent to expose (#4502) --- docker-compose.under-phrasea.yml | 4 ++-- .../WorkerManager/Worker/ExposeUploadWorker.php | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docker-compose.under-phrasea.yml b/docker-compose.under-phrasea.yml index b14932a935..1c468a33f1 100644 --- a/docker-compose.under-phrasea.yml +++ b/docker-compose.under-phrasea.yml @@ -19,7 +19,7 @@ services: phraseanet: extra_hosts: - - api-auth.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} + - keycloak.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-databox.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-expose.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-uploader.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} @@ -29,7 +29,7 @@ services: worker: extra_hosts: - - api-auth.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} + - keycloak.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-databox.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-expose.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} - api-uploader.${PHRASEA_DOMAIN}:${PHRASEA_GATEWAY_IP} diff --git a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php index 5d417cff42..cb548ef48c 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php @@ -149,7 +149,7 @@ public function process(array $payload) $databox = $record->getDatabox(); $caption = $record->get_caption(); $lat = $lng = null; - $webVTT = ''; + $webVTT = []; if (in_array($payload['databoxId'], $sendGeolocField)) { $latFieldName = $lonFieldName = ''; @@ -189,12 +189,19 @@ public function process(array $payload) if (in_array($payload['databoxId'], $sendVttField)) { foreach ($databox->get_meta_structure() as $meta) { - if (strpos(strtolower($meta->get_name()), strtolower('VideoTextTrack')) !== FALSE && $caption->has_field($meta->get_name())) { + if (1 === preg_match('#^VideoTextTrack([a-z]{2}(?:[-_]\w+)?)#i', $meta->get_name(), $matches) && $caption->has_field($meta->get_name())) { // retrieve value for the corresponding field $fieldValues = $record->get_caption()->get_field($meta->get_name())->get_values(); $fieldValue = array_pop($fieldValues); - - $webVTT .= "\n\n" .$fieldValue->getValue(); + $locale = strtolower($matches[1]); + $content = trim($fieldValue->getValue()); + + $webVTT[] = [ + 'id' => md5($content), + 'locale' => $locale, + 'label' => $locale, + 'content' => $content, + ]; } } } @@ -248,7 +255,7 @@ public function process(array $payload) $requestBody['lng'] = $lng; } - if ($webVTT !== '') { + if (!empty($webVTT)) { $requestBody['webVTT'] = $webVTT; } From df780d993ee323152ffb5e8a13eadbc2ff20c347 Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:41:33 +0300 Subject: [PATCH 5/8] PHRAS-4060 webhook - error - stay in running status (#4506) * fix webhook stay running * add databox_id and record_id in workerRunningJob --- .../Processor/SubdefEventProcessor.php | 2 +- .../WorkerManager/Worker/WebhookWorker.php | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/Alchemy/Phrasea/Webhook/Processor/SubdefEventProcessor.php b/lib/Alchemy/Phrasea/Webhook/Processor/SubdefEventProcessor.php index 925fb7c253..33732d2b29 100644 --- a/lib/Alchemy/Phrasea/Webhook/Processor/SubdefEventProcessor.php +++ b/lib/Alchemy/Phrasea/Webhook/Processor/SubdefEventProcessor.php @@ -24,7 +24,7 @@ public function process(WebhookEvent $event) $record = $this->findDataboxById($data['databox_id'])->get_record($data['record_id']); $subdef = $record->get_subdef($data['subdef_name']); - if (empty($data['permalink'])) { + if (empty($data['permalink']) && $subdef->get_permalink() !== null) { $data['permalink'] = $subdef->get_permalink()->get_url()->__toString(); } diff --git a/lib/Alchemy/Phrasea/WorkerManager/Worker/WebhookWorker.php b/lib/Alchemy/Phrasea/WorkerManager/Worker/WebhookWorker.php index 7e8a482921..593afbee5b 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Worker/WebhookWorker.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Worker/WebhookWorker.php @@ -56,6 +56,12 @@ public function __construct(Application $app) public function process(array $payload) { if (isset($payload['id'])) { + $webhookEventId = $payload['id']; + + /** @var WebhookEvent|null $webhookevent */ + $webhookevent = $this->app['repo.webhook-event']->find($webhookEventId); + $wData = $webhookevent->getData(); + $this->repoWorkerJob = $this->getWorkerRunningJobRepository(); $em = $this->repoWorkerJob->getEntityManager(); $em->beginTransaction(); @@ -70,12 +76,20 @@ public function process(array $payload) $workerRunningJob = new WorkerRunningJob(); $workerRunningJob ->setWork(MessagePublisher::WEBHOOK_TYPE) - ->setWorkOn('WebhookEventId: '. $payload['id']) + ->setWorkOn($webhookevent->getName() . ' , WebhookEventId: '. $payload['id']) ->setPayload($message) ->setPublished($date->setTimestamp($payload['published'])) ->setStatus(WorkerRunningJob::RUNNING) ; + if (isset($wData['databox_id'])) { + $workerRunningJob->setDataboxId($wData['databox_id']); + } + + if (isset($wData['record_id'])) { + $workerRunningJob->setRecordId($wData['record_id']); + } + $em->persist($workerRunningJob); $em->flush(); @@ -85,7 +99,6 @@ public function process(array $payload) $em->rollback(); } - $webhookEventId = $payload['id']; $app = $this->app; $version = new Version(); @@ -107,9 +120,6 @@ public function process(array $payload) $thirdPartyApplications = $this->app['repo.api-applications']->findWithDefinedWebhookCallback(); - /** @var WebhookEvent|null $webhookevent */ - $webhookevent = $this->app['repo.webhook-event']->find($webhookEventId); - if ($webhookevent !== null) { $app['manipulator.webhook-event']->processed($webhookevent); From 9ffb992ee4253b6354c970fdf878b05ee2cded99 Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:12:41 +0300 Subject: [PATCH 6/8] fix application delete (#4503) --- .../Manipulator/ApiApplicationManipulator.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/ApiApplicationManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/ApiApplicationManipulator.php index 5a2d4a7008..0e3f4cc8a4 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/ApiApplicationManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/ApiApplicationManipulator.php @@ -53,6 +53,31 @@ public function create($name, $type, $description, $applicationWebsite, User $cr public function delete(ApiApplication $application) { + // make sure all apiaccounts linked by apiApplication are also deleted + $accts = $this->om->getRepository('Phraseanet:ApiAccount')->findBy(['application' => $application]); + + foreach ($accts as $account) { + // remove ApiOauthCodes before ApiAccount + $oauthCodes = $this->om->getRepository('Phraseanet:ApiOauthCode')->findByAccount($account); + foreach ($oauthCodes as $oauthCode) { + $this->om->remove($oauthCode); + } + + $this->om->remove($account); + } + + $deliveries = $this->om->getRepository('Phraseanet:WebhookEventDelivery')->findBy(['application' => $application]); + + foreach ($deliveries as $delivery) { + $payloads = $this->om->getRepository('Phraseanet:WebhookEventPayload')->findBy(['delivery' => $delivery]); + + foreach ($payloads as $payload) { + $this->om->remove($payload); + } + + $this->om->remove($delivery); + } + $this->om->remove($application); $this->om->flush(); } From 50ca67433f084c120fde60e10a5968e343826952 Mon Sep 17 00:00:00 2001 From: moctardiouf Date: Mon, 29 Apr 2024 19:05:08 +0200 Subject: [PATCH 7/8] PHRAS-4053 redis native session (#4505) * PHRASEANET_USER_SESSION_LIFETIME as php session.gc_maxlifetime * dissociate PHRASEANET_SESSION_TYPE and php SESSION_SAVE_HANDLER --- .env | 2 +- docker/phraseanet/php.ini.sample | 2 +- docker/phraseanet/setup/entrypoint.sh | 17 ++++++----------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.env b/.env index f07a86b58a..43bde72aa3 100644 --- a/.env +++ b/.env @@ -485,7 +485,7 @@ PHRASEANET_CACHE_HOST=redis # @run PHRASEANET_CACHE_PORT=6379 -# PHP session management +# PHP session management : this must be related to the SESSION_SAVE_HANDLER parameter. type can be redis, file or native # @run PHRASEANET_SESSION_TYPE=redis # @run diff --git a/docker/phraseanet/php.ini.sample b/docker/phraseanet/php.ini.sample index f122f8ce15..a4c714dc60 100644 --- a/docker/phraseanet/php.ini.sample +++ b/docker/phraseanet/php.ini.sample @@ -1412,7 +1412,7 @@ session.gc_divisor = 1000 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. ; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 +session.gc_maxlifetime = $PHRASEANET_USER_SESSION_LIFETIME ; NOTE: If you are using the subdirectory option for storing session files ; (see session.save_path above), then garbage collection does *not* diff --git a/docker/phraseanet/setup/entrypoint.sh b/docker/phraseanet/setup/entrypoint.sh index 7fb412c193..8abaad59c7 100755 --- a/docker/phraseanet/setup/entrypoint.sh +++ b/docker/phraseanet/setup/entrypoint.sh @@ -157,21 +157,16 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then fi echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting session type" - echo `date +"%Y-%m-%d %H:%M:%S"` " - SESSION_SAVE_HANDLER is $SESSION_SAVE_HANDLER" - - if [[ $SESSION_SAVE_HANDLER == file ]]; then - bin/setup system:config set main.session.type "$SESSION_SAVE_HANDLER" - echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet PHP session manager is $SESSION_SAVE_HANDLER" - elif [[ $SESSION_SAVE_HANDLER == redis ]]; then - echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet PHP session manager is Redis : setting Host to $PHRASEANET_SESSION_TYPE" - bin/setup system:config set main.session.type $PHRASEANET_SESSION_TYPE + echo `date +"%Y-%m-%d %H:%M:%S"` " - PHRASEANET_SESSION_TYPE is $PHRASEANET_SESSION_TYPE" + + bin/setup system:config set main.session.type "$PHRASEANET_SESSION_TYPE" + + if [[ $PHRASEANET_SESSION_TYPE == redis ]]; then + echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet PHP session manager is Redis : setting redis connexion parameters" bin/setup system:config set main.session.options.host $PHRASEANET_SESSION_HOST bin/setup system:config set main.session.options.port $PHRASEANET_SESSION_PORT bin/setup system:config set main.session.options.namespace $PHRASEANET_HOSTNAME bin/setup system:config set main.session.ttl $PHRASEANET_USER_SESSION_LIFETIME - else - bin/setup system:config set main.session.type "native" - echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet PHP session manager is Native" fi ## Phraseanet application Database setting From 4540b287bf3598cdedb81220ccbf718921630b7b Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:19:50 +0300 Subject: [PATCH 8/8] PHRAS-4045 Log - stdout - fix error on worker passed to igorw\get_in() (#4496) * fix error on get_in on conf * fix * fix * fix --- .../Phrasea/Core/Configuration/Configuration.php | 10 ++++++++-- .../Phrasea/Core/Configuration/HostConfiguration.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php index 2a9cf416f5..249a1f9838 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php @@ -138,7 +138,7 @@ public function getConfig() return $this->parser->parse($this->loadFile($this->config)); } - if (null !== $this->cache) { + if (null !== $this->cache && is_array($this->cache)) { return $this->cache; } @@ -151,7 +151,13 @@ public function getConfig() )); } - return $this->cache = require $this->compiled; + $this->cache = require $this->compiled; + + if (is_array($this->cache)) { + return $this->cache; + } else { + throw new RuntimeException('Configuration compiled error'); + } } /** diff --git a/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php b/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php index a5badd4a17..9377868c47 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php @@ -151,7 +151,7 @@ public function setDefault($name) */ public function getConfig() { - if (empty($this->cache)) { + if (empty($this->cache) || !is_array($this->cache)) { throw new RuntimeException('Configuration is not set up.'); }