From cac44cad01b402e87abf114dac736db587cdd43c Mon Sep 17 00:00:00 2001 From: gbili Date: Thu, 17 Sep 2020 13:51:48 +0200 Subject: [PATCH] feat: allow starting session from extenders --- config/configuration.local.php | 45 ---------------------------------- src/Webservice/WebService.php | 9 +++++-- 2 files changed, 7 insertions(+), 47 deletions(-) delete mode 100644 config/configuration.local.php diff --git a/config/configuration.local.php b/config/configuration.local.php deleted file mode 100644 index bec3e0d..0000000 --- a/config/configuration.local.php +++ /dev/null @@ -1,45 +0,0 @@ - array( - 'driver' => 'FreeTDS', - 'server' => '192.168.0.8', - 'port' => '1218', - 'username' => 'alcoda', - 'password' => 'alcodaonly', - 'name' => 'netbiblio', - ), - 'solr' => array( - 'server' => '212.147.56.162', - 'port' => '8983', - 'username' => '', - 'password' => '', - 'path' => 'solr/', - 'result_count' => 10, - ), - 'renderer' => array('class' => '\Bsr\Webservice\MockRenderer'), - 'log' => array( - 'file' => realpath(dirname(__FILE__) . '/..') . '/log/log.txt', - 'format' => '%ip% - [%date%] - %status% %error% - %time% - %func%', - // The greater the verbosity, the more is displayed - // 0 : no log at all - // 1 : log summary - // 2 : log response - 'verbosity' => 1, - ), - 'session' => array( - 'save_path' => '' - ), - 'checkfile_url' => 'http://medias.bibliothequesonore.ch/checkfile.php?', - 'checkfile_url_old' => 'http://fichiers.bibliothequesonore.ch/checkfile.php?', - 'netbiblio_worker_id' => 45, - 'www_employee_id' => 45, - 'www_library_id' => 2, - );; diff --git a/src/Webservice/WebService.php b/src/Webservice/WebService.php index 85f4d2f..d8a9d36 100644 --- a/src/Webservice/WebService.php +++ b/src/Webservice/WebService.php @@ -69,6 +69,12 @@ abstract class WebService $renderer->render($this->status, $data); } + protected function startSession() + { + session_save_path(Configuration::get('session.save_path')); + session_start(); + } + /** * Determines which method to call based on GET or POST parameters and * call it before returning the result. @@ -80,8 +86,7 @@ abstract class WebService private function call($sendSession = true) { if ($sendSession) { - session_save_path(Configuration::get('session.save_path')); - session_start(); + $this->startSession(); } $params = empty($_GET) ? $_POST : $_GET;