add inbound language test
[akkoma] / lib / pleroma / maintenance.ex
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
5 defmodule Pleroma.Maintenance do
6 alias Pleroma.Repo
7 require Logger
8
9 def vacuum(args) do
10 case args do
11 "analyze" ->
12 Logger.info("Running VACUUM ANALYZE.")
13
14 Repo.query!(
15 "vacuum analyze;",
16 [],
17 timeout: :infinity
18 )
19
20 "full" ->
21 Logger.info("Running VACUUM FULL.")
22
23 Logger.warn(
24 "Re-packing your entire database may take a while and will consume extra disk space during the process."
25 )
26
27 Repo.query!(
28 "vacuum full;",
29 [],
30 timeout: :infinity
31 )
32
33 _ ->
34 Logger.error("Error: invalid vacuum argument.")
35 end
36 end
37 end