Skip to content

Instantly share code, notes, and snippets.

@molaschi
molaschi / gist:9e2654f42ece23829d17
Last active April 8, 2018 02:21
export templates
import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory
import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions
import info.magnolia.cms.core.*
import info.magnolia.repository.*
import info.magnolia.jcr.util.*
class TemplateReport {
static def mgnl45 = true
String basePath
def templates = [:]
@molaschi
molaschi / export_pages_templates.groovy
Last active April 8, 2018 02:21
Magnolia export pages and used templates
import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory
import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions
import info.magnolia.cms.core.*
import info.magnolia.repository.*
import info.magnolia.jcr.util.*
// if you don't know which is magnolia version
mgnl45 = JCRCriteriaFactory.createCriteria().setWorkspace("website").setBasePath("/jcr:root/*").execute().items.next() instanceof javax.jcr.Node
// otherwise set it directly to true or false
// e.g.
@molaschi
molaschi / stash_slack_integration.md
Created June 4, 2014 17:10
Integrate Stash with Slack using webhooks

This is a short article on how we integrate stash and slack in openmind

First of all i assume you have:

  • a working stash installation
  • a repository you to notify slack on pushes
  • stash user with administration priviledges
  • full access to the server (linux) where stash is installed on
  • a team configured on slack
  • slack user with administration priviledges
@molaschi
molaschi / datastoregc.groovy
Created February 15, 2012 16:22
Run datastore garbage collector on magnolia project via groovy shell
import info.magnolia.context.MgnlContext
// fill "repositories" list with one workspace for each repository defined in your repositories.xml jackrabbit configuration file
// (if you have different repositories using the same datastore modify this script according to http://wiki.apache.org/jackrabbit/DataStore#line-212)
def repositories = ["website", "media"]
def removedDataStoreEntries = 0
repositories.each() { repo ->
def session = MgnlContext.getHierarchyManager(repo).getWorkspace().getSession()
def gc = session.createDataStoreGarbageCollector()