From e369f66d0029594d1ce289f7a505d3ce20250828 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 8 Dec 2014 23:23:30 -0800 Subject: [PATCH] Replace wfRunHooks calls with direct Hooks::run calls * This avoids the overhead of an extra function call Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd --- includes/Autopromote.php | 4 +- includes/Block.php | 4 +- includes/ChangeTags.php | 2 +- includes/Collation.php | 2 +- includes/EditPage.php | 48 ++++++------- includes/Export.php | 8 +-- includes/FileDeleteForm.php | 2 +- includes/GitInfo.php | 2 +- includes/GlobalFunctions.php | 1 + includes/Import.php | 12 ++-- includes/Linker.php | 18 ++--- includes/MWNamespace.php | 4 +- includes/MWTimestamp.php | 4 +- includes/MagicWord.php | 4 +- includes/MediaWiki.php | 12 ++-- includes/MimeMagic.php | 6 +- includes/MovePage.php | 12 ++-- includes/OutputPage.php | 22 +++--- includes/Preferences.php | 6 +- includes/PrefixSearch.php | 6 +- includes/ProtectionForm.php | 6 +- includes/Revision.php | 2 +- includes/Sanitizer.php | 2 +- includes/Setup.php | 4 +- includes/Title.php | 38 +++++----- includes/TitleArray.php | 2 +- includes/User.php | 72 +++++++++---------- includes/UserArray.php | 2 +- includes/WebRequest.php | 4 +- includes/WebResponse.php | 2 +- includes/actions/EditAction.php | 2 +- includes/actions/FormAction.php | 4 +- includes/actions/HistoryAction.php | 8 +-- includes/actions/InfoAction.php | 2 +- includes/actions/RawAction.php | 2 +- includes/actions/WatchAction.php | 8 +-- includes/api/ApiBase.php | 10 +-- includes/api/ApiCreateAccount.php | 6 +- includes/api/ApiEditPage.php | 2 +- includes/api/ApiFormatBase.php | 2 +- includes/api/ApiHelp.php | 2 +- includes/api/ApiLogin.php | 2 +- includes/api/ApiLogout.php | 2 +- includes/api/ApiMain.php | 8 +-- includes/api/ApiOpenSearch.php | 2 +- includes/api/ApiPageSet.php | 2 +- includes/api/ApiParse.php | 2 +- includes/api/ApiQuery.php | 2 +- includes/api/ApiQueryInfo.php | 4 +- includes/api/ApiQueryRecentChanges.php | 2 +- includes/api/ApiQueryRevisions.php | 2 +- includes/api/ApiQuerySiteinfo.php | 4 +- includes/api/ApiQueryTokens.php | 2 +- includes/api/ApiQueryUsers.php | 2 +- includes/api/ApiRsd.php | 2 +- includes/api/ApiTokens.php | 2 +- includes/api/ApiUndelete.php | 2 +- includes/cache/BacklinkCache.php | 4 +- includes/cache/HTMLFileCache.php | 2 +- includes/cache/LocalisationCache.php | 4 +- includes/cache/MessageCache.php | 6 +- includes/changes/ChangesList.php | 6 +- includes/changes/OldChangesList.php | 2 +- includes/changes/RecentChange.php | 8 +-- includes/content/AbstractContent.php | 6 +- includes/content/ContentHandler.php | 14 ++-- includes/content/WikitextContent.php | 2 +- includes/context/RequestContext.php | 4 +- includes/db/DatabaseOracle.php | 2 +- includes/deferred/LinksUpdate.php | 8 +-- includes/diff/DifferenceEngine.php | 12 ++-- includes/filerepo/file/File.php | 2 +- includes/filerepo/file/LocalFile.php | 10 +-- includes/gallery/ImageGalleryBase.php | 2 +- includes/gallery/TraditionalImageGallery.php | 2 +- includes/installer/DatabaseUpdater.php | 2 +- includes/interwiki/Interwiki.php | 2 +- includes/logging/LogEventsList.php | 4 +- includes/logging/LogFormatter.php | 2 +- includes/mail/EmailNotification.php | 6 +- includes/mail/UserMailer.php | 4 +- includes/media/FormatMetadata.php | 4 +- includes/media/MediaHandler.php | 2 +- includes/media/MediaTransformOutput.php | 2 +- .../media/TransformationalImageHandler.php | 4 +- includes/media/XMP.php | 2 +- includes/media/XMPInfo.php | 2 +- includes/page/Article.php | 26 +++---- includes/page/CategoryPage.php | 2 +- includes/page/ImagePage.php | 10 +-- includes/page/WikiPage.php | 44 ++++++------ includes/parser/LinkHolderArray.php | 4 +- includes/parser/Parser.php | 58 +++++++-------- includes/parser/ParserOptions.php | 2 +- .../rcfeed/IRCColourfulRCFeedFormatter.php | 2 +- includes/resourceloader/ResourceLoader.php | 4 +- .../ResourceLoaderStartUpModule.php | 2 +- .../revisiondelete/RevDelRevisionList.php | 2 +- includes/search/SearchEngine.php | 10 +-- includes/search/SearchResult.php | 2 +- includes/skins/BaseTemplate.php | 6 +- includes/skins/Skin.php | 26 +++---- includes/skins/SkinTemplate.php | 18 ++--- .../specialpage/ChangesListSpecialPage.php | 4 +- includes/specialpage/FormSpecialPage.php | 2 +- includes/specialpage/QueryPage.php | 2 +- includes/specialpage/RedirectSpecialPage.php | 2 +- includes/specialpage/SpecialPage.php | 4 +- includes/specialpage/SpecialPageFactory.php | 2 +- includes/specials/SpecialBlock.php | 8 +-- includes/specials/SpecialBlockList.php | 2 +- includes/specials/SpecialBooksources.php | 2 +- includes/specials/SpecialChangeEmail.php | 2 +- includes/specials/SpecialChangePassword.php | 14 ++-- includes/specials/SpecialContributions.php | 10 +-- .../specials/SpecialDeletedContributions.php | 2 +- includes/specials/SpecialEditWatchlist.php | 6 +- includes/specials/SpecialEmailuser.php | 12 ++-- includes/specials/SpecialImport.php | 2 +- includes/specials/SpecialListusers.php | 10 +-- includes/specials/SpecialLog.php | 4 +- includes/specials/SpecialLonelypages.php | 2 +- includes/specials/SpecialMergeHistory.php | 2 +- includes/specials/SpecialMovepage.php | 2 +- includes/specials/SpecialNewpages.php | 4 +- includes/specials/SpecialPageLanguage.php | 2 +- includes/specials/SpecialPasswordReset.php | 4 +- includes/specials/SpecialRandompage.php | 2 +- includes/specials/SpecialRecentchanges.php | 6 +- includes/specials/SpecialResetTokens.php | 2 +- includes/specials/SpecialSearch.php | 20 +++--- includes/specials/SpecialStatistics.php | 2 +- includes/specials/SpecialUndelete.php | 16 ++--- includes/specials/SpecialUpload.php | 10 +-- includes/specials/SpecialUserlogin.php | 38 +++++----- includes/specials/SpecialUserlogout.php | 2 +- includes/specials/SpecialUserrights.php | 2 +- includes/specials/SpecialVersion.php | 6 +- includes/specials/SpecialWantedpages.php | 2 +- includes/specials/SpecialWatchlist.php | 6 +- includes/specials/SpecialWhatlinkshere.php | 2 +- includes/upload/UploadBase.php | 8 +-- includes/upload/UploadFromUrl.php | 2 +- includes/utils/IP.php | 2 +- 144 files changed, 494 insertions(+), 493 deletions(-) diff --git a/includes/Autopromote.php b/includes/Autopromote.php index 81f3b7aa00..d492d196af 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -43,7 +43,7 @@ class Autopromote { } } - wfRunHooks( 'GetAutoPromoteGroups', array( $user, &$promote ) ); + Hooks::run( 'GetAutoPromoteGroups', array( $user, &$promote ) ); return $promote; } @@ -197,7 +197,7 @@ class Autopromote { return in_array( 'bot', User::getGroupPermissions( $user->getGroups() ) ); default: $result = null; - wfRunHooks( 'AutopromoteCondition', array( $cond[0], + Hooks::run( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) ); if ( $result === null ) { throw new MWException( "Unrecognized condition {$cond[0]} for autopromotion!" ); diff --git a/includes/Block.php b/includes/Block.php index f2ab6d5479..9079fb0d85 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -580,7 +580,7 @@ class Block { if ( $this->isAutoblocking() && $this->getType() == self::TYPE_USER ) { wfDebug( "Doing retroactive autoblocks for " . $this->getTarget() . "\n" ); - $continue = wfRunHooks( + $continue = Hooks::run( 'PerformRetroactiveAutoblock', array( $this, &$blockIds ) ); if ( $continue ) { @@ -693,7 +693,7 @@ class Block { } # Allow hooks to cancel the autoblock. - if ( !wfRunHooks( 'AbortAutoblock', array( $autoblockIP, &$this ) ) ) { + if ( !Hooks::run( 'AbortAutoblock', array( $autoblockIP, &$this ) ) ) { wfDebug( "Autoblock aborted by hook.\n" ); return false; } diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 87c6ce5c03..9ee2460ddd 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -320,7 +320,7 @@ class ChangeTags { $emptyTags[] = $row->vt_tag; } - wfRunHooks( 'ListDefinedTags', array( &$emptyTags ) ); + Hooks::run( 'ListDefinedTags', array( &$emptyTags ) ); $emptyTags = array_filter( array_unique( $emptyTags ) ); diff --git a/includes/Collation.php b/includes/Collation.php index 1c2c2db36c..dac3e938a8 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -59,7 +59,7 @@ abstract class Collation { # Provide a mechanism for extensions to hook in. $collationObject = null; - wfRunHooks( 'Collation::factory', array( $collationName, &$collationObject ) ); + Hooks::run( 'Collation::factory', array( $collationName, &$collationObject ) ); if ( $collationObject instanceof Collation ) { return $collationObject; diff --git a/includes/EditPage.php b/includes/EditPage.php index 071ddeb288..a30a5eab34 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -463,7 +463,7 @@ class EditPage { function edit() { global $wgOut, $wgRequest, $wgUser; // Allow extensions to modify/prevent this form or submission - if ( !wfRunHooks( 'AlternateEdit', array( $this ) ) ) { + if ( !Hooks::run( 'AlternateEdit', array( $this ) ) ) { return; } @@ -558,9 +558,9 @@ class EditPage { } if ( !$this->mTitle->getArticleID() ) { - wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); + Hooks::run( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); } else { - wfRunHooks( 'EditFormInitialText', array( $this ) ); + Hooks::run( 'EditFormInitialText', array( $this ) ); } } @@ -627,7 +627,7 @@ class EditPage { throw new PermissionsError( $action, $permErrors ); } - wfRunHooks( 'EditPage::showReadOnlyForm:initial', array( $this, &$wgOut ) ); + Hooks::run( 'EditPage::showReadOnlyForm:initial', array( $this, &$wgOut ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setPageTitle( wfMessage( @@ -929,7 +929,7 @@ class EditPage { $this->section === 'new' ? 'MediaWiki:addsection-editintro' : '' ); // Allow extensions to modify form data - wfRunHooks( 'EditPage::importFormData', array( $this, $request ) ); + Hooks::run( 'EditPage::importFormData', array( $this, $request ) ); wfProfileOut( __METHOD__ ); } @@ -1368,7 +1368,7 @@ class EditPage { $sectionanchor = $resultDetails['sectionanchor']; // Give extensions a chance to modify URL query on update - wfRunHooks( + Hooks::run( 'ArticleUpdateBeforeRedirect', array( $this->mArticle, &$sectionanchor, &$extraQuery ) ); @@ -1448,7 +1448,7 @@ class EditPage { } // Run new style post-section-merge edit filter - if ( !wfRunHooks( 'EditFilterMergedContent', + if ( !Hooks::run( 'EditFilterMergedContent', array( $this->mArticle->getContext(), $content, $status, $this->summary, $user, $this->minoredit ) ) ) { @@ -1541,7 +1541,7 @@ class EditPage { wfProfileIn( __METHOD__ ); wfProfileIn( __METHOD__ . '-checks' ); - if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) { + if ( !Hooks::run( 'EditPage::attemptSave', array( $this ) ) ) { wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" ); $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; @@ -1627,7 +1627,7 @@ class EditPage { wfProfileOut( __METHOD__ ); return $status; } - if ( !wfRunHooks( + if ( !Hooks::run( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError, $this->summary ) ) ) { @@ -2372,7 +2372,7 @@ class EditPage { $previewOutput = $this->getPreviewText(); } - wfRunHooks( 'EditPage::showEditForm:initial', array( &$this, &$wgOut ) ); + Hooks::run( 'EditPage::showEditForm:initial', array( &$this, &$wgOut ) ); $this->setHeaders(); @@ -2439,7 +2439,7 @@ class EditPage { . Xml::closeElement( 'div' ) ); - wfRunHooks( 'EditPage::showEditForm:fields', array( &$this, &$wgOut ) ); + Hooks::run( 'EditPage::showEditForm:fields', array( &$this, &$wgOut ) ); // Put these up at the top to ensure they aren't lost on early form submission $this->showFormBeforeText(); @@ -3085,7 +3085,7 @@ HTML } # This hook seems slightly odd here, but makes things more # consistent for extensions. - wfRunHooks( 'OutputPageBeforeHTML', array( &$wgOut, &$text ) ); + Hooks::run( 'OutputPageBeforeHTML', array( &$wgOut, &$text ) ); $wgOut->addHTML( $text ); if ( $this->mTitle->getNamespace() == NS_CATEGORY ) { $this->mArticle->closeShowCategory(); @@ -3124,7 +3124,7 @@ HTML if ( $newContent ) { ContentHandler::runLegacyHooks( 'EditPageGetDiffText', array( $this, &$newContent ) ); - wfRunHooks( 'EditPageGetDiffContent', array( $this, &$newContent ) ); + Hooks::run( 'EditPageGetDiffContent', array( $this, &$newContent ) ); $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); $newContent = $newContent->preSaveTransform( $this->mTitle, $wgUser, $popts ); @@ -3176,7 +3176,7 @@ HTML */ protected function showTosSummary() { $msg = 'editpage-tos-summary'; - wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) ); + Hooks::run( 'EditPageTosSummary', array( $this->mTitle, &$msg ) ); if ( !wfMessage( $msg )->isDisabled() ) { global $wgOut; $wgOut->addHTML( '
' ); @@ -3220,7 +3220,7 @@ HTML '[[' . wfMessage( 'copyrightpage' )->inContentLanguage()->text() . ']]' ); } // Allow for site and per-namespace customization of contribution/copyright notice. - wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) ); + Hooks::run( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) ); return "
\n" . call_user_func_array( 'wfMessage', $copywarnMsg )->$format() . "\n
"; @@ -3253,7 +3253,7 @@ HTML Html::openElement( 'tbody' ); foreach ( $output->getLimitReportData() as $key => $value ) { - if ( wfRunHooks( 'ParserLimitReportFormat', + if ( Hooks::run( 'ParserLimitReportFormat', array( $key, &$value, &$limitReport, true, true ) ) ) { $keyMsg = wfMessage( $key ); @@ -3321,7 +3321,7 @@ HTML $wgOut->addHTML( " {$edithelp}\n" ); $wgOut->addHTML( "
\n" ); - wfRunHooks( 'EditPage::showStandardInputs:options', array( $this, $wgOut, &$tabindex ) ); + Hooks::run( 'EditPage::showStandardInputs:options', array( $this, $wgOut, &$tabindex ) ); $wgOut->addHTML( "\n" ); } @@ -3333,7 +3333,7 @@ HTML protected function showConflict() { global $wgOut; - if ( wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) { + if ( Hooks::run( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) { $wgOut->wrapWikiMsg( '

$1

', "yourdiff" ); $content1 = $this->toEditContent( $this->textbox1 ); @@ -3484,7 +3484,7 @@ HTML $content = $this->toEditContent( $this->textbox1 ); $previewHTML = ''; - if ( !wfRunHooks( + if ( !Hooks::run( 'AlternateEditPreview', array( $this, &$content, &$previewHTML, &$this->mParserOutput ) ) ) { @@ -3553,7 +3553,7 @@ HTML $hook_args = array( $this, &$content ); ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args ); - wfRunHooks( 'EditPageGetPreviewContent', $hook_args ); + Hooks::run( 'EditPageGetPreviewContent', $hook_args ); $parserOptions->enableLimitReport(); @@ -3751,7 +3751,7 @@ HTML $toolbar = '
'; - wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) ); + Hooks::run( 'EditPageBeforeEditToolbar', array( &$toolbar ) ); return $toolbar; } @@ -3818,7 +3818,7 @@ HTML $checkboxes['watch'] = $watchThisHtml; } } - wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) ); + Hooks::run( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) ); return $checkboxes; } @@ -3859,7 +3859,7 @@ HTML $buttons['diff'] = Html::submitButton( wfMessage( 'showdiff' )->text(), $attribs ); - wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) ); + Hooks::run( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) ); return $buttons; } @@ -3903,7 +3903,7 @@ HTML $wgOut->prepareErrorPage( wfMessage( 'nosuchsectiontitle' ) ); $res = wfMessage( 'nosuchsectiontext', $this->section )->parseAsBlock(); - wfRunHooks( 'EditPageNoSuchSection', array( &$this, &$res ) ); + Hooks::run( 'EditPageNoSuchSection', array( &$this, &$res ) ); $wgOut->addHTML( $res ); $wgOut->returnToMain( false, $this->mTitle ); diff --git a/includes/Export.php b/includes/Export.php index 840e723a9f..dd5cb0c29f 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -348,7 +348,7 @@ class WikiExporter { # Default JOIN, to be overridden... $join['revision'] = array( 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ); # One, and only one hook should set this, and return false - if ( wfRunHooks( 'WikiExporter::dumpStableQuery', array( &$tables, &$opts, &$join ) ) ) { + if ( Hooks::run( 'WikiExporter::dumpStableQuery', array( &$tables, &$opts, &$join ) ) ) { wfProfileOut( __METHOD__ ); throw new MWException( __METHOD__ . " given invalid history dump type." ); } @@ -378,7 +378,7 @@ class WikiExporter { $result = null; // Assuring $result is not undefined, if exception occurs early try { - wfRunHooks( 'ModifyExportQuery', + Hooks::run( 'ModifyExportQuery', array( $this->db, &$tables, &$cond, &$opts, &$join ) ); # Do the query! @@ -627,7 +627,7 @@ class XmlDumpWriter { strval( $row->page_restrictions ) ) . "\n"; } - wfRunHooks( 'XmlDumpWriterOpenPage', array( $this, &$out, $row, $title ) ); + Hooks::run( 'XmlDumpWriterOpenPage', array( $this, &$out, $row, $title ) ); return $out; } @@ -722,7 +722,7 @@ class XmlDumpWriter { $out .= " \n"; } - wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); + Hooks::run( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); $out .= " \n"; diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index b4e245813f..1c709e6253 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -210,7 +210,7 @@ class FileDeleteForm { } if ( $status->isOK() ) { - wfRunHooks( 'FileDeleteComplete', array( &$file, &$oldimage, &$page, &$user, &$reason ) ); + Hooks::run( 'FileDeleteComplete', array( &$file, &$oldimage, &$page, &$user, &$reason ) ); } return $status; diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 7052820e1d..fb298cfeed 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -392,7 +392,7 @@ class GitInfo { if ( self::$viewers === false ) { self::$viewers = $wgGitRepositoryViewers; - wfRunHooks( 'GitViewers', array( &self::$viewers ) ); + Hooks::run( 'GitViewers', array( &self::$viewers ) ); } return self::$viewers; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 14326ec29e..dafa48b584 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3946,6 +3946,7 @@ function wfGetLangConverterCacheStorage() { * @param string|null $deprecatedVersion Optionally mark hook as deprecated with version number * * @return bool True if no handler aborted the hook + * @deprecated 1.25 */ function wfRunHooks( $event, array $args = array(), $deprecatedVersion = null ) { return Hooks::run( $event, $args, $deprecatedVersion ); diff --git a/includes/Import.php b/includes/Import.php index 4eb8e97488..6f933519d6 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -328,7 +328,7 @@ class WikiImporter { */ public function finishImportPage( $title, $origTitle, $revCount, $sRevCount, $pageInfo ) { $args = func_get_args(); - return wfRunHooks( 'AfterImportPage', $args ); + return Hooks::run( 'AfterImportPage', $args ); } /** @@ -464,7 +464,7 @@ class WikiImporter { $tag = $this->reader->name; $type = $this->reader->nodeType; - if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', array( $this ) ) ) { + if ( !Hooks::run( 'ImportHandleToplevelXMLTag', array( $this ) ) ) { // Do nothing } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) { break; @@ -523,7 +523,7 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', array( + if ( !Hooks::run( 'ImportHandleLogItemXMLTag', array( $this, $logInfo ) ) ) { // Do nothing @@ -590,7 +590,7 @@ class WikiImporter { if ( $badTitle ) { // The title is invalid, bail out of this page $skip = true; - } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this, + } elseif ( !Hooks::run( 'ImportHandlePageXMLTag', array( $this, &$pageInfo ) ) ) { // Do nothing } elseif ( in_array( $tag, $normalFields ) ) { @@ -652,7 +652,7 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', array( + if ( !Hooks::run( 'ImportHandleRevisionXMLTag', array( $this, $pageInfo, $revisionInfo ) ) ) { // Do nothing @@ -744,7 +744,7 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleUploadXMLTag', array( + if ( !Hooks::run( 'ImportHandleUploadXMLTag', array( $this, $pageInfo ) ) ) { // Do nothing diff --git a/includes/Linker.php b/includes/Linker.php index d84e5d09d0..bfb8937db4 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -209,7 +209,7 @@ class Linker { $dummy = new DummyLinker; // dummy linker instance for bc on the hooks $ret = null; - if ( !wfRunHooks( 'LinkBegin', + if ( !Hooks::run( 'LinkBegin', array( $dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret ) ) ) { wfProfileOut( __METHOD__ ); @@ -251,7 +251,7 @@ class Linker { } $ret = null; - if ( wfRunHooks( 'LinkEnd', array( $dummy, $target, $options, &$html, &$attribs, &$ret ) ) ) { + if ( Hooks::run( 'LinkEnd', array( $dummy, $target, $options, &$html, &$attribs, &$ret ) ) ) { $ret = Html::rawElement( 'a', $attribs, $html ); } @@ -411,7 +411,7 @@ class Linker { */ public static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) { $ret = "{$prefix}{$html}{$trail}"; - if ( !wfRunHooks( 'SelfLinkBegin', array( $nt, &$html, &$trail, &$prefix, &$ret ) ) ) { + if ( !Hooks::run( 'SelfLinkBegin', array( $nt, &$html, &$trail, &$prefix, &$ret ) ) ) { return $ret; } @@ -497,7 +497,7 @@ class Linker { $alt = self::fnamePart( $url ); } $img = ''; - $success = wfRunHooks( 'LinkerMakeExternalImage', array( &$url, &$alt, &$img ) ); + $success = Hooks::run( 'LinkerMakeExternalImage', array( &$url, &$alt, &$img ) ); if ( !$success ) { wfDebug( "Hook LinkerMakeExternalImage changed the output of external image " . "with url {$url} and alt text {$alt} to {$img}\n", true ); @@ -551,7 +551,7 @@ class Linker { ) { $res = null; $dummy = new DummyLinker; - if ( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$dummy, &$title, + if ( !Hooks::run( 'ImageBeforeProduceHTML', array( &$dummy, &$title, &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) { return $res; } @@ -1031,7 +1031,7 @@ class Linker { 'title' => $alt ); - if ( !wfRunHooks( 'LinkerMakeMediaLinkFile', + if ( !Hooks::run( 'LinkerMakeMediaLinkFile', array( $title, $file, &$html, &$attribs, &$ret ) ) ) { wfDebug( "Hook LinkerMakeMediaLinkFile changed the output of link " . "with url {$url} and text {$html} to {$ret}\n", true ); @@ -1090,7 +1090,7 @@ class Linker { } $attribs['rel'] = Parser::getExternalLinkRel( $url, $title ); $link = ''; - $success = wfRunHooks( 'LinkerMakeExternalLink', + $success = Hooks::run( 'LinkerMakeExternalLink', array( &$url, &$text, &$link, &$attribs, $linktype ) ); if ( !$success ) { wfDebug( "Hook LinkerMakeExternalLink changed the output of link " @@ -1176,7 +1176,7 @@ class Linker { $items[] = self::emailLink( $userId, $userText ); } - wfRunHooks( 'UserToolLinksEdit', array( $userId, $userText, &$items ) ); + Hooks::run( 'UserToolLinksEdit', array( $userId, $userText, &$items ) ); if ( $items ) { return wfMessage( 'word-separator' )->plain() @@ -1333,7 +1333,7 @@ class Linker { $auto = $match[2]; $post = $match[3]; $comment = null; - wfRunHooks( 'FormatAutocomments', array( &$comment, $pre, $auto, $post, $title, $local ) ); + Hooks::run( 'FormatAutocomments', array( &$comment, $pre, $auto, $post, $title, $local ) ); if ( $comment === null ) { $link = ''; if ( $title ) { diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php index 392f5582f8..bd68551453 100644 --- a/includes/MWNamespace.php +++ b/includes/MWNamespace.php @@ -72,7 +72,7 @@ class MWNamespace { /** * @since 1.20 */ - wfRunHooks( 'NamespaceIsMovable', array( $index, &$result ) ); + Hooks::run( 'NamespaceIsMovable', array( $index, &$result ) ); return $result; } @@ -213,7 +213,7 @@ class MWNamespace { if ( is_array( $wgExtraNamespaces ) ) { $namespaces += $wgExtraNamespaces; } - wfRunHooks( 'CanonicalNamespaces', array( &$namespaces ) ); + Hooks::run( 'CanonicalNamespaces', array( &$namespaces ) ); } return $namespaces; } diff --git a/includes/MWTimestamp.php b/includes/MWTimestamp.php index 26f5e54370..4b3d36a71f 100644 --- a/includes/MWTimestamp.php +++ b/includes/MWTimestamp.php @@ -221,7 +221,7 @@ class MWTimestamp { $offsetRel = $relativeTo->offsetForUser( $user ); $ts = ''; - if ( wfRunHooks( 'GetHumanTimestamp', array( &$ts, $this, $relativeTo, $user, $lang ) ) ) { + if ( Hooks::run( 'GetHumanTimestamp', array( &$ts, $this, $relativeTo, $user, $lang ) ) ) { $ts = $lang->getHumanTimestamp( $this, $relativeTo, $user ); } @@ -326,7 +326,7 @@ class MWTimestamp { $ts = ''; $diff = $this->diff( $relativeTo ); - if ( wfRunHooks( + if ( Hooks::run( 'GetRelativeTimestamp', array( &$ts, &$diff, $this, $relativeTo, $user, $lang ) ) ) { diff --git a/includes/MagicWord.php b/includes/MagicWord.php index d281555296..4b24a00d86 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -273,7 +273,7 @@ class MagicWord { static function getVariableIDs() { if ( !self::$mVariableIDsInitialised ) { # Get variable IDs - wfRunHooks( 'MagicWordwgVariableIDs', array( &self::$mVariableIDs ) ); + Hooks::run( 'MagicWordwgVariableIDs', array( &self::$mVariableIDs ) ); self::$mVariableIDsInitialised = true; } return self::$mVariableIDs; @@ -308,7 +308,7 @@ class MagicWord { */ static function getDoubleUnderscoreArray() { if ( is_null( self::$mDoubleUnderscoreArray ) ) { - wfRunHooks( 'GetDoubleUnderscoreIDs', array( &self::$mDoubleUnderscoreIDs ) ); + Hooks::run( 'GetDoubleUnderscoreIDs', array( &self::$mDoubleUnderscoreIDs ) ); self::$mDoubleUnderscoreArray = new MagicWordArray( self::$mDoubleUnderscoreIDs ); } return self::$mDoubleUnderscoreArray; diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 7ce6d1b48f..6e2a0c93ac 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -169,7 +169,7 @@ class MediaWiki { } $unused = null; // To pass it by reference - wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) ); + Hooks::run( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) ); // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty. if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() ) @@ -233,7 +233,7 @@ class MediaWiki { && ( $request->getVal( 'title' ) === null || $title->getPrefixedDBkey() != $request->getVal( 'title' ) ) && !count( $request->getValueNames( array( 'action', 'title' ) ) ) - && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) + && Hooks::run( 'TestCanonicalRedirect', array( $request, $title, $output ) ) ) { if ( $title->isSpecialPage() ) { list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); @@ -342,7 +342,7 @@ class MediaWiki { // Give extensions a change to ignore/handle redirects as needed $ignoreRedirect = $target = false; - wfRunHooks( 'InitializeArticleMaybeRedirect', + Hooks::run( 'InitializeArticleMaybeRedirect', array( &$title, &$request, &$ignoreRedirect, &$target, &$article ) ); // Follow redirects only for... redirects. @@ -392,7 +392,7 @@ class MediaWiki { $title = $this->context->getTitle(); $user = $this->context->getUser(); - if ( !wfRunHooks( 'MediaWikiPerformAction', + if ( !Hooks::run( 'MediaWikiPerformAction', array( $output, $page, $title, $user, $request, $this ) ) ) { wfProfileOut( __METHOD__ ); @@ -416,7 +416,7 @@ class MediaWiki { return; } - if ( wfRunHooks( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) { + if ( Hooks::run( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) { $output->setStatusCode( 404 ); $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); } @@ -530,7 +530,7 @@ class MediaWiki { $redirUrl = preg_replace( '#^http://#', 'https://', $oldUrl ); // ATTENTION: This hook is likely to be removed soon due to overall design of the system. - if ( wfRunHooks( 'BeforeHttpsRedirect', array( $this->context, &$redirUrl ) ) ) { + if ( Hooks::run( 'BeforeHttpsRedirect', array( $this->context, &$redirUrl ) ) ) { if ( $request->wasPosted() ) { // This is weird and we'd hope it almost never happens. This diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 3406831444..d57f30524b 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -200,7 +200,7 @@ class MimeMagic { global $IP; # Allow media handling extensions adding MIME-types and MIME-info - wfRunHooks( 'MimeMagicInit', array( $this ) ); + Hooks::run( 'MimeMagicInit', array( $this ) ); $types = MM_WELL_KNOWN_MIME_TYPES; @@ -569,7 +569,7 @@ class MimeMagic { } # Media handling extensions can improve the MIME detected - wfRunHooks( 'MimeMagicImproveFromExtension', array( $this, $ext, &$mime ) ); + Hooks::run( 'MimeMagicImproveFromExtension', array( $this, $ext, &$mime ) ); if ( isset( $this->mMimeTypeAliases[$mime] ) ) { $mime = $this->mMimeTypeAliases[$mime]; @@ -802,7 +802,7 @@ class MimeMagic { # people will hopefully nag and submit patches :) $mime = false; # Some strings by reference for performance - assuming well-behaved hooks - wfRunHooks( + Hooks::run( 'MimeMagicGuessFromContent', array( $this, &$head, &$tail, $file, &$mime ) ); diff --git a/includes/MovePage.php b/includes/MovePage.php index 994be91e9f..065e189857 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -81,7 +81,7 @@ class MovePage { } } - wfRunHooks( 'MovePageCheckPermissions', + Hooks::run( 'MovePageCheckPermissions', array( $this->oldTitle, $this->newTitle, $user, $reason, $status ) ); @@ -146,7 +146,7 @@ class MovePage { } // Hook for extensions to say a title can't be moved for technical reasons - wfRunHooks( 'MovePageIsValidMove', array( $this->oldTitle, $this->newTitle, $status ) ); + Hooks::run( 'MovePageIsValidMove', array( $this->oldTitle, $this->newTitle, $status ) ); return $status; } @@ -231,7 +231,7 @@ class MovePage { public function move( User $user, $reason, $createRedirect ) { global $wgCategoryCollation; - wfRunHooks( 'TitleMove', array( $this->oldTitle, $this->newTitle, $user ) ); + Hooks::run( 'TitleMove', array( $this->oldTitle, $this->newTitle, $user ) ); // If it is a file, move it first. // It is done before all other moving stuff is done because it's hard to revert. @@ -370,7 +370,7 @@ class MovePage { $dbw->commit( __METHOD__ ); - wfRunHooks( 'TitleMoveComplete', array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) ); + Hooks::run( 'TitleMoveComplete', array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) ); return Status::newGood(); } @@ -486,7 +486,7 @@ class MovePage { $newpage->updateRevisionOn( $dbw, $nullRevision ); - wfRunHooks( 'NewRevisionFromEditComplete', + Hooks::run( 'NewRevisionFromEditComplete', array( $newpage, $nullRevision, $nullRevision->getParentId(), $user ) ); $newpage->doEditUpdates( $nullRevision, $user, @@ -513,7 +513,7 @@ class MovePage { $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); - wfRunHooks( 'NewRevisionFromEditComplete', + Hooks::run( 'NewRevisionFromEditComplete', array( $redirectArticle, $redirectRevision, false, $user ) ); $redirectArticle->doEditUpdates( $redirectRevision, $user, array( 'created' => true ) ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 32948844c8..24b9e46f42 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -786,7 +786,7 @@ class OutputPage extends ContextSource { // bug 44570: the core page itself may not change, but resources might $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config->get( 'SquidMaxage' ) ); } - wfRunHooks( 'OutputPageCheckLastModified', array( &$modifiedTimes ) ); + Hooks::run( 'OutputPageCheckLastModified', array( &$modifiedTimes ) ); $maxModified = max( $modifiedTimes ); $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified ); @@ -1325,7 +1325,7 @@ class OutputPage extends ContextSource { } # Add the remaining categories to the skin - if ( wfRunHooks( + if ( Hooks::run( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) { @@ -1765,8 +1765,8 @@ class OutputPage extends ContextSource { // Link flags are ignored for now, but may in the future be // used to mark individual language links. $linkFlags = array(); - wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) ); - wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) ); + Hooks::run( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) ); + Hooks::run( 'OutputPageParserOutput', array( &$this, $parserOutput ) ); } /** @@ -1795,7 +1795,7 @@ class OutputPage extends ContextSource { */ public function addParserOutputText( $parserOutput ) { $text = $parserOutput->getText(); - wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); + Hooks::run( 'OutputPageBeforeHTML', array( &$this, &$text ) ); $this->addHTML( $text ); } @@ -1920,7 +1920,7 @@ class OutputPage extends ContextSource { ), $config->get( 'CacheVaryCookies' ) ); - wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) ); + Hooks::run( 'GetCacheVaryCookies', array( $this, &$cookies ) ); } return $cookies; } @@ -2183,7 +2183,7 @@ class OutputPage extends ContextSource { $redirect = $this->mRedirect; $code = $this->mRedirectCode; - if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) { + if ( Hooks::run( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) { if ( $code == '301' || $code == '303' ) { if ( !$config->get( 'DebugRedirects' ) ) { $message = HttpStatus::getMessage( $code ); @@ -2260,7 +2260,7 @@ class OutputPage extends ContextSource { // Hook that allows last minute changes to the output page, e.g. // adding of CSS or Javascript by extensions. - wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) ); + Hooks::run( 'BeforePageDisplay', array( &$this, &$sk ) ); wfProfileIn( 'Output-skin' ); $sk->outputPage(); @@ -2268,7 +2268,7 @@ class OutputPage extends ContextSource { } // This hook allows last minute changes to final overall output by modifying output buffer - wfRunHooks( 'AfterFinalPageOutput', array( $this ) ); + Hooks::run( 'AfterFinalPageOutput', array( $this ) ); $this->sendCacheControl(); @@ -2697,7 +2697,7 @@ class OutputPage extends ContextSource { // Allow skins and extensions to add body attributes they need $sk->addToBodyAttributes( $this, $bodyAttrs ); - wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) ); + Hooks::run( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) ); $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n"; @@ -3247,7 +3247,7 @@ class OutputPage extends ContextSource { // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not // page-dependant but site-wide (without state). // Alternatively, you may want to use OutputPage->addJsConfigVars() instead. - wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) ); + Hooks::run( 'MakeGlobalVariablesScript', array( &$vars, $this ) ); // Merge in variables from addJsConfigVars last return array_merge( $vars, $this->getJsConfigVars() ); diff --git a/includes/Preferences.php b/includes/Preferences.php index 93844f6185..44995aca35 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -96,7 +96,7 @@ class Preferences { self::searchPreferences( $user, $context, $defaultPreferences ); self::miscPreferences( $user, $context, $defaultPreferences ); - wfRunHooks( 'GetPreferences', array( $user, &$defaultPreferences ) ); + Hooks::run( 'GetPreferences', array( $user, &$defaultPreferences ) ); self::loadPreferenceValues( $user, $context, $defaultPreferences ); self::$defaultPreferences = $defaultPreferences; @@ -1433,7 +1433,7 @@ class Preferences { $user->setOption( $key, $value ); } - wfRunHooks( 'PreferencesFormPreSave', array( $formData, $form, $user, &$result ) ); + Hooks::run( 'PreferencesFormPreSave', array( $formData, $form, $user, &$result ) ); $user->saveSettings(); } @@ -1575,7 +1575,7 @@ class PreferencesForm extends HTMLForm { */ function getLegend( $key ) { $legend = parent::getLegend( $key ); - wfRunHooks( 'PreferencesGetLegend', array( $this, $key, &$legend ) ); + Hooks::run( 'PreferencesGetLegend', array( $this, $key, &$legend ) ); return $legend; } } diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php index 4df6a9e51e..caa3ef5286 100644 --- a/includes/PrefixSearch.php +++ b/includes/PrefixSearch.php @@ -65,7 +65,7 @@ abstract class PrefixSearch { $search = $title->getText(); if ( $ns[0] == NS_MAIN ) { $ns = $namespaces; // no explicit prefix, use default namespaces - wfRunHooks( 'PrefixSearchExtractNamespace', array( &$ns, &$search ) ); + Hooks::run( 'PrefixSearchExtractNamespace', array( &$ns, &$search ) ); } return $this->searchBackend( $ns, $search, $limit, $offset ); } @@ -79,7 +79,7 @@ abstract class PrefixSearch { $namespaces = array( $title->getNamespace() ); $search = ''; } else { - wfRunHooks( 'PrefixSearchExtractNamespace', array( &$namespaces, &$search ) ); + Hooks::run( 'PrefixSearchExtractNamespace', array( &$namespaces, &$search ) ); } return $this->searchBackend( $namespaces, $search, $limit, $offset ); @@ -157,7 +157,7 @@ abstract class PrefixSearch { } } $srchres = array(); - if ( wfRunHooks( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres, $offset ) ) ) { + if ( Hooks::run( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres, $offset ) ) ) { return $this->titles( $this->defaultSearchBackend( $namespaces, $search, $limit, $offset ) ); } return $this->strings( $this->handleResultFromHook( $srchres, $namespaces, $search, $limit ) ); diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 7bad8b57ac..76ad2528ad 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -321,7 +321,7 @@ class ProtectionForm { * you can also return an array of message name and its parameters */ $errorMsg = ''; - if ( !wfRunHooks( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg, $reasonstr ) ) ) { + if ( !Hooks::run( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg, $reasonstr ) ) ) { if ( $errorMsg == '' ) { $errorMsg = array( 'hookaborted' ); } @@ -452,7 +452,7 @@ class ProtectionForm { ""; } # Give extensions a chance to add items to the form - wfRunHooks( 'ProtectionForm::buildForm', array( $this->mArticle, &$out ) ); + Hooks::run( 'ProtectionForm::buildForm', array( $this->mArticle, &$out ) ); $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' ); @@ -623,6 +623,6 @@ class ProtectionForm { $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) ); LogEventsList::showLogExtract( $out, 'protect', $this->mTitle ); # Let extensions add other relevant log extracts - wfRunHooks( 'ProtectionForm::showLogExtract', array( $this->mArticle, $out ) ); + Hooks::run( 'ProtectionForm::showLogExtract', array( $this->mArticle, $out ) ); } } diff --git a/includes/Revision.php b/includes/Revision.php index e81ed755f7..8ba79df4c7 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1419,7 +1419,7 @@ class Revision implements IDBAccessObject { $this->mId = $rev_id !== null ? $rev_id : $dbw->insertId(); - wfRunHooks( 'RevisionInsertComplete', array( &$this, $data, $flags ) ); + Hooks::run( 'RevisionInsertComplete', array( &$this, $data, $flags ) ); wfProfileOut( __METHOD__ ); return $this->mId; diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 16546430b9..11c30a2591 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -1855,7 +1855,7 @@ class Sanitizer { */ public static function validateEmail( $addr ) { $result = null; - if ( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) { + if ( !Hooks::run( 'isValidEmailAddr', array( $addr, &$result ) ) ) { return $result; } diff --git a/includes/Setup.php b/includes/Setup.php index f61de7eb6d..535b13d6cf 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -584,7 +584,7 @@ wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) . wfProfileOut( $fname . '-memcached' ); // Most of the config is out, some might want to run hooks here. -wfRunHooks( 'SetupAfterCache' ); +Hooks::run( 'SetupAfterCache' ); wfProfileIn( $fname . '-session' ); @@ -634,7 +634,7 @@ $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParser if ( !is_object( $wgAuth ) ) { $wgAuth = new AuthPlugin; - wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) ); + Hooks::run( 'AuthPluginSetup', array( &$wgAuth ) ); } /** diff --git a/includes/Title.php b/includes/Title.php index 0a9b433979..fa8d034b99 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1180,7 +1180,7 @@ class Title { } $result = true; - wfRunHooks( 'TitleIsMovable', array( $this, &$result ) ); + Hooks::run( 'TitleIsMovable', array( $this, &$result ) ); return $result; } @@ -1252,7 +1252,7 @@ class Title { # It's called here again to make sure hook functions can force this # method to return true even outside the MediaWiki namespace. - wfRunHooks( 'TitleIsCssOrJsPage', array( $this, &$isCssOrJsPage ), '1.25' ); + Hooks::run( 'TitleIsCssOrJsPage', array( $this, &$isCssOrJsPage ), '1.25' ); return $isCssOrJsPage; } @@ -1659,7 +1659,7 @@ class Title { # Finally, add the fragment. $url .= $this->getFragmentForURL(); - wfRunHooks( 'GetFullURL', array( &$this, &$url, $query ) ); + Hooks::run( 'GetFullURL', array( &$this, &$url, $query ) ); return $url; } @@ -1705,7 +1705,7 @@ class Title { $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); if ( $query == '' ) { $url = str_replace( '$1', $dbkey, $wgArticlePath ); - wfRunHooks( 'GetLocalURL::Article', array( &$this, &$url ) ); + Hooks::run( 'GetLocalURL::Article', array( &$this, &$url ) ); } else { global $wgVariantArticlePath, $wgActionPaths, $wgContLang; $url = false; @@ -1750,7 +1750,7 @@ class Title { } } - wfRunHooks( 'GetLocalURL::Internal', array( &$this, &$url, $query ) ); + Hooks::run( 'GetLocalURL::Internal', array( &$this, &$url, $query ) ); // @todo FIXME: This causes breakage in various places when we // actually expected a local URL and end up with dupe prefixes. @@ -1758,7 +1758,7 @@ class Title { $url = $wgServer . $url; } } - wfRunHooks( 'GetLocalURL', array( &$this, &$url, $query ) ); + Hooks::run( 'GetLocalURL', array( &$this, &$url, $query ) ); return $url; } @@ -1808,7 +1808,7 @@ class Title { $query = self::fixUrlQueryArgs( $query, $query2 ); $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; $url = wfExpandUrl( $server . $this->getLocalURL( $query ), PROTO_HTTP ); - wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) ); + Hooks::run( 'GetInternalURL', array( &$this, &$url, $query ) ); return $url; } @@ -1826,7 +1826,7 @@ class Title { public function getCanonicalURL( $query = '', $query2 = false ) { $query = self::fixUrlQueryArgs( $query, $query2 ); $url = wfExpandUrl( $this->getLocalURL( $query ) . $this->getFragmentForURL(), PROTO_CANONICAL ); - wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) ); + Hooks::run( 'GetCanonicalURL', array( &$this, &$url, $query ) ); return $url; } @@ -1945,7 +1945,7 @@ class Title { private function checkQuickPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) { - if ( !wfRunHooks( 'TitleQuickPermissions', + if ( !Hooks::run( 'TitleQuickPermissions', array( $this, $user, $action, &$errors, $doExpensiveQueries, $short ) ) ) { return $errors; @@ -2045,18 +2045,18 @@ class Title { private function checkPermissionHooks( $action, $user, $errors, $doExpensiveQueries, $short ) { // Use getUserPermissionsErrors instead $result = ''; - if ( !wfRunHooks( 'userCan', array( &$this, &$user, $action, &$result ) ) ) { + if ( !Hooks::run( 'userCan', array( &$this, &$user, $action, &$result ) ) ) { return $result ? array() : array( array( 'badaccess-group0' ) ); } // Check getUserPermissionsErrors hook - if ( !wfRunHooks( 'getUserPermissionsErrors', array( &$this, &$user, $action, &$result ) ) ) { + if ( !Hooks::run( 'getUserPermissionsErrors', array( &$this, &$user, $action, &$result ) ) ) { $errors = $this->resultToError( $errors, $result ); } // Check getUserPermissionsErrorsExpensive hook if ( $doExpensiveQueries && !( $short && count( $errors ) > 0 ) - && !wfRunHooks( 'getUserPermissionsErrorsExpensive', array( &$this, &$user, $action, &$result ) ) + && !Hooks::run( 'getUserPermissionsErrorsExpensive', array( &$this, &$user, $action, &$result ) ) ) { $errors = $this->resultToError( $errors, $result ); } @@ -2389,7 +2389,7 @@ class Title { if ( !$whitelisted ) { # If the title is not whitelisted, give extensions a chance to do so... - wfRunHooks( 'TitleReadWhitelist', array( $this, $user, &$whitelisted ) ); + Hooks::run( 'TitleReadWhitelist', array( $this, $user, &$whitelisted ) ); if ( !$whitelisted ) { $errors[] = $this->missingPermissionError( $action, $short ); } @@ -2523,7 +2523,7 @@ class Title { $types = array_diff( $types, array( 'upload' ) ); } - wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); + Hooks::run( 'TitleGetRestrictionTypes', array( $this, &$types ) ); wfDebug( __METHOD__ . ': applicable restrictions to [[' . $this->getPrefixedText() . ']] are {' . implode( ',', $types ) . "}\n" ); @@ -3576,7 +3576,7 @@ class Title { $urls[] = $this->getInternalUrl( 'action=raw&ctype=text/css' ); } - wfRunHooks( 'TitleSquidURLs', array( $this, &$urls ) ); + Hooks::run( 'TitleSquidURLs', array( $this, &$urls ) ); return $urls; } @@ -4247,7 +4247,7 @@ class Title { */ public function exists() { $exists = $this->getArticleID() != 0; - wfRunHooks( 'TitleExists', array( $this, &$exists ) ); + Hooks::run( 'TitleExists', array( $this, &$exists ) ); return $exists; } @@ -4280,7 +4280,7 @@ class Title { * @param Title $title * @param bool|null $isKnown */ - wfRunHooks( 'TitleIsAlwaysKnown', array( $this, &$isKnown ) ); + Hooks::run( 'TitleIsAlwaysKnown', array( $this, &$isKnown ) ); if ( !is_null( $isKnown ) ) { return $isKnown; @@ -4603,7 +4603,7 @@ class Title { // on the Title object passed in, and should probably // tell the users to run updateCollations.php --force // in order to re-sort existing category relations. - wfRunHooks( 'GetDefaultSortkey', array( $this, &$unprefixed ) ); + Hooks::run( 'GetDefaultSortkey', array( $this, &$unprefixed ) ); if ( $prefix !== '' ) { # Separate with a line feed, so the unprefixed part is only used as # a tiebreaker when two pages have the exact same prefix. @@ -4724,7 +4724,7 @@ class Title { } } - wfRunHooks( 'TitleGetEditNotices', array( $this, $oldid, &$notices ) ); + Hooks::run( 'TitleGetEditNotices', array( $this, $oldid, &$notices ) ); return $notices; } } diff --git a/includes/TitleArray.php b/includes/TitleArray.php index b67d9f4d67..0fb5b1e96b 100644 --- a/includes/TitleArray.php +++ b/includes/TitleArray.php @@ -37,7 +37,7 @@ abstract class TitleArray implements Iterator { */ static function newFromResult( $res ) { $array = null; - if ( !wfRunHooks( 'TitleArrayFromResult', array( &$array, $res ) ) ) { + if ( !Hooks::run( 'TitleArrayFromResult', array( &$array, $res ) ) ) { return null; } if ( $array === null ) { diff --git a/includes/User.php b/includes/User.php index 3cbb05240f..bda825f2be 100644 --- a/includes/User.php +++ b/includes/User.php @@ -350,7 +350,7 @@ class User implements IDBAccessObject { // Loading from session failed. Load defaults. $this->loadDefaults(); } - wfRunHooks( 'UserLoadAfterLoadFromSession', array( $this ) ); + Hooks::run( 'UserLoadAfterLoadFromSession', array( $this ) ); break; default: wfProfileOut( __METHOD__ ); @@ -709,7 +709,7 @@ class User implements IDBAccessObject { static $reservedUsernames = false; if ( !$reservedUsernames ) { $reservedUsernames = $wgReservedUsernames; - wfRunHooks( 'UserGetReservedNames', array( &$reservedUsernames ) ); + Hooks::run( 'UserGetReservedNames', array( &$reservedUsernames ) ); } // Certain names may be reserved for batch processes. @@ -817,7 +817,7 @@ class User implements IDBAccessObject { $result = false; //init $result to false for the internal checks - if ( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) ) { + if ( !Hooks::run( 'isValidPassword', array( $password, &$result, $this ) ) ) { $status->error( $result ); return $status; } @@ -879,7 +879,7 @@ class User implements IDBAccessObject { ); } // Give extensions a chance to force an expiration - wfRunHooks( 'ResetPasswordExpiration', array( $this, &$newExpire ) ); + Hooks::run( 'ResetPasswordExpiration', array( $this, &$newExpire ) ); $this->mPasswordExpires = $newExpire; } @@ -1049,7 +1049,7 @@ class User implements IDBAccessObject { $this->mRegistration = wfTimestamp( TS_MW ); $this->mGroups = array(); - wfRunHooks( 'UserLoadDefaults', array( $this, $name ) ); + Hooks::run( 'UserLoadDefaults', array( $this, $name ) ); wfProfileOut( __METHOD__ ); } @@ -1088,7 +1088,7 @@ class User implements IDBAccessObject { */ private function loadFromSession() { $result = null; - wfRunHooks( 'UserLoadFromSession', array( $this, &$result ) ); + Hooks::run( 'UserLoadFromSession', array( $this, &$result ) ); if ( $result !== null ) { return $result; } @@ -1190,7 +1190,7 @@ class User implements IDBAccessObject { : array() ); - wfRunHooks( 'UserLoadFromDatabase', array( $this, &$s ) ); + Hooks::run( 'UserLoadFromDatabase', array( $this, &$s ) ); if ( $s !== false ) { // Initialise user table data @@ -1456,7 +1456,7 @@ class User implements IDBAccessObject { } $defOpt['skin'] = Skin::normalizeKey( $wgDefaultSkin ); - wfRunHooks( 'UserGetDefaultOptions', array( &$defOpt ) ); + Hooks::run( 'UserGetDefaultOptions', array( &$defOpt ) ); return $defOpt; } @@ -1562,7 +1562,7 @@ class User implements IDBAccessObject { } // Extensions - wfRunHooks( 'GetBlockedStatus', array( &$this ) ); + Hooks::run( 'GetBlockedStatus', array( &$this ) ); wfProfileOut( __METHOD__ ); } @@ -1702,7 +1702,7 @@ class User implements IDBAccessObject { public function pingLimiter( $action = 'edit', $incrBy = 1 ) { // Call the 'PingLimiter' hook $result = false; - if ( !wfRunHooks( 'PingLimiter', array( &$this, $action, &$result, $incrBy ) ) ) { + if ( !Hooks::run( 'PingLimiter', array( &$this, $action, &$result, $incrBy ) ) ) { return $result; } @@ -1846,7 +1846,7 @@ class User implements IDBAccessObject { wfDebug( __METHOD__ . ": self-talk page, ignoring any blocks\n" ); } - wfRunHooks( 'UserIsBlockedFrom', array( $this, $title, &$blocked, &$allowUsertalk ) ); + Hooks::run( 'UserIsBlockedFrom', array( $this, $title, &$blocked, &$allowUsertalk ) ); wfProfileOut( __METHOD__ ); return $blocked; @@ -1898,7 +1898,7 @@ class User implements IDBAccessObject { $ip = $this->getRequest()->getIP(); } $blocked = false; - wfRunHooks( 'UserIsBlockedGlobally', array( &$this, $ip, &$blocked ) ); + Hooks::run( 'UserIsBlockedGlobally', array( &$this, $ip, &$blocked ) ); $this->mBlockedGlobally = (bool)$blocked; return $this->mBlockedGlobally; } @@ -2058,7 +2058,7 @@ class User implements IDBAccessObject { */ public function getNewMessageLinks() { $talks = array(); - if ( !wfRunHooks( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) ) { + if ( !Hooks::run( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) ) { return $talks; } elseif ( !$this->getNewtalk() ) { return array(); @@ -2435,7 +2435,7 @@ class User implements IDBAccessObject { */ public function getEmail() { $this->load(); - wfRunHooks( 'UserGetEmail', array( $this, &$this->mEmail ) ); + Hooks::run( 'UserGetEmail', array( $this, &$this->mEmail ) ); return $this->mEmail; } @@ -2445,7 +2445,7 @@ class User implements IDBAccessObject { */ public function getEmailAuthenticationTimestamp() { $this->load(); - wfRunHooks( 'UserGetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) ); + Hooks::run( 'UserGetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) ); return $this->mEmailAuthenticated; } @@ -2460,7 +2460,7 @@ class User implements IDBAccessObject { } $this->invalidateEmail(); $this->mEmail = $str; - wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) ); + Hooks::run( 'UserSetEmail', array( $this, &$this->mEmail ) ); } /** @@ -2836,7 +2836,7 @@ class User implements IDBAccessObject { } } - wfRunHooks( 'UserResetAllOptions', array( $this, &$newOptions, $this->mOptions, $resetKinds ) ); + Hooks::run( 'UserResetAllOptions', array( $this, &$newOptions, $this->mOptions, $resetKinds ) ); $this->mOptions = $newOptions; $this->mOptionsLoaded = true; @@ -2872,7 +2872,7 @@ class User implements IDBAccessObject { return false; } else { $https = $this->getBoolOption( 'prefershttps' ); - wfRunHooks( 'UserRequiresHTTPS', array( $this, &$https ) ); + Hooks::run( 'UserRequiresHTTPS', array( $this, &$https ) ); if ( $https ) { $https = wfCanIPUseHTTPS( $this->getRequest()->getIP() ); } @@ -2903,7 +2903,7 @@ class User implements IDBAccessObject { public function getRights() { if ( is_null( $this->mRights ) ) { $this->mRights = self::getGroupPermissions( $this->getEffectiveGroups() ); - wfRunHooks( 'UserGetRights', array( $this, &$this->mRights ) ); + Hooks::run( 'UserGetRights', array( $this, &$this->mRights ) ); // Force reindexation of rights when a hook has unset one of them $this->mRights = array_values( array_unique( $this->mRights ) ); } @@ -2936,7 +2936,7 @@ class User implements IDBAccessObject { $this->getAutomaticGroups( $recache ) // implicit groups ) ); // Hook for additional groups - wfRunHooks( 'UserEffectiveGroups', array( &$this, &$this->mEffectiveGroups ) ); + Hooks::run( 'UserEffectiveGroups', array( &$this, &$this->mEffectiveGroups ) ); // Force reindexation of groups when a hook has unset one of them $this->mEffectiveGroups = array_values( array_unique( $this->mEffectiveGroups ) ); wfProfileOut( __METHOD__ ); @@ -3033,7 +3033,7 @@ class User implements IDBAccessObject { * @param string $group Name of the group to add */ public function addGroup( $group ) { - if ( wfRunHooks( 'UserAddGroup', array( $this, &$group ) ) ) { + if ( Hooks::run( 'UserAddGroup', array( $this, &$group ) ) ) { $dbw = wfGetDB( DB_MASTER ); if ( $this->getId() ) { $dbw->insert( 'user_groups', @@ -3066,7 +3066,7 @@ class User implements IDBAccessObject { */ public function removeGroup( $group ) { $this->load(); - if ( wfRunHooks( 'UserRemoveGroup', array( $this, &$group ) ) ) { + if ( Hooks::run( 'UserRemoveGroup', array( $this, &$group ) ) ) { $dbw = wfGetDB( DB_MASTER ); $dbw->delete( 'user_groups', array( @@ -3290,7 +3290,7 @@ class User implements IDBAccessObject { // If we're working on user's talk page, we should update the talk page message indicator if ( $title->getNamespace() == NS_USER_TALK && $title->getText() == $this->getName() ) { - if ( !wfRunHooks( 'UserClearNewTalkNotification', array( &$this, $oldid ) ) ) { + if ( !Hooks::run( 'UserClearNewTalkNotification', array( &$this, $oldid ) ) ) { return; } @@ -3435,7 +3435,7 @@ class User implements IDBAccessObject { $cookies['Token'] = false; } - wfRunHooks( 'UserSetCookies', array( $this, &$session, &$cookies ) ); + Hooks::run( 'UserSetCookies', array( $this, &$session, &$cookies ) ); foreach ( $session as $name => $value ) { $request->setSessionData( $name, $value ); @@ -3470,7 +3470,7 @@ class User implements IDBAccessObject { * Log this user out. */ public function logout() { - if ( wfRunHooks( 'UserLogout', array( &$this ) ) ) { + if ( Hooks::run( 'UserLogout', array( &$this ) ) ) { $this->doLogout(); } } @@ -3535,7 +3535,7 @@ class User implements IDBAccessObject { $this->saveOptions(); - wfRunHooks( 'UserSaveSettings', array( $this ) ); + Hooks::run( 'UserSaveSettings', array( $this ) ); $this->clearSharedCache(); $this->getUserPage()->invalidateCache(); } @@ -4133,7 +4133,7 @@ class User implements IDBAccessObject { // and fire the ConfirmEmailComplete hook on redundant confirmations. if ( !$this->isEmailConfirmed() ) { $this->setEmailAuthenticationTimestamp( wfTimestampNow() ); - wfRunHooks( 'ConfirmEmailComplete', array( $this ) ); + Hooks::run( 'ConfirmEmailComplete', array( $this ) ); } return true; } @@ -4151,7 +4151,7 @@ class User implements IDBAccessObject { $this->mEmailTokenExpires = null; $this->setEmailAuthenticationTimestamp( null ); $this->mEmail = ''; - wfRunHooks( 'InvalidateEmailComplete', array( $this ) ); + Hooks::run( 'InvalidateEmailComplete', array( $this ) ); return true; } @@ -4162,7 +4162,7 @@ class User implements IDBAccessObject { public function setEmailAuthenticationTimestamp( $timestamp ) { $this->load(); $this->mEmailAuthenticated = $timestamp; - wfRunHooks( 'UserSetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) ); + Hooks::run( 'UserSetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) ); } /** @@ -4176,7 +4176,7 @@ class User implements IDBAccessObject { return false; } $canSend = $this->isEmailConfirmed(); - wfRunHooks( 'UserCanSendEmail', array( &$this, &$canSend ) ); + Hooks::run( 'UserCanSendEmail', array( &$this, &$canSend ) ); return $canSend; } @@ -4203,7 +4203,7 @@ class User implements IDBAccessObject { global $wgEmailAuthentication; $this->load(); $confirmed = true; - if ( wfRunHooks( 'EmailConfirmed', array( &$this, &$confirmed ) ) ) { + if ( Hooks::run( 'EmailConfirmed', array( &$this, &$confirmed ) ) ) { if ( $this->isAnon() ) { return false; } @@ -4361,7 +4361,7 @@ class User implements IDBAccessObject { } // Allow extensions (e.g. OAuth) to say false - if ( !wfRunHooks( 'UserIsEveryoneAllowed', array( $right ) ) ) { + if ( !Hooks::run( 'UserIsEveryoneAllowed', array( $right ) ) ) { $cache[$right] = false; return false; } @@ -4419,7 +4419,7 @@ class User implements IDBAccessObject { } else { self::$mAllRights = self::$mCoreRights; } - wfRunHooks( 'UserGetAllRights', array( &self::$mAllRights ) ); + Hooks::run( 'UserGetAllRights', array( &self::$mAllRights ) ); } return self::$mAllRights; } @@ -4433,7 +4433,7 @@ class User implements IDBAccessObject { $groups = $wgImplicitGroups; # Deprecated, use $wgImplicitGroups instead - wfRunHooks( 'UserGetImplicitGroups', array( &$groups ), '1.25' ); + Hooks::run( 'UserGetImplicitGroups', array( &$groups ), '1.25' ); return $groups; } @@ -4867,7 +4867,7 @@ class User implements IDBAccessObject { $this->mOptionsLoaded = true; - wfRunHooks( 'UserLoadOptions', array( $this, &$this->mOptions ) ); + Hooks::run( 'UserLoadOptions', array( $this, &$this->mOptions ) ); } /** @@ -4883,7 +4883,7 @@ class User implements IDBAccessObject { // Allow hooks to abort, for instance to save to a global profile. // Reset options to default state before saving. - if ( !wfRunHooks( 'UserSaveOptions', array( $this, &$saveOptions ) ) ) { + if ( !Hooks::run( 'UserSaveOptions', array( $this, &$saveOptions ) ) ) { return; } diff --git a/includes/UserArray.php b/includes/UserArray.php index 7da658272a..e5621da3af 100644 --- a/includes/UserArray.php +++ b/includes/UserArray.php @@ -27,7 +27,7 @@ abstract class UserArray implements Iterator { */ static function newFromResult( $res ) { $userArray = null; - if ( !wfRunHooks( 'UserArrayFromResult', array( &$userArray, $res ) ) ) { + if ( !Hooks::run( 'UserArrayFromResult', array( &$userArray, $res ) ) ) { return null; } if ( $userArray === null ) { diff --git a/includes/WebRequest.php b/includes/WebRequest.php index bf99e95b59..e931f286a4 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -138,7 +138,7 @@ class WebRequest { ); } - wfRunHooks( 'WebRequestPathInfoRouter', array( $router ) ); + Hooks::run( 'WebRequestPathInfoRouter', array( $router ) ); $matches = $router->parse( $path ); } @@ -1118,7 +1118,7 @@ HTML; } # Allow extensions to improve our guess - wfRunHooks( 'GetIP', array( &$ip ) ); + Hooks::run( 'GetIP', array( &$ip ) ); if ( !$ip ) { throw new MWException( "Unable to determine IP." ); diff --git a/includes/WebResponse.php b/includes/WebResponse.php index d39f884789..f977c205aa 100644 --- a/includes/WebResponse.php +++ b/includes/WebResponse.php @@ -105,7 +105,7 @@ class WebResponse { $func = $options['raw'] ? 'setrawcookie' : 'setcookie'; - if ( wfRunHooks( 'WebResponseSetCookie', array( &$name, &$value, &$expire, $options ) ) ) { + if ( Hooks::run( 'WebResponseSetCookie', array( &$name, &$value, &$expire, $options ) ) ) { wfDebugLog( 'cookie', $func . ': "' . implode( '", "', array( diff --git a/includes/actions/EditAction.php b/includes/actions/EditAction.php index 8876724412..6c8440ac1a 100644 --- a/includes/actions/EditAction.php +++ b/includes/actions/EditAction.php @@ -51,7 +51,7 @@ class EditAction extends FormlessAction { $page = $this->page; $user = $this->getUser(); - if ( wfRunHooks( 'CustomEditor', array( $page, $user ) ) ) { + if ( Hooks::run( 'CustomEditor', array( $page, $user ) ) ) { $editor = new EditPage( $page ); $editor->edit(); } diff --git a/includes/actions/FormAction.php b/includes/actions/FormAction.php index 4c9e85dd0b..26f43cb0c2 100644 --- a/includes/actions/FormAction.php +++ b/includes/actions/FormAction.php @@ -63,7 +63,7 @@ abstract class FormAction extends Action { $this->fields = $this->getFormFields(); // Give hooks a chance to alter the form, adding extra fields or text etc - wfRunHooks( 'ActionModifyFormFields', array( $this->getName(), &$this->fields, $this->page ) ); + Hooks::run( 'ActionModifyFormFields', array( $this->getName(), &$this->fields, $this->page ) ); $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() ); $form->setSubmitCallback( array( $this, 'onSubmit' ) ); @@ -81,7 +81,7 @@ abstract class FormAction extends Action { $this->alterForm( $form ); // Give hooks a chance to alter the form, adding extra fields or text etc - wfRunHooks( 'ActionBeforeFormDisplay', array( $this->getName(), &$form, $this->page ) ); + Hooks::run( 'ActionBeforeFormDisplay', array( $this->getName(), &$form, $this->page ) ); return $form; } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 3be8aff907..6ee5d2c60d 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -204,7 +204,7 @@ class HistoryAction extends FormlessAction { '' ); - wfRunHooks( 'PageHistoryBeforeList', array( &$this->page, $this->getContext() ) ); + Hooks::run( 'PageHistoryBeforeList', array( &$this->page, $this->getContext() ) ); // Create and output the list. $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds ); @@ -420,7 +420,7 @@ class HistoryPager extends ReverseChronologicalPager { $queryInfo['options'], $this->tagFilter ); - wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) ); + Hooks::run( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; } @@ -710,7 +710,7 @@ class HistoryPager extends ReverseChronologicalPager { } } // Allow extension to add their own links here - wfRunHooks( 'HistoryRevisionTools', array( $rev, &$tools ) ); + Hooks::run( 'HistoryRevisionTools', array( $rev, &$tools ) ); if ( $tools ) { $s2 .= ' ' . $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped(); @@ -728,7 +728,7 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' . . ' . $s2; } - wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) ); + Hooks::run( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) ); $attribs = array(); if ( $classes ) { diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index e7455f6e95..ad8e719fc8 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -114,7 +114,7 @@ class InfoAction extends FormlessAction { $pageInfo = $this->pageInfo(); // Allow extensions to add additional information - wfRunHooks( 'InfoAction', array( $this->getContext(), &$pageInfo ) ); + Hooks::run( 'InfoAction', array( $this->getContext(), &$pageInfo ) ); // Render page information foreach ( $pageInfo as $header => $infoTable ) { diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index d0d956ec36..727bed2015 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -117,7 +117,7 @@ class RawAction extends FormlessAction { $response->header( 'HTTP/1.x 404 Not Found' ); } - if ( !wfRunHooks( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) { + if ( !Hooks::run( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) { wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" ); } diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index 8c9a46a5b9..f333efb5a9 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -132,10 +132,10 @@ class WatchAction extends FormAction { $page = WikiPage::factory( $title ); $status = Status::newFatal( 'hookaborted' ); - if ( wfRunHooks( 'WatchArticle', array( &$user, &$page, &$status ) ) ) { + if ( Hooks::run( 'WatchArticle', array( &$user, &$page, &$status ) ) ) { $status = Status::newGood(); $user->addWatch( $title, $checkRights ); - wfRunHooks( 'WatchArticleComplete', array( &$user, &$page ) ); + Hooks::run( 'WatchArticleComplete', array( &$user, &$page ) ); } return $status; @@ -156,10 +156,10 @@ class WatchAction extends FormAction { $page = WikiPage::factory( $title ); $status = Status::newFatal( 'hookaborted' ); - if ( wfRunHooks( 'UnwatchArticle', array( &$user, &$page, &$status ) ) ) { + if ( Hooks::run( 'UnwatchArticle', array( &$user, &$page, &$status ) ) ) { $status = Status::newGood(); $user->removeWatch( $title ); - wfRunHooks( 'UnwatchArticleComplete', array( &$user, &$page ) ); + Hooks::run( 'UnwatchArticleComplete', array( &$user, &$page ) ); } return $status; diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index bbfe7ccf13..9cb895d3ac 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1957,7 +1957,7 @@ abstract class ApiBase extends ContextSource { */ public function getFinalDescription() { $desc = $this->getDescription(); - wfRunHooks( 'APIGetDescription', array( &$this, &$desc ) ); + Hooks::run( 'APIGetDescription', array( &$this, &$desc ) ); $desc = self::escapeWikiText( $desc ); if ( is_array( $desc ) ) { $desc = join( "\n", $desc ); @@ -1975,7 +1975,7 @@ abstract class ApiBase extends ContextSource { } $msgs = array( $msg ); - wfRunHooks( 'APIGetDescriptionMessages', array( $this, &$msgs ) ); + Hooks::run( 'APIGetDescriptionMessages', array( $this, &$msgs ) ); return $msgs; } @@ -2005,7 +2005,7 @@ abstract class ApiBase extends ContextSource { ) + ( isset( $params['token'] ) ? $params['token'] : array() ); } - wfRunHooks( 'APIGetAllowedParams', array( &$this, &$params, $flags ) ); + Hooks::run( 'APIGetAllowedParams', array( &$this, &$params, $flags ) ); return $params; } @@ -2019,7 +2019,7 @@ abstract class ApiBase extends ContextSource { */ public function getFinalParamDescription() { $desc = $this->getParamDescription(); - wfRunHooks( 'APIGetParamDescription', array( &$this, &$desc ) ); + Hooks::run( 'APIGetParamDescription', array( &$this, &$desc ) ); if ( !$desc ) { $desc = array(); @@ -2087,7 +2087,7 @@ abstract class ApiBase extends ContextSource { } } - wfRunHooks( 'APIGetParamDescriptionMessages', array( $this, &$msgs ) ); + Hooks::run( 'APIGetParamDescriptionMessages', array( $this, &$msgs ) ); return $msgs; } diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php index 89f8481ef5..a7ba48a102 100644 --- a/includes/api/ApiCreateAccount.php +++ b/includes/api/ApiCreateAccount.php @@ -83,7 +83,7 @@ class ApiCreateAccount extends ApiBase { $loginForm = new LoginForm(); $loginForm->setContext( $context ); - wfRunHooks( 'AddNewAccountApiForm', array( $this, $loginForm ) ); + Hooks::run( 'AddNewAccountApiForm', array( $this, $loginForm ) ); $loginForm->load(); $status = $loginForm->addNewaccountInternal(); @@ -113,7 +113,7 @@ class ApiCreateAccount extends ApiBase { // Save settings (including confirmation token) $user->saveSettings(); - wfRunHooks( 'AddNewAccount', array( $user, $params['mailpassword'] ) ); + Hooks::run( 'AddNewAccount', array( $user, $params['mailpassword'] ) ); if ( $params['mailpassword'] ) { $logAction = 'byemail'; @@ -160,7 +160,7 @@ class ApiCreateAccount extends ApiBase { } // Give extensions a chance to modify the API result data - wfRunHooks( 'AddNewAccountApiResult', array( $this, $loginForm, &$result ) ); + Hooks::run( 'AddNewAccountApiResult', array( $this, $loginForm, &$result ) ); $apiResult->addValue( null, 'createaccount', $result ); } diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 92c951d362..f663cc6559 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -382,7 +382,7 @@ class ApiEditPage extends ApiBase { // Run hooks // Handle APIEditBeforeSave parameters $r = array(); - if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $content, &$r ) ) ) { + if ( !Hooks::run( 'APIEditBeforeSave', array( $ep, $content, &$r ) ) ) { if ( count( $r ) ) { $r['result'] = 'Failure'; $apiResult->addValue( null, $this->getModuleName(), $r ); diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 913b8ebc4a..7bbd968709 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -172,7 +172,7 @@ abstract class ApiFormatBase extends ApiBase { ) ); - if ( wfRunHooks( 'ApiFormatHighlight', array( $context, $result, $mime, $format ) ) ) { + if ( Hooks::run( 'ApiFormatHighlight', array( $context, $result, $mime, $format ) ) ) { $out->addHTML( Html::element( 'pre', array( 'class' => 'api-pretty-content' ), $result ) ); diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 5d46a07522..8708fb78db 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -609,7 +609,7 @@ class ApiHelp extends ApiBase { $module->modifyHelp( $help, $options ); - wfRunHooks( 'APIHelpModifyOutput', array( $module, &$help, $options ) ); + Hooks::run( 'APIHelpModifyOutput', array( $module, &$help, $options ) ); $out .= join( "\n", $help ); } diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index cc4dee4473..920dbbfa24 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -92,7 +92,7 @@ class ApiLogin extends ApiBase { // @todo FIXME: Split back and frontend from this hook. // @todo FIXME: This hook should be placed in the backend $injected_html = ''; - wfRunHooks( 'UserLoginComplete', array( &$user, &$injected_html ) ); + Hooks::run( 'UserLoginComplete', array( &$user, &$injected_html ) ); $result['result'] = 'Success'; $result['lguserid'] = intval( $user->getId() ); diff --git a/includes/api/ApiLogout.php b/includes/api/ApiLogout.php index bf81723fde..bf0ca9c68b 100644 --- a/includes/api/ApiLogout.php +++ b/includes/api/ApiLogout.php @@ -39,7 +39,7 @@ class ApiLogout extends ApiBase { // Give extensions to do something after user logout $injected_html = ''; - wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) ); + Hooks::run( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) ); } public function isReadMode() { diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 3d04f95a8d..81353f64b1 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -192,7 +192,7 @@ class ApiMain extends ApiBase { if ( $uselang === 'user' ) { $uselang = $this->getUser()->getOption( 'language' ); $uselang = RequestContext::sanitizeLangCode( $uselang ); - wfRunHooks( 'UserGetLanguageObject', array( $this->getUser(), &$uselang, $this ) ); + Hooks::run( 'UserGetLanguageObject', array( $this->getUser(), &$uselang, $this ) ); } elseif ( $uselang === 'content' ) { global $wgContLang; $uselang = $wgContLang->getCode(); @@ -418,7 +418,7 @@ class ApiMain extends ApiBase { } // Allow extra cleanup and logging - wfRunHooks( 'ApiMain::onException', array( $this, $e ) ); + Hooks::run( 'ApiMain::onException', array( $this, $e ) ); // Log it if ( !( $e instanceof UsageException ) ) { @@ -878,7 +878,7 @@ class ApiMain extends ApiBase { // Allow extensions to stop execution for arbitrary reasons. $message = false; - if ( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) { + if ( !Hooks::run( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) { $this->dieUsageMsg( $message ); } } @@ -952,7 +952,7 @@ class ApiMain extends ApiBase { // Execute $module->profileIn(); $module->execute(); - wfRunHooks( 'APIAfterExecute', array( &$module ) ); + Hooks::run( 'APIAfterExecute', array( &$module ) ); $module->profileOut(); $this->reportUnusedParams(); diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 3b56dec6bd..f4b99aee2b 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -96,7 +96,7 @@ class ApiOpenSearch extends ApiBase { $this->search( $search, $limit, $namespaces, $resolveRedir, $results ); // Allow hooks to populate extracts and images - wfRunHooks( 'ApiOpenSearchSuggest', array( &$results ) ); + Hooks::run( 'ApiOpenSearchSuggest', array( &$results ) ); // Trim extracts, if necessary $length = $this->getConfig()->get( 'OpenSearchDescriptionLength' ); diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index c70629a920..1417ef7833 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -179,7 +179,7 @@ class ApiPageSet extends ApiBase { if ( !$isDryRun ) { $generator->executeGenerator( $this ); - wfRunHooks( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) ); + Hooks::run( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) ); } else { // Prevent warnings from being reported on these parameters $main = $this->getMain(); diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index f2603853c2..ff91b92a48 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -267,7 +267,7 @@ class ApiParse extends ApiBase { // Link flags are ignored for now, but may in the future be // included in the result. $linkFlags = array(); - wfRunHooks( 'LanguageLinks', array( $titleObj, &$langlinks, &$linkFlags ) ); + Hooks::run( 'LanguageLinks', array( $titleObj, &$langlinks, &$linkFlags ) ); } } else { $langlinks = false; diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index bd28408b64..514d559430 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -295,7 +295,7 @@ class ApiQuery extends ApiBase { $cacheMode, $module->getCacheMode( $params ) ); $module->profileIn(); $module->execute(); - wfRunHooks( 'APIQueryAfterExecute', array( &$module ) ); + Hooks::run( 'APIQueryAfterExecute', array( &$module ) ); $module->profileOut(); } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 263ab0d00e..88b2074eff 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -104,7 +104,7 @@ class ApiQueryInfo extends ApiQueryBase { 'import' => array( 'ApiQueryInfo', 'getImportToken' ), 'watch' => array( 'ApiQueryInfo', 'getWatchToken' ), ); - wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) ); + Hooks::run( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) ); return $this->tokenFunctions; } @@ -463,7 +463,7 @@ class ApiQueryInfo extends ApiQueryBase { $pageInfo['preload'] = ''; } else { $text = null; - wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) ); + Hooks::run( 'EditFormPreloadText', array( &$text, &$title ) ); $pageInfo['preload'] = $text; } diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index e20380e9e9..cdc61cd5a7 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -64,7 +64,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->tokenFunctions = array( 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' ) ); - wfRunHooks( 'APIQueryRecentChangesTokens', array( &$this->tokenFunctions ) ); + Hooks::run( 'APIQueryRecentChangesTokens', array( &$this->tokenFunctions ) ); return $this->tokenFunctions; } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 32355b91a9..7092fc43d3 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -61,7 +61,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { $this->tokenFunctions = array( 'rollback' => array( 'ApiQueryRevisions', 'getRollbackToken' ) ); - wfRunHooks( 'APIQueryRevisionsTokens', array( &$this->tokenFunctions ) ); + Hooks::run( 'APIQueryRevisionsTokens', array( &$this->tokenFunctions ) ); return $this->tokenFunctions; } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 3b8a514b93..f373021e0a 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -274,7 +274,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data['favicon'] = wfExpandUrl( $favicon, PROTO_RELATIVE ); } - wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) ); + Hooks::run( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) ); return $this->getResult()->addValue( 'query', $property, $data ); } @@ -490,7 +490,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) ); $data['jobs'] = intval( SiteStats::jobs() ); - wfRunHooks( 'APIQuerySiteInfoStatisticsInfo', array( &$data ) ); + Hooks::run( 'APIQuerySiteInfoStatisticsInfo', array( &$data ) ); return $this->getResult()->addValue( 'query', $property, $data ); } diff --git a/includes/api/ApiQueryTokens.php b/includes/api/ApiQueryTokens.php index 279e8e304f..e8d725893d 100644 --- a/includes/api/ApiQueryTokens.php +++ b/includes/api/ApiQueryTokens.php @@ -63,7 +63,7 @@ class ApiQueryTokens extends ApiQueryBase { 'rollback' => 'rollback', 'userrights' => 'userrights', ); - wfRunHooks( 'ApiQueryTokensRegisterTypes', array( &$salts ) ); + Hooks::run( 'ApiQueryTokensRegisterTypes', array( &$salts ) ); ksort( $salts ); wfProfileOut( __METHOD__ ); } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index db8cc1c819..b7f2f9ac53 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -75,7 +75,7 @@ class ApiQueryUsers extends ApiQueryBase { $this->tokenFunctions = array( 'userrights' => array( 'ApiQueryUsers', 'getUserrightsToken' ), ); - wfRunHooks( 'APIQueryUsersTokens', array( &$this->tokenFunctions ) ); + Hooks::run( 'APIQueryUsersTokens', array( &$this->tokenFunctions ) ); return $this->tokenFunctions; } diff --git a/includes/api/ApiRsd.php b/includes/api/ApiRsd.php index 91f3266a71..f28e610fce 100644 --- a/includes/api/ApiRsd.php +++ b/includes/api/ApiRsd.php @@ -99,7 +99,7 @@ class ApiRsd extends ApiBase { ) ), ); - wfRunHooks( 'ApiRsdServiceApis', array( &$apis ) ); + Hooks::run( 'ApiRsdServiceApis', array( &$apis ) ); return $apis; } diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php index 2a60af99d7..f7290af9cb 100644 --- a/includes/api/ApiTokens.php +++ b/includes/api/ApiTokens.php @@ -70,7 +70,7 @@ class ApiTokens extends ApiBase { foreach ( $names as $name ) { $types[$name] = array( 'ApiQueryInfo', 'get' . ucfirst( $name ) . 'Token' ); } - wfRunHooks( 'ApiTokensGetTokenTypes', array( &$types ) ); + Hooks::run( 'ApiTokensGetTokenTypes', array( &$types ) ); ksort( $types ); wfProfileOut( __METHOD__ ); diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 943ae8e0e6..c23e9ff6a4 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -69,7 +69,7 @@ class ApiUndelete extends ApiBase { } if ( $retval[1] ) { - wfRunHooks( 'FileUndeleteComplete', + Hooks::run( 'FileUndeleteComplete', array( $titleObj, $params['fileids'], $this->getUser(), $params['reason'] ) ); } diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index ed62bba04b..753263cea7 100644 --- a/includes/cache/BacklinkCache.php +++ b/includes/cache/BacklinkCache.php @@ -255,7 +255,7 @@ class BacklinkCache { return $prefixes[$table]; } else { $prefix = null; - wfRunHooks( 'BacklinkCacheGetPrefix', array( $table, &$prefix ) ); + Hooks::run( 'BacklinkCacheGetPrefix', array( $table, &$prefix ) ); if ( $prefix ) { return $prefix; } else { @@ -303,7 +303,7 @@ class BacklinkCache { break; default: $conds = null; - wfRunHooks( 'BacklinkCacheGetConditions', array( $table, $this->title, &$conds ) ); + Hooks::run( 'BacklinkCacheGetConditions', array( $table, $this->title, &$conds ) ); if ( !$conds ) { throw new MWException( "Invalid table \"$table\" in " . __CLASS__ ); } diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php index 58ca2dcd5e..c07032bf03 100644 --- a/includes/cache/HTMLFileCache.php +++ b/includes/cache/HTMLFileCache.php @@ -131,7 +131,7 @@ class HTMLFileCache extends FileCacheBase { return false; } // Allow extensions to disable caching - return wfRunHooks( 'HTMLFileCache::useFileCache', array( $context ) ); + return Hooks::run( 'HTMLFileCache::useFileCache', array( $context ) ); } /** diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index c79d0089f7..03162c01eb 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -945,7 +945,7 @@ class LocalisationCache { # Allow extensions an opportunity to adjust the data for this # fallback - wfRunHooks( 'LocalisationCacheRecacheFallback', array( $this, $csCode, &$csData ) ); + Hooks::run( 'LocalisationCacheRecacheFallback', array( $this, $csCode, &$csData ) ); # Merge the data for this fallback into the final array if ( $csCode === $code ) { @@ -1003,7 +1003,7 @@ class LocalisationCache { } # Run hooks $purgeBlobs = true; - wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) ); + Hooks::run( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) ); if ( is_null( $allData['namespaceNames'] ) ) { wfProfileOut( __METHOD__ ); diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 43e00cd1bb..532236e589 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -575,7 +575,7 @@ class MessageCache { global $wgContLang; MessageBlobStore::getInstance()->updateMessage( $wgContLang->lcfirst( $msg ) ); - wfRunHooks( 'MessageCacheReplace', array( $title, $text ) ); + Hooks::run( 'MessageCacheReplace', array( $title, $text ) ); wfProfileOut( __METHOD__ ); } @@ -736,7 +736,7 @@ class MessageCache { $lckey = $wgContLang->lcfirst( $lckey ); } - wfRunHooks( 'MessageCache::get', array( &$lckey ) ); + Hooks::run( 'MessageCache::get', array( &$lckey ) ); if ( ord( $lckey ) < 128 ) { $uckey = ucfirst( $lckey ); @@ -909,7 +909,7 @@ class MessageCache { } else { // XXX: This is not cached in process cache, should it? $message = false; - wfRunHooks( 'MessagesPreLoad', array( $title, &$message ) ); + Hooks::run( 'MessagesPreLoad', array( $title, &$message ) ); if ( $message !== false ) { return $message; } diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 03d1289f4b..932006d4ce 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -67,7 +67,7 @@ class ChangesList extends ContextSource { $user = $context->getUser(); $sk = $context->getSkin(); $list = null; - if ( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) { + if ( Hooks::run( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) { $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) ); return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context ); @@ -180,7 +180,7 @@ class ChangesList extends ContextSource { * @param ResultWrapper|array $rows */ public function initChangesListRows( $rows ) { - wfRunHooks( 'ChangesListInitRows', array( $this, $rows ) ); + Hooks::run( 'ChangesListInitRows', array( $this, $rows ) ); } /** @@ -364,7 +364,7 @@ class ChangesList extends ContextSource { # RTL/LTR marker $articlelink .= $this->getLanguage()->getDirMark(); - wfRunHooks( 'ChangesListInsertArticleLink', + Hooks::run( 'ChangesListInsertArticleLink', array( &$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched ) ); $s .= " $articlelink"; diff --git a/includes/changes/OldChangesList.php b/includes/changes/OldChangesList.php index c9602cc4c9..5067886c88 100644 --- a/includes/changes/OldChangesList.php +++ b/includes/changes/OldChangesList.php @@ -56,7 +56,7 @@ class OldChangesList extends ChangesList { $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] ); } - if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$html, $rc, &$classes ) ) ) { + if ( !Hooks::run( 'OldChangesListRecentChangesLine', array( &$this, &$html, $rc, &$classes ) ) ) { wfProfileOut( __METHOD__ ); return false; diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index bf0c644e5e..c719d8da58 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -309,7 +309,7 @@ class RecentChange { $this->mAttribs['rc_id'] = $dbw->insertId(); # Notify extensions - wfRunHooks( 'RecentChange_save', array( &$this ) ); + Hooks::run( 'RecentChange_save', array( &$this ) ); # Notify external application via UDP if ( !$noudp ) { @@ -321,7 +321,7 @@ class RecentChange { $editor = $this->getPerformer(); $title = $this->getTitle(); - if ( wfRunHooks( 'AbortEmailNotification', array( $editor, $title, $this ) ) ) { + if ( Hooks::run( 'AbortEmailNotification', array( $editor, $title, $this ) ) ) { # @todo FIXME: This would be better as an extension hook $enotif = new EmailNotification(); $enotif->notifyOnPageChange( $editor, $title, @@ -445,7 +445,7 @@ class RecentChange { // Automatic patrol needs "autopatrol", ordinary patrol needs "patrol" $right = $auto ? 'autopatrol' : 'patrol'; $errors = array_merge( $errors, $this->getTitle()->getUserPermissionsErrors( $right, $user ) ); - if ( !wfRunHooks( 'MarkPatrolled', array( $this->getAttribute( 'rc_id' ), &$user, false ) ) ) { + if ( !Hooks::run( 'MarkPatrolled', array( $this->getAttribute( 'rc_id' ), &$user, false ) ) ) { $errors[] = array( 'hookaborted' ); } // Users without the 'autopatrol' right can't patrol their @@ -466,7 +466,7 @@ class RecentChange { $this->reallyMarkPatrolled(); // Log this patrol event PatrolLog::record( $this, $auto, $user ); - wfRunHooks( 'MarkPatrolledComplete', array( $this->getAttribute( 'rc_id' ), &$user, false ) ); + Hooks::run( 'MarkPatrolledComplete', array( $this->getAttribute( 'rc_id' ), &$user, false ) ); return array(); } diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php index cb39fac57d..816572ca01 100644 --- a/includes/content/AbstractContent.php +++ b/includes/content/AbstractContent.php @@ -446,7 +446,7 @@ abstract class AbstractContent implements Content { $lossy = ( $lossy === 'lossy' ); // string flag, convert to boolean for convenience $result = false; - wfRunHooks( 'ConvertContent', array( $this, $toModel, $lossy, &$result ) ); + Hooks::run( 'ConvertContent', array( $this, $toModel, $lossy, &$result ) ); return $result; } @@ -480,7 +480,7 @@ abstract class AbstractContent implements Content { $po = new ParserOutput(); - if ( wfRunHooks( 'ContentGetParserOutput', + if ( Hooks::run( 'ContentGetParserOutput', array( $this, $title, $revId, $options, $generateHtml, &$po ) ) ) { // Save and restore the old value, just in case something is reusing @@ -491,7 +491,7 @@ abstract class AbstractContent implements Content { $options->setRedirectTarget( $oldRedir ); } - wfRunHooks( 'ContentAlterParserOutput', array( $this, $title, $po ) ); + Hooks::run( 'ContentAlterParserOutput', array( $this, $title, $po ) ); return $po; } diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 9aa42dd65b..8c806c6517 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -201,7 +201,7 @@ abstract class ContentHandler { $model = MWNamespace::getNamespaceContentModel( $ns ); // Hook can determine default model - if ( !wfRunHooks( 'ContentHandlerDefaultModelFor', array( $title, &$model ) ) ) { + if ( !Hooks::run( 'ContentHandlerDefaultModelFor', array( $title, &$model ) ) ) { if ( !is_null( $model ) ) { return $model; } @@ -214,7 +214,7 @@ abstract class ContentHandler { } // Hook can force JS/CSS - wfRunHooks( 'TitleIsCssOrJsPage', array( $title, &$isCssOrJsPage ), '1.25' ); + Hooks::run( 'TitleIsCssOrJsPage', array( $title, &$isCssOrJsPage ), '1.25' ); // Is this a .css subpage of a user page? $isJsCssSubpage = NS_USER == $ns @@ -229,7 +229,7 @@ abstract class ContentHandler { $isWikitext = $isWikitext && !$isCssOrJsPage && !$isJsCssSubpage; // Hook can override $isWikitext - wfRunHooks( 'TitleIsWikitextPage', array( $title, &$isWikitext ), '1.25' ); + Hooks::run( 'TitleIsWikitextPage', array( $title, &$isWikitext ), '1.25' ); if ( !$isWikitext ) { switch ( $ext ) { @@ -318,7 +318,7 @@ abstract class ContentHandler { if ( empty( $wgContentHandlers[$modelId] ) ) { $handler = null; - wfRunHooks( 'ContentHandlerForModelID', array( $modelId, &$handler ) ); + Hooks::run( 'ContentHandlerForModelID', array( $modelId, &$handler ) ); if ( $handler === null ) { throw new MWException( "No handler for model '$modelId' registered in \$wgContentHandlers" ); @@ -660,7 +660,7 @@ abstract class ContentHandler { $pageLang = wfGetLangObj( $lang ); } - wfRunHooks( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) ); + Hooks::run( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) ); return wfGetLangObj( $pageLang ); } @@ -719,7 +719,7 @@ abstract class ContentHandler { public function canBeUsedOn( Title $title ) { $ok = true; - wfRunHooks( 'ContentModelCanBeUsedOn', array( $this->getModelID(), $title, &$ok ) ); + Hooks::run( 'ContentModelCanBeUsedOn', array( $this->getModelID(), $title, &$ok ) ); return $ok; } @@ -1151,7 +1151,7 @@ abstract class ContentHandler { } // call the hook functions - $ok = wfRunHooks( $event, $args ); + $ok = Hooks::run( $event, $args ); // see if the hook changed the text foreach ( $contentTexts as $k => $orig ) { diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index 9a8ab3a6c4..7593d7ce33 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -93,7 +93,7 @@ class WikitextContent extends TextContent { # Inserting a new section $subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' ) ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : ''; - if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) { + if ( Hooks::run( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) { $text = strlen( trim( $oldtext ) ) > 0 ? "{$oldtext}\n\n{$subject}{$text}" : "{$subject}{$text}"; diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index d620be9c87..2a610a3a73 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -322,7 +322,7 @@ class RequestContext implements IContextSource { $code = $request->getVal( 'uselang', $user->getOption( 'language' ) ); $code = self::sanitizeLangCode( $code ); - wfRunHooks( 'UserGetLanguageObject', array( $user, &$code, $this ) ); + Hooks::run( 'UserGetLanguageObject', array( $user, &$code, $this ) ); if ( $code === $this->getConfig()->get( 'LanguageCode' ) ) { $this->lang = $wgContLang; @@ -362,7 +362,7 @@ class RequestContext implements IContextSource { wfProfileIn( __METHOD__ . '-createskin' ); $skin = null; - wfRunHooks( 'RequestContextCreateSkin', array( $this, &$skin ) ); + Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) ); $factory = SkinFactory::getDefaultInstance(); // If the hook worked try to set a skin from it diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index f031f78012..e1502069cc 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -229,7 +229,7 @@ class DatabaseOracle extends DatabaseBase { } $p['tablePrefix'] = strtoupper( $p['tablePrefix'] ); parent::__construct( $p ); - wfRunHooks( 'DatabaseOraclePostInit', array( $this ) ); + Hooks::run( 'DatabaseOraclePostInit', array( $this ) ); } function __destruct() { diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 45d26648a4..4e5af0bff5 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -140,16 +140,16 @@ class LinksUpdate extends SqlDataUpdate { $this->mRecursive = $recursive; - wfRunHooks( 'LinksUpdateConstructed', array( &$this ) ); + Hooks::run( 'LinksUpdateConstructed', array( &$this ) ); } /** * Update link tables with outgoing links from an updated article */ public function doUpdate() { - wfRunHooks( 'LinksUpdate', array( &$this ) ); + Hooks::run( 'LinksUpdate', array( &$this ) ); $this->doIncrementalUpdate(); - wfRunHooks( 'LinksUpdateComplete', array( &$this ) ); + Hooks::run( 'LinksUpdateComplete', array( &$this ) ); } protected function doIncrementalUpdate() { @@ -339,7 +339,7 @@ class LinksUpdate extends SqlDataUpdate { } if ( count( $insertions ) ) { $this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' ); - wfRunHooks( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) ); + Hooks::run( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) ); } } diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index dd5f3c7b2c..c8871932ee 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -283,7 +283,7 @@ class DifferenceEngine extends ContextSource { $samePage = true; $oldHeader = ''; } else { - wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) ); + Hooks::run( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) ); if ( $this->mNewPage->equals( $this->mOldPage ) ) { $out->setPageTitle( $this->msg( 'difference-title', $this->mNewPage->getPrefixedText() ) ); @@ -387,7 +387,7 @@ class DifferenceEngine extends ContextSource { $rdel = $this->revisionDeleteLink( $this->mNewRev ); # Allow extensions to define their own revision tools - wfRunHooks( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools, $this->mOldRev ) ); + Hooks::run( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools, $this->mOldRev ) ); $formattedRevisionTools = array(); // Put each one in parentheses (poor man's button) foreach ( $revisionTools as $key => $tool ) { @@ -555,7 +555,7 @@ class DifferenceEngine extends ContextSource {

{$revHeader}

\n" ); # Page content may be handled by a hooked call instead... # @codingStandardsIgnoreStart Ignoring long lines. - if ( wfRunHooks( 'ArticleContentOnDiff', array( $this, $out ) ) ) { + if ( Hooks::run( 'ArticleContentOnDiff', array( $this, $out ) ) ) { $this->loadNewText(); $out->setRevisionId( $this->mNewid ); $out->setRevisionTimestamp( $this->mNewRev->getTimestamp() ); @@ -575,7 +575,7 @@ class DifferenceEngine extends ContextSource { $out->addParserOutputContent( $po ); } } - } elseif ( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { + } elseif ( !Hooks::run( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { // Handled by extension } elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { // NOTE: deprecated hook, B/C only @@ -742,7 +742,7 @@ class DifferenceEngine extends ContextSource { $difftext = $this->generateContentDiffBody( $this->mOldContent, $this->mNewContent ); // Save to cache for 7 days - if ( !wfRunHooks( 'AbortDiffCache', array( &$this ) ) ) { + if ( !Hooks::run( 'AbortDiffCache', array( &$this ) ) ) { wfIncrStats( 'diff_uncacheable' ); } elseif ( $key !== false && $difftext !== false ) { wfIncrStats( 'diff_cache_miss' ); @@ -1224,7 +1224,7 @@ class DifferenceEngine extends ContextSource { $this->mNewid = 0; } - wfRunHooks( + Hooks::run( 'NewDifferenceEngine', array( $this->getTitle(), &$this->mOldid, &$this->mNewid, $old, $new ) ); diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index ae6b6595c4..58311d3742 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1125,7 +1125,7 @@ abstract class File { $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $transformParams, $flags ); } // Give extensions a chance to do something with this thumbnail... - wfRunHooks( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) ); + Hooks::run( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) ); } // Purge. Useful in the event of Core -> Squid connection failure or squid diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 9f1466955a..f1f8af4373 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -913,7 +913,7 @@ class LocalFile extends File { $files = $this->getThumbnails( $archiveName ); // Purge any custom thumbnail caches - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, $archiveName ) ); + Hooks::run( 'LocalFilePurgeThumbnails', array( $this, $archiveName ) ); $dir = array_shift( $files ); $this->purgeThumbList( $dir, $files ); @@ -958,7 +958,7 @@ class LocalFile extends File { } // Purge any custom thumbnail caches - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, false ) ); + Hooks::run( 'LocalFilePurgeThumbnails', array( $this, false ) ); $dir = array_shift( $files ); $this->purgeThumbList( $dir, $files ); @@ -1035,7 +1035,7 @@ class LocalFile extends File { $opts['ORDER BY'] = "oi_timestamp $order"; $opts['USE INDEX'] = array( 'oldimage' => 'oi_name_timestamp' ); - wfRunHooks( 'LocalFile::getHistory', array( &$this, &$tables, &$fields, + Hooks::run( 'LocalFile::getHistory', array( &$this, &$tables, &$fields, &$conds, &$opts, &$join_conds ) ); $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $opts, $join_conds ); @@ -1423,7 +1423,7 @@ class LocalFile extends File { if ( !is_null( $nullRevision ) ) { $nullRevision->insertOn( $dbw ); - wfRunHooks( 'NewRevisionFromEditComplete', array( $wikiPage, $nullRevision, $latest, $user ) ); + Hooks::run( 'NewRevisionFromEditComplete', array( $wikiPage, $nullRevision, $latest, $user ) ); $wikiPage->updateRevisionOn( $dbw, $nullRevision ); } } @@ -1484,7 +1484,7 @@ class LocalFile extends File { # Hooks, hooks, the magic of hooks... wfProfileIn( __METHOD__ . '-hooks' ); - wfRunHooks( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) ); + Hooks::run( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) ); wfProfileOut( __METHOD__ . '-hooks' ); # Invalidate cache for all pages using this file diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php index b0a593de97..bb9a90395a 100644 --- a/includes/gallery/ImageGalleryBase.php +++ b/includes/gallery/ImageGalleryBase.php @@ -120,7 +120,7 @@ abstract class ImageGalleryBase extends ContextSource { 'packed-overlay' => 'PackedOverlayImageGallery', ); // Allow extensions to make a new gallery format. - wfRunHooks( 'GalleryGetModes', self::$modeMapping ); + Hooks::run( 'GalleryGetModes', self::$modeMapping ); } } diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php index 37f2221f92..ac61067dd7 100644 --- a/includes/gallery/TraditionalImageGallery.php +++ b/includes/gallery/TraditionalImageGallery.php @@ -72,7 +72,7 @@ class TraditionalImageGallery extends ImageGalleryBase { if ( $this->mParser instanceof Parser ) { # Give extensions a chance to select the file revision for us $options = array(); - wfRunHooks( 'BeforeParserFetchFileAndTitle', + Hooks::run( 'BeforeParserFetchFileAndTitle', array( $this->mParser, $nt, &$options, &$descQuery ) ); # Fetch and register the file (file title may be different via hooks) list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $options ); diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index c34d09e570..ea1213c306 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -115,7 +115,7 @@ abstract class DatabaseUpdater { $this->maintenance->setDB( $db ); $this->initOldGlobals(); $this->loadExtensions(); - wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); + Hooks::run( 'LoadExtensionSchemaUpdates', array( $this ) ); } /** diff --git a/includes/interwiki/Interwiki.php b/includes/interwiki/Interwiki.php index 37a9fcfc0a..02fbb0802b 100644 --- a/includes/interwiki/Interwiki.php +++ b/includes/interwiki/Interwiki.php @@ -194,7 +194,7 @@ class Interwiki { global $wgMemc, $wgInterwikiExpiry; $iwData = array(); - if ( !wfRunHooks( 'InterwikiLoadPrefix', array( $prefix, &$iwData ) ) ) { + if ( !Hooks::run( 'InterwikiLoadPrefix', array( $prefix, &$iwData ) ) ) { return Interwiki::loadFromArray( $iwData ); } diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index e03cf1cd94..f7eaec3078 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -273,7 +273,7 @@ class LogEventsList extends ContextSource { } else { // Allow extensions to add their own extra inputs $input = ''; - wfRunHooks( 'LogEventsListGetExtraInputs', array( $types[0], $this, &$input ) ); + Hooks::run( 'LogEventsListGetExtraInputs', array( $types[0], $this, &$input ) ); return $input; } } @@ -632,7 +632,7 @@ class LogEventsList extends ContextSource { } /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */ - if ( wfRunHooks( 'LogEventsListShowLogExtract', array( &$s, $types, $page, $user, $param ) ) ) { + if ( Hooks::run( 'LogEventsListShowLogExtract', array( &$s, $types, $page, $user, $param ) ) ) { // $out can be either an OutputPage object or a String-by-reference if ( $out instanceof OutputPage ) { $out->addHTML( $s ); diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index bbe2f42975..464b723f71 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -812,7 +812,7 @@ class LegacyLogFormatter extends LogFormatter { $params = $this->entry->getParameters(); - wfRunHooks( 'LogLine', array( $type, $subtype, $title, $params, + Hooks::run( 'LogLine', array( $type, $subtype, $title, $params, &$this->comment, &$this->revert, $this->entry->getTimestamp() ) ); return $this->revert; diff --git a/includes/mail/EmailNotification.php b/includes/mail/EmailNotification.php index 8215403e66..220c6b1a87 100644 --- a/includes/mail/EmailNotification.php +++ b/includes/mail/EmailNotification.php @@ -224,7 +224,7 @@ class EmailNotification { $formattedPageStatus = array( 'deleted', 'created', 'moved', 'restored', 'changed' ); - wfRunHooks( 'UpdateUserMailerFormattedPageStatus', array( &$formattedPageStatus ) ); + Hooks::run( 'UpdateUserMailerFormattedPageStatus', array( &$formattedPageStatus ) ); if ( !in_array( $this->pageStatus, $formattedPageStatus ) ) { wfProfileOut( __METHOD__ ); throw new MWException( 'Not a valid page status!' ); @@ -251,7 +251,7 @@ class EmailNotification { && $watchingUser->isEmailConfirmed() && $watchingUser->getID() != $userTalkId ) { - if ( wfRunHooks( 'SendWatchlistEmailNotification', array( $watchingUser, $title, $this ) ) ) { + if ( Hooks::run( 'SendWatchlistEmailNotification', array( $watchingUser, $title, $this ) ) ) { $this->compose( $watchingUser ); } } @@ -295,7 +295,7 @@ class EmailNotification { ) { if ( !$targetUser->isEmailConfirmed() ) { wfDebug( __METHOD__ . ": talk page owner doesn't have validated email\n" ); - } elseif ( !wfRunHooks( 'AbortTalkPageEmailNotification', array( $targetUser, $title ) ) ) { + } elseif ( !Hooks::run( 'AbortTalkPageEmailNotification', array( $targetUser, $title ) ) ) { wfDebug( __METHOD__ . ": talk page update notification is aborted for this user\n" ); } else { wfDebug( __METHOD__ . ": sending talk page update notification\n" ); diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index b5a57a8465..3cabdaebd4 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -191,7 +191,7 @@ class UserMailer { $extraParams = $wgAdditionalMailParams; // Hook to generate custom VERP address for 'Return-Path' - wfRunHooks( 'UserMailerChangeReturnPath', array( $to, &$returnPath ) ); + Hooks::run( 'UserMailerChangeReturnPath', array( $to, &$returnPath ) ); # Add the envelope sender address using the -f command line option when PHP mail() is used. # Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the # generated VERP address when the hook runs effectively. @@ -250,7 +250,7 @@ class UserMailer { $headers['Content-transfer-encoding'] = '8bit'; } - $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) ); + $ret = Hooks::run( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) ); if ( $ret === false ) { // the hook implementation will return false to skip regular mail sending return Status::newGood(); diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 07d7618c60..8cf95dd824 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -1614,7 +1614,7 @@ class FormatMetadata extends ContextSource { $cachedValue = $wgMemc->get( $cacheKey ); if ( $cachedValue - && wfRunHooks( 'ValidateExtendedMetadataCache', array( $cachedValue['timestamp'], $file ) ) + && Hooks::run( 'ValidateExtendedMetadataCache', array( $cachedValue['timestamp'], $file ) ) ) { $extendedMetadata = $cachedValue['data']; } else { @@ -1717,7 +1717,7 @@ class FormatMetadata extends ContextSource { ) { wfProfileIn( __METHOD__ ); - wfRunHooks( 'GetExtendedMetadata', array( + Hooks::run( 'GetExtendedMetadata', array( &$extendedMetadata, $file, $this->getContext(), diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index 64ca011560..b88a1b12a0 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -162,7 +162,7 @@ abstract class MediaHandler { */ static function getMetadataVersion() { $version = array( '2' ); // core metadata version - wfRunHooks( 'GetMetadataVersion', array( &$version ) ); + Hooks::run( 'GetMetadataVersion', array( &$version ) ); return implode( ';', $version ); } diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index d9327fb5e1..a22cd1c8ba 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -410,7 +410,7 @@ class ThumbnailImage extends MediaTransformOutput { $attribs['srcset'] = Html::srcSet( $this->responsiveUrls ); } - wfRunHooks( 'ThumbnailBeforeProduceHTML', array( $this, &$attribs, &$linkAttribs ) ); + Hooks::run( 'ThumbnailBeforeProduceHTML', array( $this, &$attribs, &$linkAttribs ) ); return $this->linkWrap( $linkAttribs, Xml::element( 'img', $attribs ) ); } diff --git a/includes/media/TransformationalImageHandler.php b/includes/media/TransformationalImageHandler.php index b3ae296569..5b9982def9 100644 --- a/includes/media/TransformationalImageHandler.php +++ b/includes/media/TransformationalImageHandler.php @@ -64,7 +64,7 @@ abstract class TransformationalImageHandler extends ImageHandler { # Check if the file is smaller than the maximum image area for thumbnailing # For historical reasons, hook starts with BitmapHandler $checkImageAreaHookResult = null; - wfRunHooks( + Hooks::run( 'BitmapHandlerCheckImageArea', array( $image, &$params, &$checkImageAreaHookResult ) ); @@ -240,7 +240,7 @@ abstract class TransformationalImageHandler extends ImageHandler { # Try a hook. Called "Bitmap" for historical reasons. /** @var $mto MediaTransformOutput */ $mto = null; - wfRunHooks( 'BitmapHandlerTransform', array( $this, $image, &$scalerParams, &$mto ) ); + Hooks::run( 'BitmapHandlerTransform', array( $this, $image, &$scalerParams, &$mto ) ); if ( !is_null( $mto ) ) { wfDebug( __METHOD__ . ": Hook to BitmapHandlerTransform created an mto\n" ); $scaler = 'hookaborted'; diff --git a/includes/media/XMP.php b/includes/media/XMP.php index cdbd5ab2ad..5b46af1e93 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -173,7 +173,7 @@ class XMPReader { $data = $this->results; - wfRunHooks( 'XMPGetResults', array( &$data ) ); + Hooks::run( 'XMPGetResults', array( &$data ) ); if ( isset( $data['xmp-special']['AuthorsPosition'] ) && is_string( $data['xmp-special']['AuthorsPosition'] ) diff --git a/includes/media/XMPInfo.php b/includes/media/XMPInfo.php index 7e47ec14e3..e0a491cbcf 100644 --- a/includes/media/XMPInfo.php +++ b/includes/media/XMPInfo.php @@ -34,7 +34,7 @@ class XMPInfo { if ( !self::$ranHooks ) { // This is for if someone makes a custom metadata extension. // For example, a medical wiki might want to decode DICOM xmp properties. - wfRunHooks( 'XMPGetInfo', array( &self::$items ) ); + Hooks::run( 'XMPGetInfo', array( &self::$items ) ); self::$ranHooks = true; // Only want to do this once. } diff --git a/includes/page/Article.php b/includes/page/Article.php index e3541bd9a8..0318f654f7 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -120,7 +120,7 @@ class Article implements Page { } $page = null; - wfRunHooks( 'ArticleFromTitle', array( &$title, &$page, $context ) ); + Hooks::run( 'ArticleFromTitle', array( &$title, &$page, $context ) ); if ( !$page ) { switch ( $title->getNamespace() ) { case NS_FILE: @@ -428,7 +428,7 @@ class Article implements Page { ); $this->mRevIdFetched = $this->mRevision->getId(); - wfRunHooks( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) ); + Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) ); wfProfileOut( __METHOD__ ); @@ -602,7 +602,7 @@ class Article implements Page { while ( !$outputDone && ++$pass ) { switch ( $pass ) { case 1: - wfRunHooks( 'ArticleViewHeader', array( &$this, &$outputDone, &$useParserCache ) ); + Hooks::run( 'ArticleViewHeader', array( &$this, &$outputDone, &$useParserCache ) ); break; case 2: # Early abort if the page doesn't exist @@ -665,7 +665,7 @@ class Article implements Page { wfDebug( __METHOD__ . ": showing CSS/JS source\n" ); $this->showCssOrJsPage(); $outputDone = true; - } elseif ( !wfRunHooks( 'ArticleContentViewCustom', + } elseif ( !Hooks::run( 'ArticleContentViewCustom', array( $this->fetchContentObject(), $this->getTitle(), $outputPage ) ) ) { # Allow extensions do their own custom view for certain pages @@ -995,7 +995,7 @@ class Article implements Page { if ( isset( $this->mRedirectedFrom ) ) { // This is an internally redirected page view. // We'll need a backlink to the source page for navigation. - if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) { + if ( Hooks::run( 'ArticleViewRedirect', array( &$this ) ) ) { $redir = Linker::linkKnown( $this->mRedirectedFrom, null, @@ -1073,7 +1073,7 @@ class Article implements Page { // Show a footer allowing the user to patrol the shown revision or page if possible $patrolFooterShown = $this->showPatrolFooter(); - wfRunHooks( 'ArticleViewFooter', array( $this, $patrolFooterShown ) ); + Hooks::run( 'ArticleViewFooter', array( $this, $patrolFooterShown ) ); } /** @@ -1244,12 +1244,12 @@ class Article implements Page { } } - wfRunHooks( 'ShowMissingArticle', array( $this ) ); + Hooks::run( 'ShowMissingArticle', array( $this ) ); // Give extensions a chance to hide their (unrelated) log entries $logTypes = array( 'delete', 'move' ); $conds = array( "log_action != 'revision'" ); - wfRunHooks( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) ); + Hooks::run( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) ); # Show delete and move logs LogEventsList::showLogExtract( $outputPage, $logTypes, $title, '', @@ -1270,7 +1270,7 @@ class Article implements Page { $outputPage->setIndexPolicy( $policy['index'] ); $outputPage->setFollowPolicy( $policy['follow'] ); - $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array( $this ) ); + $hookResult = Hooks::run( 'BeforeDisplayNoArticleText', array( $this ) ); if ( !$hookResult ) { return; @@ -1346,7 +1346,7 @@ class Article implements Page { * @param int $oldid Revision ID of this article revision */ public function setOldSubtitle( $oldid = 0 ) { - if ( !wfRunHooks( 'DisplayOldSubtitle', array( &$this, &$oldid ) ) ) { + if ( !Hooks::run( 'DisplayOldSubtitle', array( &$this, &$oldid ) ) ) { return; } @@ -1697,7 +1697,7 @@ class Article implements Page { } $outputPage->addWikiMsg( 'confirmdeletetext' ); - wfRunHooks( 'ArticleConfirmDelete', array( $this, $outputPage, &$reason ) ); + Hooks::run( 'ArticleConfirmDelete', array( $this, $outputPage, &$reason ) ); $user = $this->getContext()->getUser(); @@ -1808,7 +1808,7 @@ class Article implements Page { $outputPage->addWikiMsg( 'deletedtext', wfEscapeWikiText( $deleted ), $loglink ); - wfRunHooks( 'ArticleDeleteAfterSuccess', array( $this->getTitle(), $outputPage ) ); + Hooks::run( 'ArticleDeleteAfterSuccess', array( $this->getTitle(), $outputPage ) ); $outputPage->returnToMain( false ); } else { @@ -1882,7 +1882,7 @@ class Article implements Page { && !$this->mRedirectedFrom && !$this->getTitle()->isRedirect(); // Extension may have reason to disable file caching on some pages. if ( $cacheable ) { - $cacheable = wfRunHooks( 'IsFileCacheable', array( &$this ) ); + $cacheable = Hooks::run( 'IsFileCacheable', array( &$this ) ); } } diff --git a/includes/page/CategoryPage.php b/includes/page/CategoryPage.php index 9abc6a89b0..03a5b89a0d 100644 --- a/includes/page/CategoryPage.php +++ b/includes/page/CategoryPage.php @@ -61,7 +61,7 @@ class CategoryPage extends Article { return; } - if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) ) { + if ( !Hooks::run( 'CategoryPageView', array( &$this ) ) ) { return; } diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index 348eff1431..b9f99c8bec 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -76,7 +76,7 @@ class ImagePage extends Article { $this->fileLoaded = true; $this->displayImg = $img = false; - wfRunHooks( 'ImagePageFindFile', array( $this, &$img, &$this->displayImg ) ); + Hooks::run( 'ImagePageFindFile', array( $this, &$img, &$this->displayImg ) ); if ( !$img ) { // not set by hook? $img = wfFindFile( $this->getTitle() ); if ( !$img ) { @@ -196,7 +196,7 @@ class ImagePage extends Article { # Allow extensions to add something after the image links $html = ''; - wfRunHooks( 'ImagePageAfterImageLinks', array( $this, &$html ) ); + Hooks::run( 'ImagePageAfterImageLinks', array( $this, &$html ) ); if ( $html ) { $out->addHTML( $html ); } @@ -245,7 +245,7 @@ class ImagePage extends Article { $r[] = '
  • ' . wfMessage( 'metadata' )->escaped() . '
  • '; } - wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) ); + Hooks::run( 'ImagePageShowTOC', array( $this, &$r ) ); return ''; } @@ -336,7 +336,7 @@ class ImagePage extends Article { $filename = wfEscapeWikiText( $this->displayImg->getName() ); $linktext = $filename; - wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) ); + Hooks::run( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) ); if ( $this->displayImg->allowInlineDisplay() ) { # image @@ -1384,7 +1384,7 @@ class ImageHistoryList extends ContextSource { } $rowClass = null; - wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) ); + Hooks::run( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) ); $classAttr = $rowClass ? " class='$rowClass'" : ''; return "{$row}\n"; diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 75df27c84d..b9f7eda154 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -308,11 +308,11 @@ class WikiPage implements Page, IDBAccessObject { protected function pageData( $dbr, $conditions, $options = array() ) { $fields = self::selectFields(); - wfRunHooks( 'ArticlePageDataBefore', array( &$this, &$fields ) ); + Hooks::run( 'ArticlePageDataBefore', array( &$this, &$fields ) ); $row = $dbr->selectRow( 'page', $fields, $conditions, __METHOD__, $options ); - wfRunHooks( 'ArticlePageDataAfter', array( &$this, &$row ) ); + Hooks::run( 'ArticlePageDataAfter', array( &$this, &$row ) ); return $row; } @@ -1178,7 +1178,7 @@ class WikiPage implements Page, IDBAccessObject { public function doPurge() { global $wgUseSquid; - if ( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) { + if ( !Hooks::run( 'ArticlePurge', array( &$this ) ) ) { return false; } @@ -1749,7 +1749,7 @@ class WikiPage implements Page, IDBAccessObject { $hook_args = array( &$this, &$user, &$content, &$summary, $flags & EDIT_MINOR, null, null, &$flags, &$status ); - if ( !wfRunHooks( 'PageContentSave', $hook_args ) + if ( !Hooks::run( 'PageContentSave', $hook_args ) || !ContentHandler::runLegacyHooks( 'ArticleSave', $hook_args ) ) { wfDebug( __METHOD__ . ": ArticleSave or ArticleSaveContent hook aborted save!\n" ); @@ -1860,7 +1860,7 @@ class WikiPage implements Page, IDBAccessObject { return $status; } - wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, $baseRevId, $user ) ); + Hooks::run( 'NewRevisionFromEditComplete', array( $this, $revision, $baseRevId, $user ) ); // Update recentchanges if ( !( $flags & EDIT_SUPPRESS_RC ) ) { // Mark as patrolled if the user can do so @@ -1965,7 +1965,7 @@ class WikiPage implements Page, IDBAccessObject { // Update the page record with revision data $this->updateRevisionOn( $dbw, $revision, 0 ); - wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) ); + Hooks::run( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) ); // Update recentchanges if ( !( $flags & EDIT_SUPPRESS_RC ) ) { @@ -1996,7 +1996,7 @@ class WikiPage implements Page, IDBAccessObject { $flags & EDIT_MINOR, null, null, &$flags, $revision ); ContentHandler::runLegacyHooks( 'ArticleInsertComplete', $hook_args ); - wfRunHooks( 'PageContentInsertComplete', $hook_args ); + Hooks::run( 'PageContentInsertComplete', $hook_args ); } // Do updates right now unless deferral was requested @@ -2011,7 +2011,7 @@ class WikiPage implements Page, IDBAccessObject { $flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId ); ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $hook_args ); - wfRunHooks( 'PageContentSaveComplete', $hook_args ); + Hooks::run( 'PageContentSaveComplete', $hook_args ); // Promote user to any groups they meet the criteria for $dbw->onTransactionIdle( function () use ( $user ) { @@ -2105,7 +2105,7 @@ class WikiPage implements Page, IDBAccessObject { : false; $popts = ParserOptions::newFromUserAndLang( $user, $wgContLang ); - wfRunHooks( 'ArticlePrepareTextForEdit', array( $this, $popts ) ); + Hooks::run( 'ArticlePrepareTextForEdit', array( $this, $popts ) ); $edit = (object)array(); if ( $cachedEdit ) { @@ -2203,9 +2203,9 @@ class WikiPage implements Page, IDBAccessObject { DataUpdate::runUpdates( $updates ); } - wfRunHooks( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) ); + Hooks::run( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) ); - if ( wfRunHooks( 'ArticleEditUpdatesDeleteFromRecentchanges', array( &$this ) ) ) { + if ( Hooks::run( 'ArticleEditUpdatesDeleteFromRecentchanges', array( &$this ) ) ) { if ( 0 == mt_rand( 0, 99 ) ) { // Flush old entries from the `recentchanges` table; we do this on // random requests so as to avoid an increase in writes for no good reason @@ -2250,7 +2250,7 @@ class WikiPage implements Page, IDBAccessObject { wfDebug( __METHOD__ . ": invalid username\n" ); } else { // Allow extensions to prevent user notification when a new message is added to their talk page - if ( wfRunHooks( 'ArticleEditUpdateNewTalk', array( &$this, $recipient ) ) ) { + if ( Hooks::run( 'ArticleEditUpdateNewTalk', array( &$this, $recipient ) ) ) { if ( User::isIP( $shortTitle ) ) { // An anonymous user $recipient->setNewtalk( true, $revision ); @@ -2333,7 +2333,7 @@ class WikiPage implements Page, IDBAccessObject { $revision->insertOn( $dbw ); $this->updateRevisionOn( $dbw, $revision ); - wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) ); + Hooks::run( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) ); wfProfileOut( __METHOD__ ); } @@ -2432,7 +2432,7 @@ class WikiPage implements Page, IDBAccessObject { $logRelationsField = null; if ( $id ) { // Protection of existing page - if ( !wfRunHooks( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) { + if ( !Hooks::run( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) { return Status::newGood(); } @@ -2512,8 +2512,8 @@ class WikiPage implements Page, IDBAccessObject { __METHOD__ ); - wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $nullRevision, $latest, $user ) ); - wfRunHooks( 'ArticleProtectComplete', array( &$this, &$user, $limit, $reason ) ); + Hooks::run( 'NewRevisionFromEditComplete', array( $this, $nullRevision, $latest, $user ) ); + Hooks::run( 'ArticleProtectComplete', array( &$this, &$user, $limit, $reason ) ); } else { // Protection of non-existing page (also known as "title protection") // Cascade protection is meaningless in this case $cascade = false; @@ -2775,7 +2775,7 @@ class WikiPage implements Page, IDBAccessObject { } $user = is_null( $user ) ? $wgUser : $user; - if ( !wfRunHooks( 'ArticleDelete', array( &$this, &$user, &$reason, &$error, &$status ) ) ) { + if ( !Hooks::run( 'ArticleDelete', array( &$this, &$user, &$reason, &$error, &$status ) ) ) { if ( $status->isOK() ) { // Hook aborted but didn't set a fatal status $status->fatal( 'delete-hook-aborted' ); @@ -2891,7 +2891,7 @@ class WikiPage implements Page, IDBAccessObject { $this->doDeleteUpdates( $id, $content ); - wfRunHooks( 'ArticleDeleteComplete', array( &$this, &$user, $reason, $id, $content, $logEntry ) ); + Hooks::run( 'ArticleDeleteComplete', array( &$this, &$user, $reason, $id, $content, $logEntry ) ); $status->value = $logid; return $status; } @@ -3133,7 +3133,7 @@ class WikiPage implements Page, IDBAccessObject { $revId = $status->value['revision']->getId(); - wfRunHooks( 'ArticleRollbackComplete', array( $this, $guser, $target, $current ) ); + Hooks::run( 'ArticleRollbackComplete', array( $this, $guser, $target, $current ) ); $resultDetails = array( 'summary' => $summary, @@ -3385,12 +3385,12 @@ class WikiPage implements Page, IDBAccessObject { foreach ( $added as $catName ) { $cat = Category::newFromName( $catName ); - wfRunHooks( 'CategoryAfterPageAdded', array( $cat, $that ) ); + Hooks::run( 'CategoryAfterPageAdded', array( $cat, $that ) ); } foreach ( $deleted as $catName ) { $cat = Category::newFromName( $catName ); - wfRunHooks( 'CategoryAfterPageRemoved', array( $cat, $that ) ); + Hooks::run( 'CategoryAfterPageRemoved', array( $cat, $that ) ); } } ); @@ -3543,7 +3543,7 @@ class WikiPage implements Page, IDBAccessObject { $updates = $content->getDeletionUpdates( $this ); } - wfRunHooks( 'WikiPageDeletionUpdates', array( $this, $content, &$updates ) ); + Hooks::run( 'WikiPageDeletionUpdates', array( $this, $content, &$updates ) ); return $updates; } } diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 6c1599368d..0121072fdf 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -378,7 +378,7 @@ class LinkHolderArray { } if ( count( $linkcolour_ids ) ) { //pass an array of page_ids to an extension - wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); + Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); } wfProfileOut( __METHOD__ . '-check' ); @@ -615,7 +615,7 @@ class LinkHolderArray { } } } - wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); + Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); // rebuild the categories in original order (if there are replacements) if ( count( $varCategories ) > 0 ) { diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7ea57becc6..91d8a81ad4 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -283,7 +283,7 @@ class Parser { unset( $tmp ); } - wfRunHooks( 'ParserCloned', array( $this ) ); + Hooks::run( 'ParserCloned', array( $this ) ); } /** @@ -301,7 +301,7 @@ class Parser { CoreTagHooks::register( $this ); $this->initialiseVariables(); - wfRunHooks( 'ParserFirstCallInit', array( &$this ) ); + Hooks::run( 'ParserFirstCallInit', array( &$this ) ); wfProfileOut( __METHOD__ ); } @@ -369,7 +369,7 @@ class Parser { $this->mProfiler = new SectionProfiler(); - wfRunHooks( 'ParserClearState', array( &$this ) ); + Hooks::run( 'ParserClearState', array( &$this ) ); wfProfileOut( __METHOD__ ); } @@ -428,11 +428,11 @@ class Parser { $this->mRevisionSize = null; } - wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); # No more strip! - wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); $text = $this->internalParse( $text ); - wfRunHooks( 'ParserAfterParse', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserAfterParse', array( &$this, &$text, &$this->mStripState ) ); $text = $this->internalParseHalfParsed( $text, true, $linestart ); @@ -498,14 +498,14 @@ class Parser { $this->mOutput->setLimitReportData( 'limitreport-expensivefunctioncount', array( $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit() ) ); - wfRunHooks( 'ParserLimitReportPrepare', array( $this, $this->mOutput ) ); + Hooks::run( 'ParserLimitReportPrepare', array( $this, $this->mOutput ) ); $limitReport = "NewPP limit report\n"; if ( $wgShowHostnames ) { $limitReport .= 'Parsed by ' . wfHostname() . "\n"; } foreach ( $this->mOutput->getLimitReportData() as $key => $value ) { - if ( wfRunHooks( 'ParserLimitReportFormat', + if ( Hooks::run( 'ParserLimitReportFormat', array( $key, &$value, &$limitReport, false, false ) ) ) { $keyMsg = wfMessage( $key )->inLanguage( 'en' )->useDatabase( false ); @@ -523,7 +523,7 @@ class Parser { // Since we're not really outputting HTML, decode the entities and // then re-encode the things that need hiding inside HTML comments. $limitReport = htmlspecialchars_decode( $limitReport ); - wfRunHooks( 'ParserLimitReport', array( $this, &$limitReport ) ); + Hooks::run( 'ParserLimitReport', array( $this, &$limitReport ) ); // Sanitize for comment. Note '‐' in the replacement is U+2010, // which looks much like the problematic '-'. @@ -587,8 +587,8 @@ class Parser { */ public function recursiveTagParse( $text, $frame = false ) { wfProfileIn( __METHOD__ ); - wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); - wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); $text = $this->internalParse( $text, false, $frame ); wfProfileOut( __METHOD__ ); return $text; @@ -637,8 +637,8 @@ class Parser { if ( $revid !== null ) { $this->mRevisionId = $revid; } - wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); - wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); $text = $this->replaceVariables( $text, $frame ); $text = $this->mStripState->unstripBoth( $text ); wfProfileOut( __METHOD__ ); @@ -1223,7 +1223,7 @@ class Parser { $origText = $text; # Hook to suspend the parser in this state - if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) { + if ( !Hooks::run( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) { wfProfileOut( __METHOD__ ); return $text; } @@ -1244,14 +1244,14 @@ class Parser { $text = $this->replaceVariables( $text ); } - wfRunHooks( 'InternalParseBeforeSanitize', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'InternalParseBeforeSanitize', array( &$this, &$text, &$this->mStripState ) ); $text = Sanitizer::removeHTMLtags( $text, array( &$this, 'attributeStripCallback' ), false, array_keys( $this->mTransparentTagHooks ) ); - wfRunHooks( 'InternalParseBeforeLinks', array( &$this, &$text, &$this->mStripState ) ); + Hooks::run( 'InternalParseBeforeLinks', array( &$this, &$text, &$this->mStripState ) ); # Tables need to come after variable replacement for things to work # properly; putting them before other transformations should keep @@ -1329,7 +1329,7 @@ class Parser { $text = $this->mStripState->unstripNoWiki( $text ); if ( $isMain ) { - wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) ); + Hooks::run( 'ParserBeforeTidy', array( &$this, &$text ) ); } $text = $this->replaceTransparentTags( $text ); @@ -1368,7 +1368,7 @@ class Parser { } if ( $isMain ) { - wfRunHooks( 'ParserAfterTidy', array( &$this, &$text ) ); + Hooks::run( 'ParserAfterTidy', array( &$this, &$text ) ); } return $text; @@ -2318,7 +2318,7 @@ class Parser { # Give extensions a chance to select the file revision for us $options = array(); $descQuery = false; - wfRunHooks( 'BeforeParserFetchFileAndTitle', + Hooks::run( 'BeforeParserFetchFileAndTitle', array( $this, $nt, &$options, &$descQuery ) ); # Fetch and register the file (file title may be different via hooks) list( $file, $nt ) = $this->fetchFileAndTitle( $nt, $options ); @@ -2945,14 +2945,14 @@ class Parser { * Some of these require message or data lookups and can be * expensive to check many times. */ - if ( wfRunHooks( 'ParserGetVariableValueVarCache', array( &$this, &$this->mVarCache ) ) ) { + if ( Hooks::run( 'ParserGetVariableValueVarCache', array( &$this, &$this->mVarCache ) ) ) { if ( isset( $this->mVarCache[$index] ) ) { return $this->mVarCache[$index]; } } $ts = wfTimestamp( TS_UNIX, $this->mOptions->getTimestamp() ); - wfRunHooks( 'ParserGetVariableValueTs', array( &$this, &$ts ) ); + Hooks::run( 'ParserGetVariableValueTs', array( &$this, &$ts ) ); $pageLang = $this->getFunctionLang(); @@ -3260,7 +3260,7 @@ class Parser { break; default: $ret = null; - wfRunHooks( + Hooks::run( 'ParserGetVariableValueSwitch', array( &$this, &$this->mVarCache, &$index, &$ret, &$frame ) ); @@ -4011,7 +4011,7 @@ class Parser { for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { # Give extensions a chance to select the revision instead $id = false; # Assume current - wfRunHooks( 'BeforeParserFetchTemplateAndtitle', + Hooks::run( 'BeforeParserFetchTemplateAndtitle', array( $parser, $title, &$skip, &$id ) ); if ( $skip ) { @@ -4820,7 +4820,7 @@ class Parser { * &$sectionContent : ref to the content of the section * $showEditLinks : boolean describing whether this section has an edit link */ - wfRunHooks( 'ParserSectionCreate', array( $this, $i, &$sections[$i], $showEditLink ) ); + Hooks::run( 'ParserSectionCreate', array( $this, $i, &$sections[$i], $showEditLink ) ); $i++; } @@ -5403,7 +5403,7 @@ class Parser { } $ig->setAdditionalOptions( $params ); - wfRunHooks( 'BeforeParserrenderImageGallery', array( &$this, &$ig ) ); + Hooks::run( 'BeforeParserrenderImageGallery', array( &$this, &$ig ) ); $lines = StringUtils::explode( "\n", $text ); foreach ( $lines as $line ) { @@ -5430,7 +5430,7 @@ class Parser { # file (which potentially could be of a different type and have different handler). $options = array(); $descQuery = false; - wfRunHooks( 'BeforeParserFetchFileAndTitle', + Hooks::run( 'BeforeParserFetchFileAndTitle', array( $this, $title, &$options, &$descQuery ) ); # Don't register it now, as ImageGallery does that later. $file = $this->fetchFileNoRegister( $title, $options ); @@ -5511,7 +5511,7 @@ class Parser { $ig->add( $title, $label, $alt, $link, $handlerOptions ); } $html = $ig->toHTML(); - wfRunHooks( 'AfterParserFetchFileAndTitle', array( $this, $ig, &$html ) ); + Hooks::run( 'AfterParserFetchFileAndTitle', array( $this, $ig, &$html ) ); wfProfileOut( __METHOD__ ); return $html; } @@ -5600,7 +5600,7 @@ class Parser { # Give extensions a chance to select the file revision for us $options = array(); $descQuery = false; - wfRunHooks( 'BeforeParserFetchFileAndTitle', + Hooks::run( 'BeforeParserFetchFileAndTitle', array( $this, $title, &$options, &$descQuery ) ); # Fetch and register the file (file title may be different via hooks) list( $file, $title ) = $this->fetchFileAndTitle( $title, $options ); @@ -5764,7 +5764,7 @@ class Parser { $params['frame']['title'] = $this->stripAltText( $caption, $holders ); } - wfRunHooks( 'ParserMakeImageParams', array( $title, $file, &$params, $this ) ); + Hooks::run( 'ParserMakeImageParams', array( $title, $file, &$params, $this ) ); # Linker does the rest $time = isset( $options['time'] ) ? $options['time'] : false; diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index a61dbf0d3b..7ad85a9371 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -811,7 +811,7 @@ class ParserOptions { // Give a chance for extensions to modify the hash, if they have // extra options or other effects on the parser cache. - wfRunHooks( 'PageRenderingHash', array( &$confstr, $this->getUser(), &$forOptions ) ); + Hooks::run( 'PageRenderingHash', array( &$confstr, $this->getUser(), &$forOptions ) ); // Make it a valid memcached key fragment $confstr = str_replace( ' ', '_', $confstr ); diff --git a/includes/rcfeed/IRCColourfulRCFeedFormatter.php b/includes/rcfeed/IRCColourfulRCFeedFormatter.php index 02a8d7eb85..30be343165 100644 --- a/includes/rcfeed/IRCColourfulRCFeedFormatter.php +++ b/includes/rcfeed/IRCColourfulRCFeedFormatter.php @@ -56,7 +56,7 @@ class IRCColourfulRCFeedFormatter implements RCFeedFormatter { $query .= '&rcid=' . $attribs['rc_id']; } // HACK: We need this hook for WMF's secure server setup - wfRunHooks( 'IRCLineURL', array( &$url, &$query, $rc ) ); + Hooks::run( 'IRCLineURL', array( &$url, &$query, $rc ) ); $url .= $query; } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 14a6f30108..933397c306 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -247,7 +247,7 @@ class ResourceLoader { // Register core modules $this->register( include "$IP/resources/Resources.php" ); // Register extension modules - wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) ); + Hooks::run( 'ResourceLoaderRegisterModules', array( &$this ) ); $this->register( $config->get( 'ResourceModules' ) ); if ( $config->get( 'EnableJavaScriptTest' ) === true ) { @@ -377,7 +377,7 @@ class ResourceLoader { $testModules = array(); $testModules['qunit'] = array(); // Get other test suites (e.g. from extensions) - wfRunHooks( 'ResourceLoaderTestModules', array( &$testModules, &$this ) ); + Hooks::run( 'ResourceLoaderTestModules', array( &$testModules, &$this ) ); // Add the testrunner (which configures QUnit) to the dependencies. // Since it must be ready before any of the test suites are executed. diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 2eccf81228..a0764dedc5 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -106,7 +106,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ), ); - wfRunHooks( 'ResourceLoaderGetConfigVars', array( &$vars ) ); + Hooks::run( 'ResourceLoaderGetConfigVars', array( &$vars ) ); $this->configVars[$hash] = $vars; return $this->configVars[$hash]; diff --git a/includes/revisiondelete/RevDelRevisionList.php b/includes/revisiondelete/RevDelRevisionList.php index 733fa97bbc..7315538186 100644 --- a/includes/revisiondelete/RevDelRevisionList.php +++ b/includes/revisiondelete/RevDelRevisionList.php @@ -137,7 +137,7 @@ class RevDelRevisionList extends RevDelList { public function doPostCommitUpdates() { $this->title->purgeSquid(); // Extensions that require referencing previous revisions may need this - wfRunHooks( 'ArticleRevisionVisibilitySet', array( &$this->title ) ); + Hooks::run( 'ArticleRevisionVisibilitySet', array( &$this->title ) ); return Status::newGood(); } } diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index c6cbfbe4e8..cd6cf7dd70 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -137,7 +137,7 @@ class SearchEngine { public static function getNearMatch( $searchterm ) { $title = self::getNearMatchInternal( $searchterm ); - wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) ); + Hooks::run( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) ); return $title; } @@ -170,7 +170,7 @@ class SearchEngine { } $titleResult = null; - if ( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, &$titleResult ) ) ) { + if ( !Hooks::run( 'SearchGetNearMatchBefore', array( $allSearchTerms, &$titleResult ) ) ) { return $titleResult; } @@ -197,7 +197,7 @@ class SearchEngine { return $title; } - if ( !wfRunHooks( 'SearchAfterNoDirectMatch', array( $term, &$title ) ) ) { + if ( !Hooks::run( 'SearchAfterNoDirectMatch', array( $term, &$title ) ) ) { return $title; } @@ -227,7 +227,7 @@ class SearchEngine { // Give hooks a chance at better match variants $title = null; - if ( !wfRunHooks( 'SearchGetNearMatch', array( $term, &$title ) ) ) { + if ( !Hooks::run( 'SearchGetNearMatch', array( $term, &$title ) ) ) { return $title; } } @@ -356,7 +356,7 @@ class SearchEngine { } } - wfRunHooks( 'SearchableNamespaces', array( &$arr ) ); + Hooks::run( 'SearchableNamespaces', array( &$arr ) ); return $arr; } diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php index 2cdf9f4142..d384ae96c8 100644 --- a/includes/search/SearchResult.php +++ b/includes/search/SearchResult.php @@ -71,7 +71,7 @@ class SearchResult { $this->mTitle = $title; if ( !is_null( $this->mTitle ) ) { $id = false; - wfRunHooks( 'SearchResultInitFromTitle', array( $title, &$id ) ); + Hooks::run( 'SearchResultInitFromTitle', array( $title, &$id ) ); $this->mRevision = Revision::newFromTitle( $this->mTitle, $id, Revision::READ_NORMAL ); if ( $this->mTitle->getNamespace() === NS_FILE ) { diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index 7217000cf0..3cdfca012c 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -112,7 +112,7 @@ abstract class BaseTemplate extends QuickTemplate { $toolbox['info']['id'] = 't-info'; } - wfRunHooks( 'BaseTemplateToolbox', array( &$this, &$toolbox ) ); + Hooks::run( 'BaseTemplateToolbox', array( &$this, &$toolbox ) ); wfProfileOut( __METHOD__ ); return $toolbox; } @@ -228,7 +228,7 @@ abstract class BaseTemplate extends QuickTemplate { ob_start(); // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox // can abort and avoid outputting double toolbox links - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); + Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true ) ); $hookContents = ob_get_contents(); ob_end_clean(); if ( !trim( $hookContents ) ) { @@ -285,7 +285,7 @@ abstract class BaseTemplate extends QuickTemplate { */ protected function renderAfterPortlet( $name ) { $content = ''; - wfRunHooks( 'BaseTemplateAfterPortlet', array( $this, $name, &$content ) ); + Hooks::run( 'BaseTemplateAfterPortlet', array( $this, $name, &$content ) ); if ( $content !== '' ) { echo "
    $content
    "; diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 5604bc23cc..ce0c640e10 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -259,7 +259,7 @@ abstract class Skin extends ContextSource { $titles[] = $title->getTalkPage(); } - wfRunHooks( 'SkinPreloadExistence', array( &$titles, $this ) ); + Hooks::run( 'SkinPreloadExistence', array( &$titles, $this ) ); if ( count( $titles ) ) { $lb = new LinkBatch( $titles ); @@ -587,7 +587,7 @@ abstract class Skin extends ContextSource { protected function afterContentHook() { $data = ''; - if ( wfRunHooks( 'SkinAfterContent', array( &$data, $this ) ) ) { + if ( Hooks::run( 'SkinAfterContent', array( &$data, $this ) ) ) { // adding just some spaces shouldn't toggle the output // of the whole
    , so we use trim() here if ( trim( $data ) != '' ) { @@ -624,7 +624,7 @@ abstract class Skin extends ContextSource { // OutputPage::getBottomScripts() which takes a Skin param. This should be cleaned // up at some point $bottomScriptText = $this->getOutput()->getBottomScripts(); - wfRunHooks( 'SkinAfterBottomScripts', array( $this, &$bottomScriptText ) ); + Hooks::run( 'SkinAfterBottomScripts', array( $this, &$bottomScriptText ) ); return $bottomScriptText; } @@ -684,7 +684,7 @@ abstract class Skin extends ContextSource { $out = $this->getOutput(); $subpages = ''; - if ( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages, $this, $out ) ) ) { + if ( !Hooks::run( 'SkinSubPageSubtitle', array( &$subpages, $this, $out ) ) ) { return $subpages; } @@ -793,7 +793,7 @@ abstract class Skin extends ContextSource { // @todo Remove deprecated $forContent param from hook handlers and then remove here. $forContent = true; - wfRunHooks( + Hooks::run( 'SkinCopyrightFooter', array( $this->getTitle(), $type, &$msg, &$link, &$forContent ) ); @@ -840,7 +840,7 @@ abstract class Skin extends ContextSource { $url = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" ); $text = 'Powered by MediaWiki'; - wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) ); + Hooks::run( 'SkinGetPoweredBy', array( &$text, $this ) ); return $text; } @@ -1224,7 +1224,7 @@ abstract class Skin extends ContextSource { if ( $wgEnableSidebarCache ) { $cachedsidebar = $wgMemc->get( $key ); if ( $cachedsidebar ) { - wfRunHooks( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) ); + Hooks::run( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) ); wfProfileOut( __METHOD__ ); return $cachedsidebar; @@ -1234,12 +1234,12 @@ abstract class Skin extends ContextSource { $bar = array(); $this->addToSidebar( $bar, 'sidebar' ); - wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) ); + Hooks::run( 'SkinBuildSidebar', array( $this, &$bar ) ); if ( $wgEnableSidebarCache ) { $wgMemc->set( $key, $bar, $wgSidebarCacheExpiry ); } - wfRunHooks( 'SidebarBeforeOutput', array( $this, &$bar ) ); + Hooks::run( 'SidebarBeforeOutput', array( $this, &$bar ) ); wfProfileOut( __METHOD__ ); return $bar; @@ -1379,7 +1379,7 @@ abstract class Skin extends ContextSource { $out = $this->getOutput(); // Allow extensions to disable or modify the new messages alert - if ( !wfRunHooks( 'GetNewMessagesAlert', array( &$newMessagesAlert, $newtalks, $user, $out ) ) ) { + if ( !Hooks::run( 'GetNewMessagesAlert', array( &$newMessagesAlert, $newtalks, $user, $out ) ) ) { return ''; } if ( $newMessagesAlert ) { @@ -1542,7 +1542,7 @@ abstract class Skin extends ContextSource { wfProfileIn( __METHOD__ ); $siteNotice = ''; - if ( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) { + if ( Hooks::run( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) { if ( is_object( $this->getUser() ) && $this->getUser()->isLoggedIn() ) { $siteNotice = $this->getCachedNotice( 'sitenotice' ); } else { @@ -1558,7 +1558,7 @@ abstract class Skin extends ContextSource { } } - wfRunHooks( 'SiteNoticeAfter', array( &$siteNotice, $this ) ); + Hooks::run( 'SiteNoticeAfter', array( &$siteNotice, $this ) ); wfProfileOut( __METHOD__ ); return $siteNotice; } @@ -1602,7 +1602,7 @@ abstract class Skin extends ContextSource { . ']' . ''; - wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) ); + Hooks::run( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) ); return $result; } diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 3a39fee873..d3932801f3 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -163,7 +163,7 @@ class SkinTemplate extends Skin { 'lang' => $ilInterwikiCodeBCP47, 'hreflang' => $ilInterwikiCodeBCP47, ); - wfRunHooks( + Hooks::run( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle(), $this->getOutput() ) ); @@ -484,7 +484,7 @@ class SkinTemplate extends Skin { $tpl->set( 'reporttime', wfReportTime() ); // original version by hansm - if ( !wfRunHooks( 'SkinTemplateOutputPageBeforeExec', array( &$this, &$tpl ) ) ) { + if ( !Hooks::run( 'SkinTemplateOutputPageBeforeExec', array( &$this, &$tpl ) ) ) { wfDebug( __METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" ); } @@ -703,7 +703,7 @@ class SkinTemplate extends Skin { $personal_urls['login'] = $login_url; } - wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$title, $this ) ); + Hooks::run( 'PersonalUrls', array( &$personal_urls, &$title, $this ) ); wfProfileOut( __METHOD__ ); return $personal_urls; } @@ -749,7 +749,7 @@ class SkinTemplate extends Skin { } $result = array(); - if ( !wfRunHooks( 'SkinTemplateTabAction', array( &$this, + if ( !Hooks::run( 'SkinTemplateTabAction', array( &$this, $title, $message, $selected, $checkEdit, &$classes, &$query, &$text, &$result ) ) ) { return $result; @@ -845,7 +845,7 @@ class SkinTemplate extends Skin { $userCanRead = $title->quickUserCan( 'read', $user ); $preventActiveTabs = false; - wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$preventActiveTabs ) ); + Hooks::run( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$preventActiveTabs ) ); // Checks if page is some kind of content if ( $title->canExist() ) { @@ -1054,7 +1054,7 @@ class SkinTemplate extends Skin { } } - wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) ); + Hooks::run( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) ); if ( $userCanRead && !$wgDisableLangConversion ) { $pageLang = $title->getPageLanguage(); @@ -1096,12 +1096,12 @@ class SkinTemplate extends Skin { 'context' => 'subject' ); - wfRunHooks( 'SkinTemplateNavigation::SpecialPage', + Hooks::run( 'SkinTemplateNavigation::SpecialPage', array( &$this, &$content_navigation ) ); } // Equiv to SkinTemplateContentActions - wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); + Hooks::run( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); // Setup xml ids and tooltip info foreach ( $content_navigation as $section => &$links ) { @@ -1243,7 +1243,7 @@ class SkinTemplate extends Skin { } // Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals - wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', + Hooks::run( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$revid, &$revid ) ); } diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 17a651f86b..3476c26d79 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -154,7 +154,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { protected function getCustomFilters() { if ( $this->customFilters === null ) { $this->customFilters = array(); - wfRunHooks( 'ChangesListSpecialPageFilters', array( $this, &$this->customFilters ) ); + Hooks::run( 'ChangesListSpecialPageFilters', array( $this, &$this->customFilters ) ); } return $this->customFilters; @@ -310,7 +310,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { } protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) { - return wfRunHooks( + return Hooks::run( 'ChangesListSpecialPageQuery', array( $this->getName(), &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) ); diff --git a/includes/specialpage/FormSpecialPage.php b/includes/specialpage/FormSpecialPage.php index bf86ab2e1a..fd3bc7b8da 100644 --- a/includes/specialpage/FormSpecialPage.php +++ b/includes/specialpage/FormSpecialPage.php @@ -106,7 +106,7 @@ abstract class FormSpecialPage extends SpecialPage { $this->alterForm( $form ); // Give hooks a chance to alter the form, adding extra fields or text etc - wfRunHooks( 'SpecialPageBeforeFormDisplay', array( $this->getName(), &$form ) ); + Hooks::run( 'SpecialPageBeforeFormDisplay', array( $this->getName(), &$form ) ); return $form; } diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index f902acf085..dd21af49fb 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -100,7 +100,7 @@ abstract class QueryPage extends SpecialPage { array( 'UnusedtemplatesPage', 'Unusedtemplates' ), array( 'WithoutInterwikiPage', 'Withoutinterwiki' ), ); - wfRunHooks( 'wgQueryPages', array( &$qp ) ); + Hooks::run( 'wgQueryPages', array( &$qp ) ); } return $qp; diff --git a/includes/specialpage/RedirectSpecialPage.php b/includes/specialpage/RedirectSpecialPage.php index 4226ee02a5..2e6e55a779 100644 --- a/includes/specialpage/RedirectSpecialPage.php +++ b/includes/specialpage/RedirectSpecialPage.php @@ -203,7 +203,7 @@ abstract class RedirectSpecialArticle extends RedirectSpecialPage { 'ctype', 'maxage', 'smaxage', ); - wfRunHooks( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) ); + Hooks::run( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) ); $this->mAllowedRedirectParams = $redirectParams; } } diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index 072f87f383..759d7cb182 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -377,7 +377,7 @@ class SpecialPage { * @param SpecialPage $this * @param string|null $subPage */ - wfRunHooks( 'SpecialPageBeforeExecute', array( $this, $subPage ) ); + Hooks::run( 'SpecialPageBeforeExecute', array( $this, $subPage ) ); $this->beforeExecute( $subPage ); $this->execute( $subPage ); @@ -391,7 +391,7 @@ class SpecialPage { * @param SpecialPage $this * @param string|null $subPage */ - wfRunHooks( 'SpecialPageAfterExecute', array( $this, $subPage ) ); + Hooks::run( 'SpecialPageAfterExecute', array( $this, $subPage ) ); } /** diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php index 1531f69771..e31ebf6ac0 100644 --- a/includes/specialpage/SpecialPageFactory.php +++ b/includes/specialpage/SpecialPageFactory.php @@ -252,7 +252,7 @@ class SpecialPageFactory { // Run hooks // This hook can be used to remove undesired built-in special pages - wfRunHooks( 'SpecialPage_initList', array( &self::$list ) ); + Hooks::run( 'SpecialPage_initList', array( &self::$list ) ); wfProfileOut( __METHOD__ ); } diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index a4269d1850..144d39bcdb 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -220,7 +220,7 @@ class SpecialBlock extends FormSpecialPage { $this->maybeAlterFormDefaults( $a ); // Allow extensions to add more fields - wfRunHooks( 'SpecialBlockModifyFormFields', array( $this, &$a ) ); + Hooks::run( 'SpecialBlockModifyFormFields', array( $this, &$a ) ); return $a; } @@ -317,7 +317,7 @@ class SpecialBlock extends FormSpecialPage { $otherBlockMessages = array(); if ( $this->target !== null ) { # Get other blocks, i.e. from GlobalBlocking or TorBlock extension - wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) ); + Hooks::run( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) ); if ( count( $otherBlockMessages ) ) { $s = Html::rawElement( @@ -701,7 +701,7 @@ class SpecialBlock extends FormSpecialPage { $block->mHideName = $data['HideUser']; $reason = array( 'hookaborted' ); - if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) { + if ( !Hooks::run( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) { return $reason; } @@ -762,7 +762,7 @@ class SpecialBlock extends FormSpecialPage { $logaction = 'block'; } - wfRunHooks( 'BlockIpComplete', array( $block, $performer ) ); + Hooks::run( 'BlockIpComplete', array( $block, $performer ) ); # Set *_deleted fields if requested if ( $data['HideUser'] ) { diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 02b26265f8..da6f4c062d 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -170,7 +170,7 @@ class SpecialBlockList extends SpecialPage { # Check for other blocks, i.e. global/tor blocks $otherBlockLink = array(); - wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) ); + Hooks::run( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) ); $out = $this->getOutput(); diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index d8eec7d9d8..91a148dec0 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -161,7 +161,7 @@ class SpecialBookSources extends SpecialPage { # Hook to allow extensions to insert additional HTML, # e.g. for API-interacting plugins and so on - wfRunHooks( 'BookInformation', array( $this->isbn, $this->getOutput() ) ); + Hooks::run( 'BookInformation', array( $this->isbn, $this->getOutput() ) ); # Check for a local page such as Project:Book_sources and use that if available $page = $this->msg( 'booksources' )->inContentLanguage()->text(); diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 12bbd2a7ce..e09c8ace43 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -183,7 +183,7 @@ class SpecialChangeEmail extends FormSpecialPage { return $status; } - wfRunHooks( 'PrefsEmailAudit', array( $user, $oldaddr, $newaddr ) ); + Hooks::run( 'PrefsEmailAudit', array( $user, $oldaddr, $newaddr ) ); $user->saveSettings(); diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 24664edb7c..168095f8ca 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -118,7 +118,7 @@ class SpecialChangePassword extends FormSpecialPage { } $extraFields = array(); - wfRunHooks( 'ChangePasswordForm', array( &$extraFields ) ); + Hooks::run( 'ChangePasswordForm', array( &$extraFields ) ); foreach ( $extraFields as $extra ) { list( $name, $label, $type, $default ) = $extra; $fields[$name] = array( @@ -248,7 +248,7 @@ class SpecialChangePassword extends FormSpecialPage { } if ( $newpass !== $retype ) { - wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'badretype' ) ); + Hooks::run( 'PrefsPasswordAudit', array( $user, $newpass, 'badretype' ) ); throw new PasswordError( $this->msg( 'badretype' )->text() ); } @@ -264,7 +264,7 @@ class SpecialChangePassword extends FormSpecialPage { // @todo Make these separate messages, since the message is written for both cases if ( !$user->checkTemporaryPassword( $oldpass ) && !$user->checkPassword( $oldpass ) ) { - wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) ); + Hooks::run( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) ); throw new PasswordError( $this->msg( 'resetpass-wrong-oldpass' )->text() ); } @@ -276,8 +276,8 @@ class SpecialChangePassword extends FormSpecialPage { // Do AbortChangePassword after checking mOldpass, so we don't leak information // by possibly aborting a new password before verifying the old password. $abortMsg = 'resetpass-abort-generic'; - if ( !wfRunHooks( 'AbortChangePassword', array( $user, $oldpass, $newpass, &$abortMsg ) ) ) { - wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'abortreset' ) ); + if ( !Hooks::run( 'AbortChangePassword', array( $user, $oldpass, $newpass, &$abortMsg ) ) ) { + Hooks::run( 'PrefsPasswordAudit', array( $user, $newpass, 'abortreset' ) ); throw new PasswordError( $this->msg( $abortMsg )->text() ); } @@ -288,9 +288,9 @@ class SpecialChangePassword extends FormSpecialPage { try { $user->setPassword( $newpass ); - wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) ); + Hooks::run( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) ); } catch ( PasswordError $e ) { - wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) ); + Hooks::run( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) ); throw new PasswordError( $e->getMessage() ); } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 583778f9ba..7cc542579c 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -176,7 +176,7 @@ class SpecialContributions extends IncludableSpecialPage { // Add RSS/atom links $this->addFeedLinks( $feedParams ); - if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id, $userObj, $this ) ) ) { + if ( Hooks::run( 'SpecialContributionsBeforeMainOutput', array( $id, $userObj, $this ) ) ) { if ( !$this->including() ) { $out->addHTML( $this->getForm() ); } @@ -386,7 +386,7 @@ class SpecialContributions extends IncludableSpecialPage { ); } - wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) ); + Hooks::run( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) ); return $tools; } @@ -747,7 +747,7 @@ class ContribsPager extends ReverseChronologicalPager { $data = array( $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ) ); - wfRunHooks( + Hooks::run( 'ContribsPager::reallyDoQuery', array( &$data, $pager, $offset, $limit, $descending ) ); @@ -824,7 +824,7 @@ class ContribsPager extends ReverseChronologicalPager { $this->tagFilter ); - wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); + Hooks::run( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; } @@ -1109,7 +1109,7 @@ class ContribsPager extends ReverseChronologicalPager { } // Let extensions add data - wfRunHooks( 'ContributionsLineEnding', array( $this, &$ret, $row, &$classes ) ); + Hooks::run( 'ContributionsLineEnding', array( $this, &$ret, $row, &$classes ) ); if ( $classes === array() && $ret === '' ) { wfDebug( "Dropping Special:Contribution row that could not be formatted\n" ); diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 29c3fd4144..7e5d13c3f2 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -466,7 +466,7 @@ class DeletedContributionsPage extends SpecialPage { ); } - wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); + Hooks::run( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); $links = $this->getLanguage()->pipeList( $tools ); diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index cb97420aa8..e42db8c575 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -513,7 +513,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ); $page = WikiPage::factory( $title ); - wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) ); + Hooks::run( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) ); } } } @@ -551,7 +551,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { // Allow subscribers to manipulate the list of watched pages (or use it // to preload lots of details at once) $watchlistInfo = $this->getWatchlistInfo(); - wfRunHooks( + Hooks::run( 'WatchlistEditorBeforeFormRender', array( &$watchlistInfo ) ); @@ -645,7 +645,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ); } - wfRunHooks( + Hooks::run( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $title->isRedirect(), $this->getSkin(), &$link ) ); diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 20532a92ae..c55fa94c4f 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -160,7 +160,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { $form->setWrapperLegendMsg( 'email-legend' ); $form->loadData(); - if ( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) { + if ( !Hooks::run( 'EmailUserForm', array( &$form ) ) ) { return; } @@ -243,8 +243,8 @@ class SpecialEmailUser extends UnlistedSpecialPage { $hookErr = false; - wfRunHooks( 'UserCanSendEmail', array( &$user, &$hookErr ) ); - wfRunHooks( 'EmailUserPermissionsErrors', array( $user, $editToken, &$hookErr ) ); + Hooks::run( 'UserCanSendEmail', array( &$user, &$hookErr ) ); + Hooks::run( 'EmailUserPermissionsErrors', array( $user, $editToken, &$hookErr ) ); if ( $hookErr ) { return $hookErr; @@ -324,7 +324,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { $from->name, $to->name )->inContentLanguage()->text(); $error = ''; - if ( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) { + if ( !Hooks::run( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) { return $error; } @@ -367,12 +367,12 @@ class SpecialEmailUser extends UnlistedSpecialPage { if ( $data['CCMe'] && $to != $from ) { $cc_subject = $context->msg( 'emailccsubject' )->rawParams( $target->getName(), $subject )->text(); - wfRunHooks( 'EmailUserCC', array( &$from, &$from, &$cc_subject, &$text ) ); + Hooks::run( 'EmailUserCC', array( &$from, &$from, &$cc_subject, &$text ) ); $ccStatus = UserMailer::send( $from, $from, $cc_subject, $text ); $status->merge( $ccStatus ); } - wfRunHooks( 'EmailUserComplete', array( $to, $from, $subject, $text ) ); + Hooks::run( 'EmailUserComplete', array( $to, $from, $subject, $text ) ); return $status; } diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 0831c208ce..da2df2ddea 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -579,7 +579,7 @@ class ImportReporter extends ContextSource { $page = WikiPage::factory( $title ); # Update page record $page->updateRevisionOn( $dbw, $nullRevision ); - wfRunHooks( + Hooks::run( 'NewRevisionFromEditComplete', array( $page, $nullRevision, $latest, $this->getUser() ) ); diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index fa20994177..68c5346467 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -150,7 +150,7 @@ class UsersPager extends AlphabeticPager { 'conds' => $conds ); - wfRunHooks( 'SpecialListusersQueryInfo', array( $this, &$query ) ); + Hooks::run( 'SpecialListusersQueryInfo', array( $this, &$query ) ); return $query; } @@ -211,7 +211,7 @@ class UsersPager extends AlphabeticPager { ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : ''; - wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); + Hooks::run( 'SpecialListusersFormatRow', array( &$item, $row ) ); return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}{$blocked}" ); } @@ -284,12 +284,12 @@ class UsersPager extends AlphabeticPager { ); $out .= '
    '; - wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) ); + Hooks::run( 'SpecialListusersHeaderForm', array( $this, &$out ) ); # Submit button and form bottom $out .= Html::hidden( 'limit', $this->mLimit ); $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ); - wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) ); + Hooks::run( 'SpecialListusersHeader', array( $this, &$out ) ); $out .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' ); @@ -322,7 +322,7 @@ class UsersPager extends AlphabeticPager { if ( $this->requestedUser != '' ) { $query['username'] = $this->requestedUser; } - wfRunHooks( 'SpecialListusersDefaultQuery', array( $this, &$query ) ); + Hooks::run( 'SpecialListusersDefaultQuery', array( $this, &$query ) ); return $query; } diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index 04c2fe965a..923283eb2e 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -97,13 +97,13 @@ class SpecialLog extends SpecialPage { } } else { // Allow extensions to add relations to their search types - wfRunHooks( 'SpecialLogAddLogSearchRelations', array( $opts->getValue( 'type' ), $this->getRequest(), &$qc ) ); + Hooks::run( 'SpecialLogAddLogSearchRelations', array( $opts->getValue( 'type' ), $this->getRequest(), &$qc ) ); } # Some log types are only for a 'User:' title but we might have been given # only the username instead of the full title 'User:username'. This part try # to lookup for a user by that name and eventually fix user input. See bug 1697. - wfRunHooks( 'GetLogTypesOnUser', array( &$this->typeOnUser ) ); + Hooks::run( 'GetLogTypesOnUser', array( &$this->typeOnUser ) ); if ( in_array( $opts->getValue( 'type' ), $this->typeOnUser ) ) { # ok we have a type of log which expect a user title. $target = Title::newFromText( $opts->getValue( 'page' ) ); diff --git a/includes/specials/SpecialLonelypages.php b/includes/specials/SpecialLonelypages.php index f533234f28..c072491b8e 100644 --- a/includes/specials/SpecialLonelypages.php +++ b/includes/specials/SpecialLonelypages.php @@ -72,7 +72,7 @@ class LonelyPagesPage extends PageQueryPage { ); // Allow extensions to modify the query - wfRunHooks( 'LonelyPagesQuery', array( &$tables, &$conds, &$joinConds ) ); + Hooks::run( 'LonelyPagesQuery', array( &$tables, &$conds, &$joinConds ) ); return array( 'tables' => $tables, diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index c71ef76dec..07a18b0903 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -485,7 +485,7 @@ class SpecialMergeHistory extends SpecialPage { $targetTitle->getPrefixedText(), $destTitle->getPrefixedText() )->numParams( $count )->text() ); - wfRunHooks( 'ArticleMergeComplete', array( $targetTitle, $destTitle ) ); + Hooks::run( 'ArticleMergeComplete', array( $targetTitle, $destTitle ) ); return true; } diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 4cbf584a35..2a7e435080 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -604,7 +604,7 @@ class MovePageForm extends UnlistedSpecialPage { $newLink )->params( $oldText, $newText )->parseAsBlock() ); $out->addWikiMsg( $msgName ); - wfRunHooks( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) ); + Hooks::run( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) ); # Now we move extra pages we've been asked to move: subpages and talk # pages. First, if the old page or the new page is a talk page, we diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index b3b3d48271..aa16dbc4c1 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -56,7 +56,7 @@ class SpecialNewpages extends IncludableSpecialPage { $opts->add( 'invert', false ); $this->customFilters = array(); - wfRunHooks( 'SpecialNewPagesFilters', array( $this, &$this->customFilters ) ); + Hooks::run( 'SpecialNewPagesFilters', array( $this, &$this->customFilters ) ); foreach ( $this->customFilters as $key => $params ) { $opts->add( $key, $params['default'] ); } @@ -548,7 +548,7 @@ class NewPagesPager extends ReverseChronologicalPager { ); $join_conds = array( 'page' => array( 'INNER JOIN', 'page_id=rc_cur_id' ) ); - wfRunHooks( 'SpecialNewpagesConditions', + Hooks::run( 'SpecialNewpagesConditions', array( &$this, $this->opts, &$conds, &$tables, &$fields, &$join_conds ) ); $options = array(); diff --git a/includes/specials/SpecialPageLanguage.php b/includes/specials/SpecialPageLanguage.php index 2acf23cdcb..52c2460d45 100644 --- a/includes/specials/SpecialPageLanguage.php +++ b/includes/specials/SpecialPageLanguage.php @@ -93,7 +93,7 @@ class SpecialPageLanguage extends FormSpecialPage { public function alterForm( HTMLForm $form ) { $form->setDisplayFormat( 'vform' ); $form->setWrapperLegend( false ); - wfRunHooks( 'LanguageSelector', array( $this->getOutput(), 'mw-languageselector' ) ); + Hooks::run( 'LanguageSelector', array( $this->getOutput(), 'mw-languageselector' ) ); } /** diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index 3061c85b12..6ee3290c76 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -195,7 +195,7 @@ class SpecialPasswordReset extends FormSpecialPage { // Check for hooks (captcha etc), and allow them to modify the users list $error = array(); - if ( !wfRunHooks( 'SpecialPasswordResetOnSubmit', array( &$users, $data, &$error ) ) ) { + if ( !Hooks::run( 'SpecialPasswordResetOnSubmit', array( &$users, $data, &$error ) ) ) { return array( $error ); } @@ -246,7 +246,7 @@ class SpecialPasswordReset extends FormSpecialPage { return array( 'badipaddress' ); } $caller = $this->getUser(); - wfRunHooks( 'User::mailPasswordInternal', array( &$caller, &$ip, &$firstUser ) ); + Hooks::run( 'User::mailPasswordInternal', array( &$caller, &$ip, &$firstUser ) ); $username = $caller->getName(); $msg = IP::isValid( $username ) ? 'passwordreset-emailtext-ip' diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index 6d8f59b571..73a88b9edc 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -106,7 +106,7 @@ class RandomPage extends SpecialPage { $randstr = wfRandom(); $title = null; - if ( !wfRunHooks( + if ( !Hooks::run( 'SpecialRandomGetRandomTitle', array( &$randstr, &$this->isRedir, &$this->namespaces, &$this->extra, &$title ) ) ) { diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 58b51b3ecb..efb870b830 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -95,7 +95,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage { protected function getCustomFilters() { if ( $this->customFilters === null ) { $this->customFilters = parent::getCustomFilters(); - wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ), '1.23' ); + Hooks::run( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ), '1.23' ); } return $this->customFilters; @@ -254,7 +254,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage { protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) { return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts ) - && wfRunHooks( + && Hooks::run( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ), '1.23' @@ -475,7 +475,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage { // Don't fire the hook for subclasses. (Or should we?) if ( $this->getName() === 'Recentchanges' ) { - wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) ); + Hooks::run( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) ); } return $extraOpts; diff --git a/includes/specials/SpecialResetTokens.php b/includes/specials/SpecialResetTokens.php index 4add742117..ba2b9a5bac 100644 --- a/includes/specials/SpecialResetTokens.php +++ b/includes/specials/SpecialResetTokens.php @@ -44,7 +44,7 @@ class SpecialResetTokens extends FormSpecialPage { $tokens = array( array( 'preference' => 'watchlisttoken', 'label-message' => 'resettokens-watchlist-token' ), ); - wfRunHooks( 'SpecialResetTokensTokens', array( &$tokens ) ); + Hooks::run( 'SpecialResetTokensTokens', array( &$tokens ) ); $hiddenPrefs = $this->getConfig()->get( 'HiddenPrefs' ); $tokens = array_filter( $tokens, function ( $tok ) use ( $hiddenPrefs ) { diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 448b802ea5..1923d44d60 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -196,7 +196,7 @@ class SpecialSearch extends SpecialPage { # No match, generate an edit URL $title = Title::newFromText( $term ); if ( !is_null( $title ) ) { - wfRunHooks( 'SpecialSearchNogomatch', array( &$title ) ); + Hooks::run( 'SpecialSearchNogomatch', array( &$title ) ); } $this->showResults( $term ); } @@ -214,7 +214,7 @@ class SpecialSearch extends SpecialPage { $search->prefix = $this->mPrefix; $term = $search->transformSearchTerm( $term ); - wfRunHooks( 'SpecialSearchSetupEngine', array( $this, $this->profile, $search ) ); + Hooks::run( 'SpecialSearchSetupEngine', array( $this, $this->profile, $search ) ); $this->setupPage( $term ); @@ -293,7 +293,7 @@ class SpecialSearch extends SpecialPage { . $this->msg( 'search-suggest' )->rawParams( $suggestLink )->text() . '
    '; } - if ( !wfRunHooks( 'SpecialSearchResultsPrepend', array( $this, $out, $term ) ) ) { + if ( !Hooks::run( 'SpecialSearchResultsPrepend', array( $this, $out, $term ) ) ) { # Hook requested termination return; } @@ -361,7 +361,7 @@ class SpecialSearch extends SpecialPage { ); } } - wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) ); + Hooks::run( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) ); $out->parserOptions()->setEditSection( false ); if ( $titleMatches ) { @@ -444,7 +444,7 @@ class SpecialSearch extends SpecialPage { wfEscapeWikiText( $title->getPrefixedText() ), Message::numParam( $num ) ); - wfRunHooks( 'SpecialSearchCreateLink', array( $title, &$params ) ); + Hooks::run( 'SpecialSearchCreateLink', array( $title, &$params ) ); // Extensions using the hook might still return an empty $messageName if ( $messageName ) { @@ -595,7 +595,7 @@ class SpecialSearch extends SpecialPage { $link_t = clone $title; - wfRunHooks( 'ShowSearchHitTitle', + Hooks::run( 'ShowSearchHitTitle', array( &$link_t, &$titleSnippet, $result, $terms, $this ) ); $link = Linker::linkKnown( @@ -713,7 +713,7 @@ class SpecialSearch extends SpecialPage { $html = null; $score = ''; - if ( wfRunHooks( 'ShowSearchHit', array( + if ( Hooks::run( 'ShowSearchHit', array( $this, $result, $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related, @@ -907,7 +907,7 @@ class SpecialSearch extends SpecialPage { $showSections = array( 'namespaceTables' => $namespaceTables ); - wfRunHooks( 'SpecialSearchPowerBox', array( &$showSections, $term, $opts ) ); + Hooks::run( 'SpecialSearchPowerBox', array( &$showSections, $term, $opts ) ); $hidden = ''; foreach ( $opts as $key => $value ) { @@ -978,7 +978,7 @@ class SpecialSearch extends SpecialPage { ) ); - wfRunHooks( 'SpecialSearchProfiles', array( &$profiles ) ); + Hooks::run( 'SpecialSearchProfiles', array( &$profiles ) ); foreach ( $profiles as &$data ) { if ( !is_array( $data['namespaces'] ) ) { @@ -1044,7 +1044,7 @@ class SpecialSearch extends SpecialPage { $out .= $this->powerSearchBox( $term, $opts ); } else { $form = ''; - wfRunHooks( 'SpecialSearchProfileForm', array( $this, &$form, $this->profile, $term, $opts ) ); + Hooks::run( 'SpecialSearchProfileForm', array( $this, &$form, $this->profile, $term, $opts ) ); $out .= $form; } diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 1bbc2f38c2..44290220ef 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -78,7 +78,7 @@ class SpecialStatistics extends SpecialPage { # Statistic - other $extraStats = array(); - if ( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { + if ( Hooks::run( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { $text .= $this->getOtherStats( $extraStats ); } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index bcf83c8d8d..2ea1b12a69 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -421,7 +421,7 @@ class PageArchive { $logEntry->setTarget( $this->title ); $logEntry->setComment( $reason ); - wfRunHooks( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) ); + Hooks::run( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) ); $logid = $logEntry->insert(); $logEntry->publish( $logid ); @@ -605,7 +605,7 @@ class PageArchive { $revision->insertOn( $dbw ); $restored++; - wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) ); + Hooks::run( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) ); } # Now that it's safely stored, take it out of the archive $dbw->delete( 'archive', @@ -631,7 +631,7 @@ class PageArchive { ); } - wfRunHooks( 'ArticleUndelete', array( &$this->title, $created, $comment, $oldPageId ) ); + Hooks::run( 'ArticleUndelete', array( &$this->title, $created, $comment, $oldPageId ) ); if ( $this->title->getNamespace() == NS_FILE ) { $update = new HTMLCacheUpdate( $this->title, 'imagelinks' ); @@ -908,7 +908,7 @@ class SpecialUndelete extends SpecialPage { } $archive = new PageArchive( $this->mTargetObj, $this->getConfig() ); - if ( !wfRunHooks( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj ) ) ) { + if ( !Hooks::run( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj ) ) ) { return; } $rev = $archive->getRevision( $timestamp ); @@ -992,7 +992,7 @@ class SpecialUndelete extends SpecialPage { $out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params( $time )->rawParams( $userLink )->params( $d, $t )->parse() . '' ); - if ( !wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ) ) { + if ( !Hooks::run( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ) ) { return; } @@ -1215,7 +1215,7 @@ class SpecialUndelete extends SpecialPage { ); $archive = new PageArchive( $this->mTargetObj, $this->getConfig() ); - wfRunHooks( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj ) ); + Hooks::run( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj ) ); /* $text = $archive->getLastRevisionText(); if( is_null( $text ) ) { @@ -1640,7 +1640,7 @@ class SpecialUndelete extends SpecialPage { $out = $this->getOutput(); $archive = new PageArchive( $this->mTargetObj, $this->getConfig() ); - wfRunHooks( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj ) ); + Hooks::run( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj ) ); $ok = $archive->undelete( $this->mTargetTimestamp, $this->mComment, @@ -1651,7 +1651,7 @@ class SpecialUndelete extends SpecialPage { if ( is_array( $ok ) ) { if ( $ok[1] ) { // Undeleted file count - wfRunHooks( 'FileUndeleteComplete', array( + Hooks::run( 'FileUndeleteComplete', array( $this->mTargetObj, $this->mFileVersions, $this->getUser(), $this->mComment ) ); } diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index ccc5dead7a..ff0ccc1381 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -186,7 +186,7 @@ class SpecialUpload extends SpecialPage { $this->processUpload(); } else { # Backwards compatibility hook - if ( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) { + if ( !Hooks::run( 'UploadForm:initial', array( &$this ) ) ) { wfDebug( "Hook 'UploadForm:initial' broke output of the upload form\n" ); return; @@ -414,7 +414,7 @@ class SpecialUpload extends SpecialPage { return; } - if ( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) { + if ( !Hooks::run( 'UploadForm:BeforeProcessing', array( &$this ) ) ) { wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" ); // This code path is deprecated. If you want to break upload processing // do so by hooking into the appropriate hooks in UploadBase::verifyUpload @@ -474,7 +474,7 @@ class SpecialUpload extends SpecialPage { // Success, redirect to description page $this->mUploadSuccessful = true; - wfRunHooks( 'SpecialUploadComplete', array( &$this ) ); + Hooks::run( 'SpecialUploadComplete', array( &$this ) ); $this->getOutput()->redirect( $this->mLocalFile->getTitle()->getFullURL() ); } @@ -795,7 +795,7 @@ class UploadForm extends HTMLForm { + $this->getDescriptionSection() + $this->getOptionsSection(); - wfRunHooks( 'UploadFormInitDescriptor', array( &$descriptor ) ); + Hooks::run( 'UploadFormInitDescriptor', array( &$descriptor ) ); parent::__construct( $descriptor, $context, 'upload' ); # Add a link to edit MediaWik:Licenses @@ -907,7 +907,7 @@ class UploadForm extends HTMLForm { 'checked' => $selectedSourceType == 'url', ); } - wfRunHooks( 'UploadFormSourceDescriptors', array( &$descriptor, &$radio, $selectedSourceType ) ); + Hooks::run( 'UploadFormSourceDescriptors', array( &$descriptor, &$radio, $selectedSourceType ) ); $descriptor['Extensions'] = array( 'type' => 'info', diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 83b9089d15..b7c786864d 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -122,7 +122,7 @@ class LoginForm extends SpecialPage { static $messages = null; if ( !$messages ) { $messages = self::$validErrorMessages; - wfRunHooks( 'LoginFormValidErrorMessages', array( &$messages ) ); + Hooks::run( 'LoginFormValidErrorMessages', array( &$messages ) ); } return $messages; @@ -352,7 +352,7 @@ class LoginForm extends SpecialPage { $u->saveSettings(); $result = $this->mailPasswordInternal( $u, false, 'createaccount-title', 'createaccount-text' ); - wfRunHooks( 'AddNewAccount', array( $u, true ) ); + Hooks::run( 'AddNewAccount', array( $u, true ) ); $u->addNewUserLogEntry( 'byemail', $this->mReason ); $out = $this->getOutput(); @@ -427,7 +427,7 @@ class LoginForm extends SpecialPage { // which is needed or the personal links will be // wrong. $this->getContext()->setUser( $u ); - wfRunHooks( 'AddNewAccount', array( $u, false ) ); + Hooks::run( 'AddNewAccount', array( $u, false ) ); $u->addNewUserLogEntry( 'create' ); if ( $this->hasSessionCookie() ) { $this->successfulCreation(); @@ -439,7 +439,7 @@ class LoginForm extends SpecialPage { $out->setPageTitle( $this->msg( 'accountcreated' ) ); $out->addWikiMsg( 'accountcreatedtext', $u->getName() ); $out->addReturnTo( $this->getPageTitle() ); - wfRunHooks( 'AddNewAccount', array( $u, false ) ); + Hooks::run( 'AddNewAccount', array( $u, false ) ); $u->addNewUserLogEntry( 'create2', $this->mReason ); } @@ -573,7 +573,7 @@ class LoginForm extends SpecialPage { $abortError = ''; $abortStatus = null; - if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError, &$abortStatus ) ) ) { + if ( !Hooks::run( 'AbortNewAccount', array( $u, &$abortError, &$abortStatus ) ) ) { // Hook point to add extra creation throttles and blocks wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" ); if ( $abortStatus === null ) { @@ -593,7 +593,7 @@ class LoginForm extends SpecialPage { } // Hook point to check for exempt from account creation throttle - if ( !wfRunHooks( 'ExemptFromAccountCreationThrottle', array( $ip ) ) ) { + if ( !Hooks::run( 'ExemptFromAccountCreationThrottle', array( $ip ) ) ) { wfDebug( "LoginForm::exemptFromAccountCreationThrottle: a hook " . "allowed account creation w/o throttle\n" ); } else { @@ -716,7 +716,7 @@ class LoginForm extends SpecialPage { // Give extensions a way to indicate the username has been updated, // rather than telling the user the account doesn't exist. - if ( !wfRunHooks( 'LoginUserMigrated', array( $u, &$msg ) ) ) { + if ( !Hooks::run( 'LoginUserMigrated', array( $u, &$msg ) ) ) { $this->mAbortLoginErrorMsg = $msg; return self::USER_MIGRATED; } @@ -740,7 +740,7 @@ class LoginForm extends SpecialPage { // Give general extensions, such as a captcha, a chance to abort logins $abort = self::ABORTED; $msg = null; - if ( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$msg ) ) ) { + if ( !Hooks::run( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$msg ) ) ) { $this->mAbortLoginErrorMsg = $msg; return $abort; @@ -801,12 +801,12 @@ class LoginForm extends SpecialPage { if ( $isAutoCreated ) { // Must be run after $wgUser is set, for correct new user log - wfRunHooks( 'AuthPluginAutoCreate', array( $u ) ); + Hooks::run( 'AuthPluginAutoCreate', array( $u ) ); } $retval = self::SUCCESS; } - wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $retval ) ); + Hooks::run( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $retval ) ); return $retval; } @@ -887,7 +887,7 @@ class LoginForm extends SpecialPage { } $abortError = ''; - if ( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) { + if ( !Hooks::run( 'AbortAutoAccount', array( $user, &$abortError ) ) ) { // Hook point to add extra creation throttles and blocks wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" ); $this->mAbortLoginErrorMsg = $abortError; @@ -1040,7 +1040,7 @@ class LoginForm extends SpecialPage { */ protected function resetLoginForm( Message $msg ) { // Allow hooks to explain this password reset in more detail - wfRunHooks( 'LoginPasswordResetMessage', array( &$msg, $this->mUsername ) ); + Hooks::run( 'LoginPasswordResetMessage', array( &$msg, $this->mUsername ) ); $reset = new SpecialChangePassword(); $derivative = new DerivativeContext( $this->getContext() ); $derivative->setTitle( $reset->getPageTitle() ); @@ -1073,7 +1073,7 @@ class LoginForm extends SpecialPage { } $currentUser = $this->getUser(); - wfRunHooks( 'User::mailPasswordInternal', array( &$currentUser, &$ip, &$u ) ); + Hooks::run( 'User::mailPasswordInternal', array( &$currentUser, &$ip, &$u ) ); $np = $u->randomPassword(); $u->setNewpassword( $np, $throttle ); @@ -1104,7 +1104,7 @@ class LoginForm extends SpecialPage { # Run any hooks; display injected HTML if any, else redirect $currentUser = $this->getUser(); $injected_html = ''; - wfRunHooks( 'UserLoginComplete', array( &$currentUser, &$injected_html ) ); + Hooks::run( 'UserLoginComplete', array( &$currentUser, &$injected_html ) ); if ( $injected_html !== '' ) { $this->displaySuccessfulAction( 'success', $this->msg( 'loginsuccesstitle' ), @@ -1126,14 +1126,14 @@ class LoginForm extends SpecialPage { $injected_html = ''; $welcome_creation_msg = 'welcomecreation-msg'; - wfRunHooks( 'UserLoginComplete', array( &$currentUser, &$injected_html ) ); + Hooks::run( 'UserLoginComplete', array( &$currentUser, &$injected_html ) ); /** * Let any extensions change what message is shown. * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforeWelcomeCreation * @since 1.18 */ - wfRunHooks( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) ); + Hooks::run( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) ); $this->displaySuccessfulAction( 'signup', @@ -1243,7 +1243,7 @@ class LoginForm extends SpecialPage { } // Allow modification of redirect behavior - wfRunHooks( 'PostLoginRedirect', array( &$returnTo, &$returnToQuery, &$type ) ); + Hooks::run( 'PostLoginRedirect', array( &$returnTo, &$returnToQuery, &$type ) ); $returnToTitle = Title::newFromText( $returnTo ); if ( !$returnToTitle ) { @@ -1447,9 +1447,9 @@ class LoginForm extends SpecialPage { // Give authentication and captcha plugins a chance to modify the form $wgAuth->modifyUITemplate( $template, $this->mType ); if ( $this->mType == 'signup' ) { - wfRunHooks( 'UserCreateForm', array( &$template ) ); + Hooks::run( 'UserCreateForm', array( &$template ) ); } else { - wfRunHooks( 'UserLoginForm', array( &$template ) ); + Hooks::run( 'UserLoginForm', array( &$template ) ); } $out->disallowUserJs(); // just in case... diff --git a/includes/specials/SpecialUserlogout.php b/includes/specials/SpecialUserlogout.php index d65ac85279..080dc11943 100644 --- a/includes/specials/SpecialUserlogout.php +++ b/includes/specials/SpecialUserlogout.php @@ -56,7 +56,7 @@ class SpecialUserlogout extends UnlistedSpecialPage { // Hook. $injected_html = ''; - wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) ); + Hooks::run( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) ); $out->addHTML( $injected_html ); $out->returnToMain(); diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 6ca57aa62f..3e9313cd17 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -267,7 +267,7 @@ class UserrightsPage extends SpecialPage { wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) . "\n" ); wfDebug( 'newGroups: ' . print_r( $newGroups, true ) . "\n" ); - wfRunHooks( 'UserRights', array( &$user, $add, $remove ) ); + Hooks::run( 'UserRights', array( &$user, $add, $remove ) ); if ( $newGroups != $oldGroups ) { $this->addLogEntry( $user, $oldGroups, $newGroups, $reason ); diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 34f434f6f7..ee9e2ade87 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -220,7 +220,7 @@ class SpecialVersion extends SpecialPage { $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo(); // Allow a hook to add/remove items. - wfRunHooks( 'SoftwareInfo', array( &$software ) ); + Hooks::run( 'SoftwareInfo', array( &$software ) ); $out = Xml::element( 'h2', @@ -341,7 +341,7 @@ class SpecialVersion extends SpecialPage { private static function getwgVersionLinked() { global $wgVersion; $versionUrl = ""; - if ( wfRunHooks( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) { + if ( Hooks::run( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) { $versionParts = array(); preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts ); $versionUrl = "https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]}"; @@ -402,7 +402,7 @@ class SpecialVersion extends SpecialPage { 'other' => wfMessage( 'version-other' )->text(), ); - wfRunHooks( 'ExtensionTypes', array( &self::$extensionTypes ) ); + Hooks::run( 'ExtensionTypes', array( &self::$extensionTypes ) ); } return self::$extensionTypes; diff --git a/includes/specials/SpecialWantedpages.php b/includes/specials/SpecialWantedpages.php index 38f1808f7a..cad2348b13 100644 --- a/includes/specials/SpecialWantedpages.php +++ b/includes/specials/SpecialWantedpages.php @@ -86,7 +86,7 @@ class WantedPagesPage extends WantedQueryPage { ) ); // Replacement for the WantedPages::getSQL hook - wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) ); + Hooks::run( 'WantedPages::getQueryInfo', array( &$this, &$query ) ); return $query; } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index a7c2052e68..ca3386cf3c 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -123,7 +123,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { protected function getCustomFilters() { if ( $this->customFilters === null ) { $this->customFilters = parent::getCustomFilters(); - wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ), '1.23' ); + Hooks::run( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ), '1.23' ); } return $this->customFilters; @@ -201,7 +201,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { } else { # Top log Ids for a page are not stored $nonRevisionTypes = array( RC_LOG ); - wfRunHooks( 'SpecialWatchlistGetNonRevisionTypes', array( &$nonRevisionTypes ) ); + Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', array( &$nonRevisionTypes ) ); if ( $nonRevisionTypes ) { $conds[] = $dbr->makeList( array( @@ -286,7 +286,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { &$join_conds, $opts ) { return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts ) - && wfRunHooks( + && Hooks::run( 'SpecialWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields, $opts ), '1.23' diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index e373cfffb6..11ec3637e2 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -335,7 +335,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $props[] = $msgcache['isimage']; } - wfRunHooks( 'WhatLinksHereProps', array( $row, $nt, $target, &$props ) ); + Hooks::run( 'WhatLinksHereProps', array( $row, $nt, $target, &$props ) ); if ( count( $props ) ) { $propsText = $this->msg( 'parentheses' ) diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index a278652599..4c96dc8196 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -150,7 +150,7 @@ abstract class UploadBase { // Give hooks the chance to handle this request $className = null; - wfRunHooks( 'UploadCreateFromRequest', array( $type, &$className ) ); + Hooks::run( 'UploadCreateFromRequest', array( $type, &$className ) ); if ( is_null( $className ) ) { $className = 'UploadFrom' . $type; wfDebug( __METHOD__ . ": class name: $className\n" ); @@ -335,7 +335,7 @@ abstract class UploadBase { } $error = ''; - if ( !wfRunHooks( 'UploadVerification', + if ( !Hooks::run( 'UploadVerification', array( $this->mDestName, $this->mTempPath, &$error ) ) ) { wfProfileOut( __METHOD__ ); @@ -469,7 +469,7 @@ abstract class UploadBase { } } - wfRunHooks( 'UploadVerifyFile', array( $this, $mime, &$status ) ); + Hooks::run( 'UploadVerifyFile', array( $this, $mime, &$status ) ); if ( $status !== true ) { wfProfileOut( __METHOD__ ); @@ -755,7 +755,7 @@ abstract class UploadBase { WatchedItem::IGNORE_USER_RIGHTS ); } - wfRunHooks( 'UploadComplete', array( &$this ) ); + Hooks::run( 'UploadComplete', array( &$this ) ); $this->postProcessUpload(); } diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index b60564017e..14a6da60ba 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -118,7 +118,7 @@ class UploadFromUrl extends UploadBase { public static function isAllowedUrl( $url ) { if ( !isset( self::$allowedUrls[$url] ) ) { $allowed = true; - wfRunHooks( 'IsUploadAllowedFromUrl', array( $url, &$allowed ) ); + Hooks::run( 'IsUploadAllowedFromUrl', array( $url, &$allowed ) ); self::$allowedUrls[$url] = $allowed; } diff --git a/includes/utils/IP.php b/includes/utils/IP.php index 77f9cd11fe..55a8994748 100644 --- a/includes/utils/IP.php +++ b/includes/utils/IP.php @@ -717,7 +717,7 @@ class IP { */ public static function isTrustedProxy( $ip ) { $trusted = self::isConfiguredProxy( $ip ); - wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); + Hooks::run( 'IsTrustedProxy', array( &$ip, &$trusted ) ); return $trusted; } -- 2.20.1