protected void testRevertPage(boolean hasExpandoValues) throws Exception {
    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    String originalContent = RandomTestUtil.randomString();

    WikiPage originalPage =
        WikiTestUtil.addPage(
            TestPropsValues.getUserId(),
            _node.getNodeId(),
            RandomTestUtil.randomString(),
            originalContent,
            true,
            serviceContext);

    if (hasExpandoValues) {
      addExpandoValueToPage(originalPage);
    }

    WikiPage updatedPage1 =
        WikiTestUtil.updatePage(
            originalPage,
            TestPropsValues.getUserId(),
            originalContent + "\nAdded second line.",
            serviceContext);

    Assert.assertNotEquals(originalContent, updatedPage1.getContent());

    WikiPage updatedPage2 =
        WikiTestUtil.updatePage(
            updatedPage1,
            TestPropsValues.getUserId(),
            updatedPage1.getContent() + "\nAdded third line.",
            serviceContext);

    Assert.assertNotEquals(originalContent, updatedPage2.getContent());

    WikiPage revertedPage =
        WikiPageLocalServiceUtil.revertPage(
            TestPropsValues.getUserId(),
            _node.getNodeId(),
            updatedPage2.getTitle(),
            originalPage.getVersion(),
            serviceContext);

    Assert.assertEquals(revertedPage.getContent(), originalContent);

    checkPopulatedServiceContext(serviceContext, revertedPage, hasExpandoValues);
  }
  public void markNotSpamWikiPages(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    checkWikiPagePermission(themeDisplay.getScopeGroupId());

    long[] wikiPageIds = ParamUtil.getLongValues(actionRequest, "notSpamWikiPageIds");

    List<String> wikiPageLinks = new ArrayList<String>();

    for (long wikiPageId : wikiPageIds) {
      WikiPage wikiPage = WikiPageLocalServiceUtil.getPageByPageId(wikiPageId);

      WikiPage latestVersionWikiPage =
          AkismetUtil.getWikiPage(
              wikiPage.getNodeId(), wikiPage.getTitle(), wikiPage.getVersion(), false);

      String latestContent = null;

      if (latestVersionWikiPage != null) {
        latestContent = latestVersionWikiPage.getContent();
      }

      WikiPage previousVersionWikiPage =
          AkismetUtil.getWikiPage(
              wikiPage.getNodeId(), wikiPage.getTitle(), wikiPage.getVersion(), true);

      String previousContent = null;

      if (previousVersionWikiPage != null) {
        previousContent = previousVersionWikiPage.getContent();
      }

      // Selected version

      wikiPage.setStatus(WorkflowConstants.STATUS_APPROVED);
      wikiPage.setSummary(StringPool.BLANK);

      wikiPage = WikiPageLocalServiceUtil.updateWikiPage(wikiPage);

      // Latest version

      if ((latestContent != null)
          && ((previousContent == null) || latestContent.equals(previousContent))) {

        ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

        WikiPageLocalServiceUtil.revertPage(
            themeDisplay.getUserId(),
            wikiPage.getNodeId(),
            wikiPage.getTitle(),
            wikiPage.getVersion(),
            serviceContext);
      } else {
        StringBundler sb = new StringBundler(5);

        sb.append("<a href=\"");

        long plid = PortalUtil.getPlidFromPortletId(wikiPage.getGroupId(), PortletKeys.WIKI);

        LiferayPortletURL liferayPortletURL =
            PortletURLFactoryUtil.create(
                actionRequest, PortletKeys.WIKI, plid, PortletRequest.RENDER_PHASE);

        WikiNode wikiNode = wikiPage.getNode();

        liferayPortletURL.setParameter("struts_action", "/wiki/view");
        liferayPortletURL.setParameter("nodeName", wikiNode.getName());
        liferayPortletURL.setParameter("title", wikiPage.getTitle());
        liferayPortletURL.setParameter("version", String.valueOf(wikiPage.getVersion()));

        sb.append(liferayPortletURL.toString());
        sb.append("\" target=\"_blank\">");
        sb.append(HtmlUtil.escape(wikiPage.getTitle()));
        sb.append("</a>");

        wikiPageLinks.add(sb.toString());
      }

      // Akismet

      if (AkismetUtil.isWikiEnabled(wikiPage.getCompanyId())) {
        AkismetUtil.submitHam(wikiPage);
      }
    }

    if (!wikiPageLinks.isEmpty()) {
      SessionMessages.add(actionRequest, "requestProcessed");

      SessionMessages.add(
          actionRequest,
          "anotherUserHasMadeChangesToThesePages",
          StringUtil.merge(wikiPageLinks, "<br />"));

      super.sendRedirect(actionRequest, actionResponse);
    }
  }