summaryrefslogtreecommitdiff
path: root/app/Schema/Migration21.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Schema/Migration21.php')
-rw-r--r--app/Schema/Migration21.php86
1 files changed, 44 insertions, 42 deletions
diff --git a/app/Schema/Migration21.php b/app/Schema/Migration21.php
index 799d6f21a4..936fa83985 100644
--- a/app/Schema/Migration21.php
+++ b/app/Schema/Migration21.php
@@ -20,50 +20,52 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 21 to version 22.
*/
-class Migration21 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Data fix for bug #1072477
- Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
- Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
+class Migration21 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Data fix for bug #1072477
+ Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
+ Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
- // Delete old settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('AUTO_GENERATE_THUMBS', 'POSTAL_CODE', 'MEDIA_DIRECTORY_LEVELS', 'USE_MEDIA_VIEWER')");
+ // Delete old settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('AUTO_GENERATE_THUMBS', 'POSTAL_CODE', 'MEDIA_DIRECTORY_LEVELS', 'USE_MEDIA_VIEWER')");
- // Delete old settings
- Database::exec("DELETE FROM `##module_setting` WHERE module_name='lightbox'");
+ // Delete old settings
+ Database::exec("DELETE FROM `##module_setting` WHERE module_name='lightbox'");
- // Very old versions of phpGedView allowed media paths beginning “./”
- // Remove these
- Database::exec(
- "UPDATE `##media` m" .
- " SET" .
- " m_filename = TRIM(LEADING './' FROM m_filename)," .
- " m_gedcom = REPLACE(m_gedcom, '\n1 FILE ./', '\n1 FILE ')"
- );
- Database::exec(
- "UPDATE `##change` c" .
- " SET new_gedcom = REPLACE(new_gedcom, '\n1 FILE ./', '\n1 FILE ')" .
- " WHERE status = 'pending'"
- );
+ // Very old versions of phpGedView allowed media paths beginning “./”
+ // Remove these
+ Database::exec(
+ "UPDATE `##media` m" .
+ " SET" .
+ " m_filename = TRIM(LEADING './' FROM m_filename)," .
+ " m_gedcom = REPLACE(m_gedcom, '\n1 FILE ./', '\n1 FILE ')"
+ );
+ Database::exec(
+ "UPDATE `##change` c" .
+ " SET new_gedcom = REPLACE(new_gedcom, '\n1 FILE ./', '\n1 FILE ')" .
+ " WHERE status = 'pending'"
+ );
- // Previous versions of webtrees included the MEDIA_DIRECTORY setting in the
- // FILE tag of the OBJE records. Remove it…
- Database::exec(
- "UPDATE `##media` m" .
- " JOIN `##gedcom_setting` gs ON (m.m_file = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
- " SET" .
- " m_filename = TRIM(LEADING gs.setting_value FROM m_filename)," .
- " m_gedcom = REPLACE(m_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')"
- );
- // …don’t forget pending changes
- Database::exec(
- "UPDATE `##change` c" .
- " JOIN `##gedcom_setting` gs ON (c.gedcom_id = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
- " SET new_gedcom = REPLACE(new_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')" .
- " WHERE status = 'pending'"
- );
- }
+ // Previous versions of webtrees included the MEDIA_DIRECTORY setting in the
+ // FILE tag of the OBJE records. Remove it…
+ Database::exec(
+ "UPDATE `##media` m" .
+ " JOIN `##gedcom_setting` gs ON (m.m_file = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
+ " SET" .
+ " m_filename = TRIM(LEADING gs.setting_value FROM m_filename)," .
+ " m_gedcom = REPLACE(m_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')"
+ );
+ // …don’t forget pending changes
+ Database::exec(
+ "UPDATE `##change` c" .
+ " JOIN `##gedcom_setting` gs ON (c.gedcom_id = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
+ " SET new_gedcom = REPLACE(new_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')" .
+ " WHERE status = 'pending'"
+ );
+ }
}