mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-24 17:17:15 +01:00
* [MOD] Improved bootstrapping. Work in progress.
This commit is contained in:
@@ -54,6 +54,8 @@ define('VENDOR_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'vendor');
|
||||
define('SQL_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'schemas');
|
||||
define('PUBLIC_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'public');
|
||||
|
||||
define('APP_PARTIAL_INIT', ['resource', 'install', 'bootstrap']);
|
||||
|
||||
define('DEBUG', true);
|
||||
|
||||
// Empezar a calcular la memoria utilizada
|
||||
|
||||
@@ -216,8 +216,11 @@ class Bootstrap
|
||||
|
||||
$self->initializeCommon();
|
||||
|
||||
if (in_array($controller, self::PARTIAL_INIT, true)) {
|
||||
if (!in_array($controller, APP_PARTIAL_INIT, true)) {
|
||||
$self->initializeApp();
|
||||
} else {
|
||||
// Do not keep the PHP's session opened
|
||||
Session::close();
|
||||
}
|
||||
|
||||
debugLog('Routing call: ' . $controllerClass . '::' . $method . '::' . print_r($params, true));
|
||||
|
||||
@@ -37,6 +37,16 @@ use SP\Services\User\UserLoginResponse;
|
||||
*/
|
||||
class Session
|
||||
{
|
||||
private static $isLocked = false;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLocked()
|
||||
{
|
||||
return self::$isLocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve el tema visual utilizado en sysPass
|
||||
*
|
||||
@@ -51,7 +61,7 @@ class Session
|
||||
* Devolver una variable de sesión
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getSessionKey($key, $default = null)
|
||||
@@ -76,17 +86,33 @@ class Session
|
||||
/**
|
||||
* Establecer una variable de sesión
|
||||
*
|
||||
* @param string $key El nombre de la variable
|
||||
* @param mixed $value El valor de la variable
|
||||
* @param string $key El nombre de la variable
|
||||
* @param mixed $value El valor de la variable
|
||||
* @return mixed
|
||||
*/
|
||||
protected function setSessionKey($key, $value)
|
||||
{
|
||||
$_SESSION[$key] = $value;
|
||||
if (self::$isLocked ) {
|
||||
debugLog('Session locked; key=' . $key);
|
||||
} else {
|
||||
$_SESSION[$key] = $value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes session
|
||||
*/
|
||||
public static function close()
|
||||
{
|
||||
debugLog('Session closed');
|
||||
|
||||
session_write_close();
|
||||
|
||||
self::$isLocked = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Establecer la configuración
|
||||
*
|
||||
|
||||
@@ -84,6 +84,7 @@ class SessionUtil
|
||||
* @param bool $new si es necesrio regenerar el hash
|
||||
* @param ConfigData|null $configData
|
||||
* @return string con el hash de verificación
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getSessionKey($new = false, ConfigData $configData = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user