Skip to content

Commit 76da03b

Browse files
committed
WIP; initial changes to create PR
1 parent 29b1384 commit 76da03b

File tree

3 files changed

+98
-65
lines changed

3 files changed

+98
-65
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
Package installation:
2+
13
.. code-block:: sh
24
3-
# package installation
4-
$ zammad run rails c
5+
zammad run rails c
6+
7+
Source installation:
8+
9+
.. code-block::
510
6-
# source installation
7-
$ rails c
11+
rails c

admin/console.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ a shell (e.g. for automation).
3737

3838
.. code-block:: sh
3939
40-
$ docker compose run --rm zammad-railsserver bundle exec rails r '{COMMAND}'
40+
docker compose run --rm zammad-railsserver bundle exec rails r '{COMMAND}'
4141
4242
.. tab:: Package Installation
4343

4444
.. code-block:: sh
4545
46-
$ zammad run rails r '{COMMAND}'
46+
zammad run rails r '{COMMAND}'
4747
4848
.. tab:: Source/Development Installation
4949

5050
.. code-block:: sh
5151
52-
$ rails r '{COMMAND}'
52+
rails r '{COMMAND}'
5353
5454
.. _rails_shell:
5555

@@ -65,7 +65,7 @@ It allows you to run several commands inside it.
6565

6666
.. code-block:: sh
6767
68-
$ docker compose run --rm zammad-railsserver bundle exec rails c
68+
docker compose run --rm zammad-railsserver bundle exec rails c
6969
7070
.. tip:: If you use Portainer to manage your Docker containers,
7171
you can even use a
@@ -75,13 +75,13 @@ It allows you to run several commands inside it.
7575

7676
.. code-block:: sh
7777
78-
$ $ zammad run rails c
78+
zammad run rails c
7979
8080
.. tab:: Source/Development Installation
8181

8282
.. code-block:: sh
8383
84-
$ rails c
84+
rails c
8585
8686
.. hint:: **Starting Rails Console in Safe Mode**
8787

@@ -98,7 +98,7 @@ It allows you to run several commands inside it.
9898

9999
.. code-tab:: console Package Installation
100100

101-
$ ZAMMAD_SAFE_MODE=1 zammad run rails c
101+
ZAMMAD_SAFE_MODE=1 zammad run rails c
102102
Zammad is running in safe mode. Any third-party services like Redis are ignored.
103103

104104
There was an error trying to connect to Redis via redis://localhost:6379.
@@ -109,7 +109,7 @@ It allows you to run several commands inside it.
109109

110110
.. code-tab:: console Source Installation
111111

112-
$ ZAMMAD_SAFE_MODE=1 rails c
112+
ZAMMAD_SAFE_MODE=1 rails c
113113
Zammad is running in safe mode. Any third-party services like Redis are ignored.
114114

115115
There was an error trying to connect to Redis via redis://localhost:6379.

admin/console/dangerzone-for-experts.rst

Lines changed: 82 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,41 @@ Deleting Records
1212
Removing Tickets (And Their Articles)
1313
-------------------------------------
1414

15+
Delete a ticket (specified by database ID):
16+
1517
.. code-block:: ruby
1618
17-
# Delete a ticket (specified by database ID)
18-
>> Ticket.find(4).destroy
19+
Ticket.find(4).destroy
1920
20-
# Delete all tickets
21-
>> Ticket.destroy_all
21+
Delete all tickets:
2222

23-
# Keep some tickets (specified by database ID); delete the rest
24-
>> tickets_to_keep = [1, 2, 3]
25-
>> Ticket.where.not(id: tickets_to_keep).destroy_all
23+
.. code-block:: ruby
2624
27-
Removing Users
28-
--------------
25+
Ticket.destroy_all
2926
30-
.. warning::
27+
Keep some tickets (specified by database ID); delete the rest:
28+
29+
.. code-block:: ruby
30+
31+
tickets_to_keep = [1, 2, 3]
32+
33+
.. code-block:: ruby
3134
32-
Customers **may not** be deleted while they have tickets remaining in the
33-
system.
35+
Ticket.where.not(id: tickets_to_keep).destroy_all
3436
35-
As such, the examples below will delete not only the specified customers,
36-
but **all tickets associated with them**, as well. Below commands remove
37-
upon executing without any further warnings.
37+
Removing Users
38+
--------------
3839

3940
.. hint::
4041

41-
If you're not sure what to do and need to learn more about what Zammad does
42-
upon removing users, please consider using Zammad's UI options in stead.
42+
Console based deletion is not recommended. Instead, use Zammad's
43+
:admin-docs:`data privacy </system/data-privacy.html>` feature.
4344

44-
Our documentation for the :admin-docs:`data privacy </system/data-privacy.html>`
45-
function will help you a lot!
45+
.. warning::
46+
47+
Customers **can't be** deleted while they have tickets remaining in the
48+
system. Because of that, the examples below delete **all tickets associated
49+
with them**, as well. The commands don't require a confirmation, be careful.
4650

4751
Removing users is possible in 2 ways: A single user and in bulk.
4852

@@ -52,71 +56,87 @@ Removing users is possible in 2 ways: A single user and in bulk.
5256

5357
.. code-block:: ruby
5458
55-
>> User.find_by(email: '<email address>').destroy
59+
User.find_by(email: '<email address>').destroy
5660
5761
.. tab:: Remove several users
5862

5963
.. code-block:: ruby
6064
61-
>> User.where(
62-
email: ['<email address 1>', '<email address 2>']
63-
).destroy_all
65+
User.where(
66+
email: ['<email address 1>', '<email address 2>']
67+
).destroy_all
6468
6569
Removing Organizations
6670
----------------------
6771

6872
.. note:: Removing an organization does **not** delete associated customers.
6973

7074
Step 1: Select organizations
75+
By "active" status:
76+
7177
.. code-block:: ruby
7278
73-
# by "active" status
74-
>> organizations = Organization.where(active: false)
79+
organizations = Organization.where(active: false)
80+
81+
By name:
82+
83+
.. code-block:: ruby
84+
85+
organizations = Organization.where(name: 'Acme')
86+
87+
By partial match on notes content:
7588

76-
# by name
77-
>> organizations = Organization.where(name: 'Acme')
89+
.. code-block:: ruby
7890
79-
# by partial match on notes
80-
>> organizations = Organization.where('note LIKE ?', '%foo%')
91+
organizations = Organization.where('note LIKE ?', '%foo%')
8192
8293
Step 2: Preview affected organizations
8394
.. code-block:: ruby
8495
85-
>> puts organizations.map { |org| "ORGANIZATION #{org.name}" }.join("\n")
96+
puts organizations.map { |org| "ORGANIZATION #{org.name}" }.join("\n")
8697
8798
Step 3: Proceed with deletion
8899
.. code-block:: ruby
89100
90-
>> organizations.each do |org|
91-
puts %{Preparing deletion of organization "#{org.name}"...}
101+
organizations.each do |org|
102+
puts %{Preparing deletion of organization "#{org.name}"...}
92103
93-
org.members.each do |member|
94-
puts " Removing #{member.fullname} from organization..."
95-
member.update!(organization_id: nil)
96-
end
104+
org.members.each do |member|
105+
puts " Removing #{member.fullname} from organization..."
106+
member.update!(organization_id: nil)
107+
end
97108
98-
puts " Deleting #{org.name}..."
99-
org.destroy
100-
end
109+
puts " Deleting #{org.name}..."
110+
org.destroy
111+
end
101112
102113
Removing System Records
103114
-----------------------
104115

116+
Remove all online notifications:
117+
118+
.. code-block:: ruby
119+
120+
OnlineNotification.destroy_all
121+
122+
Remove all entries from the Activity Stream (dashboard):
123+
124+
.. code-block:: ruby
125+
126+
ActivityStream.destroy_all
127+
128+
Remove entries for all recently viewed objects (tickets, users, organizations):
129+
105130
.. code-block:: ruby
106131
107-
# Remove all online notifications
108-
>> OnlineNotification.destroy_all
132+
RecentView.destroy_all
109133
110-
# Remove all entries from the Activity Stream (dashboard)
111-
>> ActivityStream.destroy_all
134+
Remove all history information from tickets, users and organizations
135+
(dangerous!):
112136

113-
# Remove entries for all recently viewed objects
114-
# (tickets, users, organizations)
115-
>> RecentView.destroy_all
137+
.. code-block:: ruby
116138
117-
# Remove all history information from tickets, users and organizations
118-
# (dangerous!)
119-
>> History.destroy_all
139+
History.destroy_all
120140
121141
.. _dangerzone_reset_zammad:
122142

@@ -133,7 +153,16 @@ Reset Zammad Installation
133153

134154
.. code-block:: sh
135155
136-
$ rake db:drop
137-
$ rake db:create
138-
$ rake db:migrate
139-
$ rake db:seed
156+
rake db:drop
157+
158+
.. code-block:: sh
159+
160+
rake db:create
161+
162+
.. code-block:: sh
163+
164+
rake db:migrate
165+
166+
.. code-block:: sh
167+
168+
rake db:seed

0 commit comments

Comments
 (0)