Skip to content

Commit

Permalink
XWIKI-22182: Page history is missing after a page containing attachme…
Browse files Browse the repository at this point in the history
…nts is moved

Revert "XWIKI-9046: Renaming a document holding a lot of revisions can lead to an OutOfMemory exception (#2926)"

This reverts commit 8e509b7.

The solution provided in this commit wasn't taking into account usecases
when the doc wasn't saved in DB yet, e.g. like in case of renaming. Also
the solution is not good since we actually never set the archive in doc
in case of criteria not all inclusive, and if it had worked it would
have been a problem since we'd have kept only latest revision and lost
the remaining of the history when saving docs. All in all we need
another solution.

(cherry picked from commit 03d3ebe)
  • Loading branch information
surli committed May 24, 2024
1 parent 5347a6f commit 0444f89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.xpn.xwiki.XWiki;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.criteria.impl.RangeFactory;
import com.xpn.xwiki.criteria.impl.RevisionCriteria;
import com.xpn.xwiki.criteria.impl.RevisionCriteriaFactory;
import com.xpn.xwiki.doc.XWikiAttachment;
Expand Down Expand Up @@ -289,11 +288,7 @@ public void updateXWikiDocArchive(XWikiDocument doc, boolean bTransaction, XWiki
XWikiContext context = getExecutionXContext(inputxcontext, true);

try {
RevisionCriteria criteria = new RevisionCriteria();
criteria.setIncludeMinorVersions(true);
criteria.setRange(RangeFactory.getLAST());

XWikiDocumentArchive archiveDoc = getXWikiDocumentArchive(doc, criteria, context);
XWikiDocumentArchive archiveDoc = getXWikiDocumentArchive(doc, context);
UserReferenceSerializer<String> userReferenceSerializer = Utils.getComponent(
new DefaultParameterizedType(null, UserReferenceSerializer.class, String.class));
String author = userReferenceSerializer.serialize(doc.getAuthors().getOriginalMetadataAuthor());
Expand Down

This file was deleted.

0 comments on commit 0444f89

Please sign in to comment.