From 40fbc9a685126d719aba423ac34ba56d0e68a06e Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 26 Jun 2013 13:05:12 -0500
Subject: [PATCH] Abort cron duties if upgrade is pending

---
 include/class.cron.php | 4 ++++
 scp/autocron.php       | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/class.cron.php b/include/class.cron.php
index 29265f805..257926e25 100644
--- a/include/class.cron.php
+++ b/include/class.cron.php
@@ -41,6 +41,10 @@ class Cron {
     }
 
     function run(){ //called by outside cron NOT autocron
+        global $ost;
+        if (!$ost || $ost->isUpgradePending())
+            return;
+
         self::MailFetcher();
         self::TicketMonitor();
         self::PurgeLogs();
diff --git a/scp/autocron.php b/scp/autocron.php
index a57071b78..ec7cb4c74 100644
--- a/scp/autocron.php
+++ b/scp/autocron.php
@@ -32,7 +32,7 @@ ob_start(); //Keep the image output clean. Hide our dirt.
 $sec=time()-$_SESSION['lastcroncall'];
 $caller = $thisstaff->getUserName();
 
-if($sec>180): //user can call cron once every 3 minutes.
+if($sec>180 && $ost && !$ost->isUpgradePending()): //user can call cron once every 3 minutes.
 require_once(INCLUDE_DIR.'class.cron.php');
 
 $thisstaff = null; //Clear staff obj to avoid false credit internal notes & auto-assignment
-- 
GitLab