Skip to content

Mustash plugins

Mark Croxton edited this page Jan 18, 2016 · 74 revisions

Mustash plugins allow pre-defined cache-breaking rules to be triggered by events in ExpressionEngine, for example immediately after creating or editing a specific item of content.

Each plugin is responsible for a discrete content module and will expose hooks provided by that module. These hooks can then be attached to rules using the [rules interface](Cache breaking rules).

Some plugins define groups that can optionally be used to narrow the action of a rule to content edited within a specific group. In the case of the Channel Entries plugin for example, the groups listed are Channels.

Activating plugins

Individual plugins can be activated on the Settings screen of the Mustash control panel. Tick the plugins you wish to activate and save. Please only activate third party plugins if you have the associated module installed.

Core plugins

Channel Entries

The Channel Entries plugin is invoked when publishing or editing Channel entries in the control panel.

Hooks

entry_submission_end
This hook is triggered after an entry is submitted.

update_multi_entries_loop
This hook is executed when entries are updated using the multi-entry editor.

delete_entries_loop
Executed in the loop that deletes each entry, after deletion.

Groups

The groups defined by this plugin are ExpressionEngine Channels.


Categories

The categories plugin is invoked when categories are edited using the category editor control panel module, or the category editor modal when editing an entry.

In versions of EE below 2.7, the categories editor does not provide any built-in hooks for editing events, and so if you would like to use this plugin you will need to add the hooks manually following the instructions below:

Hooks

category_save (requires EE 2.7.0+, or follow instructions below)
This hook is triggered when a new category is added or an existing category is edited.

Edit ./system/expressionengine/controllers/cp/admin_content.php and find the function category_update(). At the bottom of the function just before $this->session->set_flashdata('message_success', lang('preference_updated')); add this code:

    // -------------------------------------------
    //  'category_save' hook
    //   - Do extra processing after a category is added or edited
    //
    if ($this->extensions->active_hook('category_save'))
    {
        $this->extensions->call('category_save', $cat_id, $category_data);
    }
    //
    // -------------------------------------------

category_delete (requires EE 2.7.0+, or follow instructions below)
This hook is triggered when a category is deleted.

Edit ./system/expressionengine/models/cp/category_model.php and find the function delete_category(). Just before the line $this->db->where('cat_id', $cat_id); add this code:

    // -------------------------------------------
    //  'category_delete' hook
    //   - Do extra processing before a category is deleted
    //
    if ($this->extensions->active_hook('category_delete'))
    {
        $this->extensions->call('category_delete', array($cat_id));
    }
    //
    // -------------------------------------------   

In the same file, find the function delete_category_group(). Add the same code as above just before the line $this->db->delete('category_groups', array('group_id' => $group_id));

category_reorder (requires EE 2.7.0+, or follow instructions below)
This hook is triggered when a category is reordered.

Edit ./system/expressionengine/controllers/cp/admin_content.php and find the function change_category_order(). At the bottom of the function just before $this->session->set_flashdata('message_success', lang('preference_updated')); add this code:

    // -------------------------------------------
    //  'category_reorder' hook
    //   - Do extra processing when categories are re-ordered
    //
    if ($this->extensions->active_hook('category_reorder'))
    {
        $this->extensions->call('category_reorder', $cat_id);
    }
    //
    // -------------------------------------------

In the same file, find the function _reorder_cats_alphabetically(). Within the foreach() loop just before the closing brace, add the same code as above.

Groups

The groups defined by this plugin are ExpressionEngine Category Groups.


Comments

The Comments plugin is invoked when a new comment is added to an entry on the front-end of your site, or when an entry is edited or deleted in the control panel.

Hooks

insert_comment_end
Executed after a new comment has been submitted.

delete_comment_additional
Executed after a comment is deleted in the control panel.

update_comment_additional
Executed after a comment is updated in the control panel.

Groups

The groups defined by this plugin are ExpressionEngine Channels.


Forum

Hooks

forum_submit_post_end
Executed after a new post is submitted to a forum topic.

Groups

A list of all forums defined for the current site, ordered by forum category.


Member Model

The Member Model plugin is invoked when a member is created, edited or deleted in the front or backend of the website. In theory, providing you are using ExpressionEngine 2.6.0 or later, third-party add-ons that manage member registration / profiles should be supported by this plugin.

Hooks

member_create_end (requires EE 2.6.0+)
Executed after member creation.

member_update_end (requires EE 2.6.0+)
Executed after a member profile is updated.

member_delete (requires EE 2.4.0+)
Executed after a member is deleted.

Groups

The groups defined by this plugin are Member Groups which have control panel access.


API

The API plugin is invoked by an action URL. The URL must pass a hook as a parameter, and the hook must be associated with one or more rules for it to be triggered.

####Hooks Custom hooks can be defined on Settings screen in the API custom hooks field.

Third party plugins

Low Reorder

The Low Reorder plugin is invoked when a list of sortable entires is re-ordered.

Hooks

low_reorder_post_sort
Executed after a list of sortable entries has been saved.

Groups

The groups defined by this plugin are ExpressionEngine Channels.


Low Variables

Hooks

low_variables_post_save
Executed after a variable has been saved.

low_variables_delete
Executed when a variable is deleted.

Groups

The groups defined by this plugin are Low Variable groups.


Navee

Hooks

navee_clear_cache (requires Navee 2.2.8+)
Executed after a link is added, edited or deleted in a Navee navigation menu.

Groups

The groups defined by this plugin are Navee menus.


Taxonomy

Hooks

taxonomy_updated (requires Taxonomy 3.0.3+)
Executed after a node is added, edited or deleted in a Taxonomy tree.

Groups

The groups defined by this plugin are Taxonomy trees.


Structure

Hooks

structure_reorder_end (requires Structure 3.3.9 or later)
Executed when the Structure tree is reordered.


Varnish

The Varnish plugin is triggered by the stash_delete hook, and so it is called recursively when hooks associated with other plugins are triggered. That means it effectively extends any rules defined for other active plugins, thus allowing granular control of varnish cache purging.

It will attempt to purge urls in a Varnish cache when corresponding Stash cached items (saved with the @URI context pointer) are cleared. Therefore, you must be using Stash full-page caching in some form for it to work.

You must create at least one Varnish rule for the Varnish plugin to be triggered. If you want other plugins and their hooks to trigger Varnish cache purging, you need to create rules for them as well.

For more information on setting up Varnish with Mustash, follow this guide.

Hooks

stash_delete
Executed when variables are deleted, whether manually within the Mustash interface or when variables are cleared by cache-breaking rules.

stash_flush_cache
Executed when the entire cache for a site is cleared, whether manually using the Mustash interface or with the {exp:stash:flush_cache} template tag.

Clone this wiki locally