Skip to content

Commit 6f88db9

Browse files
adriendupuisdabrt
andauthored
Taxonomy subtree deletion and clean-up (#2271)
* taxonomy.md: About delete_subtree_size_limit * taxonomy.md: About ibexa:taxonomy:remove-orphaned-content * update_from_4.2.md: ibexa:taxonomy:remove-orphaned-content * update_from_4.4.md: ibexa:taxonomy:remove-orphaned --------- Co-authored-by: Tomasz Dąbrowski <[email protected]>
1 parent 4ef98f2 commit 6f88db9

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

docs/content_management/taxonomy/taxonomy.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To use this new taxonomy, add an `ibexa_taxonomy_entry_assignement` Field to a C
5757

5858
### Hide Content tab
5959

60-
The **Content** tab in taxonomy objects, for example, tags and categories, lists all Content assigned to the current taxonomy.
60+
The **Content** tab in taxonomy objects, for example, tags and categories, lists all Content assigned to the current taxonomy.
6161
You can hide the **Content** tab in the **Categories** view.
6262

6363
In configuration add `assigned_content_tab` with the flag `false` (for other taxonomies this flag is by default set to `true`):
@@ -68,3 +68,36 @@ In configuration add `assigned_content_tab` with the flag `false` (for other tax
6868
```
6969

7070
For more information about available functionalities of tags, see [User Documentation]([[= user_doc =]]/taxonomy).
71+
72+
## Hide delete button on large subtree
73+
74+
The **Delete** button can be hidden when a taxonomy entry has many children.
75+
By default, the button is hidden when there are 100 children or more.
76+
77+
The `delete_subtree_size_limit` configuration is [SiteAccess-aware](siteaccess_aware_configuration.md), and can be set per SiteAccess, per SiteAccess group, or globally per default.
78+
For example:
79+
80+
```yaml
81+
ibexa:
82+
system:
83+
default: # or a SiteAccess, or a SiteAccess group
84+
taxonomy:
85+
admin_ui:
86+
delete_subtree_size_limit: 20
87+
```
88+
89+
## Remove orphaned Content items
90+
91+
In some rare case, especially in I[[= product_name =]] v4.2 and older, when deleting parent of huge subtrees, some Taxonomy entries are not properly deleted, leaving Content items that point to a non-existing parent.
92+
The command `ibexa:taxonomy:remove-orphaned-content` deletes those orphaned Content item.
93+
It works on a taxonomy passed as an argument, and has two options that act as a protective measure against deleting data by mistake:
94+
95+
- `--dry-run` to list deletable Content items, without performing the deletion.
96+
- `--force` to effectively delete the orphaned Content items.
97+
98+
The following example first lists the orphaned Content items for taxonomy `tags`, and then deletes them:
99+
100+
```bash
101+
php bin/console ibexa:taxonomy:remove-orphaned-content tags --dry-run
102+
php bin/console ibexa:taxonomy:remove-orphaned-content tags --force
103+
```

docs/update_and_migration/from_4.2/update_from_4.2.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ Apply the following database update scripts:
144144

145145
If you have no access to [[= product_name =]]'s `ibexa/installer` package, database upgrade is not necessary.
146146

147+
### Clean-up taxonomy database
148+
149+
Run the following command for each of your taxonomies to ensure that there are no [Content items orphaned during deletion of subtrees](taxonomy.md#remove-orphaned-content-items):
150+
151+
`php bin/console ibexa:taxonomy:remove-orphaned-content <taxonomy> --force`
152+
153+
For example:
154+
155+
```bash
156+
php bin/console ibexa:taxonomy:remove-orphaned-content tags --force
157+
php bin/console ibexa:taxonomy:remove-orphaned-content product_categories --force
158+
```
159+
147160
## Ensure password safety
148161

149162
Following [Security advisory: IBEXA-SA-2022-009](https://developers.ibexa.co/security-advisories/ibexa-sa-2022-009-critical-vulnerabilities-in-graphql-role-assignment-ct-editing-and-drafts-tooltips),

docs/update_and_migration/from_4.4/update_from_4.4.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ If you have no access to [[= product_name =]]'s `ibexa/installer` package, apply
158158
);
159159
```
160160

161+
### Clean-up taxonomy database
162+
163+
If you didn't run it already when [migrating from 4.2 to 4.3](update_from_4.2.md#clean-up-taxonomy-database), run the following command for each of your taxonomies to ensure that there are no [Content items orphaned during deletion of subtrees](taxonomy.md#remove-orphaned-content-items) inherited from the earlier version's database:
164+
165+
`php bin/console ibexa:taxonomy:remove-orphaned-content <taxonomy> --force`
166+
167+
For example:
168+
169+
```bash
170+
php bin/console ibexa:taxonomy:remove-orphaned-content tags --force
171+
php bin/console ibexa:taxonomy:remove-orphaned-content product_categories --force
172+
```
173+
161174
## Finish code update
162175

163176
Finish the code update by running:

0 commit comments

Comments
 (0)