Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
584B

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Mix.Tasks.Pleroma.CountStatuses do
  5. @shortdoc "Re-counts statuses for all users"
  6. use Mix.Task
  7. alias Pleroma.User
  8. import Ecto.Query
  9. def run([]) do
  10. Mix.Pleroma.start_pleroma()
  11. stream =
  12. User
  13. |> where(local: true)
  14. |> Pleroma.Repo.stream()
  15. Pleroma.Repo.transaction(fn ->
  16. Enum.each(stream, &User.update_note_count/1)
  17. end)
  18. Mix.Pleroma.shell_info("Done")
  19. end
  20. end