Compare commits
6 Commits
2.3.1beta1
...
v3
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e0f37528 | |||
| f803effbbd | |||
| fcceec8545 | |||
| 130dee67ea | |||
| 79c7fbc841 | |||
|
|
57608f3b2f |
1
.gitignore
vendored
@@ -10,6 +10,7 @@
|
|||||||
.idea/**/shelf
|
.idea/**/shelf
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
pack.sh
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
.idea/**/contentModel.xml
|
.idea/**/contentModel.xml
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
const PICONTROL = true;
|
|
||||||
|
|
||||||
(include_once realpath(dirname(__FILE__)).'/../../resources/init.php') or die('Error: 0x0000');
|
|
||||||
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
|
|
||||||
(include_once LIBRARY_PATH.'statistic/statistic.class.php') or die('Error: 0x0002');
|
|
||||||
(include_once LIBRARY_PATH.'statistic/statistic.function.php') or die('Error: 0x0003');
|
|
||||||
(include_once LIBRARY_PATH.'api/api.class.php') or die('Error: 0x0004');
|
|
||||||
(include_once LIBRARY_PATH.'plugin/plugin.function.php') or die('Error: 0x0005');
|
|
||||||
|
|
||||||
$api = new API;
|
|
||||||
|
|
||||||
if (isset($_POST['id']))
|
|
||||||
{
|
|
||||||
$controller = new StatisticController();
|
|
||||||
$controller->loadStatistics();
|
|
||||||
|
|
||||||
if (($name = $controller->getStatisticName($_POST['id'])) !== false)
|
|
||||||
{
|
|
||||||
if (isset($_POST['plugin']) && trim($_POST['plugin']) != '')
|
|
||||||
pluginLanguage(trim($_POST['plugin']));
|
|
||||||
|
|
||||||
$builder = new StatisticBuilder();
|
|
||||||
$builder->loadFromFile($name, (isset($_POST['plugin']) && trim($_POST['plugin']) != '') ? $_POST['plugin'] : NULL);
|
|
||||||
$statistic = $builder->getArray();
|
|
||||||
|
|
||||||
$log = new LogStatistic();
|
|
||||||
$log->setFile(LOG_PATH.$statistic['raw'].'.csv');
|
|
||||||
|
|
||||||
$arr = $info = array();
|
|
||||||
|
|
||||||
foreach ($statistic['columns'] as $column)
|
|
||||||
$arr['cols'][] = array('id' => '', 'label' => _t($column['label']), 'type' => $column['type']);
|
|
||||||
|
|
||||||
getRowsFromLog($arr, $info, $log->getAll(), $statistic['columns'], $statistic['cycle']);
|
|
||||||
|
|
||||||
if (isset($arr['rows']))
|
|
||||||
{
|
|
||||||
if (isset($_POST['type']) && $_POST['type'] == 'googleChart')
|
|
||||||
$arr['rows'] = convertForGoogleChart($arr['rows']);
|
|
||||||
|
|
||||||
$arr['rows'] = array_slice($arr['rows'], -2016);
|
|
||||||
$arr['periods'] = $info['periods'];
|
|
||||||
|
|
||||||
foreach (array('min', 'max') as $type)
|
|
||||||
{
|
|
||||||
if ($statistic['limits'][$type]['use'] == 'multiply')
|
|
||||||
$arr[$type] = round($info[$type] * $statistic['limits'][$type]['value']);
|
|
||||||
elseif ($statistic['limits'][$type]['use'] == 'fix')
|
|
||||||
{
|
|
||||||
if ($statistic['limits'][$type]['fix'] == true)
|
|
||||||
$arr[$type] = $statistic['limits'][$type]['value'];
|
|
||||||
else
|
|
||||||
$arr[$type] = round($info[$type]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$api->addData('statistic', $arr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$api->setError('error', 'Empty data.');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$api->setError('error', 'Data not found.');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$statistics = array();
|
|
||||||
$hiddenStatistics = unserialize(htmlspecialchars_decode(getConfig('main:statistic.hidden', 'a:0:{}')));
|
|
||||||
|
|
||||||
$controller = new StatisticController();
|
|
||||||
$controller->loadStatistics();
|
|
||||||
|
|
||||||
foreach ($controller->getStatistics() as $statistic)
|
|
||||||
{
|
|
||||||
$builder = new StatisticBuilder();
|
|
||||||
$builder->loadFromFile($statistic);
|
|
||||||
|
|
||||||
$array = $builder->getArray();
|
|
||||||
if (!in_array($builder->getId(), $hiddenStatistics))
|
|
||||||
$statistics[] = array('array' => $array);
|
|
||||||
}
|
|
||||||
|
|
||||||
$api->addData('statistics', $statistics);
|
|
||||||
$api->addData('hidden', $hiddenStatistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
$api->display();
|
|
||||||
101
backend/api/v1/statistic.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
const PICONTROL = true;
|
||||||
|
|
||||||
|
(include_once realpath(dirname(__FILE__)) . '/../../resources/init.php') or die('Error: 0x0000');
|
||||||
|
(include_once LIBRARY_PATH . 'main/main.function.php') or die('Error: 0x0001');
|
||||||
|
(include_once LIBRARY_PATH . 'statistic/statistic.class.php') or die('Error: 0x0002');
|
||||||
|
(include_once LIBRARY_PATH . 'statistic/statistic.function.php') or die('Error: 0x0003');
|
||||||
|
(include_once LIBRARY_PATH . 'api/api.class.php') or die('Error: 0x0004');
|
||||||
|
(include_once LIBRARY_PATH . 'plugin/plugin.function.php') or die('Error: 0x0005');
|
||||||
|
|
||||||
|
$requestMethod = $_SERVER["REQUEST_METHOD"];
|
||||||
|
|
||||||
|
if ($requestMethod == 'GET') {
|
||||||
|
$log = new LogStatistic();
|
||||||
|
$log->setFile(LOG_PATH . 'statistic/' . $_GET['statistic'] . '.csv');
|
||||||
|
$data = array();
|
||||||
|
$data['data'] = array();
|
||||||
|
$limit = 2016;
|
||||||
|
if (isset($_GET['limit'])) {
|
||||||
|
$limit = $_GET['limit'];
|
||||||
|
}
|
||||||
|
$i = 0;
|
||||||
|
foreach ($log->getAll() as $row) {
|
||||||
|
if ($i >= 2016 - $limit) {
|
||||||
|
array_push($data['data'], array('time' => (int)$row[0], 'value' => (float)$row[1]));
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo json_encode($data);
|
||||||
|
} else {
|
||||||
|
$api = new API;
|
||||||
|
|
||||||
|
if (isset($_POST['id'])) {
|
||||||
|
$controller = new StatisticController();
|
||||||
|
$controller->loadStatistics();
|
||||||
|
|
||||||
|
if (($name = $controller->getStatisticName($_POST['id'])) !== false) {
|
||||||
|
if (isset($_POST['plugin']) && trim($_POST['plugin']) != '')
|
||||||
|
pluginLanguage(trim($_POST['plugin']));
|
||||||
|
|
||||||
|
$builder = new StatisticBuilder();
|
||||||
|
$builder->loadFromFile($name, (isset($_POST['plugin']) && trim($_POST['plugin']) != '') ? $_POST['plugin'] : NULL);
|
||||||
|
$statistic = $builder->getArray();
|
||||||
|
|
||||||
|
$log = new LogStatistic();
|
||||||
|
$log->setFile(LOG_PATH . $statistic['raw'] . '.csv');
|
||||||
|
$logData = $log->getAll();
|
||||||
|
|
||||||
|
$arr = $info = array();
|
||||||
|
|
||||||
|
foreach ($statistic['columns'] as $column) {
|
||||||
|
$arr['cols'][] = array('id' => '', 'label' => _t($column['label']), 'type' => $column['type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRowsFromLog($arr, $info, $logData, $statistic['columns'], $statistic['cycle']);
|
||||||
|
|
||||||
|
if (isset($arr['rows'])) {
|
||||||
|
if (isset($_POST['type']) && $_POST['type'] == 'googleChart')
|
||||||
|
$arr['rows'] = convertForGoogleChart($arr['rows']);
|
||||||
|
|
||||||
|
$arr['rows'] = array_slice($arr['rows'], -2016);
|
||||||
|
$arr['periods'] = $info['periods'];
|
||||||
|
|
||||||
|
foreach (array('min', 'max') as $type) {
|
||||||
|
if ($statistic['limits'][$type]['use'] == 'multiply')
|
||||||
|
$arr[$type] = round($info[$type] * $statistic['limits'][$type]['value']);
|
||||||
|
elseif ($statistic['limits'][$type]['use'] == 'fix') {
|
||||||
|
if ($statistic['limits'][$type]['fix'] == true)
|
||||||
|
$arr[$type] = $statistic['limits'][$type]['value'];
|
||||||
|
else
|
||||||
|
$arr[$type] = round($info[$type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$api->addData('statistic', $arr);
|
||||||
|
} else
|
||||||
|
$api->setError('error', 'Empty data.');
|
||||||
|
} else
|
||||||
|
$api->setError('error', 'Data not found.');
|
||||||
|
} else {
|
||||||
|
$statistics = array();
|
||||||
|
$hiddenStatistics = unserialize(htmlspecialchars_decode(getConfig('main:statistic.hidden', 'a:0:{}')));
|
||||||
|
|
||||||
|
$controller = new StatisticController();
|
||||||
|
$controller->loadStatistics();
|
||||||
|
|
||||||
|
foreach ($controller->getStatistics() as $statistic) {
|
||||||
|
$builder = new StatisticBuilder();
|
||||||
|
$builder->loadFromFile($statistic);
|
||||||
|
|
||||||
|
$array = $builder->getArray();
|
||||||
|
if (!in_array($builder->getId(), $hiddenStatistics))
|
||||||
|
$statistics[] = array('array' => $array);
|
||||||
|
}
|
||||||
|
|
||||||
|
$api->addData('statistics', $statistics);
|
||||||
|
$api->addData('hidden', $hiddenStatistics);
|
||||||
|
}
|
||||||
|
|
||||||
|
$api->display();
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 993 B After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 911 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 897 B After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -7,7 +7,7 @@ $tpl->setHeaderTitle(_t('Anforderungen'));
|
|||||||
|
|
||||||
// PHP
|
// PHP
|
||||||
$phpVersion = array('version' => PHP_VERSION, 'status' => false);
|
$phpVersion = array('version' => PHP_VERSION, 'status' => false);
|
||||||
$phpSSH = array('status' => false);
|
$phpSSH = array('status' => true);
|
||||||
$phpMcrypt = array('status' => false);
|
$phpMcrypt = array('status' => false);
|
||||||
$phpCLI = array('status' => false);
|
$phpCLI = array('status' => false);
|
||||||
$phpCURL = array('status' => false);
|
$phpCURL = array('status' => false);
|
||||||
@@ -28,7 +28,7 @@ if (extension_loaded('ssh2'))
|
|||||||
#if (function_exists('mcrypt_encrypt') !== false)
|
#if (function_exists('mcrypt_encrypt') !== false)
|
||||||
# $phpMcrypt['status'] = true;
|
# $phpMcrypt['status'] = true;
|
||||||
|
|
||||||
if (trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '')
|
if (trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.1-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.2-cli | grep Status: ')) != '')
|
||||||
$phpCLI['status'] = true;
|
$phpCLI['status'] = true;
|
||||||
|
|
||||||
if (function_exists('curl_init') !== false)
|
if (function_exists('curl_init') !== false)
|
||||||