code: protected CmsResourceState fixMovedResource(
          CmsDbContext dbc,
          CmsProject onlineProject,
          CmsResource offlineResource,
          CmsUUID publishHistoryId,
          int publishTag)
      throws CmsDataAccessException {
  
          CmsResource onlineResource;
          // check if the resource has been moved since last publishing
          try {
              onlineResource = m_driverManager.getVfsDriver(dbc).readResource(
                  dbc,
                  onlineProject.getUuid(),
                  offlineResource.getStructureId(),
                  true);
              if (onlineResource.getRootPath().equals(offlineResource.getRootPath())) {
                  // resource changed, not moved
                  return offlineResource.getState();
              }
          } catch (CmsVfsResourceNotFoundException e) {
              // ok, resource new, not moved
              return offlineResource.getState();
          }
  
          // move the online resource to the new position
          m_driverManager.getVfsDriver(dbc).moveResource(
              dbc,
              onlineProject.getUuid(),
              onlineResource,
              offlineResource.getRootPath());
  
          try {
              // write the resource to the publish history
              m_driverManager.getProjectDriver(dbc).writePublishHistory(
                  dbc,
                  publishHistoryId,
                  new CmsPublishedResource(onlineResource, publishTag, CmsPublishedResource.STATE_MOVED_SOURCE));
          } catch (CmsDataAccessException e) {
              if (LOG.isErrorEnabled()) {
                  LOG.error(
                      Messages.get().getBundle().key(
                          Messages.LOG_WRITING_PUBLISHING_HISTORY_1,
                          onlineResource.getRootPath()),
                      e);
              }
              throw e;
          }
          return offlineResource.getState().isDeleted()
          ? CmsResource.STATE_DELETED
          : CmsPublishedResource.STATE_MOVED_DESTINATION;
      }
docs: Checks if the given resource (by id) is available in the online project,
  if there exists a resource with a different path (a moved file), then the
  online entry is moved to the right (new) location before publishing.<p>
  
  @param dbc the db context
  @param onlineProject the online project
  @param offlineResource the offline resource to check
  @param publishHistoryId the publish history id
  @param publishTag the publish tag
  
  @return <code>true</code> if the resource has actually been moved
  
  @throws CmsDataAccessException if something goes wrong