Skip to content
Snippets Groups Projects
Commit 1805846c authored by Yaxel Perez's avatar Yaxel Perez
Browse files

Update documentation on how to configure hooks

In reference to issue #1
parent 94e5ca04
No related branches found
No related tags found
1 merge request!2Show more information about who did what and when
......@@ -8,30 +8,26 @@ at `Special:Log`.
* Download and place the file(s) in a directory called ActivityLog in your extensions/ folder
* Add the following line to your LocalSettings.php
```
```php
wfLoadExtension('ActivityLog');
```
## Usage
Enable through adding to the `$wgActivityLogHooksToWatch` global variable,
then viewing through the Special:Log page.
The page title, hook name, and user are logged to the main Log page.
## Parameters
Configure new hooks by adding them to the `$wgActivityLogHooksToWatch` array in
LocalSettings.php.
* `$wgActivityLogHooksToWatch` - The hooks to watch
Update by setting the key in the associative array to true, for any hook.
For example, you can log user logins via:
```php
$wgActivityLogHooksToWatch["UserLoginComplete"]
``` php
$wgActivityLogHooksToWatch['ArticleViewHeader'] = function ($article) {
return 'Visited article "' . $article->getTitle() . '"';
};
```
All the normal arguments that would be passed to those hook executions are
discarded.
`$wgActivityLogHooksToWatch` takes booleans, strings, and anonymous functions. A
`true` value will log the hook name, A string will log the string itself, and a
callback will be invoked with all the arguments that are passed by the hook.
[https://www.mediawiki.org/wiki/Manual:Hooks](https://www.mediawiki.org/wiki/Manual:Hooks)
## Internationalization
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment