8 $usage->setDefinitionText(
"add session handler");
9 $handlerName =
$usage->addRequiredParameter(
"handlerClass",
"class name of session handler to use - set to SessionHandler to use php system handler");
21 $filePath = $ref->getFileName();
25 if (file_exists($basefilePath)) {
26 $filePath = $basefilePath;
30 if (interface_exists(
"SessionHandlerInterface",
false) && is_a($h,
"SessionHandlerInterface")) {
32 $handlerCode = sprintf(
'<?php require_once("%s");$handler = new %s();session_set_save_handler($handler, true);', $filePath,
$handlerName);
35 if ($ref->hasMethod(
"open") && $ref->hasMethod(
"close") && $ref->hasMethod(
"read") && $ref->hasMethod(
"write") && $ref->hasMethod(
"destroy") && $ref->hasMethod(
"gc")) {
37 $handlerCode = sprintf(
'<?php require_once("%s");$handler = new %s();session_set_save_handler(array($handler, "open"), array($handler, "close"),array($handler, "read"),array($handler, "write"),array($handler, "destroy"),array($handler, "gc"));register_shutdown_function("session_write_close");', $filePath,
$handlerName);
42 file_put_contents(
"config/sessionHandler.php",
$handlerCode);
43 printf(
"Write config/sessionHandler.php Done.\n");
46 file_put_contents(
"config/sessionHandler.php",
$handlerCode);
47 printf(
"Reset config/sessionHandler.php Done.\n");
Verify arguments for wsh programs.