[RFC] API endpoint for combined Joomla & PHP version #37#40
[RFC] API endpoint for combined Joomla & PHP version #37#40alikon wants to merge 6 commits intojoomla:masterfrom
Conversation
|
All this trigger stuff is over my head but it seems we're missing the update trigger to decrement things. Beyond that though seems good to me. I'd probably do the API response as a nested array though instead of how you've got it. {
"3.8.12": {
"7.1.21": 1
},
"3.8.11": {
"7.0.31": 1,
"5.3.10": 1
}
} |
|
yes, sure the update trigger is currently missing.... i'm on this sorry i'm quite lazy 😄 |
again yes, there are a lot of things that can be done in a better way.... and this is surely one of these... |
|
what about the |
|
I haven't run the install command from a long time. I just do a DB backup if I need a current snapshot. So, no guarantees on the state of that command (or what issues it may or may not have with interacting in the database API). |
|
added the update trigger |
|
This needs to go through |
|
not sure to understand, 🤕 may i ask "someone else" to cover this side ? |
|
He means using this function https://github.com/joomla/statistics-server/blob/master/src/Views/Stats/StatsJsonView.php#L179-L205 which if you notice calls a data sanitisation method. |
|
So, there's a check in the controller to determine if the requestor is authorized to get the full raw data from the database. By default, that isn't the case (actually right now the only way to get raw data is to go through the database, the config value for what that header allows to see raw data isn't even set). In the view, after building the initial response structure (which is geared toward allowing the raw data), there is a check if the view is giving the raw data response. If not, the view pushes the data through the When authorized raw data, you get this response: {
"data": {
"php_version": {
"7.1.20": 5,
"7.0.31": 5,
"5.6.1": 3,
"5.6.20": 5
}
},
"total": 18
}When not authorized raw data, you get this response: {
"data": {
"php_version": {
"7.1": 27.78,
"7.0": 27.78,
"5.6": 44.44
}
},
"total": 18
} |
|
reworked on #43 |


Pull Request for Issue #37 .
Summary of Changes
to do
Testing Instructions
apply this patch
from the mysql console
drop the current insert trigger
drop the current update trigger
create the new insert trigger
create the new update trigger
call the new api endopoint
http://localhost/jstats/www/?source=cms_phpthis is how the new API endpoint response look like
Additional comments
if this will be accepted documentation https://developer.joomla.org/about/stats/api.html should be updated
i was not able to run the
bin/stats installfor the trigger sections 👶i've switched to the mysql console where it works successfully