In update_get_updates_list()
and $updates
array is created by a call to drupal_get_schema_versions($module)
which returns an array of update numbers or FALSE if no updates are pending.
Further in update_get_updates_list()
the function array_combine
is used to copy the values of this $updates
array to the keys and values of the $updates
array. Then a foreach
loop iterates over the array_keys($updates)
. This makes the combination of array_combine
and array_keys
reduntant and means we can just iterate over the $updates
array as returned by drupal_get_schema_versions
. The case where that variable equals FALSE is handled by a separate if statement guarding this code.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2880387-2-avoid-unneccessary-array-operations-in-update_get_update_list.patch | 892 bytes | Kingdutch |
Comments
Comment #2
KingdutchPatch attached
Comment #3
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedI agree it makes redundant by using unnecessary array operations. Manually tested the patch. It looks good
We require tests as well.
Comment #5
borisson_All the update path tests we have already test this implicitly.
Comment #7
larowlanReviewed the remainder of that function and $updates is not used again, so the change in structure has no impact on subsequent code
Committed as a64943d and pushed to 8.5.x