User:Pavila

From OpenKM Documentation
Jump to: navigation, search

OpenKM Core developer.

Cluster

 $ mysql -h 192.168.0.100 -u root -p
 mysql> CREATE USER openkm@192.168.0.100 IDENTIFIED BY 'openkm';
 mysql> GRANT ALL ON okmdb.* TO openkm@192.168.0.100;

Application with CLOSE_WAIT

sudo netstat -tonp | grep CLOSE_WAIT

See:

File descriptors used by Tomcat

sudo lsof -p $(ps -ef | grep java | grep tomcat | awk '{ print $2 }') | wc -l

Show charset and locale configuration

import java.util.*;
import java.nio.charset.*;
 
print("Charset: " + Charset.defaultCharset()+"<br/>");
print("Locale: " + Locale.getDefault()+"<br/>");

Show Java version

print("Java Vendor: " + System.getProperty("java.vm.vendor")+"<br/>");
print("Java Version: " + System.getProperty("java.version")+"<br/>");

Fix permissions

find -name "*.okm" -exec sed -i 's/<font>//g' {} \;
find -name "*.okm" -exec sed -i 's/<\/font>//g' {} \;
find -name "*.okm" -exec sed -i 's/<font class="">//g' {} \;

If you have problems read How to set up a clean UTF-8 environment in Linux.

Find duplicates - HSQL

SELECT nd.uuid, nd.name, ndv.checksum FROM NodeDocument nd, NodeDocumentVersion ndv WHERE nd.uuid = ndv.parent AND ndv.checksum IN 
  (SELECT ndv.checksum FROM NodeDocumentVersion ndv WHERE ndv.CURRENT = TRUE GROUP BY ndv.checksum HAVING COUNT(ndv.checksum) > 1) 
ORDER BY ndv.checksum, nd.name;

Find duplicates - SQL

SELECT NBS_UUID, NBS_NAME, NDV_CHECKSUM FROM OKM_NODE_BASE, OKM_NODE_DOCUMENT_VERSION WHERE NBS_UUID = NDV_PARENT AND NDV_CHECKSUM IN 
  (SELECT NDV_CHECKSUM FROM OKM_NODE_DOCUMENT_VERSION WHERE NDV_CURRENT='T' GROUP BY NDV_CHECKSUM HAVING COUNT(NDV_CHECKSUM) > 1)
ORDER BY NDV_CHECKSUM, NBS_NAME;

Find documents with assigned roles

SELECT COUNT(*) FROM NodeDocument nd WHERE SIZE(nd.rolePermissions) > 0; -- Slower
SELECT COUNT(*) FROM NodeDocument nd WHERE EXISTS elements(nd.rolePermissions); -- Faster

Find documents with a keyword

FROM NodeDocument nd WHERE 'xxx' IN elements(nd.keywords);

Find documents with a role

FROM NodeDocument nd LEFT JOIN nd.rolePermissions AS rolePerms WHERE INDEX(rolePerms) = 'ROLE_USER';

Show documents in trash

SELECT nbase.NBS_UUID, nbase.NBS_NAME, nbase.NBS_CONTEXT FROM OKM_NODE_DOCUMENT ndoc, OKM_NODE_BASE nbase WHERE ndoc.NBS_UUID = nbase.NBS_UUID AND NBS_CONTEXT='okm_trash';

Contents

MySQL

SELECT concat('DROP TABLE IF EXISTS ', TABLE_NAME, ';')
FROM information_schema.TABLES
WHERE table_schema = 'okmdb';

Para que no molestar la integridad referencial:

SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS ...;
DROP TABLE IF EXISTS ...;
DROP TABLE IF EXISTS ...;
SET FOREIGN_KEY_CHECKS = 1;

Para que no salgan los resultados con separadores hay que iniciar MySQL así:

$ mysql -h localhost -u root -p -s -r

TO DO

Books

See also