本文整理汇总了PHP中module_load_install函数的典型用法代码示例。如果您正苦于以下问题:PHP module_load_install函数的具体用法?PHP module_load_install怎么用?PHP module_load_install使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_load_install函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: setUp
protected function setUp()
{
parent::setUp();
module_load_install('system');
$schema = system_schema();
db_create_table('key_value_expire', $schema['key_value_expire']);
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:GarbageCollectionTest.php
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$config = $this->config('system.theme');
$config->set('default', 'bartik');
$config->set('admin', 'seven');
$config->save();
foreach (static::$modules as $module) {
$function = $module . '_schema';
module_load_install($module);
if (function_exists($function)) {
$schema = $function();
$this->installSchema($module, array_keys($schema));
}
}
$this->installEntitySchema('aggregator_feed');
$this->installEntitySchema('aggregator_item');
$this->installEntitySchema('block_content');
$this->installEntitySchema('comment');
$this->installEntitySchema('file');
$this->installEntitySchema('node');
$this->installEntitySchema('menu_link_content');
$this->installEntitySchema('taxonomy_term');
$this->installEntitySchema('user');
$this->installConfig(['block_content', 'comment', 'file', 'node', 'simpletest']);
// Install one of D8's test themes.
\Drupal::service('theme_handler')->install(array('test_theme'));
// Create a new user which needs to have UID 1, because that is expected by
// the assertions from
// \Drupal\migrate_drupal\Tests\d6\MigrateNodeRevisionTest.
User::create(['uid' => 1, 'name' => $this->randomMachineName(), 'status' => 1])->enforceIsNew(TRUE)->save();
$this->installMigrations('Drupal 6');
}
开发者ID:scratch,项目名称:gai,代码行数:36,代码来源:MigrateDrupal6Test.php
示例4: setUp
function setUp()
{
parent::setUp();
// Run the install hook.
// @TODO: figure out why this is necessary.
module_load_install('domain_source');
domain_source_install();
}
开发者ID:dropdog,项目名称:play,代码行数:8,代码来源:DomainSourceEntityReferenceTest.php
示例5: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create the test field.
module_load_install('entity_test');
entity_test_install();
// Install required default configuration for filter module.
$this->installConfig(array('system', 'filter'));
}
开发者ID:jeyram,项目名称:camp-gdl,代码行数:12,代码来源:EntityValidationTest.php
示例6: tableDefinition
/**
* Returns the table definition for the URL alias fixtures.
*
* @return array
* Table definitions.
*/
public function tableDefinition()
{
$tables = array();
module_load_install('system');
$schema = system_schema();
$tables['url_alias'] = $schema['url_alias'];
$tables['key_value'] = $schema['key_value'];
return $tables;
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:15,代码来源:UrlAliasFixtures.php
示例7: moduleRequirement
public function moduleRequirement($module)
{
foreach ($module as $module_name) {
module_load_install($module_name);
if ($requirements = \Drupal::moduleHandler()->invoke($module_name, 'requirements', array('install'))) {
foreach ($requirements as $requirement) {
throw new \Exception($module_name . ' can not be installed: ' . $requirement['description']);
}
}
}
}
开发者ID:ddrozdik,项目名称:DrupalConsole,代码行数:11,代码来源:ModuleTrait.php
示例8: setUp
protected function setUp()
{
parent::setUp();
module_load_install('system');
$schema = system_schema();
db_create_table('key_value', $schema['key_value']);
$this->container->register('database', 'Drupal\\Core\\Database\\Connection')->setFactoryClass('Drupal\\Core\\Database\\Database')->setFactoryMethod('getConnection')->addArgument('default');
$this->container->register('keyvalue.database', 'Drupal\\Core\\KeyValueStore\\KeyValueDatabaseFactory')->addArgument(new Reference('serialization.phpserialize'))->addArgument(new Reference('database'));
$this->container->register('serialization.phpserialize', 'Drupal\\Component\\Serialization\\PhpSerialize');
$this->settingsSet('keyvalue_default', 'keyvalue.database');
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:11,代码来源:DatabaseStorageTest.php
示例9: setUp
protected function setUp()
{
parent::setUp();
// Install field configuration.
$this->installConfig(array('field'));
// The users table is needed for creating dummy user accounts.
$this->installEntitySchema('user');
// Register entity_test text field.
module_load_install('entity_test');
entity_test_install();
}
开发者ID:alnutile,项目名称:drunatra,代码行数:11,代码来源:FieldAccessTest.php
示例10: setUp
function setUp()
{
parent::setUp();
// Run the install hook.
// @TODO: figure out why this is necessary.
module_load_install('domain_access');
domain_access_install();
// Set the access handler.
$this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
// Clear permissions for authenticated users.
$this->config('user.role.' . DRUPAL_AUTHENTICATED_RID)->set('permissions', array())->save();
}
开发者ID:dropdog,项目名称:play,代码行数:12,代码来源:DomainAccessGrantsTest.php
示例11: tableDefinition
/**
* Returns the table definition for the URL alias fixtures.
*
* @return array
* Table definitions.
*/
public function tableDefinition()
{
$tables = array();
// Prime the drupal_get_filename() cache with the location of the system
// module as its location is known and shouldn't change.
// @todo Remove as part of https://www.drupal.org/node/2186491
drupal_get_filename('module', 'system', 'core/modules/system/system.info.yml');
module_load_install('system');
$schema = system_schema();
$tables['url_alias'] = AliasStorage::schemaDefinition();
$tables['key_value'] = $schema['key_value'];
return $tables;
}
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:19,代码来源:UrlAliasFixtures.php
示例12: setUp
protected function setUp()
{
parent::setUp();
// Install system tables to test the key/value storage without installing a
// full Drupal environment.
module_load_install('system');
$schema = system_schema();
db_create_table('semaphore', $schema['semaphore']);
db_create_table('key_value_expire', $schema['key_value_expire']);
// Create several objects for testing.
for ($i = 0; $i <= 3; $i++) {
$this->objects[$i] = $this->randomObject();
}
}
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:TempStoreDatabaseTest.php
示例13: setUp
protected function setUp()
{
parent::setUp();
foreach (entity_test_entity_types() as $entity_type_id) {
// The entity_test schema is installed by the parent.
if ($entity_type_id != 'entity_test') {
$this->installEntitySchema($entity_type_id);
}
}
// Create the test field.
module_load_install('entity_test');
entity_test_install();
// Install required default configuration for filter module.
$this->installConfig(array('system', 'filter'));
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:EntityFieldTest.php
示例14: setUp
public function setUp()
{
parent::setUp();
// Clear permissions for authenticated users.
$this->config('user.role.' . RoleInterface::AUTHENTICATED_ID)->set('permissions', array())->save();
// Create Basic page node type.
if ($this->profile != 'standard') {
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page', 'display_submitted' => FALSE));
}
$this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
$this->manager = \Drupal::service('domain_access.manager');
// Create 5 domains.
$this->domainCreateTestDomains(5);
// Run the install hook.
// @TODO: figure out why this is necessary.
module_load_install('domain_access');
domain_access_install();
}
开发者ID:dropdog,项目名称:play,代码行数:18,代码来源:DomainAccessPermissionsTest.php
示例15: onRequest
/**
* Implements hook_init().
*/
function onRequest()
{
// On all Mollom administration pages, check the module configuration and
// display the corresponding requirements error, if invalid.
$url = Url::fromRoute('<current>');
$current_path = $url->toString();
if (empty($_POST) && strpos($current_path, 'admin/config/content/mollom') === 0 && \Drupal::currentUser()->hasPermission('administer mollom')) {
// Re-check the status on the settings form only.
$status = \Drupal\mollom\Utility\MollomUtilities::getAPIKeyStatus($current_path == 'admin/config/content/mollom/settings');
if ($status !== TRUE) {
// Fetch and display requirements error message, without re-checking.
module_load_install('mollom');
$requirements = mollom_requirements('runtime', FALSE);
if (isset($requirements['mollom']['description'])) {
drupal_set_message($requirements['mollom']['description'], 'error');
}
}
}
}
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:22,代码来源:Subscriber.php
示例16: setUp
protected function setUp()
{
parent::setUp();
$this->languageManager = $this->container->get('language_manager');
foreach (entity_test_entity_types() as $entity_type_id) {
// The entity_test schema is installed by the parent.
if ($entity_type_id != 'entity_test') {
$this->installEntitySchema($entity_type_id);
}
}
$this->installConfig(array('language'));
// Create the test field.
module_load_install('entity_test');
entity_test_install();
// Enable translations for the test entity type.
$this->state->set('entity_test.translation', TRUE);
// Create a translatable test field.
$this->fieldName = Unicode::strtolower($this->randomMachineName() . '_field_name');
// Create an untranslatable test field.
$this->untranslatableFieldName = Unicode::strtolower($this->randomMachineName() . '_field_name');
// Create field fields in all entity variations.
foreach (entity_test_entity_types() as $entity_type) {
entity_create('field_storage_config', array('field_name' => $this->fieldName, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
entity_create('field_config', array('field_name' => $this->fieldName, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => TRUE))->save();
$this->field[$entity_type] = FieldConfig::load($entity_type . '.' . $entity_type . '.' . $this->fieldName);
entity_create('field_storage_config', array('field_name' => $this->untranslatableFieldName, 'entity_type' => $entity_type, 'type' => 'text', 'cardinality' => 4))->save();
entity_create('field_config', array('field_name' => $this->untranslatableFieldName, 'entity_type' => $entity_type, 'bundle' => $entity_type, 'translatable' => FALSE))->save();
}
// Create the default languages.
$this->installConfig(array('language'));
// Create test languages.
$this->langcodes = array();
for ($i = 0; $i < 3; ++$i) {
$language = ConfigurableLanguage::create(array('id' => 'l' . $i, 'label' => $this->randomString(), 'weight' => $i));
$this->langcodes[$i] = $language->getId();
$language->save();
}
}
开发者ID:papillon-cendre,项目名称:d8,代码行数:38,代码来源:EntityLanguageTestBase.php
示例17: installLanguage
function installLanguage($langcode)
{
$this->addLanguage($langcode, TRUE, TRUE);
if (module_exists('atrium_translate')) {
module_load_install('atrium_translate');
module_load_include('inc', 'l10n_update');
$release = _atrium_translate_default_release($langcode);
//$release = l10n_update_project_get_release('atrium', $langcode, ATRIUM_L10N_VERSION, ATRIUM_L10N_SERVER);
if ($release && !empty($release['download_link'])) {
$project = _l10n_update_build_project('atrium', ATRIUM_L10N_VERSION, ATRIUM_L10N_SERVER);
if ($file = l10n_update_download_file($release['download_link'])) {
l10n_update_import_file($file, $langcode);
l10n_update_download_history($project, $release);
}
}
}
}
开发者ID:jamon8888,项目名称:atrium_features,代码行数:17,代码来源:atrium_web_test_case.php
示例18: uninstall
/**
* {@inheritdoc}
*/
public function uninstall(array $module_list, $uninstall_dependents = TRUE)
{
// Get all module data so we can find dependencies and sort.
$module_data = system_rebuild_module_data();
$module_list = $module_list ? array_combine($module_list, $module_list) : array();
if (array_diff_key($module_list, $module_data)) {
// One or more of the given modules doesn't exist.
return FALSE;
}
// Only process currently installed modules.
$extension_config = \Drupal::config('core.extension');
$installed_modules = $extension_config->get('module') ?: array();
if (!($module_list = array_intersect_key($module_list, $installed_modules))) {
// Nothing to do. All modules already uninstalled.
return TRUE;
}
if ($uninstall_dependents) {
// Add dependent modules to the list. The new modules will be processed as
// the while loop continues.
$profile = drupal_get_profile();
while (list($module) = each($module_list)) {
foreach (array_keys($module_data[$module]->required_by) as $dependent) {
if (!isset($module_data[$dependent])) {
// The dependent module does not exist.
return FALSE;
}
// Skip already uninstalled modules.
if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent]) && $dependent != $profile) {
$module_list[$dependent] = $dependent;
}
}
}
}
// Set the actual module weights.
$module_list = array_map(function ($module) use($module_data) {
return $module_data[$module]->sort;
}, $module_list);
// Sort the module list by their weights.
asort($module_list);
$module_list = array_keys($module_list);
// Only process modules that are enabled. A module is only enabled if it is
// configured as enabled. Custom or overridden module handlers might contain
// the module already, which means that it might be loaded, but not
// necessarily installed.
$schema_store = \Drupal::keyValue('system.schema');
$entity_manager = \Drupal::entityManager();
foreach ($module_list as $module) {
// Clean up all entity bundles (including fields) of every entity type
// provided by the module that is being uninstalled.
foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) {
foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
$entity_manager->onBundleDelete($bundle, $entity_type_id);
}
}
}
// Allow modules to react prior to the uninstallation of a module.
$this->invokeAll('module_preuninstall', array($module));
// Uninstall the module.
module_load_install($module);
$this->invoke($module, 'uninstall');
// Remove all configuration belonging to the module.
\Drupal::service('config.manager')->uninstall('module', $module);
// Notify the entity manager that this module's entity types are being
// deleted, so that it can notify all interested handlers. For example,
// a SQL-based storage handler can use this as an opportunity to drop
// the corresponding database tables.
foreach ($entity_manager->getDefinitions() as $entity_type) {
if ($entity_type->getProvider() == $module) {
$entity_manager->onEntityTypeDelete($entity_type);
}
}
// Remove the schema.
drupal_uninstall_schema($module);
// Remove the module's entry from the config.
$extension_config->clear("module.{$module}")->save();
// Update the module handler to remove the module.
// The current ModuleHandler instance is obsolete with the kernel rebuild
// below.
$module_filenames = $this->getModuleList();
unset($module_filenames[$module]);
$this->setModuleList($module_filenames);
// Remove any potential cache bins provided by the module.
$this->removeCacheBins($module);
// Clear the static cache of system_rebuild_module_data() to pick up the
// new module, since it merges the installation status of modules into
// its statically cached list.
drupal_static_reset('system_rebuild_module_data');
// Clear plugin manager caches and flag router to rebuild if requested.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Update the kernel to exclude the uninstalled modules.
\Drupal::service('kernel')->updateModules($module_filenames, $module_filenames);
// Update the theme registry to remove the newly uninstalled module.
drupal_theme_rebuild();
// Modules can alter theme info, so refresh theme data.
// @todo ThemeHandler cannot be injected into ModuleHandler, since that
//.........这里部分代码省略.........
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:101,代码来源:ModuleHandler.php
示例19: uninstall
/**
* {@inheritdoc}
*/
public function uninstall(array $module_list, $uninstall_dependents = TRUE)
{
// Get all module data so we can find dependencies and sort.
$module_data = system_rebuild_module_data();
$module_list = $module_list ? array_combine($module_list, $module_list) : array();
if (array_diff_key($module_list, $module_data)) {
// One or more of the given modules doesn't exist.
return FALSE;
}
$extension_config = \Drupal::configFactory()->getEditable('core.extension');
$installed_modules = $extension_config->get('module') ?: array();
if (!($module_list = array_intersect_key($module_list, $installed_modules))) {
// Nothing to do. All modules already uninstalled.
return TRUE;
}
if ($uninstall_dependents) {
// Add dependent modules to the list. The new modules will be processed as
// the while loop continues.
$profile = drupal_get_profile();
while (list($module) = each($module_list)) {
foreach (array_keys($module_data[$module]->required_by) as $dependent) {
if (!isset($module_data[$dependent])) {
// The dependent module does not exist.
return FALSE;
}
// Skip already uninstalled modules.
if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent]) && $dependent != $profile) {
$module_list[$dependent] = $dependent;
}
}
}
}
// Use the validators and throw an exception with the reasons.
if ($reasons = $this->validateUninstall($module_list)) {
foreach ($reasons as $reason) {
$reason_message[] = implode(', ', $reason);
}
throw new ModuleUninstallValidatorException('The following reasons prevent the modules from being uninstalled: ' . implode('; ', $reason_message));
}
// Set the actual module weights.
$module_list = array_map(function ($module) use($module_data) {
return $module_data[$module]->sort;
}, $module_list);
// Sort the module list by their weights.
asort($module_list);
$module_list = array_keys($module_list);
// Only process modules that are enabled. A module is only enabled if it is
// configured as enabled. Custom or overridden module handlers might contain
// the module already, which means that it might be loaded, but not
// necessarily installed.
foreach ($module_list as $module) {
// Clean up all entity bundles (including fields) of every entity type
// provided by the module that is being uninstalled.
// @todo Clean this up in https://www.drupal.org/node/2350111.
$entity_manager = \Drupal::entityManager();
foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) {
foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
$entity_manager->onBundleDelete($bundle, $entity_type_id);
}
}
}
// Allow modules to react prior to the uninstallation of a module.
$this->moduleHandler->invokeAll('module_preuninstall', array($module));
// Uninstall the module.
module_load_install($module);
$this->moduleHandler->invoke($module, 'uninstall');
// Remove all configuration belonging to the module.
\Drupal::service('config.manager')->uninstall('module', $module);
// In order to make uninstalling transactional if anything uses routes.
\Drupal::getContainer()->set('router.route_provider.old', \Drupal::service('router.route_provider'));
\Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.lazy_builder'));
// Notify interested components that this module's entity types are being
// deleted. For example, a SQL-based storage handler can use this as an
// opportunity to drop the corresponding database tables.
// @todo Clean this up in https://www.drupal.org/node/2350111.
$update_manager = \Drupal::entityDefinitionUpdateManager();
foreach ($entity_manager->getDefinitions() as $entity_type) {
if ($entity_type->getProvider() == $module) {
$update_manager->uninstallEntityType($entity_type);
} elseif ($entity_type->isSubclassOf(FieldableEntityInterface::CLASS)) {
// The module being installed may be adding new fields to existing
// entity types. Field definitions for any entity type defined by
// the module are handled in the if branch.
$entity_type_id = $entity_type->id();
/** @var \Drupal\Core\Entity\FieldableEntityStorageInterface $storage */
$storage = $entity_manager->getStorage($entity_type_id);
foreach ($entity_manager->getFieldStorageDefinitions($entity_type_id) as $storage_definition) {
// @todo We need to trigger field purging here.
// See https://www.drupal.org/node/2282119.
if ($storage_definition->getProvider() == $module && !$storage->countFieldData($storage_definition, TRUE)) {
$update_manager->uninstallFieldStorageDefinition($storage_definition);
}
}
}
}
// Remove the schema.
//.........这里部分代码省略.........
开发者ID:eigentor,项目名称:tommiblog,代码行数:101,代码来源:ModuleInstaller.php
示例20: getAdminAPIKeyStatus
/**
* Gets the status of Mollom's API key configuration and also displays a
* warning message if the Mollom API keys are not configured.
*
* To be used within the Mollom administration pages only.
*
* @param bool $force
* (optional) Boolean whether to ignore the cached state and re-check.
* Defaults to FALSE.
* @param bool $update
* (optional) Whether to update Mollom with locally stored configuration.
* Defaults to FALSE.
*
* @return array
* An associative array describing the current status of the module:
* - isConfigured: Boolean whether Mollom API keys have been configured.
* - isVerified: Boolean whether Mollom API keys have been verified.
* - response: The response error code of the API verification request.
* - ...: The full site resource, as returned by the Mollom API.
*
* @see Mollom::getAPIKeyStatus().
*/
public static function getAdminAPIKeyStatus($force = FALSE, $update = FALSE)
{
$status = MollomUtilities::getAPIKeyStatus($force, $update);
if (empty($_POST) && !$status['isVerified']) {
// Fetch and display requirements error message, without re-checking.
module_load_install('mollom');
$requirements = mollom_requirements('runtime', FALSE);
if (isset($requirements['mollom']['description'])) {
drupal_set_message($requirements['mollom']['description'], 'error');
}
}
return $status;
}
开发者ID:isramv,项目名称:camp-gdl,代码行数:35,代码来源:MollomUtilities.php
注:本文中的module_load_install函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论