xref: /webtrees/app/Schema/Migration15.php (revision 19d913785a45657df3e7bc9cd4411f501dd5071b)
13bfb94b0SGreg Roach<?php
23bfb94b0SGreg Roach/**
33bfb94b0SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
53bfb94b0SGreg Roach * This program is free software: you can redistribute it and/or modify
63bfb94b0SGreg Roach * it under the terms of the GNU General Public License as published by
73bfb94b0SGreg Roach * the Free Software Foundation, either version 3 of the License, or
83bfb94b0SGreg Roach * (at your option) any later version.
93bfb94b0SGreg Roach * This program is distributed in the hope that it will be useful,
103bfb94b0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
113bfb94b0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123bfb94b0SGreg Roach * GNU General Public License for more details.
133bfb94b0SGreg Roach * You should have received a copy of the GNU General Public License
143bfb94b0SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
153bfb94b0SGreg Roach */
1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Schema;
1776692c8bSGreg Roach
183bfb94b0SGreg Roachuse Fisharebest\Webtrees\Database;
193bfb94b0SGreg Roach
203bfb94b0SGreg Roach/**
2176692c8bSGreg Roach * Upgrade the database schema from version 16 to version 17.
223bfb94b0SGreg Roach */
23c1010edaSGreg Roachclass Migration15 implements MigrationInterface
24c1010edaSGreg Roach{
2576692c8bSGreg Roach    /**
2676692c8bSGreg Roach     * Upgrade to to the next version
27*19d91378SGreg Roach     *
28*19d91378SGreg Roach     * @return void
2976692c8bSGreg Roach     */
30c1010edaSGreg Roach    public function upgrade()
31c1010edaSGreg Roach    {
323bfb94b0SGreg Roach        // Delete old config settings
333bfb94b0SGreg Roach        Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES', 'SHOW_LIST_PLACES', 'SHOW_CONTEXT_HELP')");
343bfb94b0SGreg Roach        Database::exec("DELETE FROM `##user_setting` WHERE setting_name='defaulttab'");
353bfb94b0SGreg Roach
363bfb94b0SGreg Roach        // There is no way to add a RESN tag to NOTE objects
373bfb94b0SGreg Roach        Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
383bfb94b0SGreg Roach
393bfb94b0SGreg Roach        // This needs to be an absolute URL. If not set, it defaults to the full path to login.php
403bfb94b0SGreg Roach        Database::exec("DELETE FROM `##site_setting` WHERE setting_name='LOGIN_URL' AND setting_value='login.php'");
413bfb94b0SGreg Roach        // No need for an empty value
423bfb94b0SGreg Roach        Database::exec("DELETE FROM `##site_setting` WHERE setting_name='SERVER_URL' AND setting_value=''");
433bfb94b0SGreg Roach
443bfb94b0SGreg Roach        // Later PHP versions use session IDs longer than 32 chars.
453bfb94b0SGreg Roach        Database::exec("ALTER TABLE `##session` CHANGE session_id session_id CHAR(128) COLLATE utf8_unicode_ci NOT NULL");
463bfb94b0SGreg Roach    }
473bfb94b0SGreg Roach}
48