Skip to content
This repository has been archived by the owner on Mar 12, 2018. It is now read-only.

Commit

Permalink
Commit #27
Browse files Browse the repository at this point in the history
  • Loading branch information
Patra3 committed May 9, 2016
1 parent b98034b commit 8e22ac6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Glifcos
PocketMine-MP server manager run on webserver.

** NOTE: There is currently some issues running on Windows machine. Linux/Mac works fine. **
** NOTE: Glifcos will now work on all systems! Have fun! **

### Introduction
Hi, thank you for viewing Glifcos. Glifcos is a PocketMine control panel, hosted easily on your webserver.
Expand Down Expand Up @@ -37,7 +37,7 @@ You need a webserver, a PocketMine server, and the server.log file to be enabled
##### What are some bugs or errors?
Glifcos varies on performance. There are bugs specific to your host, configuration, and enviornment.
Don't think that Glifcos is completely unstable and a 'failed' project. I've put it on an Apache instance
and it was stable. If you put it on Windows, there will defintely be some memory related leaks.
and it was stable. If you put it on Windows, there will no longer be memory leaks...

If you use a stable Apache web host, and a Unix PocketMine server... it will work just fine...

Expand Down
2 changes: 1 addition & 1 deletion glifcos-plugin/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Glifcos-p
main: glifcos\glifcos
version: 0.1.1
version: 0.1.2
api: [2.0.0, 1.0.0]
author: HotFireyDeath\Chopstick Software

Expand Down
27 changes: 12 additions & 15 deletions glifcos-plugin/src/glifcos/glifcos.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
use glifcos\maintasks\enabledplugin;

class glifcos extends PluginBase implements Listener {

public $direct;

public function onEnable(){
if (!is_dir($this->getDataFolder())){
mkdir($this->getDataFolder());
Expand Down Expand Up @@ -105,18 +107,22 @@ private function runServerCheck(){
}
}
private function sellServerInfo(){
// Don't take this angrily!! I'm just syncing
// data with the webserver >~<
$domain = $this->getConfig()->get("glifcos-domain");
// this is to get the real external ip..

if (method_exists($this->getServer(), "getCodename")){
if ($this->getServer()->getCodename() === "Ikaros"){
$genisys = true;
}
}
$dat = array("ip" => json_decode(file_get_contents("http://api.ipify.org/?format=json")
, true)["ip"],
"port" => $this->getServer()->getPort(),
"api" => $this->getServer()->getApiVersion(),
"pm-v" => $this->getServer()->getPocketMineVersion(),
"motd" => $this->getServer()->getMotd(),
);
$dat["genisys"] = $genisys;
$dat["pm-v"] = $this->getServer()->getVersion();
$compile = base64_encode(json_encode($dat));
$data = fopen($domain."?type=updatedata&data=".$compile, "r");
$this->getLogger()->info(TextFormat::BLUE.TextFormat::BOLD.
Expand Down Expand Up @@ -227,18 +233,9 @@ public function url_exists($url){
} else { return false;}
}
public function get_memory_load(){
// RESOURCE FOUND AT PHP.NET
// http://php.net/manual/en/function.sys-getloadavg.php#107243
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$wmi = new \COM("Winmgmts://");
$server = $wmi->execquery("SELECT LoadPercentage FROM Win32_Processor");
$cpu_num = 0;
$load_total = 0;
foreach($server as $cpu){
$cpu_num++;
$load_total += $cpu->loadpercentage;
}
$load = round($load_total/$cpu_num);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
exec('wmic memorychip get capacity', $totalMemory);
$load = array_sum($totalMemory) / 1024 / 1024;
}
else{
$sys_load = sys_getloadavg();
Expand Down
16 changes: 15 additions & 1 deletion glifcos-plugin/src/glifcos/maintasks/cpubroadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ public function __construct($plugin){
}
public function onRun($ticks){
if ($this->start){
if (stristr(PHP_OS, 'win')){
$wmi = new \COM("Winmgmts://");
$server = $wmi->execquery("SELECT LoadPercentage FROM Win32_Processor");
$cpu_num = 0;
$load_total = 0;
foreach($server as $cpu){
$cpu_num++;
$load_total += $cpu->loadpercentage;
}
$load = round($load_total/$cpu_num);
}
else{
$load = sys_getloadavg()[0];
}
$t = fopen($this->plugin->getConfig()->get("glifcos-domain")."?type=cpu&s=".
sys_getloadavg()[0], "r");
$load, "r");
unset($t);
gc_collect_cycles();
}
Expand Down
3 changes: 3 additions & 0 deletions glifcos-webserver/library/ceoperands/grabr.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public static function getPMBuild($base_dir){
if ($data["serverdata"]["pm-v"] === "1.0dev"){
return "ImagicalMine v1.0dev";
}
elseif ($data["serverdata"]["genisys"]){
return "Genisys ".$data["serverdata"]["pm-v"];
}
else{
return "PocketMine v".$data["serverdata"]["pm-v"];
}
Expand Down
12 changes: 6 additions & 6 deletions glifcos-webserver/library/main/mainstart.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
<i class="fa fa-bug"></i>
Report a Bug
</a>
<a style="color: blue; background-color: black;">
Glifcos v0.1.0-BETA
<a style="color: green; background-color: black;">
Glifcos v0.1.2-BETA
</a>
</div>
</div>
Expand Down Expand Up @@ -340,12 +340,12 @@ class="w3-closebtn">×</span>
</header>
<div class="w3-container">
<br>
Version: 0.1.0-BETA <br>
Version: 0.1.2-BETA <br>
Changelog:
<ul>
<li> Fixed Windows memory bug (plugin side).</li>
<li> Completed User Management (server side).</li>
<li> Misc. Improvements & Cleanups</li>
<li>- Truly fixed CPU statistics/errors on Windows!</li>
<li>- General cleanup.</li>
<li>- Added support for Genisys.</li>
</ul>
</div>
<br>
Expand Down

0 comments on commit 8e22ac6

Please sign in to comment.