cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot disable global versioning

almoehi
Champ on-the-rise
Champ on-the-rise

Hi,

in my Alfresco (5.2.0, re21f2be5-b22) I'd like to disable versioning globally, only enabling it on demand. However, the documented way of putting "version.store.enableAutoVersioning=false" into alfresco-global.properties seems not to work. New files still get the cm:versioning aspect and store a history. Furthermore, if I remove the aspect manually from a file, I'm still able to upload new versions. Could this be a bug? Has anyone else observed such behaviour?

Thanks in advance,

Alex

5 REPLIES 5

ashwin_mor
Champ in-the-making
Champ in-the-making

Hi Alex,

I believe this behavior is from Share UI. If you try the same via API it will not enable versioning.

By default when you upload any content via share, it enables versioning. To disable, you will need to modify upload.post.js

Hello ashwin.mor,

thank you for your reply.
That would be quite inconsistent behaviour of Share.

I'm not sure if the API honors the setting. I tried uploading files from ezuno client, which is a desktop application that uses the API. It enabled versioning, too. However, I'm not sure if this is a "feature" of the app itself.

I also tested creating a file via webdav, which indeed did not add the versioning aspect.

I found a workaround without modifying .js files, using content rules and an additional custom aspect ("manuallyVersioned"). The rules are defined in some top folder and remove the "versionable" aspect from any content (on creation and update) if it doesn't have this custom aspect. Then I can allow versioning selectively for folders and files by adding both the "versionable" and the "manuallyVersioned" aspect.

Alex

cesarista
World-Class Innovator
World-Class Innovator

Hi:

I can confirm that "Upload new version" action in Share works as mentioned / expected (adding the versioning aspect ) and also that webdav does not add the versioning aspect. The API may add the versioning aspect or not... as commented in ezuno client.

Regards.

--C.

Hi ashwin_mor,
What changes need to be made to the upload.post.js file?
I saw that it is on /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.g.jar
In which folder structure?
Thanks a lot.
José Roberto.

abhinavmishra14
World-Class Innovator
World-Class Innovator

@jbrasil wrote:

Hi ashwin_mor,
What changes need to be made to the upload.post.js file?
I saw that it is on /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.g.jar
In which folder structure?
Thanks a lot.
José Roberto.


I think it is the same question here, i replied on this thread: https://hub.alfresco.com/t5/alfresco-content-services-forum/disabling-auto-versioning-in-alfresco-li...

To version on demand after disabling the versioning via alfresco-global.properties, you should better make use of behaviors. Don't change anything in upload.post.js file. With behaviors you would get more control over the nodes and their types and you can choose to version a specific type of node too. 

https://docs.alfresco.com/6.1/references/dev-extension-points-behaviors.html

https://dev.alfresco.com/resource/docs/java/org/alfresco/repo/node/NodeServicePolicies.OnCreateNodeP...

Create a behavior onCreateNode event and bind the behavior to a content type and then set the properties using node service on the creating node like:

private void setVersionPropertiesOnDemand(NodeRef nodeRef) {
	if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) {
		Map<QName,Serializable> props = nodeService.getProperties(nodeRef);
		props.put(ContentModel.PROP_AUTO_VERSION, true);
		props.put(ContentModel.PROP_AUTO_VERSION_PROPS, true);
		nodeService.addProperties(nodeRef, props);
	} else {
		Map<QName,Serializable> versionProps = new ConcurrentHashMap<QName, Serializable>();
		versionProps.put(ContentModel.PROP_AUTO_VERSION, true);
		versionProps.put(ContentModel.PROP_AUTO_VERSION_PROPS, true);
		nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, versionProps);
	}
}
~Abhinav
(ACSCE, AWS SAA, Azure Admin)