Skip to content

Commit 1bab008

Browse files
authored
[5.4] Task SessionGC delete metadata from db (joomla#46128)
1 parent 9c94483 commit 1bab008

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugins/task/sessiongc/src/Extension/SessionGC.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,16 @@ public static function getSubscribedEvents(): array
100100
private function sessionGC(ExecuteTaskEvent $event): int
101101
{
102102
$enableGC = (int) $event->getArgument('params')->enable_session_gc ?? 1;
103+
$app = $this->getApplication();
103104

104105
if ($enableGC) {
105-
$this->getApplication()->getSession()->gc();
106+
$app->getSession()->gc();
106107
}
107108

108109
$enableMetadata = (int) $event->getArgument('params')->enable_session_metadata_gc ?? 1;
109110

110-
if ($this->getApplication()->get('session_handler', 'none') !== 'database' && $enableMetadata) {
111-
$this->metadataManager->deletePriorTo(time() - $this->getApplication()->getSession()->getExpire());
111+
if ($enableMetadata) {
112+
$this->metadataManager->deletePriorTo(time() - $app->getSession()->getExpire());
112113
}
113114

114115
$this->logTask('SessionGC end');

0 commit comments

Comments
 (0)