Added "unknown action" event, so that extensions can define new
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Sun, 28 Nov 2004 07:06:25 +0000 (07:06 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Sun, 28 Nov 2004 07:06:25 +0000 (07:06 +0000)
actions and handle them. Documented in hooks.doc, but not really
appropriate for the Syslog extension, so ignored.

docs/hooks.doc
extensions/Syslog.php
index.php

index d140e24..34cd050 100644 (file)
@@ -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
                    
index 5d64c9a..f9afe1d 100644 (file)
@@ -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() .
index 1386b26..1de2977 100644 (file)
--- 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" );