xref: /webtrees/app/Schema/Migration24.php (revision c1010eda29c0909ed4d5d463f32d32bfefdd4dfe)
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 24 to version 25.
223bfb94b0SGreg Roach */
23*c1010edaSGreg Roachclass Migration24 implements MigrationInterface
24*c1010edaSGreg Roach{
2576692c8bSGreg Roach    /**
2676692c8bSGreg Roach     * Upgrade to to the next version
2776692c8bSGreg Roach     */
28*c1010edaSGreg Roach    public function upgrade()
29*c1010edaSGreg Roach    {
303bfb94b0SGreg Roach        // Tree settings become site settings
313bfb94b0SGreg Roach        Database::exec(
323bfb94b0SGreg Roach            "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
3388ea75f1SGreg Roach            " SELECT setting_name, MIN(setting_value)" . // Can't use ANY_VALUE() until MySQL5.7
343bfb94b0SGreg Roach            " FROM `##gedcom_setting`" .
353bfb94b0SGreg Roach            " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" .
363bfb94b0SGreg Roach            " GROUP BY setting_name"
373bfb94b0SGreg Roach        );
383bfb94b0SGreg Roach
393bfb94b0SGreg Roach        Database::exec(
403bfb94b0SGreg Roach            "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'"
413bfb94b0SGreg Roach        );
423bfb94b0SGreg Roach
433bfb94b0SGreg Roach        Database::exec(
443bfb94b0SGreg Roach            "DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')"
453bfb94b0SGreg Roach        );
463bfb94b0SGreg Roach    }
473bfb94b0SGreg Roach}
48