mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
9d125b459e
Summary: Fixes T10259. There was no real reason to do this `ip2long()` stuff in the first place -- it's very slightly smaller, but won't work with ipv6 and the savings are miniscule. Test Plan: - Ran migration. - Viewed logs in web UI. - Pulled and pushed. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10259 Differential Revision: https://secure.phabricator.com/D15165
39 lines
736 B
PHP
39 lines
736 B
PHP
<?php
|
|
|
|
$pull = new PhabricatorRepositoryPullEvent();
|
|
$push = new PhabricatorRepositoryPushEvent();
|
|
|
|
$conn_w = $pull->establishConnection('w');
|
|
|
|
$log_types = array($pull, $push);
|
|
foreach ($log_types as $log) {
|
|
foreach (new LiskMigrationIterator($log) as $row) {
|
|
$addr = $row->getRemoteAddress();
|
|
|
|
$addr = (string)$addr;
|
|
if (!strlen($addr)) {
|
|
continue;
|
|
}
|
|
|
|
if (!ctype_digit($addr)) {
|
|
continue;
|
|
}
|
|
|
|
if (!(int)$addr) {
|
|
continue;
|
|
}
|
|
|
|
$ip = long2ip($addr);
|
|
if (!is_string($ip) || !strlen($ip)) {
|
|
continue;
|
|
}
|
|
|
|
$id = $row->getID();
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET remoteAddress = %s WHERE id = %d',
|
|
$log->getTableName(),
|
|
$ip,
|
|
$id);
|
|
}
|
|
}
|