Search in sources :

Example 1 with DistributionState

use of org.xwiki.extension.distribution.internal.DistributionManager.DistributionState in project xwiki-platform by xwiki.

the class DistributionInitializerListener method onEvent.

@Override
public void onEvent(Event event, Object arg1, Object arg2) {
    XWikiContext xcontext = (XWikiContext) arg2;
    // Do nothing if the automatic start of DW is disabled
    if (!isAutoDistributionWizardEnabled(xcontext)) {
        return;
    }
    DistributionState distributionState = this.distributionManager.getFarmDistributionState();
    // Start the Distribution Wizard only if the current user has the right to access it
    if (distributionState != DistributionState.NONE && this.distributionManager.canDisplayDistributionWizard()) {
        if (xcontext.isMainWiki()) {
            if (this.distributionManager.getFarmJob() == null) {
                startFarmJob();
            }
        } else {
            String wiki = xcontext.getWikiId();
            if (this.distributionManager.getWikiJob(wiki) == null) {
                startWikiJob(wiki);
            }
        }
    }
}
Also used : XWikiContext(com.xpn.xwiki.XWikiContext) DistributionState(org.xwiki.extension.distribution.internal.DistributionManager.DistributionState)

Aggregations

XWikiContext (com.xpn.xwiki.XWikiContext)1 DistributionState (org.xwiki.extension.distribution.internal.DistributionManager.DistributionState)1