Skip to content
Snippets Groups Projects
Commit 66d7cc4c authored by Bernhard Posselt's avatar Bernhard Posselt
Browse files

Merge pull request #2584 from mrtorrent/fix_instanceid_format

Fix instanceid format to prevent session loop
parents 8ed9be54 93a6ed3d
No related branches found
No related tags found
No related merge requests found
......@@ -412,13 +412,14 @@ class OC_Util {
}
/**
* get an id unqiue for this instance
* get an id unique for this instance
* @return string
*/
public static function getInstanceId() {
$id = OC_Config::getValue('instanceid', null);
if(is_null($id)) {
$id=uniqid();
// We need to guarantee at least one letter in instanceid so it can be used as the session_name
$id = 'oc' . uniqid();
OC_Config::setValue('instanceid', $id);
}
return $id;
......
......@@ -54,4 +54,9 @@ class Test_Util extends PHPUnit_Framework_TestCase {
$this->assertEquals('no-reply@example.com', $email);
OC_Config::deleteKey('mail_domain');
}
function testGetInstanceIdGeneratesValidId() {
OC_Config::deleteKey('instanceid');
$this->assertStringStartsWith('oc', OC_Util::getInstanceId());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment