Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salvataggio delle sessioni su Database #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion setup/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function setup(Event $event) {
$_installDir = getcwd();
$_acsCustomLocation = "";
$_sloCustomLocation = "";
$_storeType = "";

$_serviceName = "myservice";
$_spName = "Service Provider Name";
Expand Down Expand Up @@ -111,6 +112,19 @@ public static function setup(Event $event) {
}
}

if (!isset($config['storeType'])) {
$scelta = "";
while ($scelta != "phpsession" && $scelta != "sql") {
echo "Please insert the store type (" .
$colors->getColoredString("phpsession", "green") . "|sql): ";
$scelta = strtolower(readline());
if ($scelta == null || $scelta == "") {
$scelta = "phpsession";
}
}
$config['storeType'] = $scelta;
}

if (!isset($config['entityID'])) {
echo "Please insert your EntityID, must start with http:// or https:// (" .
$colors->getColoredString($_entityID, "green") . "): ";
Expand Down Expand Up @@ -844,7 +858,11 @@ public static function setup(Event $event) {
"{{TECHCONTACT_EMAIL}}" => "'" . $config['technicalContactEmail'] . "'",
"{{ACSCUSTOMLOCATION}}" => "'" . $config['acsCustomLocation'] . "'",
"{{SLOCUSTOMLOCATION}}" => "'" . $config['sloCustomLocation'] . "'",
"{{SP_DOMAIN}}" => "'." . $config['spDomain'] . "'"
"{{SP_DOMAIN}}" => "'." . $config['spDomain'] . "'",
"{{STORETYPE}}" => "'" . $config['storeType'] . "'",
"{{STORESQLDNS}}" => "'sqlite:" . ($config['storeType'] == 'sql' ? $config['installDir'] : "/path/to") . "/sqlitedatabase.sq3'",
"{{STORESQLUSERNAME}}" => ($config['storeType'] == 'sql' ? "'root'": "null"),
"{{STORESQLPASSWORD}}" => ($config['storeType'] == 'sql' ? "'" . bin2hex(random_bytes(8)) . "'": "null")
);
$template = file_get_contents($config['installDir'] . '/setup/config/config.tpl', true);
$customized = str_replace(array_keys($vars), $vars, $template);
Expand Down
8 changes: 4 additions & 4 deletions setup/config/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -693,21 +693,21 @@ $config = array(
*
* (This option replaces the old 'session.handler'-option.)
*/
'store.type' => 'phpsession',
'store.type' => {{STORETYPE}},

/*
* The DSN the sql datastore should connect to.
*
* See http://www.php.net/manual/en/pdo.drivers.php for the various
* syntaxes.
*/
'store.sql.dsn' => 'sqlite:/path/to/sqlitedatabase.sq3',
'store.sql.dsn' => {{STORESQLDNS}},

/*
* The username and password to use when connecting to the database.
*/
'store.sql.username' => null,
'store.sql.password' => null,
'store.sql.username' => {{STORESQLUSERNAME}},
'store.sql.password' => {{STORESQLPASSWORD}},

/*
* The prefix we should use on our tables.
Expand Down