Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a package that uninstalls old code in CQ5?

Tags:

aem

Has anybody been able to successfully use the Replace dependency filter in the CQ5 Package Manager to uninstall/delete old code? http://dev.day.com/docs/en/crx/current/how_to/package_manager.html

I've recently restructured my directories and I'm trying to find an easy way to uninstall the old branches.

In other words, I am currently working with:

/apps/myproject/old_directory

but want to transition to:

/apps/myproject/new_directory

Like I said, I tried setting the Replace Dependency Filter with the old package name. It appears to be working because it says "Replaces my_packages:oldPackage:1" which is a valid link. However, running the install does nothing to the pre-existing code base.

I realize that I can just uninstall the original package manually, but this will be added to the Package Share, so I'd like to ensure that any current users can just install the upgrade without worrying about unused code.

I'm currently using CQ 5.4

like image 532
lyma Avatar asked Mar 24 '23 17:03

lyma


1 Answers

To remove a content branch using a CQ5 package you need a package:

  • with a filter definition pointing at the content branch to be removed
  • without any content in that branch

In other words, you can create an empty package with filter definition pointing to areas you want removed. You can do that either on an empty instance, or by manually editing the filter.xml entry to something like:

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/apps/myproject/new_directory"/>
</workspaceFilter>

Installing such package wipes content under the specified path(s). This operation cannot be undone. This works consistently on all CQ5 versions.

like image 107
Jan Kuźniak Avatar answered May 06 '23 01:05

Jan Kuźniak