mojotrollz text fixes, crons for playercounting, server handling mod includes nice graphs about online stats now
This commit is contained in:
parent
7f9c2b1ee7
commit
85947f96a6
@ -4,5 +4,5 @@ require_once dirname(__FILE__).'/page/autoload.inc';
|
||||
require_once dirname(__FILE__).'/files/autoload.inc';
|
||||
require_once dirname(__FILE__).'/api/autoload.inc';
|
||||
require_once dirname(__FILE__).'/sql/autoload.inc';
|
||||
require_once dirname(__FILE__).'/sai/autoload.inc';
|
||||
require_once dirname(__FILE__).'/cron/autoload.inc';
|
||||
require_once dirname(__FILE__).'/cron/autoload.inc';
|
||||
require_once dirname(__FILE__).'/sai/autoload.inc';
|
||||
@ -1,3 +1,4 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__));
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SQL');
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SQL');
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/log','LOG');
|
||||
6
mojotrollz/cron/cron_players_online_classic.php
Normal file
6
mojotrollz/cron/cron_players_online_classic.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class cron_players_online_classic extends \SYSTEM\CRON\cronjob{
|
||||
public static function run(){
|
||||
new \LOG\PLAYER_COUNT_CLASSIC(\SAI\saimod_mojotrollz_server_handling::online_classic());
|
||||
}
|
||||
}
|
||||
6
mojotrollz/cron/cron_players_online_tbc.php
Normal file
6
mojotrollz/cron/cron_players_online_tbc.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class cron_players_online_tbc extends \SYSTEM\CRON\cronjob{
|
||||
public static function run(){
|
||||
new \LOG\PLAYER_COUNT_TBC(\SAI\saimod_mojotrollz_server_handling::online_tbc());
|
||||
}
|
||||
}
|
||||
8
mojotrollz/cron/cron_players_online_ts.php
Normal file
8
mojotrollz/cron/cron_players_online_ts.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
class cron_players_online_ts extends \SYSTEM\CRON\cronjob{
|
||||
public static function run(){
|
||||
\LIB\lib_ts3::php();
|
||||
$ts3 = TeamSpeak3::factory("serverquery://mojotrollztsquery:9aYllYkG@127.0.0.1:10011/");
|
||||
new \LOG\PLAYER_COUNT_TS($ts3->serverGetByPort(9987)->clientCount());
|
||||
}
|
||||
}
|
||||
8
mojotrollz/cron/log/PLAYER_COUNT_CLASSIC.php
Normal file
8
mojotrollz/cron/log/PLAYER_COUNT_CLASSIC.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace LOG;
|
||||
class PLAYER_COUNT_CLASSIC extends \SYSTEM\LOG\INFO {
|
||||
public function __construct($count){
|
||||
parent::__construct('WoW Classic Players Online: '.$count, $count);
|
||||
}
|
||||
}
|
||||
|
||||
8
mojotrollz/cron/log/PLAYER_COUNT_TBC.php
Normal file
8
mojotrollz/cron/log/PLAYER_COUNT_TBC.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace LOG;
|
||||
class PLAYER_COUNT_TBC extends \SYSTEM\LOG\INFO {
|
||||
public function __construct($count){
|
||||
parent::__construct('WoW TBC Players Online: '.$count, $count);
|
||||
}
|
||||
}
|
||||
|
||||
8
mojotrollz/cron/log/PLAYER_COUNT_TS.php
Normal file
8
mojotrollz/cron/log/PLAYER_COUNT_TS.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace LOG;
|
||||
class PLAYER_COUNT_TS extends \SYSTEM\LOG\INFO {
|
||||
public function __construct($count){
|
||||
parent::__construct('TS Players Online: '.$count, $count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ class page_mojotrollz extends \SYSTEM\API\api_default {
|
||||
return 1;}
|
||||
public static function get_class($params = null){
|
||||
return self::class;}
|
||||
public static function get_default_state(){
|
||||
return 'start';}
|
||||
|
||||
public static function default_page($_escaped_fragment_ = NULL){
|
||||
return (new default_page())->html($_escaped_fragment_);}
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
function init_saimod_mojotrollz_server(){
|
||||
{
|
||||
load_visualisation_mojotrollz_server('vis_tbc', 'stats_tbc', 'Players on WoW-TBC', 400,250);
|
||||
load_visualisation_mojotrollz_server('vis_classic', 'stats_classic', 'Players on WoW-Classic', 400,250);
|
||||
load_visualisation_mojotrollz_server('vis_ts', 'stats_ts', 'Players on Teamspeak', 900,400);
|
||||
}
|
||||
{
|
||||
$('#btn_update').click(function(){
|
||||
growl_start('Updating Server Repository... please wait')
|
||||
@ -1203,3 +1208,25 @@ function growl_end_error(message){
|
||||
stackup_spacing: 10 // spacing between consecutively stacked growls.
|
||||
});
|
||||
}
|
||||
|
||||
function load_visualisation_mojotrollz_server(div, stats, name, width, height){
|
||||
$.getJSON('./sai.php?sai_mod=.SAI.saimod_mojotrollz_server_handling&action='+stats,function(json){
|
||||
if(!json || json.status != true || !json.result){
|
||||
return;}
|
||||
json = json.result;
|
||||
var data = new google.visualization.DataTable();
|
||||
first = true;
|
||||
$.each(json[0], function(key, value){
|
||||
if(first){
|
||||
data.addColumn('datetime',key);
|
||||
first = false;
|
||||
} else {
|
||||
data.addColumn('number',key);
|
||||
}
|
||||
});
|
||||
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? parseFloat(0) : parseFloat(v)];}}));});
|
||||
|
||||
var options = {title: name, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{left:40,top:40}, vAxis:{logScale: false}, interpolateNulls: false, width: width, height: height};
|
||||
new google.visualization.LineChart(document.getElementById(div)).draw(data, options);
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class STATS_CLASSIC extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.'),?)),"%Y/%m/%d %H:%i:%s") as day,'
|
||||
.'avg('.\SYSTEM\SQL\system_log::FIELD_CODE.') online'
|
||||
.' FROM '.\SYSTEM\SQL\system_log::NAME_MYS
|
||||
.' WHERE '.\SYSTEM\SQL\system_log::NAME_MYS.'.'.\SYSTEM\SQL\system_log::FIELD_CLASS.' LIKE "%PLAYER_COUNT_CLASSIC"'
|
||||
.' GROUP BY day'
|
||||
.' ORDER BY day DESC'
|
||||
.' LIMIT 30;';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class STATS_TBC extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.'),?)),"%Y/%m/%d %H:%i:%s") as day,'
|
||||
.'avg('.\SYSTEM\SQL\system_log::FIELD_CODE.') online'
|
||||
.' FROM '.\SYSTEM\SQL\system_log::NAME_MYS
|
||||
.' WHERE '.\SYSTEM\SQL\system_log::NAME_MYS.'.'.\SYSTEM\SQL\system_log::FIELD_CLASS.' LIKE "%PLAYER_COUNT_TBC"'
|
||||
.' GROUP BY day'
|
||||
.' ORDER BY day DESC'
|
||||
.' LIMIT 30;';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class STATS_TS extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\SQL\system_log::FIELD_TIME.'),?)),"%Y/%m/%d %H:%i:%s") as day,'
|
||||
.'avg('.\SYSTEM\SQL\system_log::FIELD_CODE.') online'
|
||||
.' FROM '.\SYSTEM\SQL\system_log::NAME_MYS
|
||||
.' WHERE '.\SYSTEM\SQL\system_log::NAME_MYS.'.'.\SYSTEM\SQL\system_log::FIELD_CLASS.' LIKE "%PLAYER_COUNT_TS"'
|
||||
.' GROUP BY day'
|
||||
.' ORDER BY day DESC'
|
||||
.' LIMIT 30;';
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,14 @@ class saimod_mojotrollz_server_handling extends \SYSTEM\SAI\SaiModule {
|
||||
public static function js(){return array(
|
||||
\SYSTEM\WEBPATH(new \PSAI(),'saimod_mojotrollz_server_handling/js/saimod_mojotrollz_server_handling.js'));}
|
||||
//public static function css(){}
|
||||
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_handling_action_stats_tbc($filter = 600){
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SQL\STATS_TBC::QA(array($filter)));}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_handling_action_stats_classic($filter = 600){
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SQL\STATS_CLASSIC::QA(array($filter)));}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_handling_action_stats_ts($filter = 600){
|
||||
return \SYSTEM\LOG\JsonResult::toString(\SQL\STATS_TS::QA(array($filter)));}
|
||||
|
||||
public static function online_classic(){
|
||||
return \SQL\ONLINE_PLAYERS::Q1(new \SQL\mangos_zero_chars())['count'];}
|
||||
public static function online_tbc(){
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
<div class="panel-body">
|
||||
<button id="btn_update" class="btn-primary btn btn-sm" style="margin-right: 15px; height: 32px; font-size: 13px;"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Update</button>
|
||||
<button id="btn_changes" class="btn-warning btn btn-sm" style="margin-right: 15px; height: 32px; font-size: 13px;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Find Changes</button>
|
||||
<br>
|
||||
<br>
|
||||
<div id="vis_ts"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -31,7 +34,8 @@
|
||||
<th>players test</th>
|
||||
<td>${classic_test_players_online}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<div id="vis_classic"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
@ -172,7 +176,8 @@
|
||||
<th>players test</th>
|
||||
<td>${tbc_test_players_online}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<div id="vis_tbc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
|
||||
@ -1 +1,4 @@
|
||||
INSERT INTO `system_cron` (`class`, `min`, `hour`, `day`, `day_week`, `month`, `last_run`, `status`) VALUES ('cron_calculate_votes', 0, 0, 1, 0, 0, NULL, 0);
|
||||
INSERT INTO `system_cron` (`class`, `min`, `hour`, `day`, `day_week`, `month`, `last_run`, `status`) VALUES ('cron_calculate_votes', 0, 0, 1, 0, 0, NULL, 0);
|
||||
INSERT INTO `system_cron` (`class`, `min`, `hour`, `day`, `day_week`, `month`, `last_run`, `status`) VALUES ('cron_players_online_ts', NULL, NULL, NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `system_cron` (`class`, `min`, `hour`, `day`, `day_week`, `month`, `last_run`, `status`) VALUES ('cron_players_online_tbc', NULL, NULL, NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `system_cron` (`class`, `min`, `hour`, `day`, `day_week`, `month`, `last_run`, `status`) VALUES ('cron_players_online_classic', NULL, NULL, NULL, NULL, NULL, NULL, 0);
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user