add ISession::getId() wrapper for session_id
This commit is contained in:
parent
74de72e75e
commit
0d53e86421
|
@ -141,6 +141,16 @@ class CryptoSessionData implements \ArrayAccess, ISession {
|
||||||
$this->session->regenerateId($deleteOldSession);
|
$this->session->regenerateId($deleteOldSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper around session_id
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 9.1.0
|
||||||
|
*/
|
||||||
|
public function getId() {
|
||||||
|
return $this->session->getId();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the session and release the lock, also writes all changed data in batch
|
* Close the session and release the lock, also writes all changed data in batch
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -111,6 +111,16 @@ class Internal extends Session {
|
||||||
@session_regenerate_id($deleteOldSession);
|
@session_regenerate_id($deleteOldSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper around session_id
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 9.1.0
|
||||||
|
*/
|
||||||
|
public function getId() {
|
||||||
|
return @session_id();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,6 +88,16 @@ class Memory extends Session {
|
||||||
*/
|
*/
|
||||||
public function regenerateId($deleteOldSession = true) {}
|
public function regenerateId($deleteOldSession = true) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper around session_id
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 9.1.0
|
||||||
|
*/
|
||||||
|
public function getId() {
|
||||||
|
throw new \Exception('Memory session does not have an ID');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for PHPUnit execution - don't use in non-test code
|
* Helper function for PHPUnit execution - don't use in non-test code
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -95,4 +95,12 @@ interface ISession {
|
||||||
* @since 9.0.0
|
* @since 9.0.0
|
||||||
*/
|
*/
|
||||||
public function regenerateId($deleteOldSession = true);
|
public function regenerateId($deleteOldSession = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper around session_id
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 9.1.0
|
||||||
|
*/
|
||||||
|
public function getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,17 @@
|
||||||
namespace Test\Session;
|
namespace Test\Session;
|
||||||
|
|
||||||
class Memory extends Session {
|
class Memory extends Session {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->instance = new \OC\Session\Memory($this->getUniqueID());
|
$this->instance = new \OC\Session\Memory($this->getUniqueID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Exception
|
||||||
|
*/
|
||||||
|
public function testThrowsExceptionOnGetId() {
|
||||||
|
$this->instance->getId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue