The true flag is set, it must be removed or replaced with false, since this significantly loads the server and is not used in any way!
Labels |
Added:
No Code Attached Yet
|
According to the documentation, this flag means that the fields will be additionally processed by the template engine, but we use rawvalue and we do not need templating here, it goes to empty, when a massive operation occurs, the server is very heavily loaded trying to wrap the fields in a template that will be in value but will not be in rawvalue
Evidence is not needed, just look at what this operation is for, in this place it is meaningless
But how can we test your assertion that it has an impact on the server or that it isnt used
Fields like list, radio, and other multiple fields worsen the situation because they are additionally processed by the template engine. The more such fields a material has, the slower it is to save, move to another category, change the state of the material. This is not to mention group operations, it's even worse there.
Move 100 materials that have 100 properties to another category, and then the server will start turning fans very quickly))
Evidence that in this context the true flag is simply not needed
The GetFields method in the FieldsHelper model
The third argument GetFields is $preparvalue = false
Let's see what it's for, let's go down below
It says here that if $preparvalue = true, the onCustomFieldsPrepareField event will be called with passing arguments for templating.
Let's see what the onCustomFieldsPrepareField method does, to which we pass arguments for templating.
Inside we will see the templating
$path = PluginHelper::getLayoutPath('fields', $this->_name, $field->type);
ob_start();
include $path;
$output = ob_get_clean();
return $output;
The result of onCustomFieldsPrepareField will be saved in $field->value
After that, the FieldsHelper model will return us an array of $fields with objects
Which we use at this point by collecting the $fieldsData array
After that, the $fieldsData array will be passed on, onContentAfterSave
As a result, a template engine was called, the result of which will be stored in $field->value, but $field->value was not used anywhere! But we used $field->rawvalue, which is available without the template engine.
$fields = FieldsHelper::getFields('com_content.article', $oldItem, true);
$fieldsData = array();
if (!empty($fields))
{
$fieldsData['com_fields'] = array();
foreach ($fields as $field)
{
$fieldsData['com_fields'][$field->name] = $field->rawvalue;
}
}
Factory::getApplication()->triggerEvent('onContentAfterSave', array('com_content.article', &$this->table, false, $fieldsData));
It turns out that we just started templating, consumed server resources and did not use the result of the work in any way
joomla-cms/plugins/system/fields/fields.php
Line 494 in de15a40
Title |
|
By quick look at the code, seems a valid performance improvement to me although I haven't looked at it carefully enough yet. @laoneo Since you understand this better than anyone else, could you please look at this issue and make PR to improve it (or ask @salitygen to make PR)
I guess @salitygen is right here, that it can be changed to false as the value
is not needed.
Thanks for confirming. @salitygen Could you please make PR with your suggested changes so that we can get this performance improvement ? Thanks !
Labels |
Added:
bug
|
Please provide your evidence. I am not saying you are right or wrong. But how can we test your assertion that it has an impact on the server or that it isnt used