Disabling auto-versioning in Alfresco Linux

cancel
Showing results for 
Search instead for 
Did you mean: 
jbrasil
Active Member II

Disabling auto-versioning in Alfresco Linux

Hi all,
I am not able to disable auto versioning in Alfresco Linux.
Tested in version 5.2 and 6.1
See parameters in global properties

#Disable file versioning
cm: autoVersion = false
cm: initialVersion = false

version.store.initialVersion = false
version.store.enableAutoVersioning = false
version.store.enableAutoVersionOnUpdateProps = false

What is wrong?
Thanks a lot
José Robertohistorico-versoes-Alfresco.PNG

6 Replies
cristinamr
Advanced

Re: Disabling auto-versioning in Alfresco Linux

Hi,

I think your problem is described here: https://hub.alfresco.com/t5/alfresco-content-services-forum/cannot-disable-global-versioning/td-p/35...

In short: you may need to modify upload.post.js 

Cheers!

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc
jbrasil
Active Member II

Re: Disabling auto-versioning in Alfresco Linux

Hi cristinamr,
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?
In the post he quoted, he doesn't say what the changes are.
Can you tell me?
With best regards,
José Roberto.

sufo
Established Member II

Re: Disabling auto-versioning in Alfresco Linux

You could try it with rules maybe. Try to set it on whole Document Library for the Site you want to disable versioning in it.

image.png

image.png

Didn't have time to test it more (only uploaded new version of one document and version is still 1.0), so don't know if it will work in all cases.

jbrasil
Active Member II

Re: Disabling auto-versioning in Alfresco Linux

Hi sufo,
The rule did not work with OCR.
The following error message occurs:


00280001 Failed to execute script 'classpath *: alfresco / site-webscripts / org / alfresco / components / documentlibrary / data / surf-doclist.get.js': 00280000

Thanks.

sufo
Established Member II

Re: Disabling auto-versioning in Alfresco Linux

I don't know what OCR you are using. If it acts on events (like node creation and update) and is synchronous, then it can cause some trouble as this rule is also synchronous and runs in transaction. Do you see any details in the repository log (alfresco.log) about the error?

abhinavmishra14
Moderator
Moderator

Re: Disabling auto-versioning in Alfresco Linux


@jbrasil wrote:

Hi all,
I am not able to disable auto versioning in Alfresco Linux.
Tested in version 5.2 and 6.1
See parameters in global properties

#Disable file versioning
cm: autoVersion = false
cm: initialVersion = false

version.store.initialVersion = false
version.store.enableAutoVersioning = false
version.store.enableAutoVersionOnUpdateProps = false

What is wrong?
Thanks a lot
José Robertohistorico-versoes-Alfresco.PNG


When you update these properties, it doesn't affect existing nodes. It will affect only newly created nodes. Auto version will continue to happen on existing nodes as those nodes would have below given props set:

This is the default configuration at repo level:

version.store.initialVersion=true
version.store.enableAutoVersioning=true
version.store.enableAutoVersionOnUpdateProps=false

You would need to cleanup the old existing objects by running a script/webscript to set the values to false in order to make them follow the versioning disablement. I don't think there is any change needed in upload functionality If i understood the query properly. 

Have a look at these posts:

https://hub.alfresco.com/t5/alfresco-content-services-forum/version-history-does-not-include-propert...

If you want to version nodes on demand as the nodes are created into repo, 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_INITIAL_VERSION, true); 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_INITIAL_VERSION, true); 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-C02, GAIQ)