#!/usr/bin/perl -w

use warnings;
use strict;
use POSIX qw(strftime);

#db info
our $ROOT_HOST = 'localhost';
our $ROOT_USER = 'root';
our $ROOT_PASS = '***********';

#bugzilla info
our $BZ_DB = 'bugzilla';
our $BZ_DEFAULT_ASSIGNEE = 791;
our $BZ_NEEDSINPUT_KEYWORD = 4;

#no need to edit below
use DBI;
my $dsn = "DBI:mysql:$BZ_DB:$ROOT_HOST";
our $dbh = DBI->connect($dsn, $ROOT_USER, $ROOT_PASS);

my ($find_users, $email_setting);
$find_users = $dbh->prepare("SELECT userid FROM profiles");
$email_setting = $dbh->prepare("REPLACE INTO email_setting (user_id, relationship, event) VALUES (?, ?, ?)");

$find_users->execute();
my ($userid);
while ( ($userid) = $find_users->fetchrow_array() )
{
	my ($i, $j);
	for ($i = 0; $i <= 4; $i++)
	{
		for ($j = 0; $j <= 9; $j++)
		{
			$email_setting->execute($userid, $i, $j);
		}
		$email_setting->execute($userid, $i, 50);
	}
	$email_setting->execute($userid, 100, 100);
	$email_setting->execute($userid, 100, 101);
}

