Skip to content

Commit 7de50ec

Browse files
committed
pkp/pkp-lib#11125 Add migration script to update email template variables
1 parent f88f37b commit 7de50ec

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* @file classes/migration/upgrade/v3_4_0/I11125_UpdateEmailTemplateVariables.php
5+
*
6+
* Copyright (c) 2014-2025 Simon Fraser University
7+
* Copyright (c) 2000-2025 John Willinsky
8+
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
9+
*
10+
* @class I11125_UpdateEmailTemplateVariables
11+
*
12+
* @brief Migration to update Email Template variable names
13+
*/
14+
15+
namespace APP\migration\upgrade\v3_4_0;
16+
17+
class I11125_UpdateEmailTemplateVariables extends \PKP\migration\upgrade\v3_4_0\I11125_UpdateEmailTemplateVariables
18+
{
19+
protected function oldToNewVariablesMap(): array
20+
{
21+
$oldNewVariablesMap = parent::oldToNewVariablesMap();
22+
array_walk_recursive($oldNewVariablesMap, function (&$newVariable, $oldVariable) {
23+
if ($newVariable === 'contextAcronym') {
24+
$newVariable = 'pressAcronym';
25+
}
26+
});
27+
28+
return $oldNewVariablesMap;
29+
}
30+
}

dbscripts/xml/upgrade.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@
211211
<migration class="APP\migration\upgrade\v3_4_0\I9822_ChangeUsageStatsTemporaryTablesIndexes"/>
212212
</upgrade>
213213

214+
<upgrade minversion="3.4.0.0" maxversion="3.4.9.9">
215+
<migration class="APP\migration\upgrade\v3_4_0\I11125_UpdateEmailTemplateVariables"/>
216+
</upgrade>
217+
214218
<!-- Update plugin configuration - should be done as the final upgrade task -->
215219
<code function="addPluginVersions" />
216220
</install>

0 commit comments

Comments
 (0)