A new version file is created for each slight modifications

Issue

  • Is it possible to change the attribute of a file version without creating a new one?

Environment

  • Liferay DXP 7.0

Resolution

  • Document and Media Portlet is designed to create a new file version whenever a file attribute changes. 
  • Concerns with this design have been already raised, and some changes have been made in later Liferay DXP versions.
  • Administrators now have the opportunity to select the maximum number of versions to keep per file in Documents and Media, due to this new feature included in Liferay DXP 7.2. This indicates that the older versions will be removed if a new version is created. This can be set to 1 to keep only one (and the most latest) version of a file, with any alteration overwriting the file, even if only the metadata (such as the name or description) has changed.
  • Although the new configuration option introduced in Liferay DXP 7.2 still replaces the file even if only the metadata has been changed, this is how it has been designed.

Additional Information

  • Workaround for DXP Liferay 7.0: the DLFileEntryLocalServiceImpl class could be used as a starting point. A customized solution might check if the file has been changed during the update and only call the copyfileversion method if there is a difference.
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助