Loading visitors.install +22 −16 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ function visitors_update_7131(&$sandbox) { /** * Supports IPv6. */ function visitors_update_7140(&$sandbox) { function visitors_update_7150(&$sandbox) { if (!isset($sandbox['progress'])) { $sandbox['progress'] = 0; $sandbox['last_id'] = 0; Loading @@ -148,26 +148,31 @@ function visitors_update_7140(&$sandbox) { 'visitors_ip', )) ->condition('visitors_id', $sandbox['last_id'], '>') ->range(0, 75) ->range(0, 100) ->orderBy('visitors_id', 'ASC') ->execute(); foreach ($logs as $log) { $update = TRUE; $ip_address = $log->visitors_ip; if (!visitors_is_ip_valid($ip_address)) { if (inet_pton($ip_address) != FALSE) { $update = FALSE; } elseif (long2ip($ip_address) != FALSE) { $ip_address = long2ip($log->visitors_ip); } elseif (!$ip_address) { elseif (inet_ntop($ip_address) != FALSE) { $ip_address = inet_ntop($log->visitors_ip); } elseif (!$ip_address) { else { $ip_address = '0.0.0.0'; } if ($update) { try { db_update('visitors') ->fields(array( 'visitors_ip' => $packed, 'visitors_ip' => $ip_address, )) ->condition('visitors_id', $log->visitors_id) ->execute(); Loading @@ -175,10 +180,11 @@ function visitors_update_7140(&$sandbox) { catch (\Exception $e) { watchdog_exception('visitors', $e); } } $sandbox['progress'] += 1; $sandbox['last_id'] = $log->visitors_id; } $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max']; $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max']; } Loading
visitors.install +22 −16 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ function visitors_update_7131(&$sandbox) { /** * Supports IPv6. */ function visitors_update_7140(&$sandbox) { function visitors_update_7150(&$sandbox) { if (!isset($sandbox['progress'])) { $sandbox['progress'] = 0; $sandbox['last_id'] = 0; Loading @@ -148,26 +148,31 @@ function visitors_update_7140(&$sandbox) { 'visitors_ip', )) ->condition('visitors_id', $sandbox['last_id'], '>') ->range(0, 75) ->range(0, 100) ->orderBy('visitors_id', 'ASC') ->execute(); foreach ($logs as $log) { $update = TRUE; $ip_address = $log->visitors_ip; if (!visitors_is_ip_valid($ip_address)) { if (inet_pton($ip_address) != FALSE) { $update = FALSE; } elseif (long2ip($ip_address) != FALSE) { $ip_address = long2ip($log->visitors_ip); } elseif (!$ip_address) { elseif (inet_ntop($ip_address) != FALSE) { $ip_address = inet_ntop($log->visitors_ip); } elseif (!$ip_address) { else { $ip_address = '0.0.0.0'; } if ($update) { try { db_update('visitors') ->fields(array( 'visitors_ip' => $packed, 'visitors_ip' => $ip_address, )) ->condition('visitors_id', $log->visitors_id) ->execute(); Loading @@ -175,10 +180,11 @@ function visitors_update_7140(&$sandbox) { catch (\Exception $e) { watchdog_exception('visitors', $e); } } $sandbox['progress'] += 1; $sandbox['last_id'] = $log->visitors_id; } $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max']; $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max']; }