mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-14 03:52:21 +03:00
Merge pull request #1518 from sudwebdesign/develop-config-sess_regenerate_destroy
Fix CodeIgniter creating a lot of session files
This commit is contained in:
commit
4c7ca40952
2 changed files with 5 additions and 4 deletions
|
@ -353,7 +353,7 @@ $config['sess_expiration'] = 7200;
|
||||||
$config['sess_save_path'] = __DIR__ . '/../../storage/sessions';
|
$config['sess_save_path'] = __DIR__ . '/../../storage/sessions';
|
||||||
$config['sess_match_ip'] = false;
|
$config['sess_match_ip'] = false;
|
||||||
$config['sess_time_to_update'] = 300;
|
$config['sess_time_to_update'] = 300;
|
||||||
$config['sess_regenerate_destroy'] = false;
|
$config['sess_regenerate_destroy'] = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -124,7 +124,7 @@ class CI_Session {
|
||||||
unset($_COOKIE[$this->_config['cookie_name']]);
|
unset($_COOKIE[$this->_config['cookie_name']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@session_start();
|
session_start();
|
||||||
|
|
||||||
// Is session ID auto-regeneration configured? (ignoring ajax requests)
|
// Is session ID auto-regeneration configured? (ignoring ajax requests)
|
||||||
if ((empty($_SERVER['HTTP_X_REQUESTED_WITH']) OR strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest')
|
if ((empty($_SERVER['HTTP_X_REQUESTED_WITH']) OR strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest')
|
||||||
|
@ -137,7 +137,7 @@ class CI_Session {
|
||||||
}
|
}
|
||||||
elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time))
|
elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time))
|
||||||
{
|
{
|
||||||
$this->sess_regenerate((bool) config_item('sess_regenerate_destroy'));
|
$this->sess_regenerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Another work-around ... PHP doesn't seem to send the session cookie
|
// Another work-around ... PHP doesn't seem to send the session cookie
|
||||||
|
@ -691,8 +691,9 @@ class CI_Session {
|
||||||
* @param bool $destroy Destroy old session data flag
|
* @param bool $destroy Destroy old session data flag
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function sess_regenerate($destroy = FALSE)
|
public function sess_regenerate($destroy = null)
|
||||||
{
|
{
|
||||||
|
$destroy = boolval($destroy !== null ? $destroy : config_item('sess_regenerate_destroy'));
|
||||||
$_SESSION['__ci_last_regenerate'] = time();
|
$_SESSION['__ci_last_regenerate'] = time();
|
||||||
session_regenerate_id($destroy);
|
session_regenerate_id($destroy);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue