You are here

function composer_manager_lock_file in Composer Manager 7

Same name and namespace in other branches
  1. 7.2 composer_manager.module \composer_manager_lock_file()

Return the URI to the composer.lock file.

Return value

string|bool The URI to the composer.lock file, usually in public://. Returns FALSE if the lock file cannot be read.

3 calls to composer_manager_lock_file()
composer_manager_sa_cron in composer_manager_sa/composer_manager_sa.module
Implements hook_cron().
composer_manager_sa_print in composer_manager_sa/composer_manager_sa.drush.inc
Print security advisories with Drush.
composer_manager_sa_requirements in composer_manager_sa/composer_manager_sa.install
Implements hook_requirements().

File

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

Code

function composer_manager_lock_file() {
  $dir_uri = composer_manager_file_dir();
  $lock_file = $dir_uri . '/composer.lock';

  // Make sure we can read composer.lock and it's valid.
  if (file_exists($lock_file) && is_readable($lock_file)) {
    $json = file_get_contents($lock_file);
    $decoded = drupal_json_decode($json);
    if (!is_array($decoded)) {
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
  return $lock_file;
}