summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-29 07:26:07 -0700
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-29 07:26:07 -0700
commit66d7cc4c740a1f51a6871ac5129d26d62c313720 (patch)
tree61edcc39ddd89d70f5381a365aeb58342e398935 /lib
parent8ed9be540813b0793ef6376dfe2531e43a58c1bc (diff)
parent93a6ed3dab8d54fa2c735381298bec2bbcdfde41 (diff)
downloadnextcloud-server-66d7cc4c740a1f51a6871ac5129d26d62c313720.tar.gz
nextcloud-server-66d7cc4c740a1f51a6871ac5129d26d62c313720.zip
Merge pull request #2584 from mrtorrent/fix_instanceid_format
Fix instanceid format to prevent session loop
Diffstat (limited to 'lib')
-rwxr-xr-xlib/util.php25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/util.php b/lib/util.php
index 7e8fc9b6bb7..1fa3ad765d0 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -411,18 +411,19 @@ class OC_Util {
exit();
}
- /**
- * get an id unqiue for this instance
- * @return string
- */
- public static function getInstanceId() {
- $id=OC_Config::getValue('instanceid', null);
- if(is_null($id)) {
- $id=uniqid();
- OC_Config::setValue('instanceid', $id);
- }
- return $id;
- }
+ /**
+ * get an id unique for this instance
+ * @return string
+ */
+ public static function getInstanceId() {
+ $id = OC_Config::getValue('instanceid', null);
+ if(is_null($id)) {
+ // 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;
+ }
/**
* @brief Static lifespan (in seconds) when a request token expires.