nextcloud / nextcloud/mail

Include occ command for removing orphaned accounts as a maintenance task

Open
#4,091 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Feature Request

Due to issues with the user account removal in older mail versions, orphaned accounts could be left over in the oc_mail_accounts table (probably #3135), resulting in "invisible Ghost accounts" in the mail app itself (they were not there, but the app expected multple inboxes) and errors displaying mails in the widget (see #3819).

I think, a feature allowing for a controlled/guided removal of these accounts would benefit self-made admins such as myself who are not too comfortable writing "DELETE FROM oc_mail_accounts WHERE ..." statements in SQL.

Summary

Since this is would not be a feature for regular use, I think it would best be kept as part of the "occ" maintenance tool.

As the admin of a nextcloud instance, I'd like to be able to log into the shell of my nextcloud and issue a command like "php occ mail:list-orphaned-accounts" after which the orphaned accounts are identified and listed with id, userid, server, ... , followed by "php occ mail:delete-orphaned-account 1" after which the account with the corresponding id is deleted.

... probably, in the background, there would have to be something like "DELETE FROM oc_mail_accounts WHERE id=1" but the user/admin would not have to know about SQL and the 'magic' would be the identification of the orphaned accounts. (In my case, I could only go via error messages - there's probably a smarter way to do that.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the occ maintenance-command entry points and reviewing the oc_mail_accounts table and the related account relationships. Define how orphaned accounts are identified before implementing guided listing and deletion commands. Done means admins can safely list orphaned accounts with identifying details and delete a selected account without writing SQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sql
Domain
cli, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.