本文整理汇总了PHP中drupal_flush_all_caches函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_flush_all_caches函数的具体用法?PHP drupal_flush_all_caches怎么用?PHP drupal_flush_all_caches使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_flush_all_caches函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearCache
/**
* Implements CoreInterface::clearCache().
*/
public function clearCache()
{
// Need to change into the Drupal root directory or the registry explodes.
$current_path = getcwd();
chdir(DRUPAL_ROOT);
drupal_flush_all_caches();
}
示例2: update_flush_all_caches
/**
* Remove update overrides and flush all caches.
*
* This will need to be run once all (if any) updates are run. Do not call this
* while updates are running.
*/
function update_flush_all_caches()
{
$GLOBALS['conf']['update_service_provider_overrides'] = FALSE;
\Drupal::service('kernel')->updateModules(\Drupal::moduleHandler()->getModuleList());
// No updates to run, so caches won't get flushed later. Clear them now.
drupal_flush_all_caches();
}
示例3: removeFilterConfig
/**
* Deletes config.
*
*/
protected function removeFilterConfig()
{
$mailchimp_campaign_filter = \Drupal::configFactory()->getEditable('filter.format.mailchimp_campaign');
$mailchimp_campaign_filter->delete();
// Clear cache.
drupal_flush_all_caches();
}
示例4: testInactiveDomain
public function testInactiveDomain()
{
// Create three new domains programmatically.
$this->domainCreateTestDomains(3);
$domains = \Drupal::service('domain.loader')->loadMultiple();
// Grab the last domain for testing.
$domain = end($domains);
$this->drupalGet($domain->getPath());
$this->assertTrue($domain->status(), 'Tested domain is set to active.');
$this->assertTrue($domain->getPath() == $this->getUrl(), 'Loaded the active domain.');
// Disable the domain and test for redirect.
$domain->disable();
$default = \Drupal::service('domain.loader')->loadDefaultDomain();
// Must flush cache.
drupal_flush_all_caches();
$this->drupalGet($domain->getPath());
$this->assertFalse($domain->status(), 'Tested domain is set to inactive.');
$this->assertTrue($default->getPath() == $this->getUrl(), 'Redirected an inactive domain to the default domain.');
// Try to access with the proper permission.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access inactive domains'));
$this->assertFalse($domain->status(), 'Tested domain is set to inactive.');
// Must flush cache.
drupal_flush_all_caches();
$this->drupalGet($domain->getPath());
$this->assertTrue($domain->getPath() == $this->getUrl(), 'Loaded the inactive domain with permission.');
}
示例5: at_core_submit_layouts
/**
* Form submit handler for the theme settings form.
*/
function at_core_submit_layouts(&$form, &$form_state) {
$build_info = $form_state->getBuildInfo();
$values = $form_state->getValues();
$theme = $build_info['args'][0];
// Generate and save a new layout.
if (isset($values['settings_layouts_enable']) && $values['settings_layouts_enable'] == 1) {
$generateLayout = new LayoutSubmit($theme, $values);
// Update the themes info file with new regions.
$generateLayout->saveLayoutRegions();
// Build and save the suggestions layout css files.
$generateLayout->saveLayoutSuggestionsCSS();
// Build and save the suggestions twig templates.
$generateLayout->saveLayoutSuggestionsMarkup();
// Add a new suggestion to the page suggestions array in config.
if (!empty($values['ts_name'])) {
$suggestion = trim($values['ts_name']);
$clean_suggestion = str_replace('-', '_', $suggestion);
$values["settings_suggestion_page__$clean_suggestion"] = $clean_suggestion;
}
// Delete suggestion files
$templates_directory = drupal_get_path('theme', $theme) . '/templates/page';
$css_directory = $values['settings_generated_files_path'];
foreach ($values as $values_key => $values_value) {
if (substr($values_key, 0, 18) === 'delete_suggestion_') {
if ($values_value === 1) {
$delete_suggestion_keys[] = Unicode::substr($values_key, 18);
}
}
}
if (isset($delete_suggestion_keys)) {
foreach ($delete_suggestion_keys as $suggestion_to_remove) {
$formatted_suggestion = str_replace('_', '-', $suggestion_to_remove);
$template_file_path = $templates_directory . '/' . $formatted_suggestion . '.html.twig';
$css_file_path = $css_directory . '/' . $theme . '--layout__' . $formatted_suggestion . '.css';
if (file_exists($template_file_path)) {unlink($template_file_path);}
if (file_exists($css_file_path)) {unlink($css_file_path);}
}
}
}
// Flush all caches. This is the only realy reliable way I have found to ensure
// new templates and layouts work correctly.
drupal_flush_all_caches();
// Manage settings and configuration.
// Must get mutable config otherwise bad things happen.
$config = \Drupal::configFactory()->getEditable($theme . '.settings');
$convertToConfig = new ThemeSettingsConfig();
$convertToConfig->settingsConvertToConfig($values, $config);
}
示例6: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$config = $this->configFactory->getEditable('autofloat.settings');
$config->set('start', $form_state->getValue('autofloat_start'))->set('css', $form_state->getValue('autofloat_css'))->set('span', $form_state->getValue('autofloat_span'))->set('div', $form_state->getValue('autofloat_div'));
$config->save();
drupal_flush_all_caches();
parent::submitForm($form, $form_state);
}
示例7: _rename_field
function _rename_field($old_name, $new_name)
{
$args = array(':old_name' => $old_name, ':new_name' => $new_name);
db_query("UPDATE {field_config} SET field_name = :new_name WHERE field_name = :old_name", $args);
db_query("UPDATE {field_config_instance} SET field_name = :new_name WHERE field_name = :old_name", $args);
db_query("RENAME TABLE `field_data_{$old_name}` TO `field_data_{$new_name}`");
db_query("RENAME TABLE `field_revision_{$old_name}` TO `field_revision_{$new_name}`");
drupal_flush_all_caches();
}
示例8: disableDKAN_Workflow
/**
* @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();
}
示例9: at_core_submit_extension_settings
/**
* Form submit handler for the Extension settings.
* @param $form
* @param $form_state
*/
function at_core_submit_extension_settings(&$form, &$form_state)
{
$build_info = $form_state->getBuildInfo();
$values = $form_state->getValues();
$theme = $build_info['args'][0];
$at_core_path = drupal_get_path('theme', 'at_core');
// Don't let this timeout easily.
set_time_limit(60);
// Path to save generated CSS files.
$generated_files_path = $values['settings_generated_files_path'];
if ($values['settings_enable_extensions'] === 1) {
// Require submit handlers and helper functions for extensions.
if (isset($values['settings_enable_fonts']) && $values['settings_enable_fonts'] === 1 || isset($values['settings_enable_titles']) && $values['settings_enable_titles'] === 1) {
require_once $at_core_path . '/forms/ext/fonts.inc';
require_once $at_core_path . '/forms/ext/fonts_submit.php';
require_once $at_core_path . '/forms/ext/titles_submit.php';
}
// Submit handler for Fonts.
if (isset($values['settings_enable_fonts']) && $values['settings_enable_fonts'] === 1) {
// Returns modified values to pass in new settings for typekit and google fonts.
$values = at_core_submit_fonts($values, $generated_files_path);
}
// Submit handler for Titles.
if (isset($values['settings_enable_titles']) && $values['settings_enable_titles'] === 1) {
at_core_submit_titles($values, $generated_files_path);
}
// Submit handler for Markup Overrides.
if (isset($values['settings_enable_markup_overrides']) && $values['settings_enable_markup_overrides'] === 1) {
// Breadcrumbs
if (!empty($values['settings_breadcrumb_separator'])) {
require_once $at_core_path . '/forms/ext/breadcrumb_submit.php';
at_core_submit_breadcrumb($values, $generated_files_path);
}
}
// Submit handler for Mobile blocks.
if (isset($values['settings_enable_mobile_blocks']) && $values['settings_enable_mobile_blocks'] === 1) {
require_once $at_core_path . '/forms/ext/mobile_blocks_submit.php';
at_core_submit_mobile_blocks($values, $theme, $generated_files_path);
}
// Submit handler for Custom CSS.
if (isset($values['settings_enable_custom_css']) && $values['settings_enable_custom_css'] === 1) {
require_once $at_core_path . '/forms/ext/custom_css_submit.php';
at_core_submit_custom_css($values, $generated_files_path);
}
}
// Flush caches. I really, really tried to avoid this, but if you know a better
// way of always clearing twig, CSS and the registry?
drupal_flush_all_caches();
// Manage settings and configuration.
// Must get mutable config otherwise bad things happen.
$config = \Drupal::configFactory()->getEditable($theme . '.settings');
$convertToConfig = new ThemeSettingsConfig();
$convertToConfig->settingsExtensionsConvertToConfig($values, $config);
drupal_set_message(t('Extensions configuration saved.'), 'status');
//$performance_url = Url::fromRoute('system.performance_settings')->setOptions(array('attributes' => array('target' => '_blank')));
//drupal_set_message(t('Extensions configuration saved. If settings have not taken effect, please <b>@perm</b>.', array('@perm' => \Drupal::l(t('clear the cache'), $performance_url))), 'status');
}
示例10: testDefaults
/**
* Tests the interface to manage metatag defaults.
*/
function testDefaults()
{
// Save the default title to test the Revert operation at the end.
$metatag_defaults = \Drupal::config('metatag.metatag_defaults.global');
$default_title = $metatag_defaults->get('tags')['title'];
// Initiate session with a user who can manage metatags.
$permissions = array('administer site configuration', 'administer meta tags');
$account = $this->drupalCreateUser($permissions);
$this->drupalLogin($account);
// Check that the user can see the list of metatag defaults.
$this->drupalGet('admin/structure/metatag_defaults');
$this->assertResponse(200);
// Check that the Global defaults were created.
$this->assertLinkByHref('/admin/structure/metatag_defaults/global', 0, t('Global defaults were created on installation.'));
// Check that Global and entity defaults can't be deleted.
$this->assertNoLinkByHref('/admin/structure/metatag_defaults/global/delete', 0, t('Global defaults can\'t be deleted'));
$this->assertNoLinkByHref('/admin/structure/metatag_defaults/node/delete', 0, t('Entity defaults can\'t be deleted'));
// Check that the module defaults were injected into the Global config entity.
$this->drupalGet('admin/structure/metatag_defaults/global');
$this->assertFieldById('edit-title', $metatag_defaults->get('title'), t('Metatag defaults were injected into the Global configuration entity.'));
// Update the Global defaults and test them.
$values = array('title' => 'Test title', 'description' => 'Test description');
$this->drupalPostForm('admin/structure/metatag_defaults/global', $values, 'Save');
$this->assertText('Saved the Global Metatag defaults.');
$this->drupalGet('hit-a-404');
foreach ($values as $metatag => $value) {
$this->assertRaw($value, t('Updated metatag @tag was found in the HEAD section of the page.', array('@tag' => $metatag)));
}
// Check that tokens are processed.
$values = array('title' => '[site:name] | Test title', 'description' => '[site:name] | Test description');
$this->drupalPostForm('admin/structure/metatag_defaults/global', $values, 'Save');
$this->assertText('Saved the Global Metatag defaults.');
drupal_flush_all_caches();
$this->drupalGet('hit-a-404');
foreach ($values as $metatag => $value) {
$processed_value = \Drupal::token()->replace($value);
$this->assertRaw($processed_value, t('Processed token for metatag @tag was found in the HEAD section of the page.', array('@tag' => $metatag)));
}
// Test the Robots plugin.
$robots_values = array('index', 'follow', 'noydir');
$form_values = array();
foreach ($robots_values as $value) {
$values['robots[' . $value . ']'] = TRUE;
}
$this->drupalPostForm('admin/structure/metatag_defaults/global', $values, 'Save');
$this->assertText('Saved the Global Metatag defaults.');
drupal_flush_all_caches();
$this->drupalGet('hit-a-404');
$robots_value = implode(', ', $robots_values);
$this->assertRaw($robots_value, t('Robots metatag has the expected values.'));
// Test reverting global configuration to its defaults.
$this->drupalPostForm('admin/structure/metatag_defaults/global/revert', array(), 'Revert');
$this->assertText('Reverted Global defaults.');
$this->assertText($default_title, 'Global title was reverted to its default value.');
$this->drupalLogout();
}
示例11: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
ConfigurableLanguage::createFromLangcode('fr')->save();
$this->config('system.site')->set('langcode', 'fr')->save();
// Make sure new entity type definitions are processed.
\Drupal::service('entity.definition_update_manager')->applyUpdates();
// Clear all caches so that the base field definition, its cache in the
// entity manager, the t() cache, etc. are all cleared.
drupal_flush_all_caches();
}
示例12: connect
/**
* Connect.
*/
public function connect()
{
\Drupal::configFactory()->getEditable('acquia_connector.settings')->set('spi.ssl_verify', FALSE)->save();
\Drupal::configFactory()->getEditable('acquia_connector.settings')->set('spi.ssl_override', TRUE)->save();
$admin_user = $this->createAdminUser();
$this->drupalLogin($admin_user);
$edit_fields = array('acquia_identifier' => $this->randomString(8), 'acquia_key' => $this->randomString(8));
$submit_button = 'Connect';
$this->drupalPostForm('admin/config/system/acquia-connector/credentials', $edit_fields, $submit_button);
\Drupal::service('module_installer')->install(array('acquia_search'));
drupal_flush_all_caches();
}
示例13: testFieldConfiguration
/**
* Test the field configuration form.
*/
public function testFieldConfiguration()
{
$this->drupalLogin($this->createAdminUser());
$this->createContentType(['type' => 'page', 'name' => 'Page']);
drupal_flush_all_caches();
$this->drupalGet('admin/structure/types/manage/page/fields/add-field');
$this->submitForm(['new_storage_type' => 'video_embed_field', 'label' => 'Video Embed', 'field_name' => 'video_embed'], t('Save and continue'));
$this->submitForm([], t('Save field settings'));
$this->submitForm(['label' => 'Video Embed', 'description' => 'Some help.', 'required' => '1', 'default_value_input[field_video_embed][0][value]' => 'http://example.com', 'settings[allowed_providers][vimeo]' => 'vimeo', 'settings[allowed_providers][youtube]' => 'youtube', 'settings[allowed_providers][youtube_playlist]' => 'youtube_playlist'], t('Save settings'));
$this->assertSession()->pageTextContains('Could not find a video provider to handle the given URL.');
$this->submitForm(['default_value_input[field_video_embed][0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ'], t('Save settings'));
$this->assertSession()->pageTextContains('Saved Video Embed configuration.');
}
示例14: testChanges
/**
* Tests that changes to the info file are picked up.
*/
public function testChanges()
{
$this->themeHandler->install(array('test_theme'));
$this->themeHandler->setDefault('test_theme');
$this->themeManager->resetActiveTheme();
$active_theme = $this->themeManager->getActiveTheme();
// Make sure we are not testing the wrong theme.
$this->assertEqual('test_theme', $active_theme->getName());
$this->assertEqual(['classy/base', 'core/normalize', 'test_theme/global-styling'], $active_theme->getLibraries());
// @see theme_test_system_info_alter()
$this->state->set('theme_test.modify_info_files', TRUE);
drupal_flush_all_caches();
$active_theme = $this->themeManager->getActiveTheme();
$this->assertEqual(['classy/base', 'core/normalize', 'test_theme/global-styling', 'core/backbone'], $active_theme->getLibraries());
}
示例15: run
public static function run()
{
ini_set('max_execution_time', 60 * 60);
ini_set('memory_limit', '2G');
self::migrateTaxonomy();
self::migrateNode();
self::migrateBlockContent();
self::migrateUsers();
self::migrateComments();
self::migrateFields();
self::migrateFiles();
self::migratePathAliases();
self::migrateLocaleStrings();
drupal_flush_all_caches();
}