diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 744efe57b0..a1990c94ec 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -1084,6 +1084,10 @@
+
+
+
+ ${system.patch.addUnmovableAspect.deferred}
0
9007
9008
+ false
diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties
index 534b4d2df2..4f6ee74406 100644
--- a/config/alfresco/repository.properties
+++ b/config/alfresco/repository.properties
@@ -1044,6 +1044,12 @@ system.patch.sharedFolder.deferred=false
# Default value is run new years day 2030 i.e. not run.
system.patch.sharedFolder.cronExpression=0 0 0 ? 1 1 2030
+#
+# Default values for deferring the running of the addUnmovableAspect patch
+#
+system.patch.addUnmovableAspect.deferred=false
+system.patch.addUnmovableAspect.cronExpression=0 0 0 ? 1 1 2030
+
#
# Use a canned query when requested to search for people if " [hint:useCQ]" is provided in search term
#
diff --git a/config/alfresco/scheduled-jobs-context.xml b/config/alfresco/scheduled-jobs-context.xml
index c1cc42628b..65a92d0587 100644
--- a/config/alfresco/scheduled-jobs-context.xml
+++ b/config/alfresco/scheduled-jobs-context.xml
@@ -299,4 +299,32 @@
+
+
+
+
+ org.alfresco.repo.admin.patch.AsynchronousPatch$AsynchronousPatchJob
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${system.patch.addUnmovableAspect.cronExpression}
+
+
+ ${system.cronJob.startDelayMinutes}
+
+
diff --git a/source/java/org/alfresco/repo/admin/patch/PatchService.java b/source/java/org/alfresco/repo/admin/patch/PatchService.java
index 56747f5384..eb5eed60dc 100644
--- a/source/java/org/alfresco/repo/admin/patch/PatchService.java
+++ b/source/java/org/alfresco/repo/admin/patch/PatchService.java
@@ -51,13 +51,13 @@ public interface PatchService
* Apply all outstanding patches that are relevant to the repo. If there is a failure, then the patches that were
* applied will remain so, but the process will not attempt to apply any further patches.
*
- * @return Returns true if all outstanding patches were applied, or false if the process was termintated before all
+ * @return Returns true if all outstanding patches were applied, or false if the process was terminated before all
* patches could be applied.
*/
public boolean applyOutstandingPatches();
/**
- * Apply the specified patch that is relevant to the repo.
+ * Apply the specified patch that is relevant to the repo, regardless of the deferred flag.
*
* @param patch the patch object
* @return true if the specified patch and its dependencies were applied, or
diff --git a/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java b/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java
index 69508d2d45..54eff67cb2 100644
--- a/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java
+++ b/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2014 Alfresco Software Limited.
+ * Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -183,6 +183,10 @@ public class PatchServiceImpl implements PatchService
// go through all the patches and apply them where necessary
for (Patch patch : sortedPatches)
{
+ if(patch.isDeferred())
+ {
+ continue;
+ }
// apply the patch
success = applyPatchAndDependencies(patch, appliedPatchesById);
if (!success)
@@ -284,9 +288,9 @@ public class PatchServiceImpl implements PatchService
AppliedPatch appliedPatch = appliedPatchesById.get(id);
if (appliedPatch != null && appliedPatch.getSucceeded())
{
- if (appliedPatch.getWasExecuted() && appliedPatch.getSucceeded())
+ if (appliedPatch.getWasExecuted())
{
- // It was sucessfully executed
+ // It was successfully executed
return true;
}
// We give the patch another chance
@@ -549,6 +553,7 @@ public class PatchServiceImpl implements PatchService
patch.getId(),
I18NUtil.getMessage(patch.getDescription()));
logger.info(msg);
+ // the patch is executed regardless of the deferred flag value
report = (patch.isDeferred()) ? patch.applyAsync() : patch.apply();
state = STATE.APPLIED;
}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java
index 44930de90e..27ab6eb2db 100755
--- a/source/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java
+++ b/source/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java
@@ -25,7 +25,7 @@ import java.util.Iterator;
import java.util.List;
import org.alfresco.model.ContentModel;
-import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.admin.patch.AsynchronousPatch;
import org.alfresco.repo.batch.BatchProcessWorkProvider;
import org.alfresco.repo.batch.BatchProcessor;
import org.alfresco.repo.policy.BehaviourFilter;
@@ -47,7 +47,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @author Alex Mukha
*
*/
-public class AddUnmovableAspectToSitesPatch extends AbstractPatch
+public class AddUnmovableAspectToSitesPatch extends AsynchronousPatch
{
private static Log logger = LogFactory.getLog(AddUnmovableAspectToSitesPatch.class);
private static final String MSG_SUCCESS = "patch.addUnmovableAspect.result";