From 8bac87ec3b95b86b811a19de7c6a23c5f1820dbd Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Tue, 6 Oct 2026 20:06:30 -0500 Subject: [PATCH] Translate the old-extension message in ext.php ext.php refused to enable with a hard-coded English message while the old extension was still enabled. The message now comes from the install language file, as phpBB's validation policy requires. The migration-history move also rewrites other extensions' dependency lists that point at the renamed migrations, not just this extension's own rows. phpBB reads those lists when reverting migrations. Co-Authored-By: Claude Opus 5.5 --- ext.php | 19 +++++++++++++------ language/en/install_wiki.php | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ext.php b/ext.php index 3cb29b1..1e2e0cd 100644 --- a/ext.php +++ b/ext.php @@ -70,7 +70,10 @@ public function is_enableable() if ($this->container->get('ext.manager')->is_enabled(self::OLD_EXT_NAME)) { - return ['Disable the old "' . self::OLD_EXT_NAME . '" extension first (keep its data, do not delete it).']; + $language = $this->container->get('language'); + $language->add_lang('install_wiki', 'phpbbmodders/wiki'); + + return $language->lang('WIKI_DISABLE_OLD', self::OLD_EXT_NAME); } return true; @@ -202,16 +205,20 @@ protected function move_old_install() foreach ($rows as $row) { - if ($this->new_class_name($row['migration_name']) === $row['migration_name']) + // Other extensions' migrations may depend on ours, so their + // dependency lists are rewritten too, not just our own rows + $old_depends_on = unserialize($row['migration_depends_on'], ['allowed_classes' => false]); + $old_depends_on = is_array($old_depends_on) ? $old_depends_on : []; + $depends_on = array_map([$this, 'new_class_name'], $old_depends_on); + $name = $this->new_class_name($row['migration_name']); + + if ($name === $row['migration_name'] && $depends_on === $old_depends_on) { continue; } - $depends_on = unserialize($row['migration_depends_on'], ['allowed_classes' => false]); - $depends_on = is_array($depends_on) ? array_map([$this, 'new_class_name'], $depends_on) : []; - $db->sql_query('UPDATE ' . $prefix . 'migrations SET ' . $db->sql_build_array('UPDATE', [ - 'migration_name' => $this->new_class_name($row['migration_name']), + 'migration_name' => $name, 'migration_depends_on' => serialize($depends_on), ]) . " WHERE migration_name = '" . $db->sql_escape($row['migration_name']) . "'"); } diff --git a/language/en/install_wiki.php b/language/en/install_wiki.php index 71baffc..4e4468a 100644 --- a/language/en/install_wiki.php +++ b/language/en/install_wiki.php @@ -43,4 +43,5 @@ $lang = array_merge($lang, [ 'WIKI_NOT_ENABLEABLE' => 'phpBB Modders Wiki could not be enabled. The minimum requirements of phpBB 3.3.19 and/or PHP 7.4.0 were not satisfied.', + 'WIKI_DISABLE_OLD' => 'Disable the old ā€œ%sā€ extension first. Keep its data; do not delete it.', ]);