You are here

function composer_manager_packages_have_changed in Composer Manager 6.2

Same name and namespace in other branches
  1. 6 composer_manager.module \composer_manager_packages_have_changed()
  2. 7.2 composer_manager.module \composer_manager_packages_have_changed()
  3. 7 composer_manager.module \composer_manager_packages_have_changed()

Returns TRUE if at least one passed modules has a composer.json file or implements hook_composer_json_alter(). These conditions indicate that the consolidated composer.json file has likely changed.

Parameters

array $modules: The list of modules being scanned for composer.json files, usually a list of modules that were installed or uninstalled.

Return value

bool

1 call to composer_manager_packages_have_changed()
composer_manager_write_if_changed in ./composer_manager.module
Writes the composer.json file if one of the enabled / disabled modules has a composer.json file.

File

./composer_manager.module, line 117
Provides consolidated management of third-party Composer-compatible packages required by contributed modules.

Code

function composer_manager_packages_have_changed(array $modules) {
  foreach ($modules as $module) {

    // Check if the module has a composer.json file.
    $module_path = drupal_get_path('module', $module);
    if (file_exists($module_path . '/composer.json')) {
      return TRUE;
    }

    // Check if the module implements hook_composer_json_alter().
    if (module_hook($module, 'composer_json_alter')) {
      return TRUE;
    }
  }
  return FALSE;
}