summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-07-10 12:41:53 +0200
committerGeorg Ehrke <developer@georgehrke.com>2013-07-10 12:41:53 +0200
commita357e5b284ed5b752864e4570cb179f3f2d88229 (patch)
treee811ea2288b5dfa069908f25f696f795a268cb53 /lib/base.php
parent832779804d36d27c47325d1dcce09e566c8cee60 (diff)
parent5387e5c354440b264040816ea7fcaf6783a2ebdc (diff)
downloadnextcloud-server-a357e5b284ed5b752864e4570cb179f3f2d88229.tar.gz
nextcloud-server-a357e5b284ed5b752864e4570cb179f3f2d88229.zip
merge conflicts ...
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/base.php b/lib/base.php
index 4ef524e49e7..c40453f2f59 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -173,11 +173,12 @@ class OC {
public static function checkConfig() {
if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
+ $defaults = new OC_Defaults();
$tmpl = new OC_Template('', 'error', 'guest');
$tmpl->assign('errors', array(1 => array(
'error' => "Can't write into config directory 'config'",
- 'hint' => 'You can usually fix this by giving the webserver user write access'
- .' to the config directory in owncloud'
+ 'hint' => 'This can usually be fixed by '
+ .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.'
)));
$tmpl->printPage();
exit();
@@ -288,14 +289,14 @@ class OC {
$cookie_path = OC::$WEBROOT ?: '/';
ini_set('session.cookie_path', $cookie_path);
+ //set the session object to a dummy session so code relying on the session existing still works
+ self::$session = new \OC\Session\Memory('');
+
try{
// set the session name to the instance id - which is unique
self::$session = new \OC\Session\Internal(OC_Util::getInstanceId());
// if session cant be started break with http 500 error
}catch (Exception $e){
- //set the session object to a dummy session so code relying on the session existing still works
- self::$session = new \OC\Session\Memory('');
-
OC_Log::write('core', 'Session could not be initialized',
OC_Log::ERROR);
@@ -311,16 +312,17 @@ class OC {
exit();
}
+ $sessionLifeTime = self::getSessionLifeTime();
// regenerate session id periodically to avoid session fixation
if (!self::$session->exists('SID_CREATED')) {
self::$session->set('SID_CREATED', time());
- } else if (time() - self::$session->get('SID_CREATED') > 60*60*12) {
+ } else if (time() - self::$session->get('SID_CREATED') > $sessionLifeTime / 2) {
session_regenerate_id(true);
self::$session->set('SID_CREATED', time());
}
// session timeout
- if (self::$session->exists('LAST_ACTIVITY') && (time() - self::$session->get('LAST_ACTIVITY') > 60*60*24)) {
+ if (self::$session->exists('LAST_ACTIVITY') && (time() - self::$session->get('LAST_ACTIVITY') > $sessionLifeTime)) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, $cookie_path);
}
@@ -332,6 +334,13 @@ class OC {
self::$session->set('LAST_ACTIVITY', time());
}
+ /**
+ * @return int
+ */
+ private static function getSessionLifeTime() {
+ return OC_Config::getValue('session_lifetime', 60 * 60 * 24);
+ }
+
public static function getRouter() {
if (!isset(OC::$router)) {
OC::$router = new OC_Router();
@@ -393,9 +402,6 @@ class OC {
@ini_set('post_max_size', '10G');
@ini_set('file_uploads', '50');
- //try to set the session lifetime to 60min
- @ini_set('gc_maxlifetime', '3600');
-
//copy http auth headers for apache+php-fcgid work around
if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
$_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
@@ -455,6 +461,10 @@ class OC {
exit;
}
+ //try to set the session lifetime
+ $sessionLifeTime = self::getSessionLifeTime();
+ @ini_set('gc_maxlifetime', (string)$sessionLifeTime);
+
// User and Groups
if (!OC_Config::getValue("installed", false)) {
self::$session->set('user_id','');