Skip to content
Snippets Groups Projects
Unverified Commit 42630422 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3261486 by catch, longwave, dww: Remove core updates added prior to...

Issue #3261486 by catch, longwave, dww: Remove core updates added prior to 9.3.0 and adjust test coverage
parent 22bfdaa3
No related branches found
No related tags found
38 merge requests!7471uncessary 5 files are moved from media-library folder to misc folder,!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4289Issue #1344552 by marcingy, Niklas Fiekas, Ravi.J, aleevas, Eduardo Morales...,!4114Issue #2707291: Disable body-level scrolling when a dialog is open as a modal,!3630Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create...,!3291Issue #3336463: Rewrite rules for gzipped CSS and JavaScript aggregates never match,!3143Issue #3313342: [PHP 8.1] Deprecated function: strpos(): Passing null to parameter #1 LayoutBuilderUiCacheContext.php on line 28,!3102Issue #3164428 by DonAtt, longwave, sahil.goyal, Anchal_gupta, alexpott: Use...,!2853#3274419 Makes BaseFieldOverride inherit the internal property from the base field.,!2719Issue #3110137: Remove Classy from core.,!2437Issue #3238257 by hooroomoo, Wim Leers: Fragment link pointing to <textarea>...,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2074Issue #2707689: NodeForm::actions() checks for delete access on new entities,!2062Issue #3246454: Add weekly granularity to views date sort,!1974Issue #3036862 demonstration,!1591Issue #3199697: Add JSON:API Translation experimental module,!1484Exposed filters get values from URL when Ajax is on,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1254Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS,!1162Issue #3100350: Unable to save '/' root path alias,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!957Added throwing of InvalidPluginDefinitionException from getDefinition().,!925Issue #2339235: Remove taxonomy hard dependency on node module,!877Issue #2708101: Default value for link text is not saved,!873Issue #2875228: Site install not using batch API service,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!844Resolve #3036010 "Updaters",!712Issue #2909128: Autocomplete intermittent on Chrome Android,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
Showing
with 31 additions and 775 deletions
......@@ -5,27 +5,12 @@
* Post update functions for Action module.
*/
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\system\ActionConfigEntityInterface;
/**
* Moves action plugins to core.
* Implements hook_removed_post_updates().
*/
function action_post_update_move_plugins(&$sandbox = NULL) {
$resave_ids = [
'action_goto_action',
'action_message_action',
'action_send_email_action',
function action_removed_post_updates() {
return [
'action_post_update_move_plugins' => '10.0.0',
'action_post_update_remove_settings' => '10.0.0',
];
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'action', function (ActionConfigEntityInterface $action) use ($resave_ids) {
// Save entity to recalculate dependencies.
return $action->isConfigurable() && in_array($action->getPlugin()->getPluginId(), $resave_ids, TRUE);
});
}
/**
* Removes action settings.
*/
function action_post_update_remove_settings() {
\Drupal::configFactory()->getEditable('action.settings')->delete();
}
<?php
/**
* @file
* Contains database additions to for testing upgrade path for action settings.
*
* @see https://www.drupal.org/node/3022401
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$action_settings = Yaml::decode(file_get_contents(__DIR__ . '/action.settings_3022401.yml'));
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'action.settings',
'data' => serialize($action_settings),
])
->execute();
// Enable action module.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['module' => ['action' => 0]])),
])
->condition('name', 'core.extension')
->execute();
$connection->insert('key_value')
->fields([
'collection',
'name',
'value',
])
->values([
'collection' => 'system.schema',
'name' => 'action',
'value' => serialize(8000),
])
->execute();
<?php
namespace Drupal\Tests\action\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests removing action module's configuration.
*
* @group Update
*/
class ActionConfigTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
__DIR__ . '/../../../../tests/fixtures/update/drupal-8.action-3022401.php',
];
}
/**
* Tests upgrading action settings.
*
* @see \action_post_update_remove_settings()
*/
public function testUpdateActionPlugins() {
$config = $this->config('action.settings');
$this->assertSame(35, $config->get('recursion_limit'));
// Run updates.
$this->runUpdates();
$config = $this->config('action.settings');
$this->assertTrue($config->isNew());
}
}
......@@ -13,23 +13,6 @@ function block_removed_post_updates() {
'block_post_update_disable_blocks_with_missing_contexts' => '9.0.0',
'block_post_update_disabled_region_update' => '9.0.0',
'block_post_update_fix_negate_in_conditions' => '9.0.0',
'block_post_update_replace_node_type_condition' => '10.0.0',
];
}
/**
* Updates the node type visibility condition.
*/
function block_post_update_replace_node_type_condition() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory->listAll('block.block.') as $block_config_name) {
$block = $config_factory->getEditable($block_config_name);
if ($block->get('visibility.node_type')) {
$configuration = $block->get('visibility.node_type');
$configuration['id'] = 'entity_bundle:node';
$block->set('visibility.entity_bundle:node', $configuration);
$block->clear('visibility.node_type');
$block->save(TRUE);
}
}
}
<?php
namespace Drupal\Tests\block\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests the upgrade path for updating the node type visibility condition.
*
* @group Update
*/
class BlockNodeTypeVisibilityUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.0.0.filled.standard.php.gz',
];
}
/**
* Tests that block context mapping is updated properly.
*
* @group legacy
*/
public function testBlock() {
$bundles = [
'article' => 'article',
'test_content_type' => 'test_content_type',
];
$block = \Drupal::config('block.block.stark_testblock');
$this->assertEquals($bundles, $block->get('visibility.node_type.bundles'));
$this->assertNull($block->get('visibility.entity_bundle:node'));
$this->runUpdates();
$block = \Drupal::config('block.block.stark_testblock');
$this->assertEquals($bundles, $block->get('visibility.entity_bundle:node.bundles'));
$this->assertEquals('entity_bundle:node', $block->get('visibility.entity_bundle:node.id'));
$this->assertNull($block->get('visibility.node_type'));
}
}
......@@ -5,38 +5,11 @@
* Post update functions for File.
*/
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\File\FileSystemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\file\Plugin\Field\FieldType\FileItem;
/**
* Add txt to allowed extensions for all fields that allow uploads of insecure files.
* Implements hook_removed_post_updates().
*/
function file_post_update_add_txt_if_allows_insecure_extensions(&$sandbox = NULL) {
if (\Drupal::config('system.file')->get('allow_insecure_uploads')) {
return t('The system is configured to allow insecure file uploads. No file field updates are necessary.');
}
$updater = function (FieldConfig $field) {
// Determine if this field uses an item definition that extends FileItem.
if (is_subclass_of($field->getItemDefinition()->getClass(), FileItem::class)) {
$allowed_extensions_string = trim($field->getSetting('file_extensions'));
$allowed_extensions = array_filter(explode(' ', $allowed_extensions_string));
if (in_array('txt', $allowed_extensions, TRUE)) {
// Since .txt is specifically allowed, there's nothing to do.
return FALSE;
}
foreach ($allowed_extensions as $extension) {
// Allow .txt if an insecure extension is allowed.
if (preg_match(FileSystemInterface::INSECURE_EXTENSION_REGEX, 'test.' . $extension)) {
$allowed_extensions_string .= ' txt';
$field->setSetting('file_extensions', $allowed_extensions_string);
return TRUE;
}
}
return FALSE;
}
};
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'field_config', $updater);
function file_removed_post_updates() {
return [
'file_post_update_add_txt_if_allows_insecure_extensions' => '10.0.0',
];
}
<?php
namespace Drupal\Tests\file\Functional\Update;
use Drupal\Core\Database\Database;
use Drupal\field\Entity\FieldConfig;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests file_post_update_add_txt_if_allows_insecure_extensions().
*
* @group Update
* @group legacy
*/
class FileFieldFileExtensionsUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['file'];
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
];
}
/**
* Tests adding txt extension to field that allow insecure extensions.
*/
public function testInsecureUpdatesNotAllowed() {
$this->setAllowedExtensions('php jpg');
$this->runUpdates();
$this->assertSession()->statusCodeEquals('200');
$field = FieldConfig::load('node.article.field_image');
$this->assertSame('php jpg txt', $field->getSetting('file_extensions'));
}
/**
* Tests file fields that permit all extensions.
*/
public function testAllFileTypesAllowed() {
$this->setAllowedExtensions('');
$this->runUpdates();
$this->assertSession()->statusCodeEquals('200');
$field = FieldConfig::load('node.article.field_image');
$this->assertSame('', $field->getSetting('file_extensions'));
}
/**
* Tests update when insecure uploads are allowed.
*/
public function testInsecureUpdatesAllowed() {
$this->setAllowedExtensions('php');
// Do direct database updates to avoid dependencies.
$connection = Database::getConnection();
$config = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'system.file')
->execute()
->fetchField();
$config = unserialize($config);
$config['allow_insecure_uploads'] = TRUE;
$connection->update('config')
->fields([
'data' => serialize($config),
])
->condition('collection', '')
->condition('name', 'system.file')
->execute();
$this->runUpdates();
$this->assertSession()->pageTextContains('The system is configured to allow insecure file uploads. No file field updates are necessary.');
$this->assertSession()->statusCodeEquals('200');
$field = FieldConfig::load('node.article.field_image');
$this->assertSame('php', $field->getSetting('file_extensions'));
}
/**
* Sets the allowed extensions on the article image field.
*
* @param string $allowed_extensions
* The list of allowed extensions.
*/
protected function setAllowedExtensions(string $allowed_extensions) {
// Do direct database updates to avoid dependencies.
$connection = Database::getConnection();
$config = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'field.field.node.article.field_image')
->execute()
->fetchField();
$config = unserialize($config);
$this->assertArrayHasKey('file_extensions', $config['settings']);
$config['settings']['file_extensions'] = $allowed_extensions;
$connection->update('config')
->fields([
'data' => serialize($config),
])
->condition('collection', '')
->condition('name', 'field.field.node.article.field_image')
->execute();
}
}
......@@ -6,11 +6,10 @@
*/
/**
* Remove obsolete hal.settings configuration key.
* Implements hook_removed_post_updates().
*/
function hal_post_update_delete_settings() {
\Drupal::configFactory()
->getEditable('hal.settings')
->clear('bc_file_uri_as_url_normalizer')
->save();
function hal_removed_post_updates() {
return [
'hal_post_update_delete_settings' => '10.0.0',
];
}
<?php
namespace Drupal\Tests\hal\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Ensures that update hook is run properly for deleting obsolete Hal settings.
*
* @group hal
*/
class HalSettingsDeletionUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.filled.standard.php.gz',
];
}
/**
* Ensures that update hook is run for "hal" module.
*/
public function testUpdate() {
$hal_settings = $this->config('hal.settings');
$this->assertFalse($hal_settings->isNew());
$this->assertTrue($hal_settings->get('bc_file_uri_as_url_normalizer'));
$this->runUpdates();
$hal_settings = \Drupal::configFactory()->get('hal.settings');
$this->assertFalse($hal_settings->isNew());
$this->assertNull($hal_settings->get('bc_file_uri_as_url_normalizer'));
}
}
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('key_value')
->fields([
'collection',
'name',
'value',
])
->values([
'collection' => 'system.schema',
'name' => 'jsonapi',
'value' => serialize(9000),
])
->execute();
// Update core.extension.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['jsonapi'] = 0;
$extensions['module']['serialization'] = 0;
$connection->update('config')
->fields(['data' => serialize($extensions)])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
$jsonapi_settings = Yaml::decode(file_get_contents(__DIR__ . '/jsonapi.settings.yml'));
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'jsonapi.settings',
'data' => serialize($jsonapi_settings),
])
->execute();
<?php
namespace Drupal\Tests\jsonapi\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests adding retry-after header settings.
*
* @group legacy
* @group jsonapi
*/
class JsonApiUpdatePathTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.0.0.bare.standard.php.gz',
__DIR__ . '/../../../../tests/fixtures/update/jsonapi.php',
];
}
/**
* Tests adding retry-after header settings.
*
* @see jsonapi_update_9401()
*/
public function testUpdate9401() {
$config = $this->config('jsonapi.settings');
$this->assertTrue($config->get('read_only'));
$this->assertNull($config->get('maintenance_header_retry_seconds'));
// Run updates.
$this->runUpdates();
$config = $this->config('jsonapi.settings');
$this->assertTrue($config->get('read_only'));
$header_settings = $config->get('maintenance_header_retry_seconds');
$this->assertSame(5, $header_settings['min']);
$this->assertSame(10, $header_settings['max']);
}
}
......@@ -5,10 +5,6 @@
* Post update functions for Layout Builder.
*/
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\layout_builder\Entity\LayoutEntityDisplayInterface;
/**
* Implements hook_removed_post_updates().
*/
......@@ -29,47 +25,8 @@ function layout_builder_removed_post_updates() {
'layout_builder_post_update_layout_builder_dependency_change' => '9.0.0',
'layout_builder_post_update_update_permissions' => '9.0.0',
'layout_builder_post_update_make_layout_untranslatable' => '9.0.0',
'layout_builder_post_update_override_entity_form_controller' => '10.0.0',
'layout_builder_post_update_section_storage_context_mapping' => '10.0.0',
'layout_builder_post_update_tempstore_route_enhancer' => '10.0.0',
];
}
/**
* Clear caches due to addition of service decorator for entity form controller.
*/
function layout_builder_post_update_override_entity_form_controller() {
// Empty post-update hook.
}
/**
* Update view displays that use Layout Builder to add empty context mappings.
*/
function layout_builder_post_update_section_storage_context_mapping(&$sandbox = []) {
$config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class);
$callback = function (EntityViewDisplayInterface $display) {
$needs_update = FALSE;
// Only update entity view displays where Layout Builder is enabled.
if ($display instanceof LayoutEntityDisplayInterface && $display->isLayoutBuilderEnabled()) {
foreach ($display->getSections() as $section) {
// Add an empty context mapping to each section where one doesn't exist.
$section->setLayoutSettings($section->getLayoutSettings() + [
'context_mapping' => [],
]);
// Flag this display as needing to be updated.
$needs_update = TRUE;
}
}
return $needs_update;
};
$config_entity_updater->update($sandbox, 'entity_view_display', $callback);
}
/**
* Clear caches due to adding a new route enhancer.
*/
function layout_builder_post_update_tempstore_route_enhancer() {
// Empty post-update hook.
}
<?php
/**
* @file
* Test context mapping update path by adding a layout without a context map.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Add a layout plugin to an existing entity view display.
$display = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.entity_view_display.node.article.teaser')
->execute()
->fetchField();
$display = unserialize($display);
$display['dependencies']['module'][] = 'layout_builder';
$display['dependencies']['module'][] = 'layout_discovery';
$display['third_party_settings']['layout_builder']['allow_custom'] = FALSE;
$display['third_party_settings']['layout_builder']['enabled'] = TRUE;
$display['third_party_settings']['layout_builder']['sections'][] = [
'layout_id' => 'layout_onecol',
'layout_settings' => ['label' => ''],
'components' => [],
'third_party_settings' => [],
];
$connection->update('config')
->fields(['data' => serialize($display)])
->condition('collection', '')
->condition('name', 'core.entity_view_display.node.article.teaser')
->execute();
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
->fields(['value' => 'i:8602;'])
->condition('collection', 'system.schema')
->condition('name', 'layout_builder')
->execute();
// Update core.extension.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['layout_builder'] = 0;
$extensions['module']['layout_discovery'] = 0;
$connection->update('config')
->fields(['data' => serialize($extensions)])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
// Add all layout_builder_removed_post_updates() as existing updates.
require_once __DIR__ . '/../../../../layout_builder/layout_builder.post_update.php';
require_once __DIR__ . '/../../../../layout_discovery/layout_discovery.post_update.php';
$existing_updates = $connection->select('key_value')
->fields('key_value', ['value'])
->condition('collection', 'post_update')
->condition('name', 'existing_updates')
->execute()
->fetchField();
$existing_updates = unserialize($existing_updates);
$existing_updates = array_merge(
$existing_updates,
array_keys(layout_builder_removed_post_updates()),
array_keys(layout_discovery_removed_post_updates())
);
$connection->update('key_value')
->fields(['value' => serialize($existing_updates)])
->condition('collection', 'post_update')
->condition('name', 'existing_updates')
->execute();
<?php
namespace Drupal\Tests\layout_builder\Functional\Update;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests the upgrade path for Layout Builder layout context mappings.
*
* @see layout_builder_post_update_section_storage_context_mapping()
*
* @group layout_builder
*/
class LayoutBuilderContextMappingUpdatePathTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.0.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/layout-builder.php',
__DIR__ . '/../../../fixtures/update/layout-builder-context-mapping.php',
];
}
/**
* Tests the upgrade path for Layout Builder layout context mappings.
*/
public function testRunUpdates() {
$data = EntityViewDisplay::load('node.article.teaser')->toArray();
$this->assertSame(TRUE, $data['third_party_settings']['layout_builder']['enabled']);
$this->assertArrayNotHasKey('context_mapping', $data['third_party_settings']['layout_builder']['sections'][0]->toArray()['layout_settings']);
$this->runUpdates();
$data = EntityViewDisplay::load('node.article.teaser')->toArray();
$this->assertSame(TRUE, $data['third_party_settings']['layout_builder']['enabled']);
$this->assertSame([], $data['third_party_settings']['layout_builder']['sections'][0]->toArray()['layout_settings']['context_mapping']);
}
}
......@@ -307,20 +307,9 @@ function locale_requirements($phase) {
return $requirements;
}
/**
* Delete an unnecessary index on the locales_location table.
*/
function locale_update_9101() {
$schema = \Drupal::database()->schema();
$table = 'locales_location';
if ($schema->indexExists($table, 'string_id')) {
$schema->dropIndex($table, 'string_id');
}
}
/**
* Implements hook_update_last_removed().
*/
function locale_update_last_removed() {
return 8800;
return 9101;
}
<?php
namespace Drupal\Tests\locale\Functional;
use Drupal\Core\Database\Database;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests Locale's update path.
*
* @group locale
*/
class LocaleUpdatePathTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
dirname(__DIR__, 4) . '/system/tests/fixtures/update/drupal-8.8.0.filled.standard.php.gz',
];
}
/**
* Tests Locale's update path.
*/
public function testUpdatePath() {
$schema = Database::getConnection()->schema();
$this->assertTrue($schema->indexExists('locales_location', 'string_id'));
$this->assertTrue($schema->indexExists('locales_location', 'string_type'));
$this->runUpdates();
$this->assertFalse($schema->indexExists('locales_location', 'string_id'));
$this->assertTrue($schema->indexExists('locales_location', 'string_type'));
}
}
......@@ -6,8 +6,10 @@
*/
/**
* Clear the source count cache.
* Implements hook_removed_post_updates().
*/
function migrate_post_update_clear_migrate_source_count_cache() {
// Empty post_update hook.
function migrate_removed_post_updates() {
return [
'migrate_post_update_clear_migrate_source_count_cache' => '10.0.0',
];
}
......@@ -5,66 +5,9 @@
* Contains install and update functions for Migrate Drupal.
*/
use Drupal\Core\Database\Database;
// cspell:ignore sourceid
/**
* Implements hook_update_last_removed().
*/
function migrate_drupal_update_last_removed() {
return 8601;
}
/**
* Add revision ID to entity reference translation migrate_map tables..
*/
function migrate_drupal_update_8901(&$sandbox) {
$schema = Database::getConnection()->schema();
$table_expression = 'migrate_map%entity_reference_translation%node%';
$tables = $schema->findTables($table_expression);
foreach ($tables as $table) {
// Move language code to sourceid3.
$spec = [
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
];
$schema->changeField($table, 'sourceid2', 'sourceid3', $spec);
// Add revision ID.
$spec = [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
];
$schema->addField($table, 'sourceid2', $spec);
// Add sourceid2 to index.
$spec = [
'fields' => [
'sourceid1' => [
'type' => 'int',
'not_null' => TRUE,
],
'sourceid2' => [
'type' => 'int',
'not_null' => TRUE,
],
'sourceid3' => [
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
],
],
];
$fields = [
'sourceid1',
'sourceid2',
'sourceid3',
];
$schema->dropIndex($table, 'source');
$schema->addIndex($table, 'source', $fields, $spec);
}
return 8901;
}
......@@ -6,17 +6,10 @@
*/
/**
* @addtogroup updates-8.9.x
* @{
* Implements hook_removed_post_updates().
*/
/**
* Uninstall migrate_drupal_multilingual since migrate_drupal is installed.
*/
function migrate_drupal_post_update_uninstall_multilingual() {
\Drupal::service('module_installer')->uninstall(['migrate_drupal_multilingual']);
function migrate_drupal_removed_post_updates() {
return [
'migrate_drupal_post_update_uninstall_multilingual' => '10.0.0',
];
}
/**
* @} End of "addtogroup updates-8.9.x".
*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment