isAnon() ) { throw new ErrorPageError( 'watchnologin', 'watchnologintext' ); } return parent::checkCanExecute( $user ); } public function onView() { wfProfileIn( __METHOD__ ); $user = $this->getUser(); if ( wfRunHooks( 'WatchArticle', array( &$user, &$this->page ) ) ) { $this->getUser()->addWatch( $this->getTitle() ); wfRunHooks( 'WatchArticleComplete', array( &$user, &$this->page ) ); } wfProfileOut( __METHOD__ ); return wfMessage( 'addedwatchtext', $this->getTitle()->getPrefixedText() )->parse(); } } class UnwatchAction extends WatchAction { public function getName() { return 'unwatch'; } protected function getDescription() { return wfMsg( 'removedwatch' ); } public function onView() { wfProfileIn( __METHOD__ ); $user = $this->getUser(); if ( wfRunHooks( 'UnwatchArticle', array( &$user, &$this->page ) ) ) { $this->getUser()->removeWatch( $this->getTitle() ); wfRunHooks( 'UnwatchArticleComplete', array( &$user, &$this->page ) ); } wfProfileOut( __METHOD__ ); return wfMessage( 'removedwatchtext', $this->getTitle()->getPrefixedText() )->parse(); } }