Skip to content

Commit a2e5ba4

Browse files
committed
Script: Cron: optimization of script to avoid flush for each userupdate and also set only one flush for all user when desactivating users - refs BT#20351
1 parent 5d159eb commit a2e5ba4

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

tests/scripts/synchronize_user_base_from_csv.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
}
209209

210210
$user->setCreator($creator);
211-
$userRepository->updateUser($user, true);
211+
$userRepository->updateUser($user, false);
212212

213213
foreach ($CSVuser as $fieldName => $fieldValue) {
214214
if (strpos($fieldName, EXTRA_KEY) === 0) {
@@ -296,14 +296,6 @@
296296
$trackEDefault->setDefaultValue((string) $user->getId());
297297
$entityManager->persist($trackEDefault);
298298

299-
try {
300-
$entityManager->flush();
301-
} catch (OptimisticLockException $e) {
302-
error_log("Error processing user " . $e->getMessage());
303-
echo "Trace: " . $e->getTraceAsString() . "\n";
304-
continue;
305-
}
306-
307299
if ($debug) {
308300
echo 'Disabled user ' . $usernameToDisable . "\n";
309301
}

0 commit comments

Comments
 (0)