瀏覽代碼

added system Status route to fix event sheduler

Piotr Labudda 9 年之前
父節點
當前提交
79040ab50c
共有 2 個文件被更改,包括 67 次插入2 次删除
  1. 5 2
      SE/se-lib/ProcesMenu.php
  2. 62 0
      SE/se-lib/Route/Status.php

+ 5 - 2
SE/se-lib/ProcesMenu.php

@@ -809,8 +809,11 @@ jQuery(document).ready(function() {
 							<li><a href="index.php?_route=UserMsgs" title="Wiadomości systemowe"><i class="glyphicon glyphicon-envelope"></i> Wiadomości</a></li>
 							<li><a href="index.php?_route=Notify" title="Powiadomienia"><i class="glyphicon glyphicon-bell"></i> Powiadomienia</a></li>
 							<li><a href="index.php?_route=Users&_task=reloadPerms" title="Przeładuj uprawnienia"><i class="glyphicon glyphicon-refresh"></i> Przeładuj uprawnienia</a></li>
+							<li class="divider"></li>
+							<?php if (User::isAdmin()) : ?>
+								<li><a href="index.php?_route=Status" title="Status systemu"><i class="glyphicon glyphicon-cog"></i> Status systemu</a></li>
+							<?php endif; ?>
 							<?php if (User::isAdmin()) : ?>
-								<li class="divider"></li>
 								<?php if (!$typeSpecialUserId) : ?>
 									<li>
 										<div class="alert alert-danger">Brak typespecial __USERS_ID</div>
@@ -852,8 +855,8 @@ jQuery(document).ready(function() {
 										</form>
 									</li>
 								<?php endif; ?>
+								<li class="divider"></li>
 							<?php endif; ?>
-							<li class="divider"></li>
 							<li><a href="index.php?LOGIN=LOGOUT"><i class="glyphicon glyphicon-off"></i> Wyloguj</a></li>
 						</ul>
 					</div>

+ 62 - 0
SE/se-lib/Route/Status.php

@@ -0,0 +1,62 @@
+<?php
+
+Lib::loadClass('RouteBase');
+Lib::loadClass('UI');
+
+class Route_Status extends RouteBase {
+
+  public function defaultAction() {
+    UI::gora();
+    $_ = array(UI, 'h');
+    UI::startTag('div', ['class' => "container"]);
+    echo $_('h1', [], [
+      $_('a', ['href'=>"index.php"], "SE"),
+      " &raquo; ",
+      " Status systemu procesy5"
+    ]);
+    try {
+      DB::getPDO();
+
+      if (1 == V::get('event_sheduler_on', '', $_POST)) {
+        $this->fixEventSheduler();
+      }
+
+      $dbEvents = DB::getPDO()->fetchFirst(" SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler' ");
+      // DBG::nicePrint($dbEvents, '$dbEvents');
+      //   [Variable_name] => event_scheduler
+      //   [Value] => ON
+
+      UI::table([
+        'caption' => 'Baza danych',
+        'rows' => [
+          [
+            'nazwa' => 'Event Scheduler (generowanie Grafika, itp.)',
+            'wartość' => ('ON' == $dbEvents['Value'])
+              ? $_('span', ['class' => "label label-success"], "ON")
+              : $_('span', ['class' => "label label-danger"], "OFF"),
+            '#' => UI::hButtonPost("Włącz", [
+              'class' => "btn btn-xs btn-default",
+              'data' => [
+                'event_sheduler_on' => 1
+              ]
+            ])
+          ]
+        ]
+      ]);
+
+      // UI::table([
+      //   'caption' => 'Baza danych',
+      //   'rows' => DB::getPDO()->fetchAll(" SHOW VARIABLES ")
+      // ]);
+    } catch (Exception $e) {
+      UI::alert('danger', $e->getMessage());
+    }
+    UI::endTag('div');// .container
+    UI::dol();
+  }
+
+  public function fixEventSheduler() {
+    DB::getPDO()->execSql(" SET GLOBAL event_scheduler='ON' ");
+  }
+
+}