Skip to content

Commit e6f7589

Browse files
committed
Merge remote-tracking branch 'origin/1.11.x' into 1.11.x
2 parents e537f66 + a446e4b commit e6f7589

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/scripts/unify_duplicated_user_based_on_extra_field_value.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
exit;
1010
require __DIR__.'/../../main/inc/global.inc.php';
1111

12+
// Filter to only manage those users based on their user_id :
13+
//$filteredUsers = [11,12,13]; // set the list of user_id
14+
1215
// set the extra field variable to use
1316
$extraFieldVariable = 'dni';
1417

@@ -38,6 +41,9 @@
3841
$mostRecentRegistrationDate = 0;
3942
foreach ($users as $u) {
4043
$uid = (int)$u['user_id'];
44+
if (isset($filteredUsers) && !in_array($uid, $filteredUsers) {
45+
continue;
46+
}
4147
$userInfo = api_get_user_info($uid);
4248
if ($userInfo['registration_date'] > $mostRecentRegistrationDate) {
4349
$mostRecentRegistrationDate = $userInfo['registration_date'];
@@ -46,11 +52,16 @@
4652
}
4753
foreach ($users as $u) {
4854
$uid = (int)$u['user_id'];
55+
if (isset($filteredUsers) && !in_array($uid, $filteredUsers) {
56+
continue;
57+
}
4958
if ($uid === $userIdToUnifyOn) { continue; }
50-
51-
echo 'Unifying user ' . $uid . ' on user ' . $userIdToUnifyOn . PHP_EOL;
59+
$now = date('Y-m-d H:i:s');
60+
echo $now . ' Unifying user ' . $uid . ' on user ' . $userIdToUnifyOn . PHP_EOL;
5261
MySpace::duUpdateAllUserRefsList($uid, $userIdToUnifyOn);
5362
MySpace::duDisableOrDeleteUser($uid, $unifyMode);
63+
$now = date('Y-m-d H:i:s');
64+
echo $now . ' User unified' . PHP_EOL;
5465
}
5566
}
5667
}

0 commit comments

Comments
 (0)