New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query-fix in com_content article modal #2795
Conversation
This change prevents the query from being executed when the value is 0. There is never an article with ID 0 and especially when there are more than one modal select per page, you have several unnecessary queries.
Can you add the tracker and some testing instructions? |
Do we have this in core somewhere? Just asking for testing. The only place I know we have one modal is the menu item form for the single article view. |
catch (RuntimeException $e) | ||
$title = false; | ||
|
||
if ((int) $this->value > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a check if ((int) $this->value > 0)
here? Imho if ((int) $this->value)
would be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the value is negative, its equally wrong, but will pass through the if()... Its not strictly necessary, but doesn't hurt either....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there even a case where it could possibly be a negative? I don't think so.
It's true that it doesn't hurt. It's just not needed.
This is in multilang sites, where you have this field for every language in your site. So a site with 5 languages will have 4 of these fields in every new article. |
Ah thanks! |
Same should be done for contacts, newsfeeds, categories I guess. |
Better? :-) |
There is a conflict with the category one |
Conflicts: administrator/components/com_categories/models/fields/modal/category.php
Should be good now. |
JError::raiseWarning(500, $e->getMessage()); | ||
$db = JFactory::getDbo(); | ||
$db->setQuery( | ||
'SELECT title' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be a douchebag can we update these queries to use JDatabaseQuery whilst we're at it? Or would you rather that in a separate PR?
@wilsonge |
Query-fix in com_content article modal
Query-fix in com_content article modal
This change prevents the query from being executed when the value is 0. There is never an article with ID 0 and especially when there are more than one modal select per page, you have several unnecessary queries.