diff --git a/lib/classes/Session/Handler.class.php b/lib/classes/Session/Handler.class.php index 949a776078..7f818ee165 100644 --- a/lib/classes/Session/Handler.class.php +++ b/lib/classes/Session/Handler.class.php @@ -315,6 +315,25 @@ class Session_Handler return isset($_COOKIE[$name]); } + public function renew_phrasea_session() + { + if (!$this->phrasea_session instanceof Session_Phrasea) + throw new \Exception('No phrasea session available'); + + $this->phrasea_session->close(); + + $user = \User_Adapter::getInstance($this->get_usr_id(), $this->appbox); + + $this->phrasea_session = new Session_Phrasea($this->appbox, $user); + $this->phrasea_session->create(\Browser::getInstance()); + + $this->phrasea_session->open(); + $ses_id = $this->phrasea_session->get_id(); + + $this->storage()->set('usr_id', $user->get_id()); + $this->storage()->set('ses_id', $ses_id); + } + /** * Open the phrasea session * diff --git a/lib/classes/collection.class.php b/lib/classes/collection.class.php index 025ac19761..2de3adb689 100644 --- a/lib/classes/collection.class.php +++ b/lib/classes/collection.class.php @@ -551,6 +551,8 @@ class collection implements cache_cacheableInterface phrasea::reset_baseDatas(); self::set_admin($new_bas, $user); + $appbox->get_session()->renew_phrasea_session(); + return self::get_from_coll_id($databox, $new_id); }