diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/actions | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/actions')
-rw-r--r-- | includes/actions/Action.php | 24 | ||||
-rw-r--r-- | includes/actions/CreditsAction.php | 6 | ||||
-rw-r--r-- | includes/actions/DeleteAction.php | 3 | ||||
-rw-r--r-- | includes/actions/EditAction.php | 2 | ||||
-rw-r--r-- | includes/actions/FormAction.php | 4 | ||||
-rw-r--r-- | includes/actions/HistoryAction.php | 59 | ||||
-rw-r--r-- | includes/actions/InfoAction.php | 53 | ||||
-rw-r--r-- | includes/actions/RawAction.php | 2 | ||||
-rw-r--r-- | includes/actions/RevertAction.php | 4 | ||||
-rw-r--r-- | includes/actions/RevisiondeleteAction.php | 6 | ||||
-rw-r--r-- | includes/actions/SpecialPageAction.php | 79 | ||||
-rw-r--r-- | includes/actions/UnwatchAction.php | 2 | ||||
-rw-r--r-- | includes/actions/WatchAction.php | 10 |
13 files changed, 174 insertions, 80 deletions
diff --git a/includes/actions/Action.php b/includes/actions/Action.php index 8d11d901..bb6a4d5d 100644 --- a/includes/actions/Action.php +++ b/includes/actions/Action.php @@ -132,6 +132,8 @@ abstract class Action { if ( $actionName === 'historysubmit' ) { if ( $request->getBool( 'revisiondelete' ) ) { $actionName = 'revisiondelete'; + } elseif ( $request->getBool( 'editchangetags' ) ) { + $actionName = 'editchangetags'; } else { $actionName = 'view'; } @@ -375,6 +377,28 @@ abstract class Action { } /** + * Adds help link with an icon via page indicators. + * Link target can be overridden by a local message containing a wikilink: + * the message key is: lowercase action name + '-helppage'. + * @param string $to Target MediaWiki.org page title or encoded URL. + * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o. + * @since 1.25 + */ + public function addHelpLink( $to, $overrideBaseUrl = false ) { + global $wgContLang; + $msg = wfMessage( $wgContLang->lc( + Action::getActionName( $this->getContext() ) + ) . '-helppage' ); + + if ( !$msg->isDisabled() ) { + $helpUrl = Skin::makeUrl( $msg->plain() ); + $this->getOutput()->addHelpLink( $helpUrl, true ); + } else { + $this->getOutput()->addHelpLink( $to, $overrideBaseUrl ); + } + } + + /** * The main action entry point. Do all output for display and send it to the context * output. Do not use globals $wgOut, $wgRequest, etc, in implementations; use * $this->getOutput(), etc. diff --git a/includes/actions/CreditsAction.php b/includes/actions/CreditsAction.php index e064aab4..c19e8fa3 100644 --- a/includes/actions/CreditsAction.php +++ b/includes/actions/CreditsAction.php @@ -42,7 +42,6 @@ class CreditsAction extends FormlessAction { * @return string HTML */ public function onView() { - wfProfileIn( __METHOD__ ); if ( $this->page->getID() == 0 ) { $s = $this->msg( 'nocredits' )->parse(); @@ -50,8 +49,6 @@ class CreditsAction extends FormlessAction { $s = $this->getCredits( -1 ); } - wfProfileOut( __METHOD__ ); - return Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $s ); } @@ -63,7 +60,6 @@ class CreditsAction extends FormlessAction { * @return string Html */ public function getCredits( $cnt, $showIfMax = true ) { - wfProfileIn( __METHOD__ ); $s = ''; if ( $cnt != 0 ) { @@ -73,8 +69,6 @@ class CreditsAction extends FormlessAction { } } - wfProfileOut( __METHOD__ ); - return $s; } diff --git a/includes/actions/DeleteAction.php b/includes/actions/DeleteAction.php index 12f0dff0..be21a6f1 100644 --- a/includes/actions/DeleteAction.php +++ b/includes/actions/DeleteAction.php @@ -41,13 +41,14 @@ class DeleteAction extends FormlessAction { } public function show() { + $out = $this->getOutput(); if ( $this->getContext()->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) { - $out = $this->getOutput(); $out->addModuleStyles( array( 'mediawiki.ui.input', 'mediawiki.ui.checkbox', ) ); } + $this->addHelpLink( 'Help:Sysop deleting and undeleting' ); $this->page->delete(); } } diff --git a/includes/actions/EditAction.php b/includes/actions/EditAction.php index 88767244..6c8440ac 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 4c9e85dd..26f43cb0 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 8522e560..dcd77415 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -67,8 +67,7 @@ class HistoryAction extends FormlessAction { } /** - * Get the Article object we are working on. - * @return Page + * @return WikiPage|Article|ImagePage|CategoryPage|Page The Article object we are working on. */ public function getArticle() { return $this->page; @@ -102,8 +101,6 @@ class HistoryAction extends FormlessAction { return; // Client cache fresh and headers sent, nothing more to do. } - wfProfileIn( __METHOD__ ); - $this->preCacheMessages(); $config = $this->context->getConfig(); @@ -131,7 +128,6 @@ class HistoryAction extends FormlessAction { $feedType = $request->getVal( 'feed' ); if ( $feedType ) { $this->feed( $feedType ); - wfProfileOut( __METHOD__ ); return; } @@ -151,7 +147,6 @@ class HistoryAction extends FormlessAction { 'msgKey' => array( 'moveddeleted-notice' ) ) ); - wfProfileOut( __METHOD__ ); return; } @@ -196,11 +191,15 @@ class HistoryAction extends FormlessAction { ) . ' ' . ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . $checkDeleted . - Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" . + Html::submitButton( + $this->msg( 'allpagessubmit' )->text(), + array(), + array( 'mw-ui-progressive' ) + ) . "\n" . '</fieldset></form>' ); - 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 ); @@ -211,7 +210,6 @@ class HistoryAction extends FormlessAction { ); $out->preventClickjacking( $pager->getPreventClickjacking() ); - wfProfileOut( __METHOD__ ); } /** @@ -416,7 +414,7 @@ class HistoryPager extends ReverseChronologicalPager { $queryInfo['options'], $this->tagFilter ); - wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) ); + Hooks::run( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; } @@ -481,20 +479,28 @@ class HistoryPager extends ReverseChronologicalPager { 'id' => 'mw-history-compare' ) ) . "\n"; $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n"; $s .= Html::hidden( 'action', 'historysubmit' ) . "\n"; + $s .= Html::hidden( 'type', 'revision' ) . "\n"; // Button container stored in $this->buttons for re-use in getEndBody() $this->buttons = '<div>'; $className = 'historysubmit mw-history-compareselectedversions-button'; - if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) { - $className .= ' mw-ui-button mw-ui-constructive'; - } + $attrs = array( 'class' => $className ) + + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ); $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(), - array( 'class' => $className ) - + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ) + $attrs ) . "\n"; - if ( $this->getUser()->isAllowed( 'deleterevision' ) ) { - $this->buttons .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' ); + $user = $this->getUser(); + $actionButtons = ''; + if ( $user->isAllowed( 'deleterevision' ) ) { + $actionButtons .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' ); + } + if ( ChangeTags::showTagEditingUI( $user ) ) { + $actionButtons .= $this->getRevisionButton( 'editchangetags', 'history-edit-tags' ); + } + if ( $actionButtons ) { + $this->buttons .= Xml::tags( 'div', array( 'class' => + 'mw-history-revisionactions' ), $actionButtons ); } $this->buttons .= '</div>'; @@ -561,7 +567,7 @@ class HistoryPager extends ReverseChronologicalPager { function submitButton( $message, $attributes = array() ) { # Disable submit button if history has 1 revision only if ( $this->getNumRows() > 1 ) { - return Xml::submitButton( $message, $attributes ); + return Html::submitButton( $message, $attributes ); } else { return ''; } @@ -610,11 +616,15 @@ class HistoryPager extends ReverseChronologicalPager { $del = ''; $user = $this->getUser(); - // Show checkboxes for each revision - if ( $user->isAllowed( 'deleterevision' ) ) { + $canRevDelete = $user->isAllowed( 'deleterevision' ); + $showTagEditUI = ChangeTags::showTagEditingUI( $user ); + // Show checkboxes for each revision, to allow for revision deletion and + // change tags + if ( $canRevDelete || $showTagEditUI ) { $this->preventClickjacking(); - // If revision was hidden from sysops, disable the checkbox - if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) { + // If revision was hidden from sysops and we don't need the checkbox + // for anything else, disable it + if ( !$showTagEditUI && !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) { $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) ); // Otherwise, enable the checkbox... } else { @@ -708,7 +718,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(); @@ -726,7 +736,7 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' <span class="mw-changeslist-separator">. .</span> ' . $s2; } - wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) ); + Hooks::run( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) ); $attribs = array(); if ( $classes ) { @@ -899,4 +909,5 @@ class HistoryPager extends ReverseChronologicalPager { function getPreventClickjacking() { return $this->preventClickjacking; } + } diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index f932a405..b5a73910 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -65,8 +65,8 @@ class InfoAction extends FormlessAction { */ public static function invalidateCache( Title $title ) { global $wgMemc; - // Clear page info. - $revision = WikiPage::factory( $title )->getRevision(); + + $revision = Revision::newFromTitle( $title, 0, Revision::READ_LATEST ); if ( $revision !== null ) { $key = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $revision->getId() ); $wgMemc->delete( $key ); @@ -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 ) { @@ -246,13 +246,13 @@ class InfoAction extends FormlessAction { $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-redirectsto' ), Linker::link( $this->page->getRedirectTarget() ) . - $this->msg( 'word-separator' )->text() . - $this->msg( 'parentheses', Linker::link( + $this->msg( 'word-separator' )->escaped() . + $this->msg( 'parentheses' )->rawParams( Linker::link( $this->page->getRedirectTarget(), $this->msg( 'pageinfo-redirectsto-info' )->escaped(), array(), array( 'action' => 'info' ) - ) )->text() + ) )->escaped() ); } @@ -276,7 +276,9 @@ class InfoAction extends FormlessAction { // Language in which the page content is (supposed to be) written $pageLang = $title->getPageLanguage()->getCode(); - if ( $config->get( 'PageLanguageUseDB' ) && $this->getTitle()->userCan( 'pagelang' ) ) { + if ( $config->get( 'PageLanguageUseDB' ) + && $this->getTitle()->userCan( 'pagelang', $this->getUser() ) + ) { // Link to Special:PageLanguage with pre-filled page title if user has permissions $titleObj = SpecialPage::getTitleFor( 'PageLanguage', $title->getPrefixedText() ); $langDisp = Linker::link( @@ -290,12 +292,12 @@ class InfoAction extends FormlessAction { $pageInfo['header-basic'][] = array( $langDisp, Language::fetchLanguageName( $pageLang, $lang->getCode() ) - . ' ' . $this->msg( 'parentheses', $pageLang ) ); + . ' ' . $this->msg( 'parentheses', $pageLang )->escaped() ); // Content model of the page $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-content-model' ), - ContentHandler::getLocalizedName( $title->getContentModel() ) + htmlspecialchars( ContentHandler::getLocalizedName( $title->getContentModel() ) ) ); // Search engine status @@ -314,13 +316,6 @@ class InfoAction extends FormlessAction { $this->msg( 'pageinfo-robot-policy' ), $this->msg( "pageinfo-robot-${policy['index']}" ) ); - if ( isset( $pageCounts['views'] ) ) { - // Number of views - $pageInfo['header-basic'][] = array( - $this->msg( 'pageinfo-views' ), $lang->formatNum( $pageCounts['views'] ) - ); - } - $unwatchedPageThreshold = $config->get( 'UnwatchedPageThreshold' ); if ( $user->isAllowed( 'unwatchedpages' ) || @@ -345,7 +340,11 @@ class InfoAction extends FormlessAction { $whatLinksHere, $this->msg( 'pageinfo-redirects-name' )->escaped(), array(), - array( 'hidelinks' => 1, 'hidetrans' => 1 ) + array( + 'hidelinks' => 1, + 'hidetrans' => 1, + 'hideimages' => $title->getNamespace() == NS_FILE + ) ), $this->msg( 'pageinfo-redirects-value' ) ->numParams( count( $title->getRedirectsHere() ) ) @@ -393,7 +392,7 @@ class InfoAction extends FormlessAction { // Page protection $pageInfo['header-restrictions'] = array(); - // Is this page effected by the cascading protection of something which includes it? + // Is this page affected by the cascading protection of something which includes it? if ( $title->isCascadeProtected() ) { $cascadingFrom = ''; $sources = $title->getCascadeProtectionSources(); // Array deferencing is in PHP 5.4 :( @@ -484,7 +483,7 @@ class InfoAction extends FormlessAction { $this->msg( 'pageinfo-firsttime' ), Linker::linkKnown( $title, - $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ), + htmlspecialchars( $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ) ), array(), array( 'oldid' => $firstRev->getId() ) ) @@ -503,7 +502,7 @@ class InfoAction extends FormlessAction { $this->msg( 'pageinfo-lasttime' ), Linker::linkKnown( $title, - $lang->userTimeAndDate( $this->page->getTimestamp(), $user ), + htmlspecialchars( $lang->userTimeAndDate( $this->page->getTimestamp(), $user ) ), array(), array( 'oldid' => $this->page->getLatest() ) ) @@ -637,24 +636,12 @@ class InfoAction extends FormlessAction { * @return array */ protected function pageCounts( Title $title ) { - wfProfileIn( __METHOD__ ); $id = $title->getArticleID(); $config = $this->context->getConfig(); $dbr = wfGetDB( DB_SLAVE ); $result = array(); - if ( !$config->get( 'DisableCounters' ) ) { - // Number of views - $views = (int)$dbr->selectField( - 'page', - 'page_counter', - array( 'page_id' => $id ), - __METHOD__ - ); - $result['views'] = $views; - } - // Number of page watchers $watchers = (int)$dbr->selectField( 'watchlist', @@ -761,8 +748,6 @@ class InfoAction extends FormlessAction { __METHOD__ ); - wfProfileOut( __METHOD__ ); - return $result; } diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index d0d956ec..727bed20 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/RevertAction.php b/includes/actions/RevertAction.php index 6481630e..d0258784 100644 --- a/includes/actions/RevertAction.php +++ b/includes/actions/RevertAction.php @@ -144,8 +144,6 @@ class RevertAction extends FormAction { } protected function getDescription() { - $this->getOutput()->addBacklinkSubtitle( $this->getTitle() ); - - return ''; + return OutputPage::buildBacklinkSubtitle( $this->getTitle() ); } } diff --git a/includes/actions/RevisiondeleteAction.php b/includes/actions/RevisiondeleteAction.php index b6eeb7b4..dbcb8485 100644 --- a/includes/actions/RevisiondeleteAction.php +++ b/includes/actions/RevisiondeleteAction.php @@ -27,8 +27,14 @@ * An action that just pass the request to Special:RevisionDelete * * @ingroup Actions + * @deprecated since 1.25 This class has been replaced by SpecialPageAction, but + * you really shouldn't have been using it outside core in the first place */ class RevisiondeleteAction extends FormlessAction { + public function __construct( Page $page, IContextSource $context = null ) { + wfDeprecated( 'RevisiondeleteAction class', '1.25' ); + parent::__construct( $page, $context ); + } public function getName() { return 'revisiondelete'; diff --git a/includes/actions/SpecialPageAction.php b/includes/actions/SpecialPageAction.php new file mode 100644 index 00000000..9b721634 --- /dev/null +++ b/includes/actions/SpecialPageAction.php @@ -0,0 +1,79 @@ +<?php +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * + * @file + * @ingroup Actions + */ + +/** + * An action that just passes the request to the relevant special page + * + * @ingroup Actions + * @since 1.25 + */ +class SpecialPageAction extends FormlessAction { + + /** + * @var array A mapping of action names to special page names. + */ + public static $actionToSpecialPageMapping = array( + 'revisiondelete' => 'Revisiondelete', + 'editchangetags' => 'EditTags', + ); + + public function getName() { + $request = $this->getRequest(); + $actionName = $request->getVal( 'action', 'view' ); + // TODO: Shouldn't need to copy-paste this code from Action::getActionName! + if ( $actionName === 'historysubmit' ) { + if ( $request->getBool( 'revisiondelete' ) ) { + $actionName = 'revisiondelete'; + } elseif ( $request->getBool( 'editchangetags' ) ) { + $actionName = 'editchangetags'; + } + } + + if ( isset( self::$actionToSpecialPageMapping[$actionName] ) ) { + return $actionName; + } + return 'nosuchaction'; + } + + public function requiresUnblock() { + return false; + } + + public function getDescription() { + return ''; + } + + public function onView() { + return ''; + } + + public function show() { + $action = self::getName(); + if ( $action === 'nosuchaction' ) { + throw new ErrorPageError( $this->msg( 'nosuchaction' ), $this->msg( 'nosuchactiontext' ) ); + } + + // map actions to (whitelisted) special pages + $special = SpecialPageFactory::getPage( self::$actionToSpecialPageMapping[$action] ); + $special->setContext( $this->getContext() ); + $special->getContext()->setTitle( $special->getPageTitle() ); + $special->run( '' ); + } +} diff --git a/includes/actions/UnwatchAction.php b/includes/actions/UnwatchAction.php index e2e5a1d8..0a8628dd 100644 --- a/includes/actions/UnwatchAction.php +++ b/includes/actions/UnwatchAction.php @@ -36,9 +36,7 @@ class UnwatchAction extends WatchAction { } public function onSubmit( $data ) { - wfProfileIn( __METHOD__ ); self::doUnwatch( $this->getTitle(), $this->getUser() ); - wfProfileOut( __METHOD__ ); return true; } diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index 8c9a46a5..96473409 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -48,9 +48,7 @@ class WatchAction extends FormAction { } public function onSubmit( $data ) { - wfProfileIn( __METHOD__ ); self::doWatch( $this->getTitle(), $this->getUser() ); - wfProfileOut( __METHOD__ ); return true; } @@ -132,10 +130,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 +154,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; |