Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function deleteExpiredPasswords() {
- $user_ids = $this->getUserIdsWithAlreadyExpiredPassword();
- if (!$user_ids) {
- return [];
- }
- // Выставляем флаг сброса пароля админом
- foreach ($user_ids as $user_id) {
- $user = User::model()->findByPk($user_id);
- if ($user !== null) {
- $user->admin_change_password = true;
- $user->save(['admin_change_password']);
- }
- }
- // Удаляем данные о сроке действия паролей для этих пользователей
- $user_ids_string = implode(', ', $user_ids);
- $query = "DELETE FROM ".self::TABLE_NAME." WHERE user_id IN ({$user_ids_string})";
- \App::i()->getDbConnection()->query($query);
- return $user_ids;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement