Create a gist now

Instantly share code, notes, and snippets.

Output a list of every extension hook for a given ExpressionEngine installation
# Description:
# A couple of useful bash one-liners for finding all of the extension hooks in
# a given ExpressionEngine installation. Here's what it does:
# 1. Finds all of the native hooks, and any third-party hooks;
# 2. Sorts them alphabetically;
# 3. Outputs them to STDOUT or a file of your choosing.
# Usage:
# CD to the `/system/expressionengine/` directory of your site, and run
# one of the following commands.
# Option A: Output to STDOUT.
grep -ERho "$this\->(?:EE\->)?extensions\->(?:universal_)?call\('([a-z_]+)" ./ | awk '{split($0, arr, "("); print substr(arr[2], 2);}' | sort
# Option B: Output to a file.
grep -ERho "$this\->(?:EE\->)?extensions\->(?:universal_)?call\('([a-z_]+)" ./ | awk '{split($0, arr, "("); print substr(arr[2], 2);}' | sort -o /path/to/your/file.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment