updated server handling module, moved stuff in the designated api areas.

This commit is contained in:
Ulf Gebhardt 2014-07-06 18:57:48 +02:00
parent 2e950c95f3
commit 831e14e270
10 changed files with 73 additions and 35 deletions

View File

@ -1,5 +1,6 @@
<?php
SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/server','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/realm','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/world','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/database','');

View File

@ -4,4 +4,14 @@ class database {
$count = \DBD\PLAYER_ONLINE::Q1()['count'];
new WOW_STATS_PLAYER_ONLINE($count);
return $count;}
public static function backup(){
return shell_exec('/home/mojotrolls/mojo_zero/backup_db 2>&1');}
public static function pull(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/pull 2>&1');}
public static function push(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/push 2>&1');}
public static function push_dev(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/push_dev 2>&1');}
public static function commit($comment){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/commit '.$comment.' 2>&1');}
}

View File

@ -4,4 +4,9 @@ class realm {
$res = shell_exec('/home/mojotrolls/mojo_zero/realm status 2>&1');
($res == 1) ? new WOW_STATS_REALM_ONLINE() : new WOW_STATS_REALM_OFFLINE();
return ($res == 1) ? '<status>on</status>' : '<status>off</status>';}
public static function start(){
return shell_exec('/home/mojotrolls/mojo_zero/realm start 2>&1');}
public static function stop(){
return shell_exec('/home/mojotrolls/mojo_zero/realm stop 2>&1');}
}

View File

@ -0,0 +1,14 @@
<?php
class server {
public static function compile(){
return shell_exec('/home/mojotrolls/mojo_zero/compile 2>&1');}
public static function deploy(){
return shell_exec('/home/mojotrolls/mojo_zero/deploy 2>&1');}
public static function revert(){
return shell_exec('/home/mojotrolls/mojo_zero/revert 2>&1');}
public static function rights(){
return shell_exec('/home/mojotrolls/mojo_zero/rights 2>&1');}
public static function update(){
return shell_exec('/home/mojotrolls/mojo_zero/update 2>&1');}
}

View File

@ -4,4 +4,8 @@ class world {
$res = shell_exec('/home/mojotrolls/mojo_zero/world status 2>&1');
($res == 1) ? new WOW_STATS_WORLD_ONLINE() : new WOW_STATS_WORLD_OFFLINE();
return ($res == 1) ? '<status>on</status>' : '<status>off</status>';}
public static function start(){
return shell_exec('/home/mojotrolls/mojo_zero/world start 2>&1');}
public static function stop(){
return shell_exec('/home/mojotrolls/mojo_zero/world stop 2>&1');}
}

View File

@ -4,5 +4,5 @@ namespace DBD;
class mangos_world extends \SYSTEM\DB\DBInfoMYS {
public function __construct() {
parent::__construct('mangos_one_world', 'mojotrolls_dev', 'dsjgfasudzfsvad', '127.0.0.1');}
parent::__construct('mangos_zero_world', 'mojotrolls_dev', 'dsjgfasudzfsvad', '127.0.0.1');}
}

View File

@ -39,7 +39,7 @@ class saimod_mojotrollz_db_creature extends \SYSTEM\SAI\SaiModule {
</tr>';
while($row = $res->next()){
$result .= '<tr>
<td>'.$row['entry'].'</td>
<td>'.$row['Entry'].'</td>
<td>'.$row['modelid_1'].'</td>
<td>'.$row['modelid_2'].'</td>
<td>'.$row['name'].'</td>

View File

@ -1,32 +1,33 @@
<div class="panel panel-default">
<div class="panel-heading">Realm</div>
<div class="panel-heading"><h4>Realm</h4>Status: <status_realm>${status_realm}</status_realm></div>
<div class="panel-body">
<button id="realm_start" class="btn">(re)start realm</button></br>
<button id="realm_stop" class="btn">stop realm</button></br>
Status: <status_realm>${status_realm}</status_realm>
<button id="realm_start" class="btn">(re)start realm</button>
<button id="realm_stop" class="btn">stop realm</button>
</div>
</div>
<br/>
<br/>
<div class="panel panel-default">
<div class="panel-heading">World</div>
<div class="panel-heading"><h4>World</h4>Status: <status_world>${status_world}</status_world></div>
<div class="panel-body">
<button id="world_start" class="btn">(re)start world</button></br>
<button id="world_stop" class="btn">stop world</button></br>
Status: <status_world>${status_world}</status_world>
<button id="world_start" class="btn">(re)start world</button>
<button id="world_stop" class="btn">stop world</button>
</div>
</div>
<br/>
<br/>
<div class="panel panel-default">
<div class="panel-heading">Deploy Management</div>
<div class="panel-heading"><h4>Deploy Management</h4></div>
<div class="panel-body">
<button id="update" class="btn">Update Git Repo</button></br>
<button id="deploy" class="btn">Redeploy Server</button></br>
<button id="rights" class="btn">Reset Rights</button>
<button id="update" class="btn">1. Update Git Repo</button>
<button id="rights" class="btn">2. Reset Rights</button>
<button id="deploy" class="btn">3. Redeploy Server</button>
</div>
</div>
<br/>
<br/>
<div class="panel panel-default">
<div class="panel-heading">Database</div>
<div class="panel-heading"><h4>Database</h4></div>
<div class="panel-body">
<button id="db_pull" class="btn">Pull Chars and Realm from Current DB - Run db_backup after!</button></br>
<button id="db_push_dev" class="btn danger">Push Dev World - All Changes will be lost!</button></br>
@ -34,9 +35,10 @@
<input type="text" placeholder="Commit Comment"/> <button id="db_commit" class="btn">Pull Dev World, Commit to Repo</button>
</div>
</div>
<br/>
<br/>
<div class="panel panel-default">
<div class="panel-heading">Tools</div>
<div class="panel-heading"><h4>Tools</h4></div>
<div class="panel-body">
<button id="backup_db" class="btn">Backup DB</button></br>
<button id="compile" class="btn">Compile Server</button></br>

View File

@ -5,7 +5,7 @@ class saimod_mojotrollz_server_handling extends \SYSTEM\SAI\SaiModule {
$vars['status_realm'] = self::sai_mod_saimod_mojotrollz_server_handling_action_realmstatus();
$vars['status_world'] = self::sai_mod_saimod_mojotrollz_server_handling_action_worldstatus();
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/main.tpl', $vars);}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_server_handling">server handling</a></li><li class="divider"></li>';}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_server_handling">Server</a></li><li class="divider"></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function sai_mod_saimod_mojotrollz_server_handling_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array(
@ -14,35 +14,35 @@ class saimod_mojotrollz_server_handling extends \SYSTEM\SAI\SaiModule {
public static function sai_mod_saimod_mojotrollz_server_handling_flag_css(){}
public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstart(){
return shell_exec('/home/mojotrolls/mojo_zero/realm start 2>&1');}
return realm::start();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstop(){
return shell_exec('/home/mojotrolls/mojo_zero/realm stop 2>&1');}
return realm::stop();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstatus(){
return realm::status();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstart(){
return shell_exec('/home/mojotrolls/mojo_zero/world start 2>&1');}
return world::start();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstop(){
return shell_exec('/home/mojotrolls/mojo_zero/world stop 2>&1');}
return world::stop();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstatus(){
return world::status();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_compile(){
return shell_exec('/home/mojotrolls/mojo_zero/compile 2>&1');}
return server::compile();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_backup_db(){
return shell_exec('/home/mojotrolls/mojo_zero/backup_db 2>&1');}
return database::backup();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_deploy(){
return shell_exec('/home/mojotrolls/mojo_zero/deploy 2>&1');}
return server::deploy();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_revert(){
return shell_exec('/home/mojotrolls/mojo_zero/revert 2>&1');}
return server::revert();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_rights(){
return shell_exec('/home/mojotrolls/mojo_zero/rights 2>&1');}
return server::rights();}
public static function sai_mod_saimod_mojotrollz_server_handling_action_update(){
return shell_exec('/home/mojotrolls/mojo_zero/update 2>&1');}
return server::update();}
public static function sai_mod_saimod_mojotrollz_server_handling_db_pull(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/pull 2>&1');}
return database::pull();}
public static function sai_mod_saimod_mojotrollz_server_handling_db_push(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/push 2>&1');}
return database::push();}
public static function sai_mod_saimod_mojotrollz_server_handling_db_push_dev(){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/push_dev 2>&1');}
return database::push_dev();}
public static function sai_mod_saimod_mojotrollz_server_handling_db_commit($comment){
return shell_exec('/home/mojotrolls/mojo_zero/src/database/mojo/commit '.$comment.' 2>&1');}
return database::commit($comment);}
}

View File

@ -0,0 +1,2 @@
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1000, 42, 0, 0, 'saimod_mojotrollz_server_handling', 'action', NULL);