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.
The function actions_synchronize has a parameter $actions_in_code that is really not needed and can be simplified. A look at all the references to actions_synchronize shows that in any case where a $actions_in_code parameter is passed (and not the default array() is used), all that is passed is actions_list(), which we could just do by default in actions_synchronize(). This simplifies actions code and should result in a small gain in performance.
Comment | File | Size | Author |
---|---|---|---|
#10 | 319404-actions-synchronize-D7.patch | 2.92 KB | Dave Reid |
#6 | actions-synchronize-319404-6-D7.patch | 2.78 KB | Dave Reid |
#1 | actions-synchronize-319404-1-D7.patch | 2.72 KB | Dave Reid |
Comments
Comment #1
Dave ReidAttached patch and did some ApacheBench testing on the admin/settings/actions page (which calls actions_synchronize) with 500 requests. Before patch:
After patch
Result is a very minor increase (no decrease!) in performance and increase in simplicity. Patch also added needed documentation to actions_synchronize for the $delete_orphans parameter.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThe problem I have is that now actions_list is called twice. And calling actions_synchronize now resets the $actions cache in actions_list. I don't think we want either to happen.
Comment #3
Dave ReidWhen we're running actions_synchronize, we would always want to get the latest from actions_list. By running it first in actions_synchronize, any later calls to actions_list are now cached and quick since it was already run.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedLet's see what others think.
Comment #5
Dave ReidThe main reason for this patch is simplification. Any time the actual $actions_in_code parameter is used, it's just passed array_list() in the function call (i.e.
actions_synchronize(actions_list());
). It's a pointless parameter that can just be simplified by putting an actions_list() inside the function and remove that parameter.Comment #6
Dave ReidRe-roll after DBTNG update to actions.inc
Comment #8
Dave ReidTesting error. Resetting status.
Comment #10
Dave ReidRe-rolling.
Comment #12
Dave ReidTesting slave #8 failure.
Comment #13
Dries CreditAttribution: Dries commentedI'm in support for this patch. It simplifies the code indeed.
Comment #14
Damien Tournoud CreditAttribution: Damien Tournoud commentedInteresting patch, let's get it in :)
Comment #15
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!