From 2ec5f7958bb8ca6b5f3501d9b9a68ab92fbbd7d8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 26 Dec 2005 07:14:42 +0000 Subject: [PATCH] * Add 'GetInternalURL' hook to match the GetFullURL and GetLocalURL ones --- RELEASE-NOTES | 1 + docs/hooks.txt | 15 +++++++++++++++ includes/EditPage.php | 2 +- includes/ImagePage.php | 6 +++--- includes/Title.php | 4 +++- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4b536222aa..d323676713 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -358,6 +358,7 @@ fully support the editing toolbar, but was found to be too confusing. list via Special:Undelete. Default is off, replicating the 1.5 behavior, but it can be turned back on for random users to replicate the previous 1.6 dev behavior. +* Add 'GetInternalURL' hook to match the GetFullURL and GetLocalURL ones === Caveats === diff --git a/docs/hooks.txt b/docs/hooks.txt index 85c479cc69..028d8faac0 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -308,6 +308,21 @@ $from: address of sending user $subject: subject of the mail $text: text of the mail +'GetInternalURL': modify fully-qualified URLs used for squid cache purging +$title: Title object of page +$url: string value as output (out parameter, can modify) +$query: query options passed to Title::getInternalURL() + +'GetLocalURL': modify local URLs as output into page links +$title: Title object of page +$url: string value as output (out parameter, can modify) +$query: query options passed to Title::getLocalURL() + +'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data +$title: Title object of page +$url: string value as output (out parameter, can modify) +$query: query options passed to Title::getFullURL() + 'LogPageValidTypes': action being logged. $type: array of strings diff --git a/includes/EditPage.php b/includes/EditPage.php index 570641ca3c..54f1366486 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -840,7 +840,7 @@ class EditPage { $metadata = $this->mMetaData ; $metadata = htmlspecialchars( $wgContLang->recodeForEdit( $metadata ) ) ; $helppage = Title::newFromText( wfMsg( "metadata_page" ) ) ; - $top = wfMsg( 'metadata', $helppage->getInternalURL() ); + $top = wfMsg( 'metadata', $helppage->getLocalURL() ); $metadata = $top . "" ; } else $metadata = "" ; diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 5d4274d3ef..d5b4cb01c2 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -494,9 +494,9 @@ END # Squid purging if ( $wgUseSquid ) { - $urlArr = Array( + $urlArr = array( $wgInternalServer.wfImageArchiveUrl( $oldimage ), - $wgInternalServer.$this->mTitle->getFullURL() + $this->mTitle->getInternalURL() ); wfPurgeSquidServers($urlArr); } @@ -589,7 +589,7 @@ END } function revert() { - global $wgOut, $wgRequest, $wgUser, $wgUseSquid, $wgInternalServer; + global $wgOut, $wgRequest, $wgUser; $oldimage = $wgRequest->getText( 'oldimage' ); if ( strlen( $oldimage ) < 16 ) { diff --git a/includes/Title.php b/includes/Title.php index ed8e7f6a4a..e93805c615 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -769,7 +769,9 @@ class Title { */ function getInternalURL( $query = '' ) { global $wgInternalServer; - return $wgInternalServer . $this->getLocalURL( $query ); + $url = $wgInternalServer . $this->getLocalURL( $query ); + wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) ); + return $url; } /** -- 2.20.1