Skip to content

Commit

Permalink
Merge branch 'master' into PHRAS-3668-videotools-happyscribe-subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaillat authored Nov 17, 2023
2 parents 5bcff96 + b3f2076 commit bd24b2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Alchemy/Phrasea/Command/Maintenance/CleanUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
return 1;
}

$clauses[] = sprintf("`last_connection` < DATE_SUB(NOW(), INTERVAL %d day)", $inactivityPeriod);
$clauses[] = sprintf("((`last_connection` IS NULL AND `Users`.`created` < DATE_SUB(NOW(), INTERVAL %d day)) OR (`last_connection` < DATE_SUB(NOW(), INTERVAL %d day)))", $inactivityPeriod, $inactivityPeriod);

$sql_where_u = 1;
$sql_where_ub = 1;
Expand Down Expand Up @@ -249,7 +249,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
$usersList[] = [
$user->getId(),
$user->getLogin(),
$user->getLastConnection()->format('Y-m-d h:m:s'),
($user->getLastConnection() == null) ? 'never connected' : $user->getLastConnection()->format('Y-m-d h:m:s'),
$action
];
}
Expand Down Expand Up @@ -280,7 +280,7 @@ private function relanceUser(User $user, $graceDuration)

$mail->setLogin($user->getLogin());
$mail->setLocale($user->getLocale());
$mail->setLastConnection($user->getLastConnection()->format('Y-m-d'));
$mail->setLastConnection(($user->getLastConnection() == null) ? 'never connected': $user->getLastConnection()->format('Y-m-d'));
$mail->setDeleteDate((new \DateTime("+{$graceDuration} day"))->format('Y-m-d'));

// return 0 on failure
Expand All @@ -296,7 +296,7 @@ private function doDelete(User $user, UserManipulator $userManipulator, $validMa
if ($validMail && !empty($maxRelances)) {
$receiver = Receiver::fromUser($user);
$mail = MailSuccessAccountInactifDelete::create($this->container, $receiver);
$mail->setLastConnection($user->getLastConnection()->format('Y-m-d'));
$mail->setLastConnection(($user->getLastConnection() == null) ? 'never connected' : $user->getLastConnection()->format('Y-m-d'));

// if --max_relances=0 there is no inactivity email
if ($user->getLastInactivityEmail() !== null) {
Expand Down

0 comments on commit bd24b2f

Please sign in to comment.