media.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/media/src/Entity/Media.php
- 9 core/modules/media/src/Plugin/views/wizard/Media.php
- 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Media.php
- 8.9.x core/modules/media/src/Entity/Media.php
- 8.9.x core/modules/media/src/Plugin/views/wizard/Media.php
- 11.x core/modules/media/src/Entity/Media.php
- 11.x core/modules/media/src/Plugin/views/wizard/Media.php
- 11.x core/modules/media/tests/fixtures/update/media.php
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Media.php
File
-
core/
modules/ media/ tests/ fixtures/ update/ media.php
View source
<?php
// phpcs:ignoreFile
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
->fields([
'value' => 'i:8700;',
'name' => 'media',
'collection' => 'system.schema',
])
->condition('collection', 'system.schema')
->condition('name', 'media')
->execute();
// Update core.extension.
$extensions = $connection->select('config')
->fields('config', [
'data',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['media'] = 0;
$connection->update('config')
->fields([
'data' => serialize($extensions),
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
// Add all media_removed_post_updates() as existing updates.
require_once __DIR__ . '/../../../../media/media.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(media_removed_post_updates()));
$connection->update('key_value')
->fields([
'value' => serialize($existing_updates),
])
->condition('collection', 'post_update')
->condition('name', 'existing_updates')
->execute();
// Create media.settings.
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'media.settings',
'data' => serialize([
'icon_base_uri' => 'public://media-icons/generic',
'iframe_domain' => '',
'oembed_providers_url' => 'https://oembed.com/providers.json',
'standalone_url' => FALSE,
]),
])
->execute();
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.