smeserver-bandwidthd/root/etc/e-smith/db/configuration/migrate/80bandwidthd

17 lines
462 B
Plaintext

{
use MIME::Base64 qw(encode_base64);
my $rec = $DB->get('bandwidthd') || $DB->new_record('bandwidthd', {type => 'service'});
if (my $grapCutofff = $DB->get_prop_and_delete('bandwidthd', 'grapCutofff')) {
$rec->merge_props('grapCutoff', $grapCutofff);
}
my $pw = $rec->prop('DbPassword');
return "" if $pw;
$pw = MIME::Base64::encode(int( (1000000000000000) * rand() ));
chomp($pw);
$rec->set_prop('DbPassword', "$pw" );
}