Deleting and restoring documents – system description

Status-based deletion and restore, permanent deletion with share confirmation and storage clean-up, the permission keys and the scope gap.

A document can be deleted by status (status = 9, record and file stay) or permanently (record, placements, physical file and cache). Both refuse documents linked to an object.

Data model

Table names carry the installation's own prefix in the database.

TableRole
docstatus (1 = active, 9 = trash)
doc_linkblocking reference
doc_share_itemshare membership (confirmation, detaching)
doc_locationadditional placements

Process

  1. statusdelete: refuses a document linked to an object (error_referenced), otherwise status = 9.
  2. statusrestore: 9 → 1, only for users who see the trash (canSeeDeleted(document)).
  3. delete: refuses on object links; for a document in a share folder it first lists the folders and asks for confirmation (need_force), with force=1 it detaches; orphan share rows are cleaned silently.
  4. Then purgeStoredDoc(): Drive file (to the bin or permanently – removeFile), shortcuts of further placements, OneDrive or local file; placement rows, record and the whole cache (purgeDoc). A physical delete error does not stop the record deletion (logged).

Permissions

  • The interface shows one red bin (i-del) with the statusdelete right; users who also have delete get a separate "Delete permanently" item.
  • statusdelete: BASE; single and count-based bulk right; docIdInScope per document.
  • delete: not classified in the seeds.

Known limitations

Permanent deletion (delete()) does not check the content scope.

Related topics: trash storage permissions