Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taslangraham
Copy link
Contributor

For #11125

Comment on lines 6 to 7
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
foreach ($variablesMap as $key => $value) {
foreach ($variablesMap as $oldName => $newName) {

}

// Default templates
$data = DB::table('email_templates_default_data')->where('email_key', $emailKey)->get();
Copy link
Contributor

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);
Copy link
Contributor

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.

Comment on lines 29 to 33
$newToOldVariableMap = array_map(function ($variablesMap) {
return array_flip($variablesMap);
}, $this->oldToNewVariablesMap());

$this->renameTemplateVariables($newToOldVariableMap);
Copy link
Contributor

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

@taslangraham taslangraham force-pushed the i11125-main branch 2 times, most recently from 7111426 to 5c753b5 Compare May 27, 2025 20:09
@taslangraham taslangraham requested a review from ewhanson May 27, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants