Changeset 5736


Ignore:
Timestamp:
Sep 14, 2011, 2:32:46 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1591: Upgrade script for BASE 2.17 --> 3.0

Disable all plug-ins during the first part of the update. Core plug-ins are later re-enabled near the end of the installation. External plug-ins should be re-installed from a BASE 3-compatible pacakge. If no such package exists, the admin may try to manually re-install the old plug-in.

Location:
trunk/src/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r5734 r5736  
    33383338    </description>
    33393339  </query>
    3340    
     3340 
     3341  <query id="DISABLE_ALL_PLUGINS" type="HQL">
     3342    <sql>
     3343      UPDATE PluginDefinitionData pl
     3344      SET pl.disabled = true
     3345    </sql>
     3346    <description>
     3347      A Hibernate query that disable all plug-ins.
     3348    </description>
     3349  </query>
     3350 
    33413351 
    33423352</predefined-queries>
  • trunk/src/core/net/sf/basedb/core/Update.java

    r5734 r5736  
    5050import net.sf.basedb.core.data.ItemSubtypeData;
    5151import net.sf.basedb.core.data.PhysicalBioAssayData;
    52 import net.sf.basedb.core.data.PluginDefinitionData;
    5352import net.sf.basedb.core.data.ProjectKeyData;
    5453import net.sf.basedb.core.data.PropertyFilterData;
     
    335334      session.delete(tmpType);
    336335     
    337       // Disable the 'BioAssaySetExporter' plug-in since it is no longer included in the code
    338       query = HibernateUtil.getPredefinedQuery(session, "GET_PLUGINDEFINITION_FOR_CLASSNAME");
    339       query.setString("className", "net.sf.basedb.plugins.BioAssaySetExporter");
    340       PluginDefinitionData plugin = HibernateUtil.loadData(PluginDefinitionData.class, query);
    341       if (plugin != null)
    342       {
    343         plugin.setDisabled(true);
    344       }
    345      
    346336      // Update the schema version number
    347337      setSchemaVersion(session, schemaVersion);
     
    458448      removeContext(session, FILETYPE);
    459449   
     450      progress.display(65, "--Disabling all plug-ins");
     451      disablePlugins(session);
     452     
    460453      // 2: remove unused columns/tables
    461454      progress.display(80, "--Dropping old database objects");
     
    656649      throw ex;
    657650    }
     651  }
     652 
     653  private static void disablePlugins(org.hibernate.Session session)
     654  {
     655    org.hibernate.Transaction tx = null;
     656    org.hibernate.Query query = null;
     657    try
     658    {
     659      log.debug("Disabling all plug-ins");
     660      tx = HibernateUtil.newTransaction(session);
     661     
     662      // Disable all plug-ins
     663      query = HibernateUtil.getPredefinedQuery(session, "DISABLE_ALL_PLUGINS");
     664      query.executeUpdate();
     665      HibernateUtil.commit(tx);
     666    }
     667    catch (BaseException ex)
     668    {
     669      if (tx != null) HibernateUtil.rollback(tx);
     670      throw ex;
     671    }
     672
    658673  }
    659674 
Note: See TracChangeset for help on using the changeset viewer.