Clean up scripts using Groovy
Magnolia Groovy module adds Groovy capabilities to Magnolia. Groovy is a popular dynamic language for the JVM. To know more about it, visit the Groovy official website which has many tutorials and documentation both for beginners and advanced users of the language.
The module provides:
-
A web based Unix-like console where you can access contents in Magnolia repositories in a
groovyish
way -
A
scripts
repository where you can store your scripts -
The ability to plug in Groovy classes into Magnolia at runtime, without the need for deploying them and restarting the servlet container.
All these tools make for a more agile approach to coding and maintaining Magnolia-based websites.
For more information, see Groovy module.
Archive resolved tasks
archived 10 tasks
Alternatively, use the Tasks Cleaner module instead of the Groovy script above. |
Clear notifications
Clear all the notifications for a given user.
clearNotificationsForUser('superuser'); (1)
1 | Notifications removed for superuser . |
archived 7 notifications
Remove messages
Removes all messages from the specified user.
removeMessages("superuser"); (1)
1 | Messages removed for superuser . |
messages of superuser removed
[/superuser/0]
Unused assets
This script shows a list of assets that aren’t referenced from any page.
found 90 unused assets
shark_brian_warrick_0824.JPG
ash-edmonds-441220-unsplash
ruben-mishchuk-571314-unsplash
vietnam_jan_16323513143_82062f3a9a_k.jpg
...
List all assets and their sizes
This script lists all assets printing the node and the size in MB.
Asset: /travel-demo/social-icons/google-plus.png
Size(Mb) : 0.010852813720703125
Asset: /travel-demo/social-icons/fb.png
Size(Mb) : 0.00937175750732421875
Asset: /travel-demo/social-icons/linkedin.png
Size(Mb) : 0.0100536346435546875
...
Number of active sessions
Get the number of active sessions in Magnolia in Tomcat (you can’t find the number of concurrent users, but this might help estimate it).