Skip to content

Commit 778e351

Browse files
authored
Merge pull request #10226 from nextcloud/backport/10208/stable26
[stable26] Run occ commands in maintenance mode
2 parents ccb6422 + 54b2428 commit 778e351

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

admin_manual/configuration_server/occ_command.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ occ command Directory
1616
---------------------
1717

1818
* :ref:`http_user_label`
19+
* :ref:`run_commands_in_maintenance_mode`
1920
* :ref:`apps_commands_label`
2021
* :ref:`background_jobs_selector_label`
2122
* :ref:`config_commands_label`
@@ -186,6 +187,25 @@ you need to specify ``--program occ`` after the ``--generate-hook``.
186187
If you want the completion to apply automatically for all new shell sessions, add the command to your
187188
shell's profile (eg. ``~/.bash_profile`` or ``~/.zshrc``).
188189

190+
.. _run_commands_in_maintenance_mode:
191+
192+
Run commands in maintenance mode
193+
--------------------------------
194+
195+
In maintenance mode, no apps are loaded [1]_.
196+
197+
Commands provided by apps are not available.
198+
199+
The commands, available in maintenance mode, are integrated in Nextcloud server.
200+
A command may use events to communicate with other apps. An app can only react to an event when loaded.
201+
202+
Example: The command `user:delete` deletes a user account. UserDeletedEvent is emitted. Calendar app implements an event listener to delete user data [2]_. In maintenance mode, the Calendar app is not loaded, and hence the user data not deleted.
203+
204+
Consider running such commands with maintenance mode off.
205+
206+
.. [1] Exception: `The settings app is loaded <https://github.com/nextcloud/server/blob/75f17b60945e15effc3eea41393eef2b13937226/lib/base.php#L780>`_
207+
.. [2] `Calendar app event listener for UserDeletedEvent <https://github.com/nextcloud/calendar/blob/87e8586971a8676dc15a90f0cd969274678b7009/lib/Listener/UserDeletedListener.php>`_
208+
189209
.. _apps_commands_label:
190210

191211
Apps commands
@@ -606,10 +626,7 @@ user::
606626

607627
sudo -u www-data php occ encryption:decrypt freda
608628

609-
Users must have enabled recovery keys on their Personal pages. You must first
610-
put your Nextcloud server into :ref:`maintenance
611-
mode <maintenance_commands_label>` to prevent any user activity until
612-
decryption is completed.
629+
Users must have enabled recovery keys on their Personal pages.
613630

614631
Note that if you do not have master key/recovery key enabled, you can ONLY
615632
decrypt files per user, one user at a time and NOT when in maintenance mode.
@@ -1151,6 +1168,7 @@ This example restores the deleted files of users molly and freda::
11511168

11521169
User commands
11531170
-------------
1171+
.. note:: Read :ref:`run_commands_in_maintenance_mode` if you intend to use a user command in maintenance mode.
11541172

11551173
The ``user`` commands create and remove users, reset passwords, display a simple
11561174
report showing how many users you have, and when a user was last logged in::
@@ -1281,6 +1299,8 @@ authentication servers such as LDAP::
12811299
Group commands
12821300
--------------
12831301

1302+
.. note:: Read :ref:`run_commands_in_maintenance_mode` if you intend to use a group command in maintenance mode.
1303+
12841304
The ``group`` commands create and remove groups, add and remove users in
12851305
groups, display a list of all users in a group::
12861306

0 commit comments

Comments
 (0)