You are here

public static function Check::canUse in Hook Update Deploy Tools 7

Same name and namespace in other branches
  1. 8 src/Check.php \HookUpdateDeployTools\Check::canUse()

Evaluates if a module can be used.

Parameters

string $module_name: The machine name of a module.

Return value

bool TRUE if the module exists.

Throws

HudtException if the module does not exist.

22 calls to Check::canUse()
Check::isGroup in src/Check.php
A strict check for entity being a group. Fails update if !group.
Contexts::canSwitch in src/Contexts.php
Check availability of modules & methods needed to enable/disable a context.
Features::revert in src/Features.php
Safely revert an array of Features and provide feedback.
Groups::assignUsersToGroup in src/Groups.php
Add users to an Organic Group.
Groups::cooptMembers in src/Groups.php
Add members from one group, to another group.

... See full list

File

src/Check.php, line 51
File for methods related to strictly checking things.

Class

Check
Public methods for dealing with Checking things.

Namespace

HookUpdateDeployTools

Code

public static function canUse($module_name) {
  if (!empty($module_name) && module_exists($module_name)) {
    return TRUE;
  }
  else {
    $message = "The module '@name' does not exist and can not be used.";
    $vars = array(
      '@name' => $module_name,
    );
    throw new HudtException($message, $vars, WATCHDOG_ERROR, TRUE);
  }
}