{"action":"created","issue":{"url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/2","labels_url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/2/comments","events_url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/2/events","html_url":"https://github.com/joomla-extensions/jstats-plugin/issues/2","id":85895911,"number":2,"title":"Server down","user":{"login":"Bakual","id":1018684,"avatar_url":"https://avatars.githubusercontent.com/u/1018684?v=3","gravatar_id":"","url":"https://api.github.com/users/Bakual","html_url":"https://github.com/Bakual","followers_url":"https://api.github.com/users/Bakual/followers","following_url":"https://api.github.com/users/Bakual/following{/other_user}","gists_url":"https://api.github.com/users/Bakual/gists{/gist_id}","starred_url":"https://api.github.com/users/Bakual/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bakual/subscriptions","organizations_url":"https://api.github.com/users/Bakual/orgs","repos_url":"https://api.github.com/users/Bakual/repos","events_url":"https://api.github.com/users/Bakual/events{/privacy}","received_events_url":"https://api.github.com/users/Bakual/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-06-07T11:50:09Z","updated_at":"2015-06-08T13:37:44Z","closed_at":"2015-06-07T13:37:01Z","body":"The plugin is trying to reach http://jstats.dongilbert.net/submit but that one is down.\r\nI guess @dongilbert closed it for good.\r\n\r\nSo we either have to get that server side script onto own property if we want to get that plugin included eventually, or just remove the code."},"comment":{"url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/comments/109997737","html_url":"https://github.com/joomla-extensions/jstats-plugin/issues/2#issuecomment-109997737","issue_url":"https://api.github.com/repos/joomla-extensions/jstats-plugin/issues/2","id":109997737,"user":{"login":"nikosdion","id":256041,"avatar_url":"https://avatars.githubusercontent.com/u/256041?v=3","gravatar_id":"","url":"https://api.github.com/users/nikosdion","html_url":"https://github.com/nikosdion","followers_url":"https://api.github.com/users/nikosdion/followers","following_url":"https://api.github.com/users/nikosdion/following{/other_user}","gists_url":"https://api.github.com/users/nikosdion/gists{/gist_id}","starred_url":"https://api.github.com/users/nikosdion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikosdion/subscriptions","organizations_url":"https://api.github.com/users/nikosdion/orgs","repos_url":"https://api.github.com/users/nikosdion/repos","events_url":"https://api.github.com/users/nikosdion/events{/privacy}","received_events_url":"https://api.github.com/users/nikosdion/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T13:37:44Z","updated_at":"2015-06-08T13:37:44Z","body":"I can tell you how I have already worked around the exact same issue in my own software – I don't want it to be broken if/when my server is down.\r\n\r\nBefore anything else I made sure I'm using a separate server for the stats collection than the main site / download area. It is on a different physical server, it has its own DNS (via Amazon Route 53), the works. This was the easy part.\r\n\r\nThe hard part is how do you do the stats collection without blocking the interface. The stats collection is NOT performed in the lifetime of a regular request. It's a separate controller task, loaded in a hidden IFRAME. If the stats call fails there's no problem with the page. We could do that in Joomla! by using a system plugin which adds this hidden IFRAME only when an Administrator or Super User is logged in AND format=html (front-end or back-end). We can do so by hooking onAfterRender and injecting the IFRAME before the `</body>` tag.\r\n\r\nHowever, this is not enough. We can do another stats collection web call when fetching updates through the CLI script. In order to prevent a network issue from killing the script we can put the stats collection last in the script and set a timeout of 10 seconds.\r\n\r\nAlso, collecting stats every 12 hours? That's an overkill! We are releasing once every 2 months, not once every week. Therefore we can live with last week's data just fine I guess. Once a week stats collection is more than enough.\r\n\r\nOf course we need another two places where that handy IFRAME is injected: the final page of the installation script and right after we've finished installing a Joomla! update. Actually, we don't even have to do that. The first time someone logs into their site after installation the stats are collected. No problem. As for updates, the .php file we run to finalise the installation can simply remove the last timestamp of the stats collection script, therefore triggering stats collection when Joomla! Update tells you that the update is completed.\r\n\r\nSo what about sites which do not use the CLI script and nobody logs into them? Ugh, well, we already have the opt-in Joomla! update check plugin. I guess that it could also run the stats collection as the last thing it does but do note that this might make the site appear slower to one or two pageloads per week. Knowing the utter crap you can read in the forum I'm pretty sure some moron will tell our users to disable update checks to prevent that non-issue from occurring once every blue moon. At the same time we're talking about the exact sites which are completely indifferent to us: they never update, they are \"built once, forgotten forever\". Do we really want to expend energy on them?\r\n\r\n## TL;DR\r\n\r\n* You need a plugin which injects an IFRAME for stats collection.\r\n* You need five extra lines in the CLI fetch updates script to also collect the stats.\r\n* Clear the last stats collection timestamp after updating Joomla!.\r\n* The collection frequency is once a week.\r\n* Unpublishing the plugin disables stats collection, making the feature opt-out to conform with various local legislation (e.g. EU requires call home to be opt-out)"}}