mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
FIXED : ALF-12533: When run with -directory, MMT should only backup the alfresco.war file once
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -145,6 +145,10 @@ public class ModuleManagementTool
|
|||||||
java.io.File dir = new java.io.File(directoryLocation);
|
java.io.File dir = new java.io.File(directoryLocation);
|
||||||
if (dir.exists() == true)
|
if (dir.exists() == true)
|
||||||
{
|
{
|
||||||
|
if (backupWAR) {
|
||||||
|
backupWar(warFileLocation,true);
|
||||||
|
backupWAR = false; //Set it to false so a backup doesn't occur again.
|
||||||
|
}
|
||||||
installModules(dir, warFileLocation, preview, forceInstall,backupWAR);
|
installModules(dir, warFileLocation, preview, forceInstall,backupWAR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -215,22 +219,7 @@ public class ModuleManagementTool
|
|||||||
{
|
{
|
||||||
moduleDir.mkdir();
|
moduleDir.mkdir();
|
||||||
}
|
}
|
||||||
File backUpDir = new File(warFileLocation + BACKUP_DIR, DETECTOR_AMP_AND_WAR);
|
backupWar(warFileLocation, backupWAR);
|
||||||
if (backUpDir.exists() == false)
|
|
||||||
{
|
|
||||||
backUpDir.mkdir();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a backup of the war we are going to modify
|
|
||||||
if (backupWAR == true)
|
|
||||||
{
|
|
||||||
java.io.File warFile = new java.io.File(warFileLocation);
|
|
||||||
String backupLocation = warFileLocation + "-" + System.currentTimeMillis() + ".bak";
|
|
||||||
java.io.File backup = new java.io.File(backupLocation);
|
|
||||||
copyFile(warFile, backup);
|
|
||||||
|
|
||||||
outputMessage("WAR has been backed up to '" + backupLocation + "'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the details of the installing module
|
// Get the details of the installing module
|
||||||
@@ -383,6 +372,33 @@ public class ModuleManagementTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void backupWar(String warFileLocation, boolean backupWAR)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Make a backup of the war we are going to modify
|
||||||
|
if (backupWAR == true)
|
||||||
|
{
|
||||||
|
File backUpDir = new File(warFileLocation + BACKUP_DIR, DETECTOR_AMP_AND_WAR);
|
||||||
|
if (backUpDir.exists() == false)
|
||||||
|
{
|
||||||
|
backUpDir.mkdir();
|
||||||
|
}
|
||||||
|
java.io.File warFile = new java.io.File(warFileLocation);
|
||||||
|
String backupLocation = warFileLocation + "-" + System.currentTimeMillis() + ".bak";
|
||||||
|
java.io.File backup = new java.io.File(backupLocation);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
copyFile(warFile, backup);
|
||||||
|
}
|
||||||
|
catch (IOException exception)
|
||||||
|
{
|
||||||
|
throw new ModuleManagementToolException("An IO error was encountered when backing up the WAR", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
outputMessage("WAR has been backed up to '" + backupLocation + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the custom file mapping properties or null if they weren't overwritten
|
* @return Returns the custom file mapping properties or null if they weren't overwritten
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user