-
Notifications
You must be signed in to change notification settings - Fork 479
Open
Description
Description
Implement a runonce startup task that ensures the Angular Tags portlet (id tags, route /tags) is present in the admin menu and the legacy Tags portlet (tags-legacy) is removed from all layouts. This was previously implemented in Task260211AddTagsNewPortletToMenu and removed from the current PR so it can be delivered in a separate PR.
The task should:
- Run when: Any layout still has
tags-legacy, or no layout hastags, or any layout has the old idtags-new. - On run:
- Migrate layout entries from portlet id
tags-newtotags(portlet was renamed). - Remove
tags-legacyfrom all layouts (so it does not appear in the sidebar). - If
tagsis still not in any layout after migration, add it to the "Content Types" layout (or fallback to a layout that containedtags-legacy). - Clear layout cache (
CacheLocator.getLayoutCache().clearCache()).
- Migrate layout entries from portlet id
Acceptance Criteria
- New runonce task class in
dotCMS/src/main/java/com/dotmarketing/startup/runonce/(e.g.Task260211AddTagsNewPortletToMenuor follow current naming). -
forceRun()returns true when: legacy portlet is in any layout, or Angular tags portlet is in zero layouts, ortags-newis in any layout. -
executeUpgrade()migratestags-new→tags, removestags-legacyfrom all layouts, addstagsto Content Types (or fallback) if missing, then clears layout cache. - Uses
PortletID.TAGSandPortletID.TAGS_LEGACYfromcom.dotmarketing.util.PortletID. - Exception handling: in
forceRun(), catchException(notDotDataException) becauseDotConnect.getInt()throwsDotRuntimeExceptionviagetResult(). - Logging via
Logger; noSystem.out. Follow patterns from existing runonce tasks in the same package.
Priority
Medium
Additional Context
- Reference implementation: Same package contains
Task260206AddUsagePortletToMenu.java, which adds the Usage portlet to the menu with similar logic (get layout, insert intocms_layouts_portlets, clear cache). Use it as a pattern; note that task usesgetInt("count")inforceRun()and therefore should catchException(see compilation fix that was applied before removal). - Tables:
cms_layout,cms_layouts_portlets. Columns used:layout_id,portlet_id,portlet_order,id(UUID for new rows). - Layout lookup: Prefer layout with
LOWER(layout_name) = 'content types'; fallback: any layout that hastags-legacy(use itslayout_id). - Insert:
INSERT INTO cms_layouts_portlets(id, layout_id, portlet_id, portlet_order) VALUES (?, ?, ?, ?)withUUIDUtil.uuid()for id andmax(portlet_order)+1for the chosen layout. - This work was split out from the PR that adds the Tags Angular portlet to the menu (issue-32937) so the startup task can be reviewed and merged in a dedicated PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
New