浏览代码

Do not create a new version if previousNode has the same mtime

Signed-off-by: Louis Chemineau <louis@chmn.me>
Louis Chemineau 1 年之前
父节点
当前提交
7fec07196d
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      apps/files_versions/lib/Listener/FileEventsListener.php

+ 2 - 2
apps/files_versions/lib/Listener/FileEventsListener.php

@@ -232,8 +232,8 @@ class FileEventsListener implements IEventListener {
 		}
 
 		if (
-			($writeHookInfo['versionCreated'] && $node->getMTime() !== $writeHookInfo['previousNode']->getMTime()) ||
-			$writeHookInfo['previousNode']->getSize() === 0
+			($writeHookInfo['versionCreated'] || $writeHookInfo['previousNode']->getSize() === 0) &&
+			$node->getMTime() !== $writeHookInfo['previousNode']->getMTime()
 		) {
 			// If a new version was created, insert a version in the DB for the current content.
 			// Unless both versions have the same mtime.