From 82124462edbe3fad6d4af3cf2f49def8b05239b8 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 9 Aug 2013 21:23:41 +0000
Subject: [PATCH] Properly unset phash after task completion

---
 include/class.upgrader.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index b599e59af..076a00ab5 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -316,7 +316,7 @@ class StreamUpgrader extends SetupWizard {
         if (!isset($this->task)) {
             $class = (include $task_file);
             if (!is_string($class) || !class_exists($class))
-                return $ost->logError("{$this->phash}:{$class}: Bogus migration task");
+                return $ost->logError("Bogus migration task", "{$this->phash}:{$class}") ;
             $this->task = new $class();
             if (isset($_SESSION['ost_upgrader']['task'][$this->phash]))
                 $this->task->wakeup($_SESSION['ost_upgrader']['task'][$this->phash]);
@@ -347,7 +347,8 @@ class StreamUpgrader extends SetupWizard {
         // data
         $this->cleanup();
         unset($_SESSION['ost_upgrader']['task'][$this->phash]);
-        unset($this->phash);
+        $this->phash = null;
+        unset($this->task);
         return false;
     }
 
@@ -414,8 +415,11 @@ class StreamUpgrader extends SetupWizard {
             return 0;
 
         //We have a cleanup script  ::XXX: Don't abort on error?
-        if($this->load_sql_file($file, $this->getTablePrefix(), false, true))
+        if($this->load_sql_file($file, $this->getTablePrefix(), false, true)) {
+            $ost->logDebug("Upgrader - {$this->phash} cleanup",
+                "Applied cleanup script {$file}");
             return 0;
+        }
 
         $ost->logDebug('Upgrader', sprintf("%s: Unable to process cleanup file",
                         $this->phash));
-- 
GitLab