Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
DIR=`pwd`
cd /tmp
CRASH="/tmp/crash-1.3.1/crash/bin/crash.sh"
if [ ! -f "$CRASH" ]; then
curl https://repo1.maven.org/maven2/org/crashub/crash.distrib/1.3.1/crash.distrib-1.3.1.tar.gz > crash.distrib-1.3.1.tar.gz
import javax.portlet.PortletPreferences;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.PortletKeys;
import com.liferay.portal.kernel.service.PortalPreferencesLocalServiceUtil;
companyId = PortalUtil.getDefaultCompanyId()
PortletPreferences portalPreferences = PortalPreferencesLocalServiceUtil.getPreferences(PortletKeys.PREFS_OWNER_ID_DEFAULT, PortletKeys.PREFS_OWNER_TYPE_COMPANY);
import com.liferay.portal.util.PropsValues;
import com.liferay.document.library.kernel.antivirus.AntivirusScannerUtil
import com.liferay.document.library.kernel.antivirus.AntivirusScannerWrapper;
println "[config] Antivirus implementation: " + PropsValues.DL_STORE_ANTIVIRUS_IMPL
println "[config] Antivirus enabled: " + PropsValues.DL_STORE_ANTIVIRUS_ENABLED
println "[util] Antivirus scanner: " + AntivirusScannerUtil.getAntivirusScanner().getClass().getName()
println "[util] Antivirus enabled: " + AntivirusScannerUtil.isActive()
import com.liferay.portal.kernel.backgroundtask.BackgroundTask;
import com.liferay.portal.kernel.backgroundtask.BackgroundTaskConstants;
import com.liferay.portal.kernel.backgroundtask.BackgroundTaskManagerUtil;
import com.liferay.portal.kernel.backgroundtask.BackgroundTaskStatusRegistryUtil;
import com.liferay.portal.kernel.model.CompanyConstants;
def printTask(task) {
def status = BackgroundTaskStatusRegistryUtil.getBackgroundTaskStatus(task.backgroundTaskId);
#!/bin/sh
DIR=`pwd`
URL=`grep -h jdbc.default.url /opt/liferay/*.properties | sed s#.*jdbc.default.url=##`
USER=`grep -h jdbc.default.username /opt/liferay/*.properties | sed s#.*jdbc.default.username=##`
PASS=`grep -h jdbc.default.password /opt/liferay/*.properties | sed s#.*jdbc.default.password=##`
SQLLINE="sqlline.jar"
DB_DRIVER="mysql-connector-java.jar"
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
import com.liferay.portal.util.PropsValues;
import java.nio.file.Files;
import java.nio.charset.Charset
import java.nio.file.StandardOpenOption
/*
Calculating the size of very large folder trees can take very long time
In such case the web server may timeout with 504 error
To work around that, the data can be stored in a tmp file
@milendyankov
milendyankov / DXP70-runSQL.groovy
Last active May 12, 2023 11:20
Running SQL queries from liferay's groovy console
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
Connection con = null;
Statement st = null;
@milendyankov
milendyankov / HelloService.java
Last active August 29, 2015 14:04
OSGI DS test
public interface HelloService {
String hello ();
}