mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
auto-update - create 's' keys for all users that don't have 'em
This commit is contained in:
parent
b9d768972e
commit
cc64742e23
2 changed files with 24 additions and 3 deletions
24
update.php
24
update.php
|
@ -40,4 +40,26 @@ function update_1005() {
|
|||
q("ALTER TABLE `user` ADD `spubkey` TEXT NOT NULL AFTER `prvkey` ,
|
||||
ADD `sprvkey` TEXT NOT NULL AFTER `spubkey`");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function update_1006() {
|
||||
|
||||
// create 's' keys for everybody that does not have one
|
||||
|
||||
$r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$sres=openssl_pkey_new(array('encrypt_key' => false ));
|
||||
$sprvkey = '';
|
||||
openssl_pkey_export($sres, $sprvkey);
|
||||
$spkey = openssl_pkey_get_details($sres);
|
||||
$spubkey = $spkey["key"];
|
||||
$r = q("UPDATE `user` SET `spubkey` = '%s', `sprvkey` = '%s'
|
||||
WHERE `uid` = %d LIMIT 1",
|
||||
dbesc($spubkey),
|
||||
dbesc($sprvkey),
|
||||
intval($rr['uid'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue