/** 
  * @AfterFeature
  */
 public static function teardownFeature(AfterFeatureScope $scope)
 {
     $feature = $scope->getFeature();
     if ($feature->getTitle() == 'Dkan Harvest') {
         module_disable(array('dkan_harvest_test'));
     }
 }
Пример #2
0
/**
 * implements hook_sanmateo_is_master_set
 *
 * PARAM is_master: a bool that states if this is the master site
 *
 * THis is called when ever this site is set as master or not master
 * It can be used when other items need to be udpated
 */
function hook_sanmateo_is_master_set($is_master)
{
    if ($is_master) {
        module_enable(array('openid_provider'));
    } else {
        module_disable(array('openid_provider'));
    }
}
Пример #3
0
 /**
  * @AfterFeature @enableDKAN_Workflow
  */
 public static function disableDKAN_Workflow(AfterFeatureScope $event)
 {
     if (!parent::shouldEnableModule("dkan_workflow")) {
         return;
     }
     // Enable 'open_data_federal_extras' module.
     module_disable(array('dkan_workflow', 'dkan_workflow_permissions', 'views_dkan_workflow_tree', 'workbench', 'workbench_email', 'workbench_moderation'));
     drupal_flush_all_caches();
 }
 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $enable_for_scrub = acsf_vget('acsf_duplication_enable_for_scrub', array());
     if (!empty($enable_for_scrub)) {
         require_once DRUPAL_ROOT . '/includes/install.inc';
         // Re-disable modules that were disabled prior to starting the scrubbing
         // process, and enabled only for scrubbing.
         module_disable($enable_for_scrub);
         // Uninstall these modules. Drupal will drop their tables and any orphaned
         // data remaining in them.
         drupal_uninstall_modules($enable_for_scrub);
     }
 }
Пример #5
0
/**
 * React to an environment state change.
 *
 * Use this hook to specify changes to your site configuration depending on
 * what kind of environment the site is operating in. For example, production
 * environments should not have developer/site-builder oriented modules enabled,
 * such as administrative UI modules.
 *
 * When defining your state change actions, be careful to account for a given
 * state always consisting of the same behaviors and configuration, regardless
 * of how it returns to that state (which previous environment it was in.) Be
 * careful that you do not *disable* any modules in one environment that
 * implement a necessary instance of hook_environment_switch().
 *
 * @param $target_env
 *  The name of the environment being activated.
 * @param $current_env
 *  The name of the environment being deactivated.
 * @param $workflow
 *  The name of the environment workflow whose current state is being switched.
 *  A "NULL" workflow is the default/generic/unspecified workflow for the site.
 *
 * @return
 *  String summarizing changes made for drush user.
 */
function hook_environment_switch($target_env, $current_env, $workflow = NULL)
{
    // Declare each optional development-related module
    $devel_modules = array('devel', 'devel_generate', 'devel_node_access');
    switch ($target_env) {
        case 'production':
            module_disable($devel_modules);
            drupal_set_message('Disabled development modules');
            return;
        case 'development':
            module_enable($devel_modules);
            drupal_set_message('Enabled development modules');
            return;
    }
}
 /**
  * Test successful execution of hook_uninstall() with Mongodb disabled.
  *
  * This cannot be checked by API calls, because the missing functions will
  * still be loaded in PHP, hence the need to use the UI to trigger page
  * reloads.
  */
 public function testUninstall()
 {
     module_enable([static::DRIVER, static::MODULE]);
     $this->pass('Successfully enabled driver and watchdog.module.');
     module_disable([static::MODULE, static::DRIVER]);
     $admin = $this->drupalCreateUser(['administer modules']);
     $this->drupalLogin($admin);
     $modules = ['uninstall[mongodb_watchdog]' => 1];
     $this->drupalPost('admin/modules/uninstall', $modules, t('Uninstall'));
     $this->assertResponse(200, 'Module uninstall form succeeded');
     $this->drupalPost(NULL, [], t('Uninstall'));
     // Broken core : this should NOT be a 200, but actually is.
     // $this->assertResponse(200, 'Module uninstall confirmation succeeded');
     $this->assertText(t('The selected modules have been uninstalled.'), 'Module uninstall confirmation succeeded.');
     $this->pass('Successfully uninstalled watchdog module.');
 }
Пример #7
0
 /**
  * Disabled and uninstall modules.
  *
  * @AfterScenario
  */
 public function cleanModule()
 {
     if (isset($this->modules) && !empty($this->modules)) {
         // Disable and uninstall any modules that were enabled.
         module_disable($this->modules);
         $res = drupal_uninstall_modules($this->modules);
         unset($this->modules);
     }
 }
Пример #8
0
         } else {
             echo '<span class="success">' . sprintf(_("%s installed successfully"), $modulename) . '</span>';
         }
     }
     break;
 case 'enable':
     if (is_array($errors = module_enable($modulename))) {
         echo '<span class="error">' . sprintf(_("Error(s) enabling %s"), $modulename) . ': ';
         echo '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
         echo '</span>';
     } else {
         echo '<span class="success">' . sprintf(_("%s enabled successfully"), $modulename) . '</span>';
     }
     break;
 case 'disable':
     if (is_array($errors = module_disable($modulename))) {
         echo '<span class="error">' . sprintf(_("Error(s) disabling %s"), $modulename) . ': ';
         echo '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
         echo '</span>';
     } else {
         echo '<span class="success">' . sprintf(_("%s disabled successfully"), $modulename) . '</span>';
     }
     break;
 case 'uninstall':
     if (!EXTERNAL_PACKAGE_MANAGEMENT) {
         if (is_array($errors = module_uninstall($modulename))) {
             echo '<span class="error">' . sprintf(_("Error(s) uninstalling %s"), $modulename) . ': ';
             echo '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
             echo '</span>';
         } else {
             echo '<span class="success">' . sprintf(_("%s uninstalled successfully"), $modulename) . '</span>';
Пример #9
0
 /**
  * @Then /^I disable pinserver$/
  */
 public function iDisablePinserver()
 {
     module_disable(array('pinserver', 'pinserver_authenticate', 'os_pinserver_auth'));
 }
 /**
  * @When /^I disable the "(?P<text>(?:[^"]|\\")*)" module$/
  */
 public function iDisableTheModule($text)
 {
     module_disable(array($text));
 }
Пример #11
0
 /**
  * @When I disable the module :module
  */
 public function iDisableTheModule($module)
 {
     module_disable(array($module));
 }
Пример #12
0
 /**
  * Disabled and uninstall modules.
  *
  * @AfterScenario
  */
 public function cleanModule()
 {
     if (!empty($this->modules)) {
         // Disable and uninstall any modules that were enabled.
         module_disable($this->modules);
         drupal_uninstall_modules($this->modules);
         $this->modules = array();
     }
 }
Пример #13
0
 /**
  * This is removed in Drupal 8, and module deactivation is highly discouraged.
  *
  * @link https://www.drupal.org/node/2225029
  *
  * @see  module_disable
  *
  * @param string[] $modules
  * @param bool     $disableDependents
  */
 public function disableModules(array $modules, $disableDependents = false)
 {
     module_disable($modules, $disableDependents);
 }
osha_configure_search_autocomplete();
osha_configure_addtoany_social_share();
osha_disable_blocks();
osha_configure_permissions();
osha_config_development();
osha_configure_recaptcha();
osha_configure_on_the_web();
osha_configure_search_index();
osha_add_menu_position_rules();
variable_set('admin_theme', 'osha_admin');
variable_set('theme_default', 'osha_frontend');
variable_set('menu_position_active_link_display', 'parent');
// @todo: Workflow configuration - hook_enable throws errors.
variable_set('workbench_moderation_per_node_type', 1);
osha_workflow_create_roles();
module_disable(array('overlay'));
/**
 * Configure the index to exclude unpublished nodes.
 */
function osha_configure_search_index()
{
    if ($index = search_api_index_load('default_multilingual_node_index')) {
        $index->options['data_alter_callbacks']['search_api_alter_node_status']['status'] = 1;
        $index->save();
        $index->reindex();
        drupal_set_message(t("The indexing workflow was successfully edited. All content was scheduled for re-indexing so the new settings can take effect."));
    }
}
/**
 * Configure permissions.
 *
Пример #15
0
 /**
  * @Given /^I disable "([^"]*)"$/
  */
 public function iDisable($modules)
 {
     $modules = explode(',', $modules);
     module_disable($modules);
 }
Пример #16
0
 /**
  * @AfterScenario @remove_ODFE
  */
 public function removeODFE(AfterScenarioScope $event)
 {
     // Disable 'open_data_federal_extras' module.
     module_disable(array('open_data_federal_extras'));
     // Remove ODFE fields.
     field_delete_field('field_odfe_bureau_code');
     field_delete_field('field_odfe_data_quality');
     field_delete_field('field_odfe_investment_uii');
     field_delete_field('field_odfe_program_code');
     field_delete_field('field_odfe_system_of_records');
 }
Пример #17
0
 /**
  * Checks the behavior when enabling/disabling plug_test module.
  *
  * @param array $results
  *   Array containing the base plugins defined in plug_example module.
  * @param array $extra
  *   Array containing the extra plugins defined in plug_test module.
  * @param $path
  *   Path to the test page.
  * @param $cid
  *   Cache id related to the plugin type
  */
 protected function assertTestModulePlugins(array $results, array $extra, $path, $cid)
 {
     $modules = array('plug_test');
     module_enable($modules);
     cache_clear_all($cid, 'cache');
     $this->assertExamplePageResults(array_merge($results, $extra), $path);
     module_disable($modules);
     drupal_uninstall_modules($modules);
     cache_clear_all($cid, 'cache');
     $this->assertExamplePageResults($results, $path);
 }