Skip to content
Snippets Groups Projects
Commit c8536fe6 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #623 from greezybacon/issue/stateless-api


Make API requests stateless

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents f76ca095 908e0ad0
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,13 @@ ...@@ -14,6 +14,13 @@
vim: expandtab sw=4 ts=4 sts=4: vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/ **********************************************************************/
file_exists('../main.inc.php') or die('System Error'); file_exists('../main.inc.php') or die('System Error');
// Disable sessions for the API. API should be considered stateless and
// shouldn't chew up database records to store sessions
if (!function_exists('noop')) { function noop() {} }
session_set_save_handler('noop','noop','noop','noop','noop','noop');
define('DISABLE_SESSION', true);
require_once('../main.inc.php'); require_once('../main.inc.php');
require_once(INCLUDE_DIR.'class.http.php'); require_once(INCLUDE_DIR.'class.http.php');
require_once(INCLUDE_DIR.'class.api.php'); require_once(INCLUDE_DIR.'class.api.php');
......
...@@ -26,7 +26,7 @@ class osTicketSession { ...@@ -26,7 +26,7 @@ class osTicketSession {
if(!$this->ttl) if(!$this->ttl)
$this->ttl=SESSION_TTL; $this->ttl=SESSION_TTL;
if (!OsticketConfig::getDBVersion()) { if (!defined('DISABLE_SESSION') && !OsticketConfig::getDBVersion()) {
//Set handlers. //Set handlers.
session_set_save_handler( session_set_save_handler(
array(&$this, 'open'), array(&$this, 'open'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment