Skip to content

Commit

Permalink
fixes ips migration (#1569)
Browse files Browse the repository at this point in the history
* fixes ips migration

* Update Updater130002.php
  • Loading branch information
Elorfin authored Feb 10, 2021
1 parent 85918ad commit 15068a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/authentication/Installation/Updater/Updater130002.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function postUpdate()
if (is_array($ips)) {
$processed = [];
foreach ($ips as $ip) {
if (!in_array($ip, $processed)) {
if (!empty($ip) && !in_array($ip, $processed)) {
$ipUser = new IpUser();
$ipUser->setIp($ip);
$ipUser->setUser($user);
Expand All @@ -69,10 +69,12 @@ public function postUpdate()
$ranges = Yaml::parseFile($rangeFile);
if (is_array($ranges)) {
foreach ($ranges as $range) {
$ipUser = new IpUser();
$ipUser->setIp(implode(',', array_values($range)));
$ipUser->setRange(true);
$ipUser->setUser($user);
if (!empty($range)) {
$ipUser = new IpUser();
$ipUser->setIp(implode(',', array_values($range)));
$ipUser->setRange(true);
$ipUser->setUser($user);
}

$this->om->persist($ipUser);
}
Expand Down

0 comments on commit 15068a1

Please # to comment.