Couple of new hooks; FileUpload and SearchUpdate
authorRob Church <robchurch@users.mediawiki.org>
Tue, 10 Apr 2007 02:18:42 +0000 (02:18 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 10 Apr 2007 02:18:42 +0000 (02:18 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/Image.php
includes/SearchUpdate.php

index d7540d7..2af3079 100644 (file)
@@ -112,6 +112,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9046) Special page to list pages without language links
 * Predefined block reasons added to Special:Blockip
 * (bug 9508) Special page to list articles with the fewest revisions
+* Introduce 'FileUpload' hook; see docs/hooks.txt for more information
+* Introduce 'SearchUpdate' hook; see docs/hooks.txt for more information
 
 == Bugfixes since 1.9 ==
 
index 0d0ff78..2e10c6d 100644 (file)
@@ -378,6 +378,9 @@ $text: text of the mail
 &$list: List object (defaults to NULL, change it to an object instance and return
 false override the list derivative used)
 
+'FileUpload': When a file upload occurs
+$file : Image object representing the file that was uploaded
+
 'GetInternalURL': modify fully-qualified URLs used for squid cache purging
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
@@ -465,6 +468,12 @@ $form : PreferencesForm object
 &$obj: RawPage object
 &$text: The text that's going to be the output
 
+'SearchUpdate': Prior to search update completion
+$id : Page id
+$namespace : Page namespace
+$title : Page title
+$text : Current text being indexed
+
 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed
 &$siteNotice: HTML returned as the sitenotice
 Return true to allow the normal method of notice selection/rendering to work,
index 0a3aec7..14dcf3d 100644 (file)
@@ -1656,6 +1656,9 @@ class Image
                        $article->insertNewArticle( $textdesc, $desc, $minor, $watch, $suppressRC );
                }
 
+               # Hooks, hooks, the magic of hooks...
+               wfRunHooks( 'FileUpload', array( $this ) );
+
                # Add the log entry
                $log = new LogPage( 'upload' );
                $log->addEntry( 'upload', $descTitle, $desc );
index aae4a66..e79c1d0 100644 (file)
@@ -96,8 +96,13 @@ class SearchUpdate {
                # Strip wiki '' and '''
                $text = preg_replace( "/''[']*/", " ", $text );
                wfProfileOut( "$fname-regexps" );
+
+               wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) );
+               
+               # Perform the actual update
                $search->update($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle ),
                                $text);
+               
                wfProfileOut( $fname );
        }
 }