Index: src/main/java/com/xpn/xwiki/XWiki.java =================================================================== --- src/main/java/com/xpn/xwiki/XWiki.java (revision 27386) +++ src/main/java/com/xpn/xwiki/XWiki.java (working copy) @@ -4571,15 +4571,18 @@ { String db = context.getDatabase(); int nb = 0; - String sql = ""; + // Workaround for XWIKI-3915: Do not use XWikiStoreInterface#searchDocumentNames since currently it has the + // side effect of hidding hidden documents and no other workaround exists than directly using + // XWikiStoreInterface#search directly + String sql = "select doc.fullName from XWikiDocument as doc"; if (web != null) { - sql = "where doc.space = '" + Utils.SQLFilter(web) + "'"; + sql += " where doc.space = '" + Utils.SQLFilter(web) + "'"; } if (clean) { try { context.setDatabase(targetWiki); - List list = getStore().searchDocumentsNames(sql, context); + List list = getStore().search(sql, 0, 0, context); if (LOG.isInfoEnabled()) { LOG.info("Deleting " + list.size() + " documents from wiki " + targetWiki); } @@ -4595,7 +4598,7 @@ try { context.setDatabase(sourceWiki); - List list = getStore().searchDocumentsNames(sql, context); + List list = getStore().search(sql, 0, 0, context); if (LOG.isInfoEnabled()) { LOG.info("Copying " + list.size() + " documents from wiki " + sourceWiki + " to wiki " + targetWiki); }