use of org.xwiki.extension.job.plan.ExtensionPlan in project xwiki-platform by xwiki.
the class OutdatedExtensionsDistributionStep method createRepairPlan.
private ExtensionPlan createRepairPlan(ExtensionId invalidExtension, String namespace) throws JobException, InterruptedException {
// Install the default UI
InstallRequest installRequest = new InstallRequest();
installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_PLAN_PREFIX, invalidExtension.getId(), namespace));
installRequest.addExtension(invalidExtension);
installRequest.addNamespace(namespace);
// Don't take any risk
installRequest.setUninstallAllowed(false);
// Indicate if it's allowed to do modification on root namespace
installRequest.setRootModificationsAllowed(true);
installRequest.setInteractive(false);
// Set user to use as author (for example) to be superadmin
installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, XWikiRightService.SUPERADMIN_USER_FULLNAME);
Job job = this.jobExecutor.execute(UpgradePlanJob.JOBTYPE, installRequest);
job.join();
return (ExtensionPlan) job.getStatus();
}
use of org.xwiki.extension.job.plan.ExtensionPlan in project xwiki-platform by xwiki.
the class OutdatedExtensionsDistributionStep method repair.
private void repair(ExtensionId invalidExtension, String namespace) throws JobException, InterruptedException {
// Find valid extension version
ExtensionPlan plan = createRepairPlan(invalidExtension, namespace);
// Install valid extension version
if (plan.getTree().size() > 0) {
ExtensionPlanAction action = plan.getTree().iterator().next().getAction();
install(action.getExtension().getId(), namespace, false);
}
}
Aggregations