for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
*
* phpBB Media Embed PlugIn extension for the phpBB Forum Software package.
* @copyright (c) 2019 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*/
namespace phpbb\mediaembed\migrations;
* Migration 5: Remove sites no longer supported in MediaEmbed from config_text storage
class m5_remove_sites extends \phpbb\db\migration\container_aware_migration
{
public static function depends_on()
return ['\phpbb\mediaembed\migrations\m1_install_data'];
}
public function update_data()
return [
['config_text.update', ['media_embed_sites', call_user_func([$this, 'remove_sites'])]],
];
* Compare the sites currently stored in the config_text with the sites
* currently available in MediaEmbed. Remove any sites in config_text that
* are not found in MediaEmbed (which means they have been removed from it).
* @return string
public function remove_sites()
$config_text = $this->container->get('config_text');
$stored_sites = json_decode($config_text->get('media_embed_sites'), true);
$configurator = $this->container->get('text_formatter.s9e.factory')->get_configurator();
$available_sites = array_keys(iterator_to_array($configurator->MediaEmbed->defaultSites));
return json_encode(array_values(array_intersect($stored_sites, $available_sites)));