Mabinogi World Wiki is brought to you by Coty C., 808idiotz, our other patrons, and contributors like you!!
Keep this wiki going by contributing to our Patreon!
PHP Server Statuses?
Was wondering if we could automate server statuses a little. A small javascript/php ping could easily find out if a server is online or not. A simple "override" could be provided in the rare event the script was wrong or to clarify details. Let me know, I'll do some research.
Was thinking of that, obviously. Unfortunately, we'd have to jump through hoops to get javascript/PHP on the wiki
Some additional problems that would have to be resolved using this would be:
- Determining whether if the server is down due to maintenance/update or is actually crashed.
- As far as I can tell, this only uses one of the channel's status to determine all. If a channel other than the first is down, it will still be shown as online/event tag.
- Short timeouts could lead to inaccurate results, especially during times with a lot of server traffic.
- MOAAAAAR.
Yeah, I made a PHP script. ATM its hosted on my personal server, http://www.ketelaar.com/MabiServers.php When I put the finishing touches on it, I'll release the sourcecode. For now, the script is working on my personal server. BTW, anyone know who the server admin is? We should bring him/her in on this....
The idea is that it would fill in the content for http://wiki.mabinogiworld.com/index.php?title=Wiki_Home/Server_Status&action=edit thus breaking the existing style as little as possible. :)
But that's where we need IJ's experience.
I defer the scripting matters to you people. I do not script in PHP; I'm a Perl guy myself. I just integrate stuff and (try to) make sure it won't break the box's security as PHP has a frequent propensity to do.
Also, Ij, this is a question for you. Where is the actual content stored? For example, the ServerStatus page, where is the Index pulling: {{:Wiki Home/Server Status/Template |Mabinogi=event |Nexon=online |Login=online |Alexina=event |AlexinaHCH=online
from? Cause if possible, I'd replace that stuff completely with the configuration section for my script, and just require() it.
The reason for that is PHP could really open up the server to attack IF we let joe blow see the source code. By separating the configuration from the workhorse, we can prevent that.
But that's a problem. People need to access the script's configuration to set things like events. So we need to have some wiki functionality.
Here's the config section of the PHP script. Good luck passing that with AJAX :/
At the Minimum we need to have this hosted on the wiki server....
OK, I gave it a face lift: http://www.ketelaar.com/WikiStatus/MabiServers.php technically, you COULD replace the current box with an iframe pointing to this. However, I am still farting with the looks, so it may break intermittently.....
HOW ABOUT WE JUST IMPLEMENT SECURE PHP? HOW ABOUT WE JUST IMPLEMENT SECURE PHP? HOW ABOUT WE JUST IMPLEMENT SECURE PHP? HOW ABOUT WE JUST IMPLEMENT SECURE PHP? HOW ABOUT WE JUST IMPLEMENT SECURE PHP? HOW ABOUT WE JUST IMPLEMENT SECURE PHP? etc etc etc
Now now, kiddies. I think, depending on if IJ has access/can directly edit the Wiki_Home sourcecode, AJAX is the way to go as this will not prevent the page from loading simply because the server status is taking a while.
AJAX code that would REPLACE the current server box. Note that the URL is for EXAMPLE ONLY and would need to be changed to reflect the actual location:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#response").load("ServerStat/info.php");
});
</script>
Elsewise, I've been looking at: http://www.mediawiki.org/wiki/Extension:Include
This implementation is potentially less secure, but if we configure it to use a regex that ONLY matches the path to the .PHP file, it should be watertight.... IJ, note that the regex would use PERL syntax, so you could fill that bit in yourself.
EITHER WAY, WE ARE NOT PERMANENTLY HOSTING THIS ON MY PERSONAL SITE
SOMEONE NEEDS TO DRAG IJ IN HERE AND MAKE HIM READ WHAT I JUST POSTED ^^^^^ (not it!)
Also, my script now reads from http://wiki.mabinogiworld.com/index.php?title=Automated_Server_Test for its configuration, so we'll need a (slightly) new template on how to edit. Its not really that much different, if you look, you'll see what I mean.
PHP source: http://pastebin.com/gbhFpga6
AJAX cannot be called Ajax because AJAX is an acronym...
Secure PHP on the other hand, cannot be all caps because "Secure" is not an acronym.
And I still don't see why we need to call IJ in when this can be done with AJAX. If you don't want it to be hosted on MM, I can host it on my 110mb.com site... ~小太郎 TALKCONTRIBS 2011:06:15:11:23 (Wednesday)
Because as a general rule, you should keep content together. This (helps) to eliminate the elements-missing look when some dependant server goes down.
Also, I cannot directly edit the homepage or insert AJAX into the server page. Unless your permissions are different, we need IJ for that.
OK, well I have heard nothing on t his for a long time.... The script has been slightly modified for reliability and ease of use... The configuration page is set up with proper editing help:Automatic Server Status and its working. The only things left to do:
- Get IJ to place the PHP and img files on the server
- Replace the current status box with some kind of include of the PHP script.