Skip to content

Commit

Permalink
Merge branch 'master' into PHRAS-4045-error-get-in
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaillat authored Apr 29, 2024
2 parents 770e97b + 50ca674 commit d8a8c49
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/phraseanet/php.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
17 changes: 6 additions & 11 deletions docker/phraseanet/setup/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit d8a8c49

Please sign in to comment.