aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Church <robchurch@users.mediawiki.org>2007-04-10 02:18:42 +0000
committerRob Church <robchurch@users.mediawiki.org>2007-04-10 02:18:42 +0000
commit859e431af329c3667afc931060dbf7dfae0b2f87 (patch)
tree734954de362e7a13545062652a3619afdc96d27a
parent0fc57a354ca4af09d8283a48749ef4ce5301629a (diff)
downloadmediawikicore-859e431af329c3667afc931060dbf7dfae0b2f87.tar.gz
mediawikicore-859e431af329c3667afc931060dbf7dfae0b2f87.zip
Couple of new hooks; FileUpload and SearchUpdate
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/21135
-rw-r--r--RELEASE-NOTES2
-rw-r--r--docs/hooks.txt9
-rw-r--r--includes/Image.php3
-rw-r--r--includes/SearchUpdate.php5
4 files changed, 19 insertions, 0 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d7540d7571da..2af30797262f 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 0d0ff78aca34..2e10c6dbbae3 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 0a3aec782e01..14dcf3ddf729 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 aae4a66c86dd..e79c1d083ef7 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 );
}
}