From 831e14e27006e4a9f91b96df2b260ef334b45a9b Mon Sep 17 00:00:00 2001 From: rylon Date: Sun, 6 Jul 2014 18:57:48 +0200 Subject: [PATCH] updated server handling module, moved stuff in the designated api areas. --- mojotrollz/api/autoload.inc.php | 1 + mojotrollz/api/database/database.php | 10 +++++ mojotrollz/api/realm/realm.php | 5 +++ mojotrollz/api/server/server.php | 14 +++++++ mojotrollz/api/world/world.php | 4 ++ mojotrollz/dbd/db/mangos_world.php | 2 +- .../saimod_mojotrollz_db_creature.php | 2 +- .../main.tpl | 38 ++++++++++--------- .../saimod_mojotrollz_server_handling.php | 30 +++++++-------- mojotrollz/sai/sql/server_handling.sql | 2 + 10 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 mojotrollz/api/server/server.php create mode 100644 mojotrollz/sai/sql/server_handling.sql diff --git a/mojotrollz/api/autoload.inc.php b/mojotrollz/api/autoload.inc.php index bda1015..34cd3d1 100644 --- a/mojotrollz/api/autoload.inc.php +++ b/mojotrollz/api/autoload.inc.php @@ -1,5 +1,6 @@ &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');} } diff --git a/mojotrollz/api/realm/realm.php b/mojotrollz/api/realm/realm.php index 587f552..f16f953 100644 --- a/mojotrollz/api/realm/realm.php +++ b/mojotrollz/api/realm/realm.php @@ -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) ? 'on' : 'off';} + + 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');} } \ No newline at end of file diff --git a/mojotrollz/api/server/server.php b/mojotrollz/api/server/server.php new file mode 100644 index 0000000..44b569c --- /dev/null +++ b/mojotrollz/api/server/server.php @@ -0,0 +1,14 @@ +&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');} +} + diff --git a/mojotrollz/api/world/world.php b/mojotrollz/api/world/world.php index 9b5ea3a..6355320 100644 --- a/mojotrollz/api/world/world.php +++ b/mojotrollz/api/world/world.php @@ -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) ? 'on' : 'off';} + 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');} } diff --git a/mojotrollz/dbd/db/mangos_world.php b/mojotrollz/dbd/db/mangos_world.php index d75586b..f1eba89 100644 --- a/mojotrollz/dbd/db/mangos_world.php +++ b/mojotrollz/dbd/db/mangos_world.php @@ -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');} } \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php index 46935cb..84bccce 100644 --- a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php +++ b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php @@ -39,7 +39,7 @@ class saimod_mojotrollz_db_creature extends \SYSTEM\SAI\SaiModule { '; while($row = $res->next()){ $result .= ' - '.$row['entry'].' + '.$row['Entry'].' '.$row['modelid_1'].' '.$row['modelid_2'].' '.$row['name'].' diff --git a/mojotrollz/sai/saimod_mojotrollz_server_handling/main.tpl b/mojotrollz/sai/saimod_mojotrollz_server_handling/main.tpl index 4dcca10..b1bae16 100644 --- a/mojotrollz/sai/saimod_mojotrollz_server_handling/main.tpl +++ b/mojotrollz/sai/saimod_mojotrollz_server_handling/main.tpl @@ -1,32 +1,33 @@
-
Realm
+

Realm

Status: ${status_realm}
-
-
- Status: ${status_realm} + +
- +
+
-
World
+

World

Status: ${status_world}
-
-
- Status: ${status_world} + +
- +
+
-
Deploy Management
+

Deploy Management

-
-
- + + +
- +
+
-
Database
+

Database



@@ -34,9 +35,10 @@
- +
+
-
Tools
+

Tools



diff --git a/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php index 5cc5818..4a49851 100644 --- a/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php +++ b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php @@ -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 '
  • server handling
  • ';} + public static function html_li_menu(){return '
  • Server
  • ';} 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);} } \ No newline at end of file diff --git a/mojotrollz/sai/sql/server_handling.sql b/mojotrollz/sai/sql/server_handling.sql new file mode 100644 index 0000000..0c25123 --- /dev/null +++ b/mojotrollz/sai/sql/server_handling.sql @@ -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); +