Hi,

countries_countries_alter() contains following code:

$countries = array_intersect_key($enabled_countries, $countries);
$countries = array_merge($countries, array_diff_key($enabled_countries, $countries));
uasort($countries, 'countries_sort');

I might be wrong, but I think $countries and $enabled_countries will always be equal at the end? And since $enabled_countries was already sorted in countries_get_countries() we can save a lot of sorting overhead (+-10 seconds in my case)...

Patch forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Matthijs’s picture

Status: Active » Needs review
FileSize
581 bytes
Alan D.’s picture

Status: Needs review » Reviewed & tested by the community

I think the logic here was meant to update the existing countries then to merge in any additional ones that were coming in from the $countries parameter that were not defined within the Countries module. However, as it is written, there is a logical error that breaks this and you effectively do have what your patch does.

Personally, happy to pass all responsibility to the countries module, so RTBTC from me :)

Alan D.’s picture

Status: Reviewed & tested by the community » Fixed

and pushed.

Thanks

Matthijs’s picture

Great, thanks!

Matthijs

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Removed solution code (it's in the patch).