|
Line 0
Link Here
|
| 0 |
- |
1 |
$DBversion = 'XXX'; |
|
|
2 |
if( CheckVersion( $DBversion ) ) { |
| 3 |
|
| 4 |
use Koha::AuthUtils qw(hash_password); |
| 5 |
|
| 6 |
my $sth = $dbh->prepare(q{ |
| 7 |
SELECT client_id, secret |
| 8 |
FROM api_keys |
| 9 |
}); |
| 10 |
$sth->execute; |
| 11 |
my $results = $sth->fetchall_arrayref({}); |
| 12 |
|
| 13 |
$sth = $dbh->prepare(q{ |
| 14 |
UPDATE api_keys |
| 15 |
SET |
| 16 |
secret = ? |
| 17 |
WHERE |
| 18 |
client_id = ? |
| 19 |
}); |
| 20 |
|
| 21 |
foreach my $api_key (@$results) { |
| 22 |
my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} ); |
| 23 |
$sth->execute( $digest, $api_key->{client_id} ); |
| 24 |
} |
| 25 |
|
| 26 |
NewVersion( $DBversion, 28772, "Store hashed API key secrets" ); |
| 27 |
} |