diff --git a/setup/js/setup.js b/setup/js/setup.js index b1f8e08c3aa48397206c43ad854fc3bf4815473c..7dd4c81aa5887c7388538e9dadd9f06927d1ac4b 100644 --- a/setup/js/setup.js +++ b/setup/js/setup.js @@ -18,47 +18,4 @@ jQuery(function($) { $('#overlay, #loading').show(); return true; }); - - $('form#upgrade').submit(function(e) { - e.preventDefault(); - var form = $(this); - $('input[type=submit]', this).attr('disabled', 'disabled'); - $('#overlay, #loading').show(); - doTasks('upgrade.php',form.serialize()); - - return false; - }); - - function doTasks(url, data) { - function _lp(count) { - $.ajax({ - type: 'GET', - url: 'p.php', - async: true, - cache: false, - data: data, - dataType: 'text', - success: function(res) { - if (res) { - $('#loading #msg').html(res); - } - }, - statusCode: { - 200: function() { - setTimeout(function() { _lp(count+1); }, 2); - }, - - 304: function() { - $('#loading #msg').html("We're done... cleaning up!"); - setTimeout(function() { location.href =url;}, 3000); - } - }, - error: function() { - $('#loading #msg').html("Something went wrong"); - setTimeout(function() { location.href =url;}, 1000); - } - }); - }; - _lp(0); - } }); diff --git a/setup/p.php b/setup/p.php deleted file mode 100644 index 51c7055f257559099fd600ef12c31e882605873d..0000000000000000000000000000000000000000 --- a/setup/p.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/********************************************************************* - upgrader.php - - osTicket Upgrader Helper - called via ajax. - - Peter Rotich <peter@osticket.com> - Copyright (c) 2006-2012 osTicket - http://www.osticket.com - - Released under the GNU General Public License WITHOUT ANY WARRANTY. - See LICENSE.TXT for details. - - vim: expandtab sw=4 ts=4 sts=4: -**********************************************************************/ -function staffLoginPage($msg) { - Http::response(403, $msg?$msg:'Access Denied'); - exit; -} - -require '../scp/staff.inc.php'; -if(!$thisstaff or !$thisstaff->isAdmin()) { - staffLoginPage('Admin Access Required!'); - exit; -} - -define('SETUPINC', true); -define('INC_DIR', './inc/'); -define('SQL_DIR', INC_DIR.'sql/'); - -require_once INC_DIR.'class.upgrader.php'; - - -$upgrader = new Upgrader($cfg->getSchemaSignature(), TABLE_PREFIX, SQL_DIR); - -//Just report the next action on the first call. -if(!$_SESSION['ost_upgrader'][$upgrader->getShash()]['progress']) { - $_SESSION['ost_upgrader'][$upgrader->getShash()]['progress'] = $upgrader->getNextAction(); - Http::response(200, $upgrader->getNextAction()); - exit; -} - -if($upgrader->getNumPendingTasks()) { - if($upgrader->doTasks() && !$upgrader->getNumPendingTasks() && $ost->isUpgradePending()) { - //Just reporting done...with tasks - break in between patches! - header("HTTP/1.1 304 Not Modified"); - exit; - } -} elseif($ost->isUpgradePending() && $upgrader->isUpgradable()) { - $version = $upgrader->getNextVersion(); - if($upgrader->upgrade()) { - //We're simply reporting progress here - call back will report next action' - Http::response(200, "Upgraded to $version ... post-upgrade checks!"); - exit; - } -} elseif(!$ost->isUpgradePending()) { - $upgrader->setState('done'); - session_write_close(); - header("HTTP/1.1 304 Not Modified"); - exit; -} - -if($upgrader->isAborted() || $upgrader->getErrors()) { - Http::response(416, "We have a problem ... wait a sec."); - exit; -} - -Http::response(200, $upgrader->getNextAction()); -?>