xref: /webtrees/app/Schema/Migration29.php (revision 3bfb94b0b402ff08e5888afb946384316f6d3e60)
1<?php
2namespace Fisharebest\Webtrees\Schema;
3
4/**
5 * webtrees: online genealogy
6 * Copyright (C) 2015 webtrees development team
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18use Fisharebest\Webtrees\Database;
19
20/**
21 * Class Migration29 - upgrade the database schema from version 29 to version 30.
22 */
23class Migration29 implements MigrationInterface {
24	/** {@inheritDoc} */
25	public function upgrade() {
26		// Originally migrated from PhpGedView, but never used.
27		Database::exec("DROP TABLE IF EXISTS `##ip_address`");
28
29		// No longer used
30		Database::exec("DELETE FROM `##user_setting` WHERE setting_name IN ('editaccount')");
31		Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SHOW_STATS')");
32		Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('REQUIRE_ADMIN_AUTH_REGISTRATION')");
33
34		// https://bugs.launchpad.net/webtrees/+bug/1405672
35		Database::exec(
36			"UPDATE `##site_access_rule` SET user_agent_pattern = 'Mozilla/5.0 (% Konqueror/%'" .
37			" WHERE user_agent_pattern='Mozilla/5.0 (compatible; Konqueror/%'"
38		);
39
40		// Embedded variables are based on function names - which were renamed for PSR2
41		Database::exec(
42			"UPDATE `##block_setting` " .
43			" JOIN `##block` USING (block_id)" .
44			" SET setting_value = REPLACE(setting_value, '#WT_VERSION#', '#webtreesVersion#')" .
45			" WHERE setting_name = 'html' AND module_name = 'html'"
46		);
47		Database::exec(
48			"UPDATE `##block_setting` " .
49			" JOIN `##block` USING (block_id)" .
50			" SET setting_value = REPLACE(setting_value, '#browserTime24#', '#browserTime#')" .
51			" WHERE setting_name = 'html' AND module_name = 'html'"
52		);
53
54		// Language settings have changed from locale (en_GB) to language tag (en-GB)
55		Database::exec(
56			"UPDATE `##gedcom_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
57		);
58		Database::exec(
59			"UPDATE `##site_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
60		);
61		Database::exec(
62			"UPDATE `##user_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
63		);
64		Database::exec(
65			"UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'languages'"
66		);
67	}
68}
69