diff options
author | lain <lain@soykaf.club> | 2019-10-10 12:38:51 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-10-10 12:38:51 +0000 |
commit | d7f9679ff2c9c4bd2b9967d7a32b5a4fe145305e (patch) | |
tree | f99394ee5d40b8c1bff6301acd683e13dc23edc8 /lib/mix/tasks | |
parent | 6c278cfe09fb9fd5220743d8f69c6e232623a09b (diff) | |
parent | 9fd5176c35d21846fb8368ea7bc0285f9cd74ad4 (diff) | |
download | pleroma-d7f9679ff2c9c4bd2b9967d7a32b5a4fe145305e.tar.gz |
Merge branch 'develop' into 'reactions'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r-- | lib/mix/tasks/pleroma/count_statuses.ex | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/count_statuses.ex b/lib/mix/tasks/pleroma/count_statuses.ex new file mode 100644 index 000000000..e1e8195dd --- /dev/null +++ b/lib/mix/tasks/pleroma/count_statuses.ex @@ -0,0 +1,22 @@ +defmodule Mix.Tasks.Pleroma.CountStatuses do + @shortdoc "Re-counts statuses for all users" + + use Mix.Task + alias Pleroma.User + import Ecto.Query + + def run([]) do + Mix.Pleroma.start_pleroma() + + stream = + User + |> where(local: true) + |> Pleroma.Repo.stream() + + Pleroma.Repo.transaction(fn -> + Enum.each(stream, &User.update_note_count/1) + end) + + Mix.Pleroma.shell_info("Done") + end +end |