docs: public void replaceElementsInPages(
          String elementPath,
          String targetElementPath,
          String project,
          String basePath,
          boolean ignoreSubSites) {
  
          try {
              CmsObject cms = OpenCms.initCmsObject(m_cms);
              cms.getRequestContext().setCurrentProject(cms.readProject(project));
              cms.getRequestContext().setSiteRoot("");
              CmsResource resource = cms.readResource(elementPath);
              CmsResource targetResource = cms.readResource(targetElementPath);
              CmsSearchReplaceSettings settings = new CmsSearchReplaceSettings();
              settings.setType(SearchType.resourcetype);
              settings.setSearchpattern(CmsSearchReplaceSettings.searchElementInPagePattern(resource));
              settings.setReplacepattern(CmsSearchReplaceSettings.replaceElementInPagePattern(targetResource));
              String siteRoot = OpenCms.getSiteManager().getSiteRoot(basePath);
              if (siteRoot != null) {
                  settings.setSiteRoot(siteRoot);
                  settings.setPaths(Collections.singletonList(basePath.substring(siteRoot.length())));
              } else {
                  settings.setSiteRoot("");
                  settings.setPaths(Collections.singletonList(basePath));
              }
  
              settings.setIgnoreSubSites(ignoreSubSites);
              settings.setProject(project);
              settings.setTypes(
                  CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME
                      + ","
                      + CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
  
              CmsSearchReplaceThread thread = new CmsSearchReplaceThread(
                  null,
                  cms,
                  settings,
                  new CmsShellLogReport(m_cms.getRequestContext().getLocale()));
              thread.run();
          } catch (CmsException e) {
              LOG.error("test", e);
          }
      }