Drupal update.php may fail when certain modules are inactive

When running Drupal in a multi-site configuration, it’s possible to have a number of shared modules, which are only active on certain sites.

This can cause problems when updating Drupal. If certain modules are inactive running update.php may fail.

 

This has been observed with the:

Search API module:

PHP Fatal error:  Call to undefined function search_api_index_load_multiple() in /etc/drupal/7/sites/all/modules/search_api_attachments/search_api_attachments.install on line 93

Rules module:

PHP Fatal error:  Call to undefined function rules_set_cache() in /etc/drupal/7/sites/all/modules/rules/rules.install on line 517

 

The solution in both cases was to activate the modules in question and then it was possible to run update.php successfully.

After the update you can choose to deactivate the modules again or leave them active with relevant settings.