From a2c58a8ec8df15471cc320984a33c81356b05eeb Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 16 May 2014 17:00:05 -0500
Subject: [PATCH] pjax: Support detection of new deployment

---
 bootstrap.php                | 1 +
 include/staff/header.inc.php | 1 +
 setup/cli/modules/deploy.php | 4 ++++
 setup/cli/package.php        | 1 +
 4 files changed, 7 insertions(+)

diff --git a/bootstrap.php b/bootstrap.php
index e6b95d038..a4e56510c 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -294,6 +294,7 @@ define('I18N_DIR', INCLUDE_DIR.'i18n/');
 
 #Current version && schema signature (Changes from version to version)
 define('THIS_VERSION','1.8-git'); //Shown on admin panel
+define('GIT_VERSION','$git');
 //Path separator
 if(!defined('PATH_SEPARATOR')){
     if(strpos($_ENV['OS'],'Win')!==false || !strcasecmp(substr(PHP_OS, 0, 3),'WIN'))
diff --git a/include/staff/header.inc.php b/include/staff/header.inc.php
index 551fb6800..5140a44e0 100644
--- a/include/staff/header.inc.php
+++ b/include/staff/header.inc.php
@@ -6,6 +6,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta http-equiv="cache-control" content="no-cache" />
     <meta http-equiv="pragma" content="no-cache" />
+    <meta http-equiv="x-pjax-version" content="<?php echo GIT_VERSION; ?>">
     <title><?php echo ($ost && ($title=$ost->getPageTitle()))?$title:'osTicket :: Staff Control Panel'; ?></title>
     <!--[if IE]>
     <style type="text/css">
diff --git a/setup/cli/modules/deploy.php b/setup/cli/modules/deploy.php
index 06d1a2042..19aa38cee 100644
--- a/setup/cli/modules/deploy.php
+++ b/setup/cli/modules/deploy.php
@@ -116,6 +116,10 @@ class Deployment extends Unpacker {
         $source = preg_replace("/^(\s*)define\s*\(\s*'THIS_VERSION'.*$/m",
             "$1define('THIS_VERSION', '".$version."'); // Set by installer",
             $source);
+        // Set GIT_VERSION
+        $source = preg_replace("/^(\s*)define\s*\(\s*'GIT_VERSION'.*$/m",
+            "$1define('GIT_VERSION', '".$short."'); // Set by installer",
+            $source);
         // Disable error display
         $source = preg_replace("/^(\s*)ini_set\s*\(\s*'(display_errors|display_startup_errors)'.*$/m",
             "$1ini_set('$2', '0'); // Set by installer",
diff --git a/setup/cli/package.php b/setup/cli/package.php
index 6a1c68e6a..3d71d93b9 100755
--- a/setup/cli/package.php
+++ b/setup/cli/package.php
@@ -144,6 +144,7 @@ chdir($stage_path);
 
 shell_exec("sed -ri -e \"
     s/( *)define\('THIS_VERSION'.*/\\1define('THIS_VERSION', '$version');/
+    s/( *)define\('GIT_VERSION'.*/\\1define('GIT_VERSION', '$short');/
     \" upload/bootstrap.php");
 shell_exec("find upload -name '*.php' -print0 | xargs -0 sed -i -e '
     s:<script\(.*\) src=\"\(.*\).js\"></script>:<script\\1 src=\"\\2.js?$short\"></script>:
-- 
GitLab