Kaynağa Gözat

added upgrade screen if accessed twice while updating
update izi to 1.4.0

causefx 7 yıl önce
ebeveyn
işleme
785ccfb1ac

+ 36 - 30
api/functions/upgrade-functions.php

@@ -1,35 +1,41 @@
 <?php
 function upgradeCheck()
 {
-	$updateDB = false;
-	$updateSuccess = true;
-	$compare = new Composer\Semver\Comparator;
-	$oldVer = $GLOBALS['configVersion'];
-	// Upgrade check start for version below
-	$versionCheck = '2.0.0-beta-200';
-	if ($compare->lessThan($oldVer, $versionCheck)) {
-		$updateDB = true;
-		$oldVer = $versionCheck;
+	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+		$tempLock = $GLOBALS['dbLocation'] . 'DBLOCK.txt';
+		if (file_exists($tempLock)) {
+			die('upgrading');
+		}
+		$updateDB = false;
+		$updateSuccess = true;
+		$compare = new Composer\Semver\Comparator;
+		$oldVer = $GLOBALS['configVersion'];
+		// Upgrade check start for version below
+		$versionCheck = '2.0.0-beta-200';
+		if ($compare->lessThan($oldVer, $versionCheck)) {
+			$updateDB = true;
+			$oldVer = $versionCheck;
+		}
+		// End Upgrade check start for version above
+		// Upgrade check start for version below
+		$versionCheck = '2.0.0-beta-500';
+		if ($compare->lessThan($oldVer, $versionCheck)) {
+			$updateDB = true;
+			$oldVer = $versionCheck;
+		}
+		// End Upgrade check start for version above
+		if ($updateDB == true) {
+			//return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
+			// Upgrade database to latest version
+			$updateSuccess = (updateDB($oldVer)) ? true : false;
+		}
+		// Update config.php version if different to the installed version
+		if ($updateSuccess && $GLOBALS['installedVersion'] !== $GLOBALS['configVersion']) {
+			updateConfig(array('apply_CONFIG_VERSION' => $GLOBALS['installedVersion']));
+		}
+		if ($updateSuccess == false) {
+			die('Database update failed - Please manually check logs and fix - Then reload this page');
+		}
+		return true;
 	}
-	// End Upgrade check start for version above
-	// Upgrade check start for version below
-	$versionCheck = '2.0.0-beta-500';
-	if ($compare->lessThan($oldVer, $versionCheck)) {
-		$updateDB = true;
-		$oldVer = $versionCheck;
-	}
-	// End Upgrade check start for version above
-	if ($updateDB == true) {
-		//return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
-		// Upgrade database to latest version
-		$updateSuccess = (updateDB($oldVer)) ? true : false;
-	}
-	// Update config.php version if different to the installed version
-	if ($updateSuccess && $GLOBALS['installedVersion'] !== $GLOBALS['configVersion']) {
-		updateConfig(array('apply_CONFIG_VERSION' => $GLOBALS['installedVersion']));
-	}
-	if ($updateSuccess == false) {
-		die('Database update failed - Please manually check logs and fix - Then reload this page');
-	}
-	return true;
 }

+ 14 - 3
js/functions.js

@@ -5310,7 +5310,8 @@ function include(filename) {
     return false;
 }
 function defineNotification(){
-    switch(activeInfo.settings.notifications.backbone){
+    var bb = (typeof activeInfo !== 'undefined') ? activeInfo.settings.notifications.backbone : 'izi';
+    switch(bb){
         case 'toastr':
             include('plugins/bower_components/toast-master/css/jquery.toast.css');
             include('plugins/bower_components/toast-master/js/jquery.toast.js');
@@ -5386,7 +5387,7 @@ function messagePositions(){
     };
 }
 function message(heading,text,position,color,icon,timeout){
-    var bb = activeInfo.settings.notifications.backbone;
+    var bb = (typeof activeInfo !== 'undefined') ? activeInfo.settings.notifications.backbone : 'izi';
     switch (bb) {
         case 'toastr':
 
@@ -5683,12 +5684,22 @@ function toggleFullScreen() {
         }
     }
 }
+function orgErrorCode(code){
+    switch (code) {
+        case 'upgrading':
+            window.location.href = './plugins/static/upgrade.html';
+        default:
+
+    }
+}
 function launch(){
 	organizrConnect('api/?v1/launch_organizr').success(function (data) {
         try {
             var json = JSON.parse(data);
         } catch (e) {
-            message('FATAL ERROR',data,activeInfo.settings.notifications.position,'#FFF','error','60000');
+            orgErrorCode(data);
+            defineNotification();
+            message('FATAL ERROR',data,'br','#FFF','error','60000');
             return false;
         }
 		if(json.data.user == false){ location.reload(); }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
plugins/bower_components/iziToast/css/iziToast.min.css


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
plugins/bower_components/iziToast/js/iziToast.min.js


+ 92 - 0
plugins/static/upgrade.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <title>Upgrading...</title>
+    <!-- Bootstrap Core CSS -->
+    <link href="../../bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
+    <!-- animation CSS -->
+    <link href="../../css/animate.css" rel="stylesheet">
+
+    <!-- Custom CSS -->
+    <link href="../../css/dark.css" rel="stylesheet">
+    <!-- color CSS -->
+    <link href="../../css/colors/default.css" id="theme" rel="stylesheet">
+    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+    <!--[if lt IE 9]>
+    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+</head>
+<body>
+<!-- Preloader -->
+
+<section id="wrapper" class="error-page">
+    <div class="error-box">
+        <div class="error-body text-center">
+            <h1 class="text-info">Upgrading</h1>
+            <h3 class="text-uppercase">Please wait while we update Organizr for you...</h3>
+            <p class="text-muted m-t-30 m-b-30 text-uppercase">This page will auto-refresh in <span
+                    id="countdown"></span> second(s)</p>
+        </div>
+
+    </div>
+</section>
+<!-- jQuery -->
+<script src="../bower_components/jquery/dist/jquery.min.js"></script>
+<!-- Bootstrap Core JavaScript -->
+<script src="../../bootstrap/dist/js/bootstrap.min.js"></script>
+<script>
+    var time_left = 10;
+    var cinterval;
+
+    function time_dec() {
+        time_left--;
+        document.getElementById('countdown').innerHTML = time_left;
+        if (time_left == 0) {
+            local('s', 'message', 'Upgrade Complete|Thank you!');
+            document.getElementById('countdown').innerHTML = time_left;
+            window.location.replace("../../");
+            clearInterval(cinterval);
+        }
+    }
+
+    function localStorageSupport() {
+        return (('localStorage' in window) && window['localStorage'] !== null)
+    }
+
+    function local(type, key, value = null) {
+        if (localStorageSupport) {
+            switch (type) {
+                case 'set':
+                case 's':
+                    localStorage.setItem(key, value);
+                    break;
+                case 'get':
+                case 'g':
+                    return localStorage.getItem(key);
+                    break;
+                case 'remove':
+                case 'r':
+                    localStorage.removeItem(key);
+                    break;
+                default:
+                    console.warn('Organizr Function: localStorage action not defined');
+            }
+        }
+    }
+
+    cinterval = setInterval('time_dec()', 1000);
+
+
+</script>
+
+
+</body>
+</html>

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor