From bd8995d35ec99c5bec62eb59ada2fd7df4a0e19b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 28 Nov 2004 07:06:25 +0000 Subject: [PATCH] Added "unknown action" event, so that extensions can define new actions and handle them. Documented in hooks.doc, but not really appropriate for the Syslog extension, so ignored. --- docs/hooks.doc | 5 +++++ extensions/Syslog.php | 4 +++- index.php | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/hooks.doc b/docs/hooks.doc index d140e24e3b..34cd050b1a 100644 --- a/docs/hooks.doc +++ b/docs/hooks.doc @@ -276,6 +276,11 @@ $user: the user _doing_ the block (not the one being blocked) $block: the Block object that was saved $user: the user who did the block (not the one being blocked) +'UnknownAction': An unknown "action" has occured (useful for defining + your own actions) +$action: action name +$article: article "acted on" + 'UserLoginComplete': after a user has logged in $user: the user object that was created on login diff --git a/extensions/Syslog.php b/extensions/Syslog.php index 5d64c9a423..f9afe1dc54 100644 --- a/extensions/Syslog.php +++ b/extensions/Syslog.php @@ -78,7 +78,9 @@ if (defined('MEDIAWIKI')) { # Hook for article save - function syslogArticleSave(&$article, &$user, &$text, $summary, $isminor, $iswatch, $section) { + function syslogArticleSave(&$article, &$user, &$text, $summary, + $isminor, $iswatch, $section) + { $title = $article->mTitle; syslog(LOG_NOTICE, "User '" . $user->getName() . "' saved '" . $title->getPrefixedText() . diff --git a/index.php b/index.php index 1386b26ed3..1de2977160 100644 --- a/index.php +++ b/index.php @@ -182,7 +182,9 @@ if( !is_null( $search ) && $search !== '' ) { $wgArticle->view(); break; default: - $wgOut->errorpage( "nosuchaction", "nosuchactiontext" ); + if (wfRunHooks('UnknownAction', $action, $wgArticle)) { + $wgOut->errorpage( "nosuchaction", "nosuchactiontext" ); + } } } wfProfileOut( "main-action" ); -- 2.20.1