? ? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
31 May 2021

Summary of Changes

On installing Joomla 4.0-dev today I was confronted with this in the Home Dashboard:

Screenshot 2021-05-31 at 21 24 57

As I personally had worked on the Empty State design for modules I know this was changed since my work, so I went hunting and found the recent changes in https://github.com/joomla/joomla-cms/pull/34257/files

The problem is, after a clean install of Joomla 4.0-dev, the params for com_content do not contain a valid for record_hits and therefore the code added in #34257 below, will return false

if (!ComponentHelper::getParams('com_content')->get('record_hits'))

If you check the article options, right after clean install, you see the toggle is on for the feature, but this is an assumed default and not actually in the database params

Screenshot 2021-05-31 at 21 29 02

DB Params for com_content in #_extensions table: after clean install (Note there is no record_hits in this)

{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_tags":"1","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_links":"4","show_subcategory_content":"0","link_intro_image":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0","sef_ids":1}

HOWEVER, Joomla (rightly or wrongly) assumes the default of 1 for record_hits if it is not set, when actually recording hits (this is done in this code block below), and when displaying the Article Options after a clean install.

if (ComponentHelper::getParams('com_content')->get('record_hits', 1) == 1)

Therefore, in order to rightly assume that the recording of hits is disabled, enough to tell the user it is disabled, we have to apply the same logic, and set a default of 1 throughout

if (!ComponentHelper::getParams('com_content')->get('record_hits', 1))

Testing Instructions

see above

Actual result BEFORE applying this Pull Request

This in the module gives the game away - its a lie - hits is not disabled :-)
Screenshot 2021-05-31 at 21 24 57

Expected result AFTER applying this Pull Request

Screenshot 2021-05-31 at 21 24 43

Documentation Changes Required

// @chmst @brianteeman @richard67 @Abernyte-Git @SharkyKZ @Quy

avatar PhilETaylor PhilETaylor - open - 31 May 2021
avatar PhilETaylor PhilETaylor - change - 31 May 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 May 2021
Category Administration com_content Modules Libraries Front End
avatar PhilETaylor PhilETaylor - change - 31 May 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 31 May 2021
avatar PhilETaylor PhilETaylor - change - 31 May 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 31 May 2021
avatar PhilETaylor PhilETaylor - change - 31 May 2021
Title
[4] Set the correct default for record_hits
[4] Set the correct default for record_hits when using php
avatar PhilETaylor PhilETaylor - edited - 31 May 2021
avatar brianteeman
brianteeman - comment - 31 May 2021

why not set the value in the db on install?

avatar PhilETaylor
PhilETaylor - comment - 31 May 2021

b/c for one. The rare case that someone has installed Joomla before, and never ever saved the article options.

For 4.0.x fresh installs - we should and Im trying to add that now.

avatar PhilETaylor PhilETaylor - change - 31 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 31 May 2021
Category Administration com_content Modules Libraries Front End Administration com_content Modules SQL Installation Postgresql Libraries Front End
avatar brianteeman
brianteeman - comment - 31 May 2021

roflmao - guess you're not perfect after all. the pr that introduced the condition was not the one you referenced but one that you tested yourself and said was good. ;) haha

avatar PhilETaylor
PhilETaylor - comment - 31 May 2021

05d7440 adds the defaults on fresh installations installation

roflmao - guess you're not perfect after all.

I never said I was?

the pr that introduced the condition was not the one you referenced but one that you tested yourself and said was good. ;) haha

The PR that was "in my face" tonight after a fresh install was the one referenced that made changes to the home dashboard module. I do not know which other one you refer to?

avatar PhilETaylor
PhilETaylor - comment - 31 May 2021

Looking again at https://github.com/joomla/joomla-cms/pull/34257/files changes those are the ones ...

avatar Abernyte-Git Abernyte-Git - test_item - 1 Jun 2021 - Tested successfully
avatar Abernyte-Git
Abernyte-Git - comment - 1 Jun 2021

I have tested this item successfully on 6dd3186


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34318.

avatar Abernyte-Git
Abernyte-Git - comment - 1 Jun 2021

I have tested this item successfully on 6dd3186


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34318.

avatar sandramay0905 sandramay0905 - test_item - 2 Jun 2021 - Tested successfully
avatar sandramay0905
sandramay0905 - comment - 2 Jun 2021

I have tested this item successfully on 6dd3186


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34318.

avatar richard67 richard67 - change - 2 Jun 2021
The description was changed
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 2 Jun 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34318.

avatar richard67 richard67 - edited - 2 Jun 2021
avatar chmst chmst - close - 2 Jun 2021
avatar chmst chmst - merge - 2 Jun 2021
avatar chmst chmst - change - 2 Jun 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-06-02 19:02:11
Closed_By chmst
Labels Added: ?
avatar chmst
chmst - comment - 2 Jun 2021

Thanks

Add a Comment

Login with GitHub to post a comment