Knowledge:Migration from 6.4.4 to 6.4.5

From OpenKM Documentation
Jump to: navigation, search
  • Make a backup!!!
  • Stop Tomcat
  • Run from your preferred SQL client these queries:

MySQL

UPDATE OKM_NODE_MAIL SET NML_ATTACHMENT='F';

HSQL

alter table OKM_NODE_MAIL add column NML_ATTACHMENT char(1) DEFAULT 'F' not null
  • Edit OpenKM.cfg and set hibernate.hbm2ddl to update
  • Replace the OpenKM.war
  • Review file descriptor limit and, eventually, increase it.
  • Start Tomcat again
  • Check for database errors:
$ grep "ERROR .*hbm2ddl" $TOMCAT_HOME/logs/catalina.log
  • Go to Administration > Scripting and execute:
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.openkm.dao.HibernateUtil;
import com.openkm.dao.bean.NodeMail;
import com.openkm.dao.bean.NodeDocument;

String qsMail = "from NodeMail";
String qsAttachment = "from NodeDocument nd where nd.parent=:parent";
Session session = null;
Transaction tx = null;

try {
    // Start transaction
    session = HibernateUtil.getSessionFactory().openSession();
    tx = session.beginTransaction();
    
    for (NodeMail nMail : session.createQuery(qsMail).list()) {
        Query qAttachment = session.createQuery(qsAttachment);
        qAttachment.setString("parent", nMail.getUuid());
        nMail.setAttachment(!qAttachment.list().isEmpty());
        session.update(nMail);
    }
    
    // End transaction
    HibernateUtil.commit(tx);
} catch (Exception e) {
    HibernateUtil.rollback(tx);
    print("Error: " + e);
}
  • Enjoy OpenKM 6.4.5!

If you have any weird problem try to stop Tomcat, delete these folders:

  • $TOMCAT_HOME/webapps/OpenKM
  • $TOMCAT_HOME/work/Catalina/localhost

And start Tomcat again.


Nota clasica.png Recommended to clear browser cache and Java Plugin cache