Gardening Application

Last modified by Thomas Mortagne on 2024/02/05 00:13

cogAutomate some gardening actions in order to keep a wiki clean
TypeXAR
CategoryApplication
Developed by

Clément Aubin

Active Installs10
Rating
1 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This application helps keeping a clean wiki by performing maintenance tasks using predefined scripts.

Concepts

Using this application, you can define two type of elements that will help you keep your wiki clean.

  • Query scripts: scripts that will generate a list of documents that should be gardened based on a given concept. For example, a script fetching every document updated in the past X minutes.
  • Action scripts: scripts that will perform an action on a given document. The action can be anything from changing the content of the document, to deleting it from the wiki.

When performing a gardening operation, you can select a set of query scripts and one action script. The action script will run on every document provided by the list of all the documents retrieved by the query scripts.

Usage

When installing the application, it comes by default with an administration interface to use the gardening scripts that you defined (see the section Define your own gardening scripts).

Start first by selecting some query scripts and one action script. Once this is saved, you can trigger the start of the gardening operation by clicking on the button "Start mowing!".

Since 1.3.1, descriptions are shown aside from the query and action scripts to help the choice of the scripts.

Test the gardening actions

Before running a gardening action on a wiki, it's usually interesting to see what are going to be the documents concerned by this gardening. Since 1.3.1, you can test the gardening action by clicking on the button "Test the gardening process". A special gardening job will then be triggered, only using the query scripts to get the list of documents on which a standard gardening job would act on. The complete list of documents found can be seen in the job log.

Define your own gardening scripts

Using Wiki Components

Defining new gardening scripts requires administrator privileges on the current wiki.

You can easily define a gardening query script or a gardening action script using two related XClasses. Those scripts will then be instantly shown in the gardening application UI.

The two XClasess GardeningQueryScriptClass and GardeningActionScriptClass share the following similar structure:

  • Name: The name of the script as shown in the admin UI
  • Identifier: A script unique identifier
  • Description: The description of the script
  • Content: The actual script content

Those scripts also use the following variables in order to transmit information:

  • $xreturn: used in query scripts, this variable should be set to a list of DocumentReference to select. Since 1.3, a list of serialized serialized document references can be used.
  • $documentReference: used in action scripts, contains the DocumentReference of the document to act on.

Using Java Components

You can also create your gardening scripts by implementing the interfaces org.xwiki.contrib.gardening.scripts.GardeningQueryScript and org.xwiki.contrib.gardening.scripts.GardeningActionScript defined in application-gardening-scripts.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.3.4

The following translations have been updated with this release:

v1.3.3

The following translations have been updated with this release:

v1.3.2

The following translations have been updated with this release:

v1.3.1

Bugfix release.

v1.3

v1.2

v1.1

Fix minimum required version.

v1.0

Dependencies

Dependencies for this extension (org.xwiki.contrib:application-gardening-ui 1.3.4):

  • org.xwiki.contrib:application-gardening-script 1.3.4
  • org.xwiki.contrib:application-gardening-wiki-script 1.3.4
Tags:
    

Get Connected