From db6c02a54dbdb568b88588fbab0d254361f24ea6 Mon Sep 17 00:00:00 2001 From: Dimitris Efstathiou Date: Tue, 14 Feb 2023 10:24:44 +0200 Subject: [PATCH] pkp/pkp-lib#8598 DB Migration changes --- .../upgrade/v3_4_0/MergeLocalesMigration.php | 71 +++++++++++++++++++ config.TEMPLATE.inc.php | 2 +- dbscripts/xml/upgrade.xml | 1 + .../pubmed/filter/ArticlePubMedXmlFilter.php | 3 +- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php diff --git a/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php b/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php new file mode 100644 index 00000000000..878f9f46e22 --- /dev/null +++ b/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php @@ -0,0 +1,71 @@ +get(); + + foreach ($issueGalleys as $issueGalley) { + $this->updateSingleValueLocale($issueGalley->locale, 'issue_galleys', 'locale', 'galley_id', $issueGalley->galley_id); + } + + // publication_galleys + $publicationGalleys = DB::table('publication_galleys') + ->get(); + + foreach ($publicationGalleys as $publicationGalley) { + $this->updateSingleValueLocale($publicationGalley->locale, 'publication_galleys', 'locale', 'galley_id', $publicationGalley->galley_id); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + throw new DowngradeNotSupportedException(); + } + + protected function getSettingsTables(): Collection + { + return collect([ + 'issue_galley_settings' => 'galley_id', + 'issue_settings' => 'issue_id', + 'journal_settings' => 'journal_id', + 'publication_galley_settings' => 'galley_id', + 'section_settings' => 'section_id', + 'static_page_settings' => 'static_page_id', + 'subscription_type_settings' => 'type_id', + ])->merge(parent::getSettingsTables()); + } +} diff --git a/config.TEMPLATE.inc.php b/config.TEMPLATE.inc.php index 6bdff27bf11..2918d44d235 100644 --- a/config.TEMPLATE.inc.php +++ b/config.TEMPLATE.inc.php @@ -204,7 +204,7 @@ [i18n] ; Default locale -locale = en_US +locale = en ; Database connection character set connection_charset = utf8 diff --git a/dbscripts/xml/upgrade.xml b/dbscripts/xml/upgrade.xml index a030af4fbc5..8efabe07ec7 100644 --- a/dbscripts/xml/upgrade.xml +++ b/dbscripts/xml/upgrade.xml @@ -194,6 +194,7 @@ + diff --git a/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php b/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php index b3a90d700b8..153df78c87b 100644 --- a/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php +++ b/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php @@ -8,6 +8,7 @@ * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class ArticlePubMedXmlFilter + * * @brief Class that converts a Article to a PubMed XML document. */ @@ -88,7 +89,7 @@ public function &process(&$submissions) $publication = $submission->getCurrentPublication(); $locale = $publication->getData('locale'); - if ($locale == 'en_US') { + if ($locale == 'en') { $articleNode->appendChild($doc->createElement('ArticleTitle'))->appendChild($doc->createTextNode($publication->getLocalizedTitle($locale))); } else { $articleNode->appendChild($doc->createElement('VernacularTitle'))->appendChild($doc->createTextNode($publication->getLocalizedTitle($locale)));