Browse Source

UPD: Engine bump to version 1.9.25
FIX: in admin, redirect to /admin/omlsettings if can't connect to findbox., maybe change this logic in future

Giancarlo 7 years ago
parent
commit
6dfa00af13
3 changed files with 16 additions and 2 deletions
  1. 1 1
      package.json
  2. 14 1
      src/OpenMind/Admin/Pages.php
  3. 1 0
      src/OpenMind/System/Notifications.php

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "OM-Link",
 	"name": "OM-Link",
-	"version": "1.9.20",
+	"version": "1.9.25",
 	"private": true,
 	"private": true,
 	"description": "OM-Link Engine",
 	"description": "OM-Link Engine",
 	"author": "Open Mind",
 	"author": "Open Mind",

+ 14 - 1
src/OpenMind/Admin/Pages.php

@@ -10,6 +10,7 @@ namespace OpenMind\Admin;
 use Exception;
 use Exception;
 use OpenMind\FindBox\FindBoxCoreSystem;
 use OpenMind\FindBox\FindBoxCoreSystem;
 use OpenMind\FindBox\SmartESL;
 use OpenMind\FindBox\SmartESL;
+use OpenMind\System\Notifications;
 use OpenMind\Web\Controller;
 use OpenMind\Web\Controller;
 use Template;
 use Template;
 
 
@@ -17,11 +18,23 @@ class Pages extends Controller
 {
 {
 	private $findBoxCore = null;
 	private $findBoxCore = null;
 
 
+	/**
+	 * Pages constructor.
+	 * @param \Base $f3
+	 */
 	public function __construct($f3)
 	public function __construct($f3)
 	{
 	{
 		parent::__construct($f3);
 		parent::__construct($f3);
 
 
-		$this->findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb')));
+		try {
+			$this->findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb')));
+		} catch (\Exception $e) {
+			$ns = new Notifications();
+			$ns->notify(Notifications::FB_ADMIN, $f3->clean($e->getMessage()));
+			// IF can't connect to FINDBOX, reroute to OMLINK Page Settings to fast change settings
+			if ($f3->get('PATTERN') != '/admin/omlsettings')
+				$f3->reroute('/admin/omlsettings');
+		}
 
 
 		// Set Admin F3 UI folder
 		// Set Admin F3 UI folder
 		$f3->set('UI', 'ui/admin/');
 		$f3->set('UI', 'ui/admin/');

+ 1 - 0
src/OpenMind/System/Notifications.php

@@ -14,6 +14,7 @@ class Notifications extends Mapper
 {
 {
 	const FB_GENERIC = 0x01;
 	const FB_GENERIC = 0x01;
 	const FB_IMPORT = 0x02;
 	const FB_IMPORT = 0x02;
+	const FB_ADMIN = 0x03;
 	const FB_NOTALIVE = 0x0B;
 	const FB_NOTALIVE = 0x0B;
 	/**
 	/**
 	 * If you need custom notification or to simply send a command to client use FB_CUSTOM_NOTIFICATION+xxx where xxx is a number that identify your notification
 	 * If you need custom notification or to simply send a command to client use FB_CUSTOM_NOTIFICATION+xxx where xxx is a number that identify your notification