From 9a72118282f1f3f4bd61de5483fa947ae815f8aa Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 13 May 2013 14:33:23 -0400
Subject: [PATCH] Get the upgrader to actually work

---
 include/ajax.upgrader.php  | 7 -------
 include/class.upgrader.php | 6 ++++--
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/include/ajax.upgrader.php b/include/ajax.upgrader.php
index 00e284e42..331d23d26 100644
--- a/include/ajax.upgrader.php
+++ b/include/ajax.upgrader.php
@@ -27,13 +27,6 @@ class UpgraderAjaxAPI extends AjaxController {
 
         $upgrader = new Upgrader(TABLE_PREFIX, UPGRADE_DIR.'streams/');
 
-        //Just report the next action on the first call.
-        if(!$_SESSION['ost_upgrader'] || !$_SESSION['ost_upgrader'][$upgrader->getShash()]['progress']) {
-            $_SESSION['ost_upgrader'][$upgrader->getShash()]['progress'] = $upgrader->getNextAction();
-            Http::response(200, $upgrader->getNextAction());
-            exit;
-        }
-
         if($upgrader->isAborted()) {
             Http::response(416, "We have a problem ... wait a sec.");
             exit;
diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index 528850020..dc9aba33f 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -98,7 +98,8 @@ class Upgrader {
     }
 
     function getNumPendingTasks() {
-        return $this->getCurrentStream()->getNumPendingTasks();
+        if ($this->getCurrentStream())
+            return $this->getCurrentStream()->getNumPendingTasks();
     }
 
     function doTasks() {
@@ -125,7 +126,8 @@ class Upgrader {
     }
 
     function getSHash() {
-        return $this->getCurrentStream()->getSHash();
+        if ($this->getCurrentStream())
+            return $this->getCurrentStream()->getSHash();
     }
 }
 
-- 
GitLab