mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
04.03.2014 b4bfab886e5e0ad8073c164763520c8fd829b973
CR-3127 OPENDJ-1098 – Upgrading must disable old patches
4 files modified
56 ■■■■■ changed files
opendj3-server-dev/resource/upgrade 10 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/resource/upgrade.bat 16 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/messages/messages/tools.properties 2 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java 28 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/resource/upgrade
@@ -22,7 +22,7 @@
# CDDL HEADER END
#
#
#      Copyright 2013 ForgeRock AS
#      Copyright 2013-2014 ForgeRock AS
# This script may be used to perform a backup of a Directory Server backend.
@@ -32,5 +32,13 @@
SCRIPT_NAME="upgrade"
export SCRIPT_NAME
DIR_CLASSES="./classes"
# The upgrade is not compatible with patches. If the folder is not empty
# we renamed it as "classes.disabled", and the upgrade process should be launched properly.
if [ "`(ls -A ${DIR_CLASSES})`" ]; then
    mv -f ${DIR_CLASSES} "./classes.disabled"
    mkdir ${DIR_CLASSES}
fi
SCRIPT_DIR=`dirname "${0}"`
"${SCRIPT_DIR}/lib/_server-script.sh" "${@}"
opendj3-server-dev/resource/upgrade.bat
@@ -22,11 +22,25 @@
rem CDDL HEADER END
rem
rem
rem      Copyright 2013 ForgeRock AS
rem      Copyright 2013-2014 ForgeRock AS
setlocal
set OPENDJ_INVOKE_CLASS="org.opends.server.tools.upgrade.UpgradeCli"
set SCRIPT_NAME=upgrade
set DIR_CLASSES="classes"
rem The upgrade is not compatible with patches. If the folder is not empty
rem we renamed it as "classes.disabled", and the upgrade process should be launched properly.
IF EXIST "%DIR_CLASSES%" (
  for /F %%i in ('dir /b %DIR_CLASSES%\*.*') do goto renamePatchesFolder
)
goto end
:renamePatchesFolder
rename %DIR_CLASSES% "classes.disabled"
mkdir %DIR_CLASSES%
:end
for %%i in (%~sf0) do call "%%~dPsi\lib\_server-script.bat" %*
opendj3-server-dev/src/messages/messages/tools.properties
@@ -2553,6 +2553,8 @@
ERR_UPGRADE_CORRUPTED_TEMPLATE_1850='%s' is missing or empty, it is probably corrupted
INFO_UPGRADE_REBUILD_INDEX_NO_BACKEND_FOUND_1851=No backend found. The rebuild index task \
stops
INFO_UPGRADE_CLASSES_FOLDER_RENAMED_1852=The classes folder has been renamed to \
'%s' to avoid compatibility issues.
# Upgrade tasks
INFO_UPGRADE_TASK_6869_SUMMARY_10000=Fixing de-DE collation matching rule OID
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -418,6 +418,8 @@
    // Checks License.
    checkLicence(context);
    logWarnAboutPatchesFolder();
    /*
     * Get the list of required upgrade tasks.
     */
@@ -711,6 +713,32 @@
  }
  /**
   * The classes folder is renamed by the script launcher to avoid
   * incompatibility between patches and upgrade process. If a folder
   * "classes.disabled" is found, this function just displays a warning in the
   * log file, meaning the "classes" folder has been renamed. See upgrade.sh /
   * upgrade.bat scripts which hold the renaming process. (OPENDJ-1098)
   */
  private static void logWarnAboutPatchesFolder()
  {
    try
    {
      final File backup =
          new File(UpgradeUtils.getInstancePath(), "classes.disabled");
      if (backup.exists() && backup.listFiles() != null
          && backup.listFiles().length > 0)
      {
        logger.warn(INFO_UPGRADE_CLASSES_FOLDER_RENAMED.get(backup
            .getAbsoluteFile()));
      }
    }
    catch (SecurityException se)
    {
      logger.debug(LocalizableMessage.raw(se.getMessage()));
    }
  }
  /**
   * Returns {@code true} if the current upgrade contains post upgrade tasks.
   *
   * @return {@code true} if the current upgrade contains post upgrade tasks.