Skip to content

Instantly share code, notes, and snippets.

View CorneAussems's full-sized avatar
🎯
Focusing

Corné Aussems CorneAussems

🎯
Focusing
View GitHub Profile
@CorneAussems
CorneAussems / LiferayIsMaster.groovy
Created January 24, 2023 17:00
Liferay Groovy Verify if Master
#https://liferay.dev/blogs/-/blogs/how-to-diagnose-and-recover-liferay-cluster
import com.liferay.portal.kernel.cache.MultiVMPool;
import com.liferay.registry.RegistryUtil;
import com.liferay.registry.Registry;
import com.liferay.portal.kernel.cache.PortalCache;
import com.liferay.registry.ServiceReference;
import com.liferay.portal.kernel.cluster.ClusterExecutorUtil;
import com.liferay.portal.kernel.cluster.ClusterMasterExecutorUtil;
@CorneAussems
CorneAussems / gist:5b0ed3131a26a80ce1c3054298e8692a
Created October 28, 2022 19:40
GROOVY JournalArticle UPDATE ASSET ENTRY 7.0
// GROOVY DELETE ARTICLE
import com.liferay.dynamic.data.mapping.service.DDMStructureLocalService;
import com.liferay.asset.kernel.model.*;
import com.liferay.asset.kernel.service.*;
import com.liferay.journal.model.JournalArticle;
import com.liferay.journal.service.JournalArticleLocalServiceUtil;
import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil;
import com.liferay.portal.kernel.service.ClassNameLocalServiceUtil;
import com.liferay.portal.kernel.service.*;
@CorneAussems
CorneAussems / liferay_debug.log
Created October 12, 2022 09:29
Liferay Log Debugging
# Follow the long running reindexing process
com.liferay.portal.search.internal.SearchEngineInitializer
### more details
com.liferay.portal.search.internal.background.task.ReindexStatusMessageSenderImpl
# Follow BackgroundTaskStatus
com.liferay.portal.background.task.internal.messaging.RemoveOnCompletionBackgroundTaskStatusMessageListener
@CorneAussems
CorneAussems / remove_old_versions_from_dl.groovy
Last active October 10, 2022 09:49
Remove old File versions from DL
import java.util.List;
import java.util.Date;
import java.time.*;
import java.text.SimpleDateFormat;
import java.nio.file.*;
import com.liferay.portal.kernel.model.*;
import com.liferay.portal.kernel.service.*;
import com.liferay.portal.kernel.repository.model.*;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.document.library.kernel.model.*;
@CorneAussems
CorneAussems / gist:92996c136829e269ba5820374733b357
Last active January 2, 2023 09:32
Liferay 7x Additional Log Levels Indexing
// Progress
com.liferay.portal.search.internal.SearchEngineInitializer
// More
com.componence.generic.indexer
com.componence.generic.indexer.JournalIndexerPostProcessor
// DL
com.liferay.portlet.documentlibrary.util
com.liferay.portlet.documentlibrary.util.DLFileEntryIndexer
@CorneAussems
CorneAussems / Liferay_Remove_Lock.groovy
Last active October 12, 2022 07:45
Liferay Remove Backgroundtask Locks groovy
/**
https://help.liferay.com/hc/en-us/articles/360045141191-Stuck-reindex-How-to-check-the-progress-of-a-reindex-process-and-remove-blocked-BackgroundTask-and-Lock-records
**/
/** **/
import com.liferay.portal.lock.service.LockLocalServiceUtil;
import com.liferay.portal.lock.model.Lock;
try{
locks = LockLocalServiceUtil.getLocks(-1,-1)
@CorneAussems
CorneAussems / SendEmail.groovy
Created May 19, 2022 15:13
Liferay 7.2 Send Email
import com.liferay.mail.kernel.service.MailServiceUtil;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import com.liferay.mail.kernel.model.MailMessage;
import com.liferay.portal.util.*
try {
property = "mail.throws.exception.on.failure";
PropsUtil.set(property,"true")
@CorneAussems
CorneAussems / thumbnails.groovy
Created April 26, 2022 16:02
Liferay 7.0 Regenerate Thumbnails Groovy
import com.liferay.document.library.kernel.service.*
import com.liferay.document.library.kernel.util.*
import com.liferay.portlet.documentlibrary.util.*
import com.liferay.portlet.documentlibrary.lar.*
import com.liferay.portlet.documentlibrary.service.*
import com.liferay.portal.kernel.service.*;
import com.liferay.portlet.documentlibrary.model.*
import com.liferay.portal.kernel.dao.orm.*
@CorneAussems
CorneAussems / Valamis_Miller.js
Last active June 17, 2020 10:47
Valamis Miller bulk javascript
############################################################
# Step 0: Open on Miller page the Javascript console #
############################################################
############################################################
# Step 1 : Find first 50 records with only 1 select option #
############################################################
counter=0;
$('select').each(function() {
if(this.length==1){
@CorneAussems
CorneAussems / getAllLayouts.groovy
Created February 16, 2019 17:55
Groovy Liferay 7 get all Layouts
import com.liferay.portal.kernel.service.*;
try{
companyId = 5015832
def start = -1
def end = -1
def privateLayout = false;
groups = GroupLocalServiceUtil.getGroups(start,end);
println('groups found='+groups.size()+ groups[0])