当前位置: 首页>>代码示例>>PHP>>正文


PHP module_enable函数代码示例

本文整理汇总了PHP中module_enable函数的典型用法代码示例。如果您正苦于以下问题:PHP module_enable函数的具体用法?PHP module_enable怎么用?PHP module_enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了module_enable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Implements setUp().
  */
 function setUp($modules = array())
 {
     if (!isset($this->time)) {
         $this->time = time();
     }
     $this->timeLimit = 1000;
     parent::setUp();
     if (!module_exists('forum_access')) {
         module_enable(array('acl', 'chain_menu_access', 'forum_access'), FALSE);
     }
     $this->assertTrue(module_exists('acl'), t('Module %module enabled!', array('%module' => 'acl')), 'Setup');
     $this->assertTrue(module_exists('chain_menu_access'), t('Module %module enabled!', array('%module' => 'chain_menu_access')), 'Setup');
     $this->assertTrue(module_exists('forum_access'), t('Module %module enabled!', array('%module' => 'forum_access')), 'Setup');
     $modules = array('devel', 'devel_node_access') + $modules;
     $files = system_rebuild_module_data();
     $available_modules = array();
     foreach ($modules as $module) {
         if (!empty($files[$module]) && !module_exists($module)) {
             $available_modules[] = $module;
         }
     }
     if (!empty($available_modules)) {
         module_enable($available_modules);
     }
     parent::resetAll();
     $this->accesses = array('view', 'create', 'update', 'delete');
 }
开发者ID:alauzon,项目名称:pf,代码行数:30,代码来源:forum_access_test_base.php

示例2: testPermissions

 /**
  * Test that the links are added to the page (no JS testing).
  */
 function testPermissions()
 {
     module_enable(array('contact'));
     $this->resetAll();
     // Anonymous users should not see the menu.
     $this->drupalGet('');
     $this->assertNoElementByXPath('//div[@id="admin-menu"]', array(), t('Administration menu not found.'));
     // Create a user who
     // - can access content overview
     // - cannot access drupal.org links
     // - cannot administer Contact module
     $permissions = $this->basePermissions + array('access content overview');
     $admin_user = $this->drupalCreateUser($permissions);
     $this->drupalLogin($admin_user);
     // Check that the user can see the admin links, but not the drupal links.
     $this->assertElementByXPath('//div[@id="admin-menu"]', array(), 'Administration menu found.');
     $this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/content'), 'Content link found.');
     $this->assertNoElementByXPath('//div[@id="admin-menu"]//a[@href=:path]', array(':path' => 'http://drupal.org'), 'Icon » Drupal.org link not found.');
     $this->assertNoElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/structure/contact'), 'Structure » Contact link not found.');
     // Create a user "reversed" to the above; i.e., who
     // - cannot access content overview
     // - can access drupal.org links
     // - can administer Contact module
     $permissions = $this->basePermissions + array('display drupal links', 'administer contact forms');
     $admin_user2 = $this->drupalCreateUser($permissions);
     $this->drupalLogin($admin_user2);
     $this->assertElementByXPath('//div[@id="admin-menu"]', array(), 'Administration menu found.');
     $this->assertNoElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/content'), 'Content link not found.');
     $this->assertElementByXPath('//div[@id="admin-menu"]//a[@href=:path]', array(':path' => 'http://drupal.org'), 'Icon » Drupal.org link found.');
     $this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/structure/contact'), 'Structure » Contact link found.');
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:34,代码来源:AdminMenuPermissionsTest.php

示例3: setupFeature

 /** 
  * @BeforeFeature
  */
 public static function setupFeature(BeforeFeatureScope $scope)
 {
     $feature = $scope->getFeature();
     if ($feature->getTitle() == 'Dkan Harvest') {
         module_enable(array('dkan_harvest_test'));
     }
 }
开发者ID:nucivic,项目名称:dkanextension,代码行数:10,代码来源:HarvestSourceContext.php

示例4: xautoloadTestWithCacheTypes

 /**
  * @param array $cache_types
  *   The autoloader modes that are enabled, e.g.
  *   array('apc' => 'apc', 'xcache' => 'xcache')
  * @param bool $cache_lazy
  *   Whether the "lazy" mode is enabled.
  */
 protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy)
 {
     // @FIXME
     // // @FIXME
     // // The correct configuration object could not be determined. You'll need to
     // // rewrite this call manually.
     // variable_set(XAUTOLOAD_VARNAME_CACHE_TYPES, $cache_types);
     $this->pass("Set cache types: " . var_export($cache_types, TRUE));
     // @FIXME
     // // @FIXME
     // // The correct configuration object could not be determined. You'll need to
     // // rewrite this call manually.
     // variable_set(XAUTOLOAD_VARNAME_CACHE_LAZY, $cache_lazy);
     $this->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));
     // Enable xautoload.
     module_enable(array('xautoload'), FALSE);
     // At this time the xautoload_cache_mode setting is not in effect yet,
     // so we have to clear old cached values from APC cache.
     xautoload()->cacheManager->renewCachePrefix();
     module_enable(array('xautoload_test_1', 'xautoload_test_2', 'xautoload_test_3', 'xautoload_test_4', 'xautoload_test_5'), FALSE);
     menu_rebuild();
     foreach (array('xautoload_test_1' => array('Drupal\\xautoload_test_1\\ExampleClass'), 'xautoload_test_2' => array('xautoload_test_2_ExampleClass'), 'xautoload_test_3' => array('Drupal\\xautoload_test_3\\ExampleClass')) as $module => $classes) {
         $classes_on_include = in_array($module, array('xautoload_test_2', 'xautoload_test_3'));
         $this->xautoloadModuleEnabled($module, $classes, $classes_on_include);
         $this->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:34,代码来源:XAutoloadWebTestCase.php

示例5: testEnable

 /**
  * Test successful execution of hook_requirements() during install/enable.
  *
  * Function module_enable() does not check requirements, unlike normal
  * enabling, so we need to invoke the hook manually to simulate it.
  */
 public function testEnable()
 {
     module_load_install(static::MODULE);
     module_invoke(static::MODULE, 'requirements', 'install');
     module_enable([static::MODULE], FALSE);
     $this->pass('Successfully enabled mongodb.module.');
 }
开发者ID:pjcdawkins,项目名称:drupal7mongodb,代码行数:13,代码来源:PackageManagementTest.php

示例6: hook_sanmateo_is_master_set

/**
 * 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'));
    }
}
开发者ID:anselmbradford,项目名称:OpenSanMateo,代码行数:16,代码来源:sanmateo.api.php

示例7: prepTestData

 function prepTestData()
 {
     $servers = array();
     $variables = array();
     $authentication = array();
     $authorization = array();
     $this->testFunctions = new LdapTestFunctions();
     if ($this->useFeatureData) {
         module_enable(array('ctools'), TRUE);
         module_enable(array('strongarm'), TRUE);
         module_enable(array('features'), TRUE);
         module_enable(array($this->featureName), TRUE);
         // will need to set non exportables such as bind password also
         // also need to create fake ldap server data.  use
         if (!(module_exists('ctools') && module_exists('strongarm') && module_exists('features') && module_exists('$this->featureName'))) {
             drupal_set_message(t('Features and Strongarm modules must be available to use Features as configuratio of simpletests'), 'warning');
         }
         // with test data stored in features, need to get server properties from ldap_server properties
         require_once drupal_get_path('module', $this->featureName) . '/' . $this->featureName . '.ldap_servers.inc';
         require_once drupal_get_path('module', $this->featureName) . '/fake_ldap_server_data.inc';
         $function_name = $this->featureName . '_default_ldap_servers';
         $servers = call_user_func($function_name);
         foreach ($servers as $sid => $server) {
             $this->testData['servers'][$sid]['properties'] = (array) $server;
             // convert to array
             $this->testData['servers'][$sid]['properties']['inDatabase'] = TRUE;
             $this->testData['servers'][$sid]['properties']['bindpw'] = 'goodpwd';
             $this->testData['servers'][$sid] = array_merge($this->testData['servers'][$sid], $fake_ldap_server_data[$sid]);
         }
         // make included fake sid match feature sid
         $this->testFunctions->prepTestConfiguration($this->testData, TRUE);
     } else {
         include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->authorizationData;
         $this->testData['authorization'] = $authorization;
         include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->authenticationData;
         $this->testData['authentication'] = $authentication;
         include drupal_get_path('module', 'ldap_authorization') . '/tests/' . $this->serversData;
         $this->testData['servers'] = $servers;
         $this->testData['variables'] = $variables;
         // if only one server, set as default in authentication and authorization
         if (count($this->testData['servers']) == 1) {
             $sids = array_keys($servers);
             $this->sid = $sids[0];
             foreach ($this->testData['authorization'] as $consumer_type => $consumer_conf) {
                 $this->testData['authorization'][$consumer_type]['consumerType'] = $consumer_type;
                 $this->testData['authorization'][$consumer_type]['sid'] = $this->sid;
             }
             $this->testData['authentication']['sids'] = array($this->sid => $this->sid);
             $this->testData['servers'][$this->sid]['sid'] = $this->sid;
         }
         $this->testFunctions->prepTestConfiguration($this->testData, FALSE);
     }
 }
开发者ID:bellcom,项目名称:syddjurs.dk,代码行数:53,代码来源:LdapAuthorizationTestCase.class.php

示例8: enableDKAN_Workflow

 /**
  * @BeforeFeature @enableDKAN_Workflow
  */
 public static function enableDKAN_Workflow(BeforeFeatureScope $scope)
 {
     if (!parent::shouldEnableModule("dkan_workflow")) {
         return;
     }
     // This order matters through drupal_flush_all_caches.
     module_enable(array('link_badges', 'menu_badges', 'views_dkan_workflow_tree', 'workbench', 'workbench_moderation', 'workbench_email'));
     // Enable 'open_data_federal_extras' module.
     module_enable(array('dkan_workflow_permissions'));
     module_enable(array('dkan_workflow'));
     features_revert(array('dkan_workflow_permissions' => array('roles_permissions')));
     drupal_flush_all_caches();
 }
开发者ID:nucivic,项目名称:dkanextension,代码行数:16,代码来源:WorkflowContext.php

示例9: hook_environment_switch

/**
 * 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;
    }
}
开发者ID:Juterpillar,项目名称:dartprints,代码行数:40,代码来源:environment.api.php

示例10: testUninstall

 /**
  * 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.');
 }
开发者ID:pjcdawkins,项目名称:drupal7mongodb,代码行数:23,代码来源:PackageManagementTest.php

示例11: enable_modules_if_needed

/**
 * Enable modules if disabled.
 *
 * @param array $modules
 *  An array of modules
 */
function enable_modules_if_needed($modules)
{
    foreach ($modules as $module) {
        // Check if modules are disabled.
        $result = db_select('system', 's')->fields('s', array('status'))->condition('name', $module, '=')->condition('status', 0, '=')->execute();
        if ($result->fetchAssoc()) {
            // Create an array of modules to enable.
            $to_enable[] = $module;
        }
    }
    if ($to_enable) {
        module_enable($to_enable);
        echo "Enabled new modules";
    } else {
        echo "No new modules to enable";
    }
}
开发者ID:sergii-tkachenko,项目名称:phoenix,代码行数:23,代码来源:enable_modules.php

示例12: xautoloadTestWithCacheTypes

 /**
  * @param array $cache_types
  *   The autoloader modes that are enabled, e.g.
  *   array('apc' => 'apc', 'xcache' => 'xcache')
  * @param bool $cache_lazy
  *   Whether the "lazy" mode is enabled.
  */
 protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy)
 {
     variable_set('xautoload_cache_types', $cache_types);
     $this->pass("Set cache types: " . var_export($cache_types, TRUE));
     variable_set('xautoload_cache_lazy', $cache_lazy);
     $this->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));
     // Enable xautoload.
     module_enable(array('xautoload'), FALSE);
     // At this time the xautoload_cache_mode setting is not in effect yet,
     // so we have to clear old cached values from APC cache.
     xautoload()->cacheManager->renewCachePrefix();
     module_enable(array('xautoload_test_1', 'xautoload_test_2', 'xautoload_test_3'), FALSE);
     menu_rebuild();
     foreach (array('xautoload_test_1' => array('Drupal\\xautoload_test_1\\ExampleClass'), 'xautoload_test_2' => array('xautoload_test_2_ExampleClass'), 'xautoload_test_3' => array('Drupal\\xautoload_test_3\\ExampleClass')) as $module => $classes) {
         $classes_on_include = in_array($module, array('xautoload_test_2', 'xautoload_test_3'));
         $this->xautoloadModuleEnabled($module, $classes, $classes_on_include);
         $this->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
     }
 }
开发者ID:stevebresnick,项目名称:iomedia_stp_d7_core,代码行数:26,代码来源:XAutoloadWebTestCase.php

示例13: enableModule

 /**
  * Enables given module(s) at given location by symlinking their contents
  *
  * @param string            $loc  the location the module(s) can be found
  * @param array|string|null $name the name(s) of the module(s). Defaults to basename($loc).
  *
  * @throws \InvalidArgumentException
  */
 public static function enableModule($loc, $name = null)
 {
     $loc = rtrim($loc, '/');
     if (!is_dir($loc) || !is_readable($loc)) {
         throw new \InvalidArgumentException(sprintf('Unable to read directory %s', $loc));
     }
     $base = basename($loc);
     $link = DRUPAL_ROOT . "/sites/all/modules/{$base}";
     if (file_exists($link) && readlink($link)) {
         unlink($link);
     }
     symlink($loc, $link);
     drupal_static('system_rebuild_module_data', null, true);
     $modules = (array) ($name ?: $base);
     $enabled = module_enable($modules);
     if (false === $enabled) {
         throw new \InvalidArgumentException(sprintf('Unable to enable module(s) "%s"', implode(',', $modules)));
     }
     module_invoke_all('boot');
     module_invoke_all('init');
 }
开发者ID:korstiaan,项目名称:drunit,代码行数:29,代码来源:Drunit.php

示例14: setUp

 public function setUp()
 {
     // For benchmarking.
     $this->start = time();
     // Enable any modules required for the test.
     parent::setUp('better_exposed_filters', 'date', 'date_views', 'list', 'number', 'taxonomy', 'text', 'views', 'views_ui');
     // One of these days I'll figure out why Features is breaking all my tests.
     module_enable(array('bef_test_content'));
     // User with edit views perms
     $this->admin_user = $this->drupalCreateUser();
     $role = user_role_load_by_name('administrator');
     $this->assertTrue(!empty($role->rid), 'Found the "administrator" role.');
     user_save($this->admin_user, array('roles' => array($role->rid => $role->rid)));
     $this->drupalLogin($this->admin_user);
     // Build a basic view for use in tests.
     $this->createView();
     // $this->createDisplay('Page', array('path' => array('path' => 'bef_test_page')));
     // Add field to default display
     // $this->addField('node.title');
     // Turn of Better Exposed Filters
     $this->setBefExposedForm();
 }
开发者ID:rwelle,项目名称:mukurtucms,代码行数:22,代码来源:better_exposed_filters_TestBase.php

示例15: __init

/**
 * Initialize auto-inc values on dev site.  Run this function only once, at setup.
 */
function __init()
{
    // Bring config vars into function namespace
    extract(__config());
    // Enable profile module
    drush_print("Installing profile module.");
    if (drush_drupal_major_version() < 7) {
        include_once 'includes/install.inc';
        drupal_install_modules(array('profile'));
    } else {
        module_enable(array('profile'));
    }
    // Set auto-increment values
    $tables = array('authmap', 'comments', 'files', 'node', 'node_revisions', 'profile_fields', 'role', 'term_data', 'url_alias', 'users', 'vocabulary');
    foreach ($tables as $table) {
        $value = ${$table};
        db_query("ALTER TABLE `{$table}` AUTO_INCREMENT = %d", $value);
        drush_print("Set auto-increment value for {$table} to {$value}");
    }
    unset($value);
    drush_print("Initialization done!");
}
开发者ID:srhaber,项目名称:d6migration,代码行数:25,代码来源:import.drush.php


注:本文中的module_enable函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。