You are here

function merci_check_dependencies in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 import/merci_import.php \merci_check_dependencies()

Helper function for determining module dependencies.

Parameters

$modules: An associative array of modules to check. Key is module name, value is human-readable name.

Return value

A string containing the error message, if any -- FALSE otherwise.

1 call to merci_check_dependencies()
merci_import.php in import/merci_import.php
Administrative page for adding MERCI bucket/resource content types and items.

File

import/merci_import.php, line 556
Administrative page for adding MERCI bucket/resource content types and items.

Code

function merci_check_dependencies($modules) {
  $message = FALSE;
  $messages = array();

  // Have to reset the module list here, as the maintenance theme wipes
  // out the full list.
  module_list(TRUE, FALSE);
  foreach ($modules as $module => $name) {
    if (!module_exists($module)) {
      $messages[] = t('The %module module is not enabled.', array(
        '%module' => $name,
      ));
    }
  }
  if (!empty($messages)) {
    $message = t('The import was aborted for the following reasons: !messages', array(
      '!messages' => theme('item_list', $messages),
    )) . t("This has most likely occurred because the required modules are not <a href=\"index.php?q=admin/build/modules\">properly installed</a>.");
  }
  return $message;
}