1*c9beb871SGreg Roach<?php 2*c9beb871SGreg Roach/** 3*c9beb871SGreg Roach * webtrees: online genealogy 4*c9beb871SGreg Roach * Copyright (C) 2018 webtrees development team 5*c9beb871SGreg Roach * This program is free software: you can redistribute it and/or modify 6*c9beb871SGreg Roach * it under the terms of the GNU General Public License as published by 7*c9beb871SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8*c9beb871SGreg Roach * (at your option) any later version. 9*c9beb871SGreg Roach * This program is distributed in the hope that it will be useful, 10*c9beb871SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11*c9beb871SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*c9beb871SGreg Roach * GNU General Public License for more details. 13*c9beb871SGreg Roach * You should have received a copy of the GNU General Public License 14*c9beb871SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15*c9beb871SGreg Roach */ 16*c9beb871SGreg Roachdeclare(strict_types=1); 17*c9beb871SGreg Roach 18*c9beb871SGreg Roachnamespace Fisharebest\Webtrees\Schema; 19*c9beb871SGreg Roach 20*c9beb871SGreg Roachuse Illuminate\Database\Capsule\Manager as DB; 21*c9beb871SGreg Roach 22*c9beb871SGreg Roach/** 23*c9beb871SGreg Roach * Populate the default_resn table 24*c9beb871SGreg Roach */ 25*c9beb871SGreg Roachclass SeedDefaultResnTable implements SeedInterface 26*c9beb871SGreg Roach{ 27*c9beb871SGreg Roach private const DEFAULT_RESTRICTIONS = [ 28*c9beb871SGreg Roach 'SSN' => 'confidential', 29*c9beb871SGreg Roach 'SOUR' => 'privacy', 30*c9beb871SGreg Roach 'REPO' => 'privacy', 31*c9beb871SGreg Roach 'SUBM' => 'confidential', 32*c9beb871SGreg Roach 'SUBN' => 'confidential', 33*c9beb871SGreg Roach ]; 34*c9beb871SGreg Roach 35*c9beb871SGreg Roach /** 36*c9beb871SGreg Roach * Run the seeder. 37*c9beb871SGreg Roach * 38*c9beb871SGreg Roach * @return void 39*c9beb871SGreg Roach */ 40*c9beb871SGreg Roach public function run(): void 41*c9beb871SGreg Roach { 42*c9beb871SGreg Roach // Set default privacy settings for new trees 43*c9beb871SGreg Roach foreach (self::DEFAULT_RESTRICTIONS as $tag_type => $resn) { 44*c9beb871SGreg Roach DB::table('default_resn')->updateOrInsert([ 45*c9beb871SGreg Roach 'gedcom_id' => -1, 46*c9beb871SGreg Roach 'tag_type' => $tag_type, 47*c9beb871SGreg Roach ], [ 48*c9beb871SGreg Roach 'resn' => $resn, 49*c9beb871SGreg Roach ]); 50*c9beb871SGreg Roach } 51*c9beb871SGreg Roach } 52*c9beb871SGreg Roach} 53