Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1089424
20141107.ssh.4.keymig.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1021 B
Referenced Files
None
Subscribers
None
20141107.ssh.4.keymig.php
View Options
<?php
$table
=
new
PhabricatorAuthSSHKey
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
echo
"Updating SSH public key indexes...
\n
"
;
$keys
=
new
LiskMigrationIterator
(
$table
);
foreach
(
$keys
as
$key
)
{
$id
=
$key
->
getID
();
echo
"Updating key {$id}...
\n
"
;
try
{
$hash
=
$key
->
toPublicKey
()->
getHash
();
}
catch
(
Exception
$ex
)
{
echo
"Key has bad format! Removing key.
\n
"
;
queryfx
(
$conn_w
,
'DELETE FROM %T WHERE id = %d'
,
$table
->
getTableName
(),
$id
);
continue
;
}
$collision
=
queryfx_all
(
$conn_w
,
'SELECT * FROM %T WHERE keyIndex = %s AND id < %d'
,
$table
->
getTableName
(),
$hash
,
$key
->
getID
());
if
(
$collision
)
{
echo
"Key is a duplicate! Removing key.
\n
"
;
queryfx
(
$conn_w
,
'DELETE FROM %T WHERE id = %d'
,
$table
->
getTableName
(),
$id
);
continue
;
}
queryfx
(
$conn_w
,
'UPDATE %T SET keyIndex = %s WHERE id = %d'
,
$table
->
getTableName
(),
$hash
,
$key
->
getID
());
}
echo
"Done.
\n
"
;
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jun 30, 3:22 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
269534
Default Alt Text
20141107.ssh.4.keymig.php (1021 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment