From 8bca400b08606a68d4ca1ca7636bfc24dacec32e Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Fri, 17 Jan 2014 16:01:08 +0000
Subject: [PATCH] Drop global signal idea for a simple life, man!

No need to execute signal connect for each request!
---
 bootstrap.php  | 14 --------------
 main.inc.php   |  1 -
 scp/logout.php |  4 ++++
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/bootstrap.php b/bootstrap.php
index 9a66c5a07..a82796ebd 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -48,20 +48,6 @@ class Bootstrap {
             $_SERVER['REMOTE_ADDR'] = '';
     }
 
-    /*
-     * Glue to global signals  we're interested in
-     */
-    static function signals() {
-
-        //Clear upgrader session on logout.
-        Signal::connect('auth.logout', function ($user, $data=null) {
-                    if (!$user) return;
-
-                    if ($user instanceof Staff)
-                        $_SESSION['ost_upgrader'] = null;
-                });
-    }
-
     function https() {
        return
             (isset($_SERVER['HTTPS'])
diff --git a/main.inc.php b/main.inc.php
index 8c6d3d337..7feb271e7 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -26,7 +26,6 @@ Bootstrap::defineTables(TABLE_PREFIX);
 Bootstrap::i18n_prep();
 Bootstrap::loadCode();
 Bootstrap::connect();
-Bootstrap::signals();
 
 if(!($ost=osTicket::start()) || !($cfg = $ost->getConfig()))
 Bootstrap::croak('Unable to load config info from DB. Get tech support.');
diff --git a/scp/logout.php b/scp/logout.php
index 0c78cd00e..4cf519d35 100644
--- a/scp/logout.php
+++ b/scp/logout.php
@@ -15,11 +15,15 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 require('staff.inc.php');
+
 //Check token: Make sure the user actually clicked on the link to logout.
 if(!$_GET['auth'] || !$ost->validateLinkToken($_GET['auth']))
     @header('Location: index.php');
 
 $thisstaff->logOut();
+//Clear upgrader session on logout.
+$_SESSION['ost_upgrader'] = null;
+
 @header('Location: login.php');
 require('login.php');
 ?>
-- 
GitLab