MDL-31360 Don't use get_in_or_equal if array is empty, tidy up structure of $extracap...