3 # Pulls the jabber users from the oils/jabber config files
4 # and populates the mysql db for the jabber server with the users
8 use OpenILS::Utils::Config qw( /pines/conf/oils.conf );
9 my $config = OpenILS::Utils::Config->current;
12 print "usage: perl jcreate.pl dbhost dbuser dbpass\n";
21 my $connection = DBI->connect( "DBI:mysql:jabberd2:$host", $user, $pass )
22 or die "Cannot connect to db: $! \n";
24 my $jpass = $config->transport->auth->password;
25 my $realm = $config->transport->server->primary;
28 my $clean = "delete from authreg;";
29 my $sth = $connection->prepare( $clean );
32 my @users = keys %{$config->transport->users};
34 # Grab each user from the config and push them into mysql
35 for my $user (@users) {
36 if( ! $user or $user eq "__id" or $user eq "__sub") { next; }
37 print "Inserting $user: ";
39 my $sql = "insert into authreg (username, realm, password) values " .
40 "('$user', '$realm', '$jpass');";
44 $sth = $connection->prepare( $sql );