From: Rob Church Date: Tue, 10 Apr 2007 02:18:42 +0000 (+0000) Subject: Couple of new hooks; FileUpload and SearchUpdate X-Git-Tag: 1.31.0-rc.0~53442 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=859e431af329c3667afc931060dbf7dfae0b2f87;p=lhc%2Fweb%2Fwiklou.git Couple of new hooks; FileUpload and SearchUpdate --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d7540d7571..2af3079726 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/docs/hooks.txt b/docs/hooks.txt index 0d0ff78aca..2e10c6dbba 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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, diff --git a/includes/Image.php b/includes/Image.php index 0a3aec782e..14dcf3ddf7 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -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 ); diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index aae4a66c86..e79c1d083e 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -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 ); } }