From a9713886d8dc632d085eede59a7001082f11aa0d Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 4 Feb 2015 11:00:30 -0500 Subject: [PATCH] Making some more progress on AJAX-driven install --- install/index.php | 2 +- install/mods-for-hesk/ajax/database-ajax.php | 10 +++ .../installModsForHesk.php | 72 ++++++------------- install/{ => mods-for-hesk}/migrateBans.php | 4 +- install/{ => mods-for-hesk}/modsForHesk.php | 6 +- .../{ => mods-for-hesk}/modsForHeskSql.php | 0 install/{ => mods-for-hesk}/updateTo2-0-0.php | 2 +- js/modsForHesk-javascript.js | 55 ++++++++++++++ 8 files changed, 93 insertions(+), 58 deletions(-) create mode 100644 install/mods-for-hesk/ajax/database-ajax.php rename install/{ => mods-for-hesk}/installModsForHesk.php (69%) rename install/{ => mods-for-hesk}/migrateBans.php (71%) rename install/{ => mods-for-hesk}/modsForHesk.php (98%) rename install/{ => mods-for-hesk}/modsForHeskSql.php (100%) rename install/{ => mods-for-hesk}/updateTo2-0-0.php (94%) diff --git a/install/index.php b/install/index.php index 28115f1a..0542c9cd 100644 --- a/install/index.php +++ b/install/index.php @@ -54,7 +54,7 @@ hesk_iHeader(); Upgrade


Upgrade existing HESK installation to version



- Install / Upgrade Mods for HESK + Install / Upgrade Mods for HESK


Install or upgrade existing Mods for HESK installation to version

diff --git a/install/mods-for-hesk/ajax/database-ajax.php b/install/mods-for-hesk/ajax/database-ajax.php new file mode 100644 index 00000000..bf7918ee --- /dev/null +++ b/install/mods-for-hesk/ajax/database-ajax.php @@ -0,0 +1,10 @@ + Installing / Updating Mods for HESK - + - + @@ -81,6 +80,20 @@ function printRow($version) { + + + + + + + + + + + + + +
TaskStatus
Migrate IP / Email Bans Waiting...
@@ -104,51 +117,8 @@ function printRow($version) { + - - -startVersionUpgrade(\'p140\')'; - //executePre140Scripts(); - echo ''; -} -if ($startingVersion < 140) { - echo ''; - //executePre140Scripts(); - echo ''; -} -if ($startingVersion < 141) { - echo ''; - //execute141Scripts(); - echo ''; -} -if ($startingVersion < 150) { - echo ''; - //execute150Scripts(); - echo ''; -} -if ($startingVersion < 160) { - echo ''; - //execute160Scripts(); - echo ''; -} -if ($startingVersion < 161) { - echo ''; - //execute161Scripts(); - echo ''; -} -if ($startingVersion < 170) { - echo ''; - //execute170Scripts(); - //execute170FileUpdate(); - echo ''; -} -if ($startingVersion < 200) { - echo ''; - //execute200Scripts(); - //execute200FileUpdate(); - echo ''; - //Echo completion message where the warning panel is. -} -?> \ No newline at end of file + \ No newline at end of file diff --git a/install/migrateBans.php b/install/mods-for-hesk/migrateBans.php similarity index 71% rename from install/migrateBans.php rename to install/mods-for-hesk/migrateBans.php index 5847722a..19097874 100644 --- a/install/migrateBans.php +++ b/install/mods-for-hesk/migrateBans.php @@ -1,6 +1,6 @@

Installation / Update complete!

-

Please delete the install folder for security reasons, and then proceed back to the Help Desk

+

Please delete the install folder for security reasons, and then proceed back to the Help Desk

\ No newline at end of file diff --git a/install/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php similarity index 98% rename from install/modsForHesk.php rename to install/mods-for-hesk/modsForHesk.php index e6343699..be94ca87 100644 --- a/install/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -1,6 +1,6 @@ Mods For HESK 2.0.0 Install / Upgrade - + - + diff --git a/install/modsForHeskSql.php b/install/mods-for-hesk/modsForHeskSql.php similarity index 100% rename from install/modsForHeskSql.php rename to install/mods-for-hesk/modsForHeskSql.php diff --git a/install/updateTo2-0-0.php b/install/mods-for-hesk/updateTo2-0-0.php similarity index 94% rename from install/updateTo2-0-0.php rename to install/mods-for-hesk/updateTo2-0-0.php index fba6d0b5..43866610 100644 --- a/install/updateTo2-0-0.php +++ b/install/mods-for-hesk/updateTo2-0-0.php @@ -29,5 +29,5 @@ then click "Submit".

Installation / Update complete!

-

Please delete the install folder for security reasons, and then proceed back to the Help Desk

+

Please delete the install folder for security reasons, and then proceed back to the Help Desk

\ No newline at end of file diff --git a/js/modsForHesk-javascript.js b/js/modsForHesk-javascript.js index 86dae3b4..9037c10f 100644 --- a/js/modsForHesk-javascript.js +++ b/js/modsForHesk-javascript.js @@ -133,4 +133,59 @@ function appendToInstallConsole(text) { $('#console-text').append(text).append('
'); } +function processUpdates(startingVersion) { + if (startingVersion < 1) { + startVersionUpgrade('p140'); + executeUpdate(1, 'p140'); + } else if (startingVersion < 140) { + startVersionUpgrade('140'); + executeUpdate(140, '140'); + } else if (startingVersion < 141) { + startVersionUpgrade('141'); + executeUpdate(141, '141'); + } else if (startingVersion < 150) { + startVersionUpgrade('150'); + executeUpdate(150, '150'); + } else if (startingVersion < 160) { + startVersionUpgrade('160'); + executeUpdate(160, '160'); + } else if (startingVersion < 161) { + startVersionUpgrade('161'); + executeUpdate(161, '161'); + } else if (startingVersion < 170) { + startVersionUpgrade('170'); + executeUpdate(170, '170'); + } else if (startingVersion < 200) { + startVersionUpgrade('200'); + executeUpdate(200, '200'); + } +} + +function executeUpdate(version, cssclass) { + $.ajax({ + type: 'POST', + url: 'ajax/database-ajax.php', + data: { version: version }, + success: function() { + appendToInstallConsole('Version: ' + version); + console.log('Version: ' + version); + markUpdateAsSuccess(cssclass); + if (version == 200) { + //go to ipbanmigration + appendToInstallConsole('Going to IP/Email Ban Migration...'); + console.log('Going to IP/Email Ban Migration...'); + } + processUpdates(version); + }, + error: function() { + markUpdateAsFailure(cssclass); + console.error('ERROR!'); + } + }); +} + +function migrateIpEmailBans() { + +} + jQuery(document).ready(loadJquery);