[5.2] Only register hits on items when GET or POST request#43231
[5.2] Only register hits on items when GET or POST request#43231pe7er merged 4 commits intojoomla:5.2-devfrom
Conversation
|
Hi @Hackwar , can you eleborate what is the reason for doing these changes in the controller / view and not in the model or table hit function? |
|
The model and table do the actual work of registering the hit. The decision if the hit should be counted has to be done by the controller/view. Normally, the code should be unified to check this either in the controller or in the view and not one time in the controller and the other time in the view. I can't say which solution is the right one right now. In the end, you might want to use the model or table in another context (a JSON API or CLI code) and register that as a hit, which would then create problems when you have the additional checks in there. |
|
I have tested this item ✅ successfully on 98a9ed5 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43231. |
|
I have tested this item ✅ successfully on 98a9ed5 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43231. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43231. |
|
Thanks @Hackwar ! |
Pull Request for Issue #40476 .
Summary of Changes
Right now, Joomla registers every call to the URL of a content item as a hit. However, there are cases where for example FeedBurner does HEAD requests to the URL, which isn't really a real request to get the content item. This PR filters the requests to only be registered as a hit when triggered by GET or POST.
Testing Instructions
Install the testing sample data and visit an article of your choice, for example "Content Component". See the hit counter. Request the same URL with a tool like Postman as a HEAD request.
Actual result BEFORE applying this Pull Request
The HEAD request is counted as a hit.
Expected result AFTER applying this Pull Request
The HEAD request is not counted as a hit.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed