The function field_info_field_map(), introduced in Drupal 7.22, is more memory-efficient than field_info_fields(). That is, provided the latter isn't called at all during the request.
See https://drupal.org/node/1915646 for more information.
A small patch is attached, which removes the only instance where Rules didn't conform.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | rules-replace_field_info_fields-2206545-4.patch | 847 bytes | sanchiz |
| #2 | rules-field_api_memory-2206545-2.patch | 807 bytes | pjcdawkins |
Comments
Comment #1
dave reidWhy not just $fields = ... ? field_info_field_map() and field_info_fields();
Possibly just do a function_exists() instead of version_compare().
We could even remove the foreach() here and just do return drupal_map_assoc(array_keys($fields));
Comment #2
pjcdawkins commentedThanks for reviewing. New patch attached. The version_compare() is due to your earlier advice.
Comment #3
fagoLet's use function_exists() as those calls are pretty cheap.
Comment #4
sanchiz commentedNew patch with function_exists().
Comment #5
dasjoLooks good to go.
Comment #6
fagoThanks, committed.