You are here

function composer_manager_write_if_changed in Composer Manager 7.2

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

Writes the composer.json file if one of the enabled / disabled modules has a composer.json file.

This is a primitive check to ensure that the composer.json file is built only when it has changes. A static boolean is also set flagging whether one or more modules being acted on contains a composer.json file, which is used in Drush hooks.

Parameters

array $modules: The enabled / disabled modules being scanned for a composer.json file.

2 calls to composer_manager_write_if_changed()
composer_manager_modules_disabled in ./composer_manager.module
Implements hook_modules_disabled().
composer_manager_modules_enabled in ./composer_manager.module
Implements hook_modules_enabled().
1 string reference to 'composer_manager_write_if_changed'
drush_composer_manager_write_if_changed in ./composer_manager.drush.inc
If one or more extensions being acted on contain a composer.json file, prompt the user to automatically run Composer's update command.

File

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

Code

function composer_manager_write_if_changed(array $modules) {
  $changed =& drupal_static(__FUNCTION__, FALSE);
  if (variable_get('composer_manager_autobuild_file', 1)) {
    if (composer_manager_packages_have_changed($modules)) {
      $changed = TRUE;
      composer_manager_write_file();
    }
  }
}