-
Notifications
You must be signed in to change notification settings - Fork 461
pkp/pkp-lib#11125 Fix: Copyediting Stage, Discussion tags do not populate [main] #11180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2bbf644
to
7f9c7a2
Compare
7f9c7a2
to
710db5a
Compare
* Copyright (c) 2014-2025 Simon Fraser University | ||
* Copyright (c) 2000-2025 John Willinsky |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Copyright (c) 2014-2025 Simon Fraser University | |
* Copyright (c) 2000-2025 John Willinsky | |
* Copyright (c) 2025 Simon Fraser University | |
* Copyright (c) 2025 John Willinsky |
$existingVariables = []; | ||
$replacementsVariables = []; | ||
|
||
foreach ($variablesMap as $key => $value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foreach ($variablesMap as $key => $value) { | |
foreach ($variablesMap as $oldName => $newName) { |
} | ||
|
||
// Default templates | ||
$data = DB::table('email_templates_default_data')->where('email_key', $emailKey)->get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how many rows this and the next table might have (some installations out there have many journals), but such simple string replacements can be done with SQL, then you won't need to download all the record set and the operation should complete faster.
$data = DB::table('email_templates_default_data')->where('email_key', $emailKey)->get(); | ||
|
||
$data->each(function (object $entry) use ($existingVariables, $replacementsVariables) { | ||
$subject = preg_replace($existingVariables, $replacementsVariables, $entry->subject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's a simple string, then you could use the str_replace()
instead of a regular expression.
$newToOldVariableMap = array_map(function ($variablesMap) { | ||
return array_flip($variablesMap); | ||
}, $this->oldToNewVariablesMap()); | ||
|
||
$this->renameTemplateVariables($newToOldVariableMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note... At the moment, given the number of migrations without a down()
, I think it's a bit pointless to code it, we need to have a well defined policy. I had started a discussion here: #9061
For #11125