[CQ5] - Publisher enviornment is having stale/old content | Community
Skip to main content
Level 2
April 2, 2021
Solved

[CQ5] - Publisher enviornment is having stale/old content

  • April 2, 2021
  • 1 reply
  • 1695 views

Due to some reason , we need to bring our few publisher down. Now when i am trying to bring those back it is having old data or stale data which was published before we brought them down.

 

Can you please help me, how we can have the latest data on the publisher server.

 

Also, how i can setup parallel author instance and move content from one server to other.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by bilal_ahmad

Hey @niks1 you need to republish that content(if you know the pages/paths/assets) again.

 

If you don't know the exact path(s) then you may need to run query to figure out the content (cq:Page/dam:Asset etc) which got added/modified and ten create a package using the same script(from groovyscript) and then getting it installed on publish server. I have not mentioned replicating those pages through programmatically replicating them because if the number of paths are way too many then it might slow down your instance(too many in replication queue), so I'd recommend creating a package and installing it on publish.

 

One drawback would be - that you'd end up losing the version in package creation.

 

Thanks,

Bilal.

1 reply

bilal_ahmad
bilal_ahmadAccepted solution
Level 5
April 2, 2021

Hey @niks1 you need to republish that content(if you know the pages/paths/assets) again.

 

If you don't know the exact path(s) then you may need to run query to figure out the content (cq:Page/dam:Asset etc) which got added/modified and ten create a package using the same script(from groovyscript) and then getting it installed on publish server. I have not mentioned replicating those pages through programmatically replicating them because if the number of paths are way too many then it might slow down your instance(too many in replication queue), so I'd recommend creating a package and installing it on publish.

 

One drawback would be - that you'd end up losing the version in package creation.

 

Thanks,

Bilal.

bilal_ahmad
Level 5
April 4, 2021

hey @niks1 CQ5 and AEM are the same things. Just that before Adobe procured Communique back in 2010, it was knows as CQ5, post procurement it was called Adobe Experience Manager.
Also, the content should/must get replicated to your publishers. Please take a look at your replication agent(s) if they are working fine(you can hit 'test' and it'd let you know).

I'm sharing a sample script with you, you should modify it based on your requirements and then package creation through the script will be super easy.

Please install Groovy Console  in your instance and then run(customize first!) this script:

 

 

import javax.jcr.query.Query; import javax.jcr.query.QueryManager; import javax.jcr.query.QueryResult; import org.apache.jackrabbit.vault.packaging.JcrPackage; import org.apache.jackrabbit.vault.packaging.PackagingService; import org.apache.jackrabbit.vault.packaging.JcrPackageManager; import org.apache.jackrabbit.vault.packaging.JcrPackageDefinition; import org.apache.jackrabbit.vault.fs.api.PathFilterSet; import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter; PACKAGE_GROUP_NAME="Test-Package-Group"; PACKAGE_NAME="Test-Package-Name" checkIfPackageExists() def checkIfPackageExists(){ if(getNode("/etc/packages").hasNode(PACKAGE_GROUP_NAME)){ getNode("/etc/packages/"+PACKAGE_GROUP_NAME).remove(); save(); } doQuery(); } def doQuery(){ String sqlStatement = 'SELECT * FROM [dam:Asset] AS asset WHERE ISDESCENDANTNODE ([/content/dam/myProject]) AND (asset.[jcr:created] >= CAST("2020-10-29T00:00:00.000+05:30" AS DATE) OR asset.[jcr:lastModified] >= CAST("2020-10-29T00:00:00.000+05:30" AS DATE)) ORDER BY asset.[jcr:created] DESC'; QueryManager queryManager = session.getWorkspace().getQueryManager(); Query query = queryManager.createQuery(sqlStatement, "JCR-SQL2"); QueryResult result = query.execute(); nodeIter = result.getNodes(); DefaultWorkspaceFilter filters = new DefaultWorkspaceFilter(); int counter; while(nodeIter.hasNext()){ filters.add(new PathFilterSet(nodeIter.nextNode().getPath())); counter++; } println "Number of nodes added in filter path(s): "+counter; createPackage(filters); } def createPackage(DefaultWorkspaceFilter filters){ JcrPackageManager packMgr = PackagingService.getPackageManager(session); JcrPackage pack = packMgr.create(PACKAGE_GROUP_NAME,PACKAGE_NAME,null); JcrPackageDefinition jcrPackageDefinition = pack.getDefinition(); jcrPackageDefinition.setFilter(filters, true); jcrPackageDefinition.set("acHandling","acHandling",false); packMgr.assemble(pack, null); println "Package created successful"; }

 

 


Thanks,

Bilal.