sub step_core_init { return 300; } sub step_core { my ($opts, $notok, $ps, $ok); $wiz->wraptext($lang->{core_start}); require PS; # must require this here, instead of the main install.pl, # incase not all the modules are installed first. $ok = 1; $wiz->wraptext($lang->{core_init1}, {trimtail => 1}); eval { $opts = { INSTALL => 1, CONFFILE => $wiz->{data}{statscfg} }; $ps = PS->new($opts)->do_init($opts); if (!$ps) { # just incase we actually get to this point even though the init above failed die($!); } else { # all is well! $wiz->wraptext($lang->{ok}); } }; print "\n"; $wiz->{data}{dbname} = $conf->{ $conf->{savetype} }{dbname}; $wiz->{data}{dbhost} = $conf->{ $conf->{savetype} }{host}; $wiz->{data}{dbusername} = $data->{username} = $data->{user} = $conf->{ $conf->{savetype} }{username}; $wiz->{data}{dbpassword} = $data->{password} = $data->{pass} = $conf->{ $conf->{savetype} }{password}; if ($@) { $ok = 0; print hline('-'), "\n$@\n", hline('-'), "\n"; } else { $wiz->wraptext($lang->{core_init2}, {trimtail => 1}); $notok = $wiz->{data}{error} = $ps->{saver}->install; if ($notok) { $ok = 0; $wiz->wraptext($lang->{core_savererr}); print hline('- '), "\n"; $wiz->wraptext($notok); print hline('- '), "\n"; if ($notok =~ /using password/i) { $wiz->wraptext($lang->{core_passwd}); } elsif ($notok =~ /can't connect/i) { $wiz->wraptext($lang->{core_dbhost}); } elsif ($notok =~ /unknown database/i) { $wiz->wraptext($lang->{core_unknowndb}); } elsif ($notok =~ /access denied/i) { $wiz->wraptext($lang->{core_userauth}); } } else { $wiz->wraptext($lang->{ok}); } print "\n"; } if ($ok) { print hline('- '), "\n"; $wiz->wraptext($lang->{core_done}); print hline('- '), "\n\n"; } else { } } 1;