Skip to content

mattdees/standard_hooks_examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This repo contains examples of how to use the Standardized Hooks system in cPanel & WHM. These examples are designed to be as simple as possible while implementing Standardized Hooks in real-life scenarios. Each module is well commented with quite a bit of information on how a feature works along with links to the documentation on the feature.

It is suggested that you review the Standardized Hooks documentation on http://sdk.cpanel.net/ before reviewing these files.

Installation

WARNING: These hooks will modify the behavior of your cPanel & WHM installation, these should only be installed after the affects of using them is fully understood. This specifically applies to the "RollbackHook" module which will disable the ability to create accounts.

Install the example hooks on the cPanel system:

mkdir -p /var/cpanel/perl5/lib/Example cp /path/to/checked/out/modules/*pm /var/cpanel/perl5/lib/Example

Register the hooks with the cPanel system:

/usr/local/cpanel/bin/manage_hooks add module Example::$modulename

Information on the Included Libraries

Each one of these modules provides new functionality in cPanel & WHM. These are intended to be implemented in the simplest way possible.

Example::StatsLogger

This module implements a feature that will make it so a user's log files are copied into their home directory after statistics are processed. This contains in-line information about; how a hook is inserted into the hooks database, the general structure of a hook module, and how to work with statistics processing through the hooks system.

Example::PasswordLimitations

This module implements a very simple check to ensure that no passwords are created or set with a length less than 12 characters. This module is a simple example of how to deny an event from occurring & providing a custom error message.

Example::RollbackHook

This module implements a rollback hook, which is a hook that contains logic to back itself out in case a subsequent hook fails.

This module contains quite a bit of information on how to use the Rollback Feature and how to enable the "Debug Mode" for the hooks system.

Author & License information

These modules were developed by Matt Dees (matt@cpanel.net) at cPanel, Inc. These are intended as examples and provided as is with no warrantee. Use at your own risk.

About

This page contains examples of how to implement Standard Hooks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages