Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey,
when having large result sets the php code is run for every result which creates a performance problem for me. Is it possible to run the code just for the rendered results?
cheers Volkan
Comment | File | Size | Author |
---|---|---|---|
#1 | views_php_runs_for_every_result-1600488-2.patch | 1.68 KB | muschpusch |
Comments
Comment #1
muschpusch CreditAttribution: muschpusch commentedI had a quick look at the code and the problem seems to be that the php code is executed in hook_views_post_execute. At that moment current_page and items_per_page aren't populated and php is executed for every result. I added items_per_page and current_page and skip the php execution for all records which won't be shown to the user. I have no idea how this will affect views_php sorting because i didn't looked at the code for it. So please review wisely. It works nicely with exposed filters btw.
Comment #2
geerlingguy CreditAttribution: geerlingguy commentedThis would most likely mess with a Views PHP sort filter, because that filter would require every row to be loaded in order to work correctly. Note that I haven't tested it, but it seems like that would be the case...
Comment #3
Liam Morland