Skip to content

Commit

Permalink
Properly migrate ACP modules
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ober committed Nov 4, 2023
1 parent bc1c95e commit 71aef0a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
24 changes: 0 additions & 24 deletions migrations/add_modules.php

This file was deleted.

43 changes: 43 additions & 0 deletions migrations/v308/add_modules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace mober\discordnotifications\migrations\v308;

class add_modules extends \phpbb\db\migration\container_aware_migration
{
static public function depends_on()
{
return ['\mober\discordnotifications\migrations\extension_installation'];
}

public function effectively_installed()
{
/** @var \phpbb\db\migration\tool\module $module_manager */
$module_manager = $this->container->get('migrator.tool.module');
return $module_manager->exists('acp', 'ACP_DISCORD_NOTIFICATIONS', 'ACP_DISCORD_NOTIFICATIONS_SETTINGS');
}

public function update_data()
{
return [
['module.remove', [
'acp',
'ACP_DISCORD_NOTIFICATIONS',
[
'module_langname' => 'ACP_DISCORD_NOTIFICATIONS_TITLE',
],
]],
['module.add', [
'acp',
'ACP_DISCORD_NOTIFICATIONS',
[
'module_basename' => '\mober\discordnotifications\acp\discord_notifications_module',
'modes' => [
'settings',
'webhooks',
'mapping',
],
],
]],
];
}
}

0 comments on commit 71aef0a

Please sign in to comment.