mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
PHRAS-3742 Admin flush session (#4131)
PHRAS-3742 : - flush session - command - redis remove by pattern - cmd - add log - clean table session
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Model\Repositories;
|
||||
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
@@ -21,4 +22,16 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class SessionRepository extends EntityRepository
|
||||
{
|
||||
public function deleteAllExceptSessionId($sessionId)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->where($criteria->expr()->neq('id', $sessionId));
|
||||
$sessions = $this->matching($criteria);
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$this->_em->remove($session);
|
||||
}
|
||||
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user