mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Making Session.model the required setting and not Session.table. Session.table can still be used to set the table name used when configuring sessions, but the default value is cake_session as before. Fixes #223
This commit is contained in:
parent
913450daef
commit
c5a5d1dfe6
2 changed files with 17 additions and 16 deletions
|
@ -138,17 +138,19 @@ class CakeSession extends Object {
|
||||||
if (empty($database)) {
|
if (empty($database)) {
|
||||||
$database = 'default';
|
$database = 'default';
|
||||||
}
|
}
|
||||||
if (empty($modelName)) {
|
$settings = array(
|
||||||
ClassRegistry::init(array(
|
'class' => 'Session',
|
||||||
'class' => Inflector::classify($table),
|
'alias' => 'Session',
|
||||||
'alias' => 'Session'
|
'table' => 'cake_sessions',
|
||||||
));
|
'ds' => $database
|
||||||
} else {
|
);
|
||||||
ClassRegistry::init(array(
|
if (!empty($modelName)) {
|
||||||
'class' => $modelName,
|
$settings['class'] = $modelName;
|
||||||
'alias' => 'Session'
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
if (!empty($table)) {
|
||||||
|
$settings['table'] = $table;
|
||||||
|
}
|
||||||
|
ClassRegistry::init($settings);
|
||||||
}
|
}
|
||||||
if ($start === true) {
|
if ($start === true) {
|
||||||
if (!empty($base)) {
|
if (!empty($base)) {
|
||||||
|
@ -492,11 +494,9 @@ class CakeSession extends Object {
|
||||||
break;
|
break;
|
||||||
case 'database':
|
case 'database':
|
||||||
if (empty($_SESSION)) {
|
if (empty($_SESSION)) {
|
||||||
if (Configure::read('Session.table') === null) {
|
if (Configure::read('Session.model') === null) {
|
||||||
trigger_error(__("You must set the all Configure::write('Session.*') in core.php to use database storage"), E_USER_WARNING);
|
trigger_error(__("You must set the all Configure::write('Session.*') in core.php to use database storage"), E_USER_WARNING);
|
||||||
exit();
|
$this->_stop();
|
||||||
} elseif (Configure::read('Session.database') === null) {
|
|
||||||
Configure::write('Session.database', 'default');
|
|
||||||
}
|
}
|
||||||
if ($iniSet) {
|
if ($iniSet) {
|
||||||
ini_set('session.use_trans_sid', 0);
|
ini_set('session.use_trans_sid', 0);
|
||||||
|
@ -763,7 +763,6 @@ class CakeSession extends Object {
|
||||||
|
|
||||||
$model =& ClassRegistry::getObject('Session');
|
$model =& ClassRegistry::getObject('Session');
|
||||||
$return = $model->save(compact('id', 'data', 'expires'));
|
$return = $model->save(compact('id', 'data', 'expires'));
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,8 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
unset($_SESSION);
|
unset($_SESSION);
|
||||||
session_destroy();
|
session_destroy();
|
||||||
Configure::write('Session.table', 'sessions');
|
Configure::write('Session.table', 'sessions');
|
||||||
Configure::write('Session.database', 'test');
|
Configure::write('Session.model', 'Session');
|
||||||
|
Configure::write('Session.database', 'test_suite');
|
||||||
Configure::write('Session.save', 'database');
|
Configure::write('Session.save', 'database');
|
||||||
$this->setUp();
|
$this->setUp();
|
||||||
|
|
||||||
|
@ -463,5 +464,6 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
Configure::write('Session.save', 'php');
|
Configure::write('Session.save', 'php');
|
||||||
$this->setUp();
|
$this->setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue