Seti:ServersModel
From Wikiturbine
TIER 2 MODEL
Contents |
[edit] Description
This module is for reporting up-to-date status of the servers contained within the IRC network.
[edit] Abstract Model
This section is designed for planning model functionality. The code implementation of this abstraction is listed in the CakePHP portion of this page.
[edit] Variables
Variables should have type, name and short description.
Example: string name - object's name
- string name - server's name
- string hostname - net reachable hostname
- string website - A url for the server, must start with http:// or whatever the relevant protocol is
- int array ircports - list of ports listening for IRC connections using comma seperators
- string location - physical location (consider doing syntax validation upon instance creation)
- User administrator - name (and link to profile of) server admin
- int status - state of server. considered values are ONLINE (1), OFFLINE (0), N/A (otherwise)
- int userCount - how many users are on the server
[edit] Methods
Actions we would like to perform with and on this model (this includes MVC's views and controllers together).
- add/delete/update - obvious 3, should be restricted to Admin AROs in the ACL
[edit] Views
Possible views we need to have the model be capable to support
- front page / portal view - provides general information about irc servers and allows the visitors to further explore /servers via various server and irc related links.
- contained within it's own DIV within content that spans the page, with CSS defines specifically for this DIV and its children
- Output very global data
-
# of servers online out of total - # of users online out of possible max, last time and date of update
- All the math (summation of totals) should be done after an update has happened and cached.
-
- Output a few "fun" statistics if space permits
-
list 3 random available servers in line followed by "More »" - 3 'strongest' servers (whatever that would imply, most users? physically closest?)
- any one or two data outputs along these lines
-
- A few links/buttons for users to begin interacting with server model and irc
- "connect to [dropdown]" link/button - sends user to the irc link of server selected (port options included). If none selected, default 'irc.neoturbine.net' is used. Warn with "irc client required"
- "connect from browser" or otherwise appropriately named - sends user to pjirc (warn about java) or Ajax client (if we can find one) link to chat. server dropdown optional, if we can pass it.
- Link to /servers and /irc (?)
- /server views - provide complete listings of server statistics on the /servers subdomain. All of the following options for the view should contain some general server statistics at the top as well as a tab-style menu to switch between them. Clicking items on the list will lead to single item view. Under consideration is the addition of a server avatar to the model. In terms of all views for the servers, this should provide more info than the front page view and somewhat less than single item view.
- list view - displays all servers in a table format. Include columns for name, avatar, load, etc...Column titles in the header can be clicked to resort the list (by reload or ajax). Example of such list can be found on most trackers and on facebook.
- grid view - similar to facebook grid view. It will show server avatar and name in a grid. Dropdown can be used to sort items by category. NOTE: This might be a useless view to outsiders since it doesn't provide any relevant data for outside visitors.
- map view - using gmaps API or otherwise, map servers and logically connect them (hubs and leaves). Clicking markers on the map will bring up a pop-up with the server avatar, name, location, load and link to single view.
- single item view - displays all publicly acceptable information about a server in a profile style display. This includes links to admin profiles, other servers and IRC options at the bottom for all various methods of connection.
[edit] CakePHP Implementation
[edit] Model
TBA
[edit] Controllers
TBA
[edit] Views
TBA
[edit] Notes
Obtaining status information
There are probably several methods about doing this.
- Have a cron job run a script which checks each server's status one by one (allowing for a 10-15 second timeout), and then record the resulting information in the database, along with a current timestamp. This can be implemented with a simple command line PHP script.
- Use a service already available to us (like trevorj's StatServ) to report the information. The only problem with this would be in the event that his server goes down.
- This seems to be the best method so far, and can easily be implemented with RSS feeds.
- Invent some crazy way of integrating this directly into CakePHP (who knows?)
Things to consider
- How frequently should we poll for updated information?
- Could tools such as CakePHP Shells help us in any way?
- $this->requestAction('controller/action');
- call a function residing in a different controller?
- can be used to show server list on homepage (calling a function in 'servers' controller from 'pages' controller)