joomla / statistics-server

Server for collecting environment stats for Joomla Installations
GNU General Public License v2.0
11 stars 17 forks source link

Architectural Overhaul #10

Closed mbabker closed 9 years ago

mbabker commented 9 years ago

To sum it up:

Application is converted into a RESTful web service which returns machine readable JSON data strings

HTML rendering is fully removed; a module should be written to display chart based statistics instead

Defaults to returning "sanitized" data with ability to request raw data

By default, a sanitized string similar to the one below is returned:

{"data":{"php_version":{"5.5":100},"db_type":{"mysql":100},"db_version":{"5.6":100},"cms_version":{"3.4.3":100},"server_os":{"Darwin":100},"total":1}}

This represents grouped data based on a characteristic of each type (for version groups it's based on a minor version branch for example) and the returned value is a float representing a percentage of the total tracked data. The total number is appended always to the response to represent the total number of unique sites for which data is collected.

The raw data may be requested by sending a Joomla-Raw header with the request with the correct header value (defined in the configuration).

Better Dependency Injection

Everything is built by the DI Container and the classes are registered as services. This better declares the object dependencies and should make it a bit easier to unit test this code.

Model/Table Consolidated

The table classes are overkill for this app. The save function is consolidated into the stats model. If this thing grows and the code becomes useful again, it's always available from the CMS (original source) or the issue tracker repo (slightly modified version of JTable).

Ability to Limit on a Single Source

A request to /php_version will only return the PHP version data. Invalid sources will cause a 404 error.

Plugin Changes Required

Should be none, I honestly didn't test, but absolutely nothing was changed in the POST handler that would require an update.