You are here

function hosting_features_disable in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 hosting.features.inc \hosting_features_disable()

Disable one or more Hosting features.

Parameters

bool $rebuild: Rebuild caches afterwards, default TRUE.

bool $disable_module: Also disable the Drupal module, default TRUE.

2 calls to hosting_features_disable()
hosting_features_form_submit in ./hosting.features.inc
Submit callback for the Hosting features form.
hosting_modules_disabled in ./hosting.module
Implements hook_modules_disabled().

File

./hosting.features.inc, line 460
Include for functionality related to Hosting module features.

Code

function hosting_features_disable($disable, $rebuild = TRUE, $disable_module = TRUE) {
  if (count($disable)) {
    drupal_set_message(t("Disabling %feature feature!plural.", array(
      '%feature' => implode(", ", $disable),
      '!plural' => count($disable) > 1 ? 's' : '',
    )));
    include_once 'includes/install.inc';
    if ($disable_module) {
      module_disable(array_keys($disable));
    }
    $features = hosting_get_features();
    foreach ($disable as $module => $feature) {
      if (isset($features[$feature]['disable']) && function_exists($callback = $features[$feature]['disable'])) {
        $callback();
      }
      variable_set('hosting_feature_' . $feature, HOSTING_FEATURE_DISABLED);
    }
    if ($rebuild) {
      hosting_feature_rebuild_caches();
    }
  }
}