Difference between revisions of "Knowledge:Migration from 6.2.6 to 6.2.7"
From OpenKM Documentation
m |
|||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
* See [http://issues.openkm.com/changelog_page.php?version_id=61 changelog at Mantis] | * See [http://issues.openkm.com/changelog_page.php?version_id=61 changelog at Mantis] | ||
− | * Download update from http://openkm.com/download/okm/OpenKM-6.2.7.zip ( | + | * Download update from http://openkm.com/download/okm/OpenKM-6.2.7.zip (eMpg8eIjY5) |
* Make a backup!!! | * Make a backup!!! | ||
Line 10: | Line 10: | ||
* Replace the OpenKM.war | * Replace the OpenKM.war | ||
+ | |||
+ | * Review file descriptor limit and, eventually, [http://okm07.openkmcloud.com/OpenKM/index.jsp?docPath=%2Fokm%3Aroot%2FKnowledge+Base%2FSet+ulimit+in+Ubuntu.html increase it]. | ||
* Run from your preferred SQL client these queries: | * Run from your preferred SQL client these queries: | ||
+ | |||
+ | '''HSQL''' | ||
+ | <source lang="sql"> | ||
+ | ALTER TABLE OKM_NODE_NOTE alter column NNT_TEXT clob; | ||
+ | </source> | ||
'''MySQL''' | '''MySQL''' | ||
Line 33: | Line 40: | ||
alter table OKM_NODE_NOTE add NNT_TEXT_TMP CLOB; | alter table OKM_NODE_NOTE add NNT_TEXT_TMP CLOB; | ||
update OKM_NODE_NOTE set NNT_TEXT_TMP = NNT_TEXT; | update OKM_NODE_NOTE set NNT_TEXT_TMP = NNT_TEXT; | ||
− | alter table OKM_NODE_NOTE drop NNT_TEXT; | + | alter table OKM_NODE_NOTE drop column NNT_TEXT; |
− | alter table OKM_NODE_NOTE rename NNT_TEXT_TMP to NNT_TEXT; | + | alter table OKM_NODE_NOTE rename column NNT_TEXT_TMP to NNT_TEXT; |
</source> | </source> | ||
* Start Tomcat again | * Start Tomcat again | ||
+ | |||
+ | * Check for database errors: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ grep "ERROR .*hbm2ddl" $TOMCAT_HOME/logs/catalina.log | ||
+ | </source> | ||
+ | |||
+ | * Set installation customer at [http://update.openkm.com/admin/license_list.php License Manager]. | ||
* Go to '''Administration''' > '''Scripting''' and execute this script: | * Go to '''Administration''' > '''Scripting''' and execute this script: | ||
+ | |||
+ | {{Warning|This script is not necessary because in OpenKM 6.2.10 by default '''node path''' is not used. If you want to enable '''node path''' again, please use the '''store.node.path''' configuration property.}} | ||
<source lang="java"> | <source lang="java"> | ||
Line 53: | Line 70: | ||
import com.openkm.dao.HibernateUtil; | import com.openkm.dao.HibernateUtil; | ||
import com.openkm.core.Config; | import com.openkm.core.Config; | ||
+ | |||
+ | Logger log = LoggerFactory.getLogger("com.openkm.migration"); | ||
+ | int MAX_DEPTH = Integer.MAX_VALUE; | ||
+ | int count = 0; | ||
+ | |||
+ | void fixNodePathHelper(Session session, NodeBase parentNode, int depth) throws HibernateException { | ||
+ | String qs = "from NodeBase nb where nb.parent=:parent"; | ||
+ | Query q = session.createQuery(qs).setCacheable(true); | ||
+ | q.setString("parent", parentNode.getUuid()); | ||
+ | |||
+ | for (NodeBase nb : q.list()) { | ||
+ | if (nb.getPath() == null) { | ||
+ | nb.setPath(parentNode.getPath() + "/" + nb.getName()); | ||
+ | session.update(nb); | ||
+ | log.info("Updated node: {}", nb.getPath()); | ||
+ | |||
+ | if (count++ % 100 == 0) { | ||
+ | log.info("*** Commit transaction ***"); | ||
+ | HibernateUtil.commit(session.getTransaction()); | ||
+ | session.beginTransaction(); | ||
+ | } | ||
+ | } else { | ||
+ | log.info("Node already updated: {}", nb.getPath()); | ||
+ | } | ||
+ | |||
+ | if (depth < MAX_DEPTH) { | ||
+ | // Process in depth | ||
+ | fixNodePathHelper(session, nb, depth + 1); | ||
+ | } | ||
+ | } | ||
+ | } | ||
− | + | log.info("***** Process BEGIN *****"); | |
− | log.info("Process BEGIN"); | ||
String qs = "from NodeBase nb where nb.parent=:parent"; | String qs = "from NodeBase nb where nb.parent=:parent"; | ||
Session session = null; | Session session = null; | ||
− | + | ||
− | |||
try { | try { | ||
− | + | session = HibernateUtil.getSessionFactory().openSession(); | |
− | + | session.beginTransaction(); | |
− | + | ||
− | + | // First level nodes | |
− | + | Query q = session.createQuery(qs); | |
− | + | q.setString("parent", Config.ROOT_NODE_UUID); | |
− | + | ||
− | + | for (NodeBase nb : q.list()) { | |
− | + | nb.setPath("/" + nb.getName()); | |
− | + | session.update(nb); | |
− | + | log.info("Updated node: {}", nb.getPath()); | |
− | + | ||
− | + | // Process in depth | |
− | + | fixNodePathHelper(session, nb, 1); | |
− | + | } | |
− | + | ||
− | + | HibernateUtil.commit(session.getTransaction()); | |
− | |||
} catch (HibernateException e) { | } catch (HibernateException e) { | ||
− | + | HibernateUtil.rollback(session.getTransaction()); | |
− | + | throw new DatabaseException(e.getMessage(), e); | |
} finally { | } finally { | ||
− | + | HibernateUtil.close(session); | |
} | } | ||
− | + | log.info("***** Process END *****"); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</source> | </source> | ||
Line 106: | Line 138: | ||
<source lang="bash"> | <source lang="bash"> | ||
$ tail -f $TOMCAT_HOME/log/catalina.log | $ tail -f $TOMCAT_HOME/log/catalina.log | ||
+ | </source> | ||
+ | |||
+ | * Translation property "fileupload.send" has been changed to "fileupload.button.send" so, you can remove the old one: | ||
+ | |||
+ | <source lang="sql"> | ||
+ | delete from OKM_TRANSLATION where TR_KEY='fileupload.send'; | ||
</source> | </source> | ||
Latest revision as of 09:38, 28 February 2013
- Download update from http://openkm.com/download/okm/OpenKM-6.2.7.zip (eMpg8eIjY5)
- Make a backup!!!
- Stop Tomcat
- Edit OpenKM.cfg and set hibernate.hbm2ddl to update
- Replace the OpenKM.war
- Review file descriptor limit and, eventually, increase it.
- Run from your preferred SQL client these queries:
HSQL
ALTER TABLE OKM_NODE_NOTE alter column NNT_TEXT clob;
MySQL
alter table OKM_NODE_NOTE modify NNT_TEXT longtext;
PostgreSQL
alter table OKM_NODE_NOTE alter NNT_TEXT TYPE text;
Oracle
alter table OKM_NODE_NOTE modify (NNT_TEXT clob);
If the ALTER TABLE sentence fails in Oracle with ORA-22858, you have another way:
alter table OKM_NODE_NOTE add NNT_TEXT_TMP CLOB;
update OKM_NODE_NOTE set NNT_TEXT_TMP = NNT_TEXT;
alter table OKM_NODE_NOTE drop column NNT_TEXT;
alter table OKM_NODE_NOTE rename column NNT_TEXT_TMP to NNT_TEXT;
- Start Tomcat again
- Check for database errors:
$ grep "ERROR .*hbm2ddl" $TOMCAT_HOME/logs/catalina.log
- Set installation customer at License Manager.
- Go to Administration > Scripting and execute this script:
This script is not necessary because in OpenKM 6.2.10 by default node path is not used. If you want to enable node path again, please use the store.node.path configuration property. |
// com.openkm.dao.NodeBaseDAO.getInstance().fixNodePath();
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.core.DatabaseException;
import com.openkm.dao.bean.NodeBase;
import com.openkm.dao.HibernateUtil;
import com.openkm.core.Config;
Logger log = LoggerFactory.getLogger("com.openkm.migration");
int MAX_DEPTH = Integer.MAX_VALUE;
int count = 0;
void fixNodePathHelper(Session session, NodeBase parentNode, int depth) throws HibernateException {
String qs = "from NodeBase nb where nb.parent=:parent";
Query q = session.createQuery(qs).setCacheable(true);
q.setString("parent", parentNode.getUuid());
for (NodeBase nb : q.list()) {
if (nb.getPath() == null) {
nb.setPath(parentNode.getPath() + "/" + nb.getName());
session.update(nb);
log.info("Updated node: {}", nb.getPath());
if (count++ % 100 == 0) {
log.info("*** Commit transaction ***");
HibernateUtil.commit(session.getTransaction());
session.beginTransaction();
}
} else {
log.info("Node already updated: {}", nb.getPath());
}
if (depth < MAX_DEPTH) {
// Process in depth
fixNodePathHelper(session, nb, depth + 1);
}
}
}
log.info("***** Process BEGIN *****");
String qs = "from NodeBase nb where nb.parent=:parent";
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
// First level nodes
Query q = session.createQuery(qs);
q.setString("parent", Config.ROOT_NODE_UUID);
for (NodeBase nb : q.list()) {
nb.setPath("/" + nb.getName());
session.update(nb);
log.info("Updated node: {}", nb.getPath());
// Process in depth
fixNodePathHelper(session, nb, 1);
}
HibernateUtil.commit(session.getTransaction());
} catch (HibernateException e) {
HibernateUtil.rollback(session.getTransaction());
throw new DatabaseException(e.getMessage(), e);
} finally {
HibernateUtil.close(session);
}
log.info("***** Process END *****");
To see the progress:
$ tail -f $TOMCAT_HOME/log/catalina.log
- Translation property "fileupload.send" has been changed to "fileupload.button.send" so, you can remove the old one:
delete from OKM_TRANSLATION where TR_KEY='fileupload.send';
- Enjoy OpenKM 6.2.7!
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.
Recommended to clear browser cache and Java Plugin cache |