code: public static void enforceProjectStateOnUpdated(Item item) {
          if (item.getParent() instanceof TemplateDrivenMultiBranchProject) {
              TemplateDrivenMultiBranchProject parent = (TemplateDrivenMultiBranchProject) item.getParent();
              AbstractProject template = parent.getTemplate();
  
              if (item.equals(template)) {
                  try {
                      if (!(template.getScm() instanceof NullSCM)) {
                          template.setScm(new NullSCM());
                      }
  
                      if (!template.isDisabled()) {
                          template.disable();
                      }
                  } catch (IOException e) {
                      LOGGER.log(Level.WARNING, "Unable to correct template configuration.", e);
                  }
              }
  
              // Don't allow sub-projects to be enabled if parent is disabled
              AbstractProject project = (AbstractProject) item;
              if (parent.isDisabled() && !project.isDisabled()) {
                  try {
                      project.disable();
                  } catch (IOException e) {
                      LOGGER.log(Level.WARNING, "Unable to keep sub-project disabled.", e);
                  }
              }
          }
      }
docs: Triggered by different listeners to enforce state for multi-branch projects and their sub-projects.
  <ul>
  <li>Watches for changes to the template project and corrects the SCM and enabled/disabled state if modified.</li>
  <li>Looks for rogue template project in the branches directory and removes it if no such sub-project exists.</li>
  <li>Re-disables sub-projects if they were enabled when the parent project was disabled.</li>
  </ul>
  
  @param item the item that was just updated