summaryrefslogtreecommitdiff
path: root/includes/actions
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /includes/actions
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'includes/actions')
-rw-r--r--includes/actions/CachedAction.php182
-rw-r--r--includes/actions/CreditsAction.php2
-rw-r--r--includes/actions/HistoryAction.php92
-rw-r--r--includes/actions/InfoAction.php629
-rw-r--r--includes/actions/PurgeAction.php6
-rw-r--r--includes/actions/RawAction.php26
-rw-r--r--includes/actions/RevertAction.php36
-rw-r--r--includes/actions/RevisiondeleteAction.php2
-rw-r--r--includes/actions/RollbackAction.php6
-rw-r--r--includes/actions/ViewAction.php3
-rw-r--r--includes/actions/WatchAction.php12
11 files changed, 852 insertions, 144 deletions
diff --git a/includes/actions/CachedAction.php b/includes/actions/CachedAction.php
new file mode 100644
index 00000000..d21f9aeb
--- /dev/null
+++ b/includes/actions/CachedAction.php
@@ -0,0 +1,182 @@
+<?php
+
+/**
+ * Abstract action class with scaffolding for caching HTML and other values
+ * in a single blob.
+ *
+ * Before using any of the caching functionality, call startCache.
+ * After the last call to either getCachedValue or addCachedHTML, call saveCache.
+ *
+ * To get a cached value or compute it, use getCachedValue like this:
+ * $this->getCachedValue( $callback );
+ *
+ * To add HTML that should be cached, use addCachedHTML like this:
+ * $this->addCachedHTML( $callback );
+ *
+ * The callback function is only called when needed, so do all your expensive
+ * computations here. This function should returns the HTML to be cached.
+ * It should not add anything to the PageOutput object!
+ *
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Action
+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
+ * @since 1.20
+ */
+abstract class CachedAction extends FormlessAction implements ICacheHelper {
+
+ /**
+ * CacheHelper object to which we forward the non-SpecialPage specific caching work.
+ * Initialized in startCache.
+ *
+ * @since 1.20
+ * @var CacheHelper
+ */
+ protected $cacheHelper;
+
+ /**
+ * If the cache is enabled or not.
+ *
+ * @since 1.20
+ * @var boolean
+ */
+ protected $cacheEnabled = true;
+
+ /**
+ * Sets if the cache should be enabled or not.
+ *
+ * @since 1.20
+ * @param boolean $cacheEnabled
+ */
+ public function setCacheEnabled( $cacheEnabled ) {
+ $this->cacheHelper->setCacheEnabled( $cacheEnabled );
+ }
+
+ /**
+ * Initializes the caching.
+ * Should be called before the first time anything is added via addCachedHTML.
+ *
+ * @since 1.20
+ *
+ * @param integer|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
+ * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not.
+ */
+ public function startCache( $cacheExpiry = null, $cacheEnabled = null ) {
+ $this->cacheHelper = new CacheHelper();
+
+ $this->cacheHelper->setCacheEnabled( $this->cacheEnabled );
+ $this->cacheHelper->setOnInitializedHandler( array( $this, 'onCacheInitialized' ) );
+
+ $keyArgs = $this->getCacheKey();
+
+ if ( array_key_exists( 'action', $keyArgs ) && $keyArgs['action'] === 'purge' ) {
+ unset( $keyArgs['action'] );
+ }
+
+ $this->cacheHelper->setCacheKey( $keyArgs );
+
+ if ( $this->getRequest()->getText( 'action' ) === 'purge' ) {
+ $this->cacheHelper->rebuildOnDemand();
+ }
+
+ $this->cacheHelper->startCache( $cacheExpiry, $cacheEnabled );
+ }
+
+ /**
+ * Get a cached value if available or compute it if not and then cache it if possible.
+ * The provided $computeFunction is only called when the computation needs to happen
+ * and should return a result value. $args are arguments that will be passed to the
+ * compute function when called.
+ *
+ * @since 1.20
+ *
+ * @param {function} $computeFunction
+ * @param array|mixed $args
+ * @param string|null $key
+ *
+ * @return mixed
+ */
+ public function getCachedValue( $computeFunction, $args = array(), $key = null ) {
+ return $this->cacheHelper->getCachedValue( $computeFunction, $args, $key );
+ }
+
+ /**
+ * Add some HTML to be cached.
+ * This is done by providing a callback function that should
+ * return the HTML to be added. It will only be called if the
+ * item is not in the cache yet or when the cache has been invalidated.
+ *
+ * @since 1.20
+ *
+ * @param {function} $computeFunction
+ * @param array $args
+ * @param string|null $key
+ */
+ public function addCachedHTML( $computeFunction, $args = array(), $key = null ) {
+ $this->getOutput()->addHTML( $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ) );
+ }
+
+ /**
+ * Saves the HTML to the cache in case it got recomputed.
+ * Should be called after the last time anything is added via addCachedHTML.
+ *
+ * @since 1.20
+ */
+ public function saveCache() {
+ $this->cacheHelper->saveCache();
+ }
+
+ /**
+ * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
+ *
+ * @since 1.20
+ *
+ * @param integer $cacheExpiry
+ */
+ public function setExpiry( $cacheExpiry ) {
+ $this->cacheHelper->setExpiry( $cacheExpiry );
+ }
+
+ /**
+ * Returns the variables used to constructed the cache key in an array.
+ *
+ * @since 1.20
+ *
+ * @return array
+ */
+ protected function getCacheKey() {
+ return array(
+ get_class( $this->page ),
+ $this->getName(),
+ $this->getLanguage()->getCode()
+ );
+ }
+
+ /**
+ * Gets called after the cache got initialized.
+ *
+ * @since 1.20
+ *
+ * @param boolean $hasCached
+ */
+ public function onCacheInitialized( $hasCached ) {
+ if ( $hasCached ) {
+ $this->getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) );
+ }
+ }
+
+}
diff --git a/includes/actions/CreditsAction.php b/includes/actions/CreditsAction.php
index cd083c30..f7152297 100644
--- a/includes/actions/CreditsAction.php
+++ b/includes/actions/CreditsAction.php
@@ -30,7 +30,7 @@ class CreditsAction extends FormlessAction {
}
protected function getDescription() {
- return wfMsgHtml( 'creditspage' );
+ return $this->msg( 'creditspage' )->escaped();
}
/**
diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php
index 457f67ff..dcd6fe55 100644
--- a/includes/actions/HistoryAction.php
+++ b/includes/actions/HistoryAction.php
@@ -3,6 +3,22 @@
* Page history
*
* Split off from Article.php and Skin.php, 2003-12-22
+ *
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
*/
@@ -69,10 +85,9 @@ class HistoryAction extends FormlessAction {
/**
* Print the history page for an article.
- * @return nothing
*/
function onView() {
- global $wgScript, $wgUseFileCache, $wgSquidMaxage;
+ global $wgScript, $wgUseFileCache;
$out = $this->getOutput();
$request = $this->getRequest();
@@ -86,10 +101,6 @@ class HistoryAction extends FormlessAction {
wfProfileIn( __METHOD__ );
- if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL( 'action=history' ) ) {
- $out->setSquidMaxage( $wgSquidMaxage );
- }
-
$this->preCacheMessages();
# Fill in the file cache if not set already
@@ -107,8 +118,9 @@ class HistoryAction extends FormlessAction {
// Handle atom/RSS feeds.
$feedType = $request->getVal( 'feed' );
if ( $feedType ) {
+ $this->feed( $feedType );
wfProfileOut( __METHOD__ );
- return $this->feed( $feedType );
+ return;
}
// Fail nicely if article doesn't exist.
@@ -192,6 +204,11 @@ class HistoryAction extends FormlessAction {
* @return ResultWrapper
*/
function fetchRevisions( $limit, $offset, $direction ) {
+ // Fail if article doesn't exist.
+ if( !$this->getTitle()->exists() ) {
+ return new FakeResultWrapper( array() );
+ }
+
$dbr = wfGetDB( DB_SLAVE );
if ( $direction == HistoryPage::DIR_PREV ) {
@@ -231,8 +248,8 @@ class HistoryAction extends FormlessAction {
$feed = new $wgFeedClasses[$type](
$this->getTitle()->getPrefixedText() . ' - ' .
- wfMsgForContent( 'history-feed-title' ),
- wfMsgForContent( 'history-feed-description' ),
+ $this->msg( 'history-feed-title' )->inContentLanguage()->text(),
+ $this->msg( 'history-feed-description' )->inContentLanguage()->text(),
$this->getTitle()->getFullUrl( 'action=history' )
);
@@ -258,8 +275,8 @@ class HistoryAction extends FormlessAction {
function feedEmpty() {
return new FeedItem(
- wfMsgForContent( 'nohistory' ),
- $this->getOutput()->parse( wfMsgForContent( 'history-feed-empty' ) ),
+ $this->msg( 'nohistory' )->inContentLanguage()->text(),
+ $this->msg( 'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
$this->getTitle()->getFullUrl(),
wfTimestamp( TS_MW ),
'',
@@ -287,15 +304,14 @@ class HistoryAction extends FormlessAction {
);
if ( $rev->getComment() == '' ) {
global $wgContLang;
- $title = wfMsgForContent( 'history-feed-item-nocomment',
+ $title = $this->msg( 'history-feed-item-nocomment',
$rev->getUserText(),
$wgContLang->timeanddate( $rev->getTimestamp() ),
$wgContLang->date( $rev->getTimestamp() ),
- $wgContLang->time( $rev->getTimestamp() )
- );
+ $wgContLang->time( $rev->getTimestamp() ) )->inContentLanguage()->text();
} else {
$title = $rev->getUserText() .
- wfMsgForContent( 'colon-separator' ) .
+ $this->msg( 'colon-separator' )->inContentLanguage()->text() .
FeedItem::stripComment( $rev->getComment() );
}
return new FeedItem(
@@ -316,6 +332,10 @@ class HistoryPager extends ReverseChronologicalPager {
public $lastRow = false, $counter, $historyPage, $buttons, $conds;
protected $oldIdChecked;
protected $preventClickjacking = false;
+ /**
+ * @var array
+ */
+ protected $parentLens;
function __construct( $historyPage, $year = '', $month = '', $tagFilter = '', $conds = array() ) {
parent::__construct( $historyPage->getContext() );
@@ -384,7 +404,11 @@ class HistoryPager extends ReverseChronologicalPager {
# Do a link batch query
$this->mResult->seek( 0 );
$batch = new LinkBatch();
+ $revIds = array();
foreach ( $this->mResult as $row ) {
+ if( $row->rev_parent_id ) {
+ $revIds[] = $row->rev_parent_id;
+ }
if( !is_null( $row->user_name ) ) {
$batch->add( NS_USER, $row->user_name );
$batch->add( NS_USER_TALK, $row->user_name );
@@ -393,6 +417,7 @@ class HistoryPager extends ReverseChronologicalPager {
$batch->add( NS_USER_TALK, $row->rev_user_text );
}
}
+ $this->parentLens = Revision::getParentLengths( $this->mDb, $revIds );
$batch->execute();
$this->mResult->seek( 0 );
}
@@ -523,7 +548,7 @@ class HistoryPager extends ReverseChronologicalPager {
$histLinks = Html::rawElement(
'span',
array( 'class' => 'mw-history-histlinks' ),
- '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
+ $this->msg( 'parentheses' )->rawParams( $curlink . $this->historyPage->message['pipe-separator'] . $lastlink )->escaped()
);
$s = $histLinks . $diffButtons;
@@ -574,26 +599,29 @@ class HistoryPager extends ReverseChronologicalPager {
}
# Size is always public data
- $prevSize = $prevRev ? $prevRev->getSize() : 0;
+ $prevSize = isset( $this->parentLens[$row->rev_parent_id] )
+ ? $this->parentLens[$row->rev_parent_id]
+ : 0;
$sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() );
- $s .= ' . . ' . $sDiff . ' . . ';
+ $fSize = Linker::formatRevisionSize($rev->getSize());
+ $s .= ' <span class="mw-changeslist-separator">. .</span> ' . "$fSize $sDiff";
- $s .= Linker::revComment( $rev, false, true );
+ # Text following the character difference is added just before running hooks
+ $s2 = Linker::revComment( $rev, false, true );
if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
- $s .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
+ $s2 .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
+ $classes[] = 'mw-history-line-updated';
}
$tools = array();
# Rollback and undo links
- if ( $prevRev &&
- !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) ) )
- {
- if ( $latest && !count( $this->getTitle()->getUserPermissionsErrors( 'rollback', $this->getUser() ) ) ) {
+ if ( $prevRev && $this->getTitle()->quickUserCan( 'edit', $user ) ) {
+ if ( $latest && $this->getTitle()->quickUserCan( 'rollback', $user ) ) {
$this->preventClickjacking();
$tools[] = '<span class="mw-rollback-link">' .
- Linker::buildRollbackLink( $rev ) . '</span>';
+ Linker::buildRollbackLink( $rev, $this->getContext() ) . '</span>';
}
if ( !$rev->isDeleted( Revision::DELETED_TEXT )
@@ -618,13 +646,20 @@ class HistoryPager extends ReverseChronologicalPager {
}
if ( $tools ) {
- $s .= ' (' . $lang->pipeList( $tools ) . ')';
+ $s2 .= ' '. $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped();
}
# Tags
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
$classes = array_merge( $classes, $newClasses );
- $s .= " $tagSummary";
+ if ( $tagSummary !== '' ) {
+ $s2 .= " $tagSummary";
+ }
+
+ # Include separator between character difference and following text
+ if ( $s2 !== '' ) {
+ $s .= ' <span class="mw-changeslist-separator">. .</span> ' . $s2;
+ }
wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s, &$classes ) );
@@ -649,7 +684,7 @@ class HistoryPager extends ReverseChronologicalPager {
$link = Linker::linkKnown(
$this->getTitle(),
$date,
- array(),
+ array( 'class' => 'mw-changeslist-date' ),
array( 'oldid' => $rev->getId() )
);
} else {
@@ -784,6 +819,7 @@ class HistoryPager extends ReverseChronologicalPager {
/**
* Get the "prevent clickjacking" flag
+ * @return bool
*/
function getPreventClickjacking() {
return $this->preventClickjacking;
diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index 70edabce..ae550391 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -1,7 +1,6 @@
<?php
/**
- * Display informations about a page.
- * Very inefficient for the moment.
+ * Displays information about a page.
*
* Copyright © 2011 Alexandre Emsenhuber
*
@@ -24,124 +23,592 @@
*/
class InfoAction extends FormlessAction {
-
+ /**
+ * Returns the name of the action this object responds to.
+ *
+ * @return string lowercase
+ */
public function getName() {
return 'info';
}
- protected function getDescription() {
- return '';
+ /**
+ * Whether this action can still be executed by a blocked user.
+ *
+ * @return bool
+ */
+ public function requiresUnblock() {
+ return false;
}
+ /**
+ * Whether this action requires the wiki not to be locked.
+ *
+ * @return bool
+ */
public function requiresWrite() {
return false;
}
- public function requiresUnblock() {
- return false;
+ /**
+ * Shows page information on GET request.
+ *
+ * @return string Page information that will be added to the output
+ */
+ public function onView() {
+ $content = '';
+
+ // Validate revision
+ $oldid = $this->page->getOldID();
+ if ( $oldid ) {
+ $revision = $this->page->getRevisionFetched();
+
+ // Revision is missing
+ if ( $revision === null ) {
+ return $this->msg( 'missing-revision', $oldid )->parse();
+ }
+
+ // Revision is not current
+ if ( !$revision->isCurrent() ) {
+ return $this->msg( 'pageinfo-not-current' )->plain();
+ }
+ }
+
+ // Page header
+ if ( !$this->msg( 'pageinfo-header' )->isDisabled() ) {
+ $content .= $this->msg( 'pageinfo-header' )->parse();
+ }
+
+ // Hide "This page is a member of # hidden categories" explanation
+ $content .= Html::element( 'style', array(),
+ '.mw-hiddenCategoriesExplanation { display: none; }' );
+
+ // Hide "Templates used on this page" explanation
+ $content .= Html::element( 'style', array(),
+ '.mw-templatesUsedExplanation { display: none; }' );
+
+ // Get page information
+ $pageInfo = $this->pageInfo();
+
+ // Allow extensions to add additional information
+ wfRunHooks( 'InfoAction', array( $this->getContext(), &$pageInfo ) );
+
+ // Render page information
+ foreach ( $pageInfo as $header => $infoTable ) {
+ $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() );
+ $table = '';
+ foreach ( $infoTable as $infoRow ) {
+ $name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0];
+ $value = ( $infoRow[1] instanceof Message ) ? $infoRow[1]->escaped() : $infoRow[1];
+ $table = $this->addRow( $table, $name, $value );
+ }
+ $content = $this->addTable( $content, $table );
+ }
+
+ // Page footer
+ if ( !$this->msg( 'pageinfo-footer' )->isDisabled() ) {
+ $content .= $this->msg( 'pageinfo-footer' )->parse();
+ }
+
+ // Page credits
+ /*if ( $this->page->exists() ) {
+ $content .= Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $this->getContributors() );
+ }*/
+
+ return $content;
}
- protected function getPageTitle() {
- return $this->msg( 'pageinfo-title', $this->getTitle()->getSubjectPage()->getPrefixedText() )->text();
+ /**
+ * Creates a header that can be added to the output.
+ *
+ * @param $header The header text.
+ * @return string The HTML.
+ */
+ protected function makeHeader( $header ) {
+ global $wgParser;
+ $spanAttribs = array( 'class' => 'mw-headline', 'id' => $wgParser->guessSectionNameFromWikiText( $header ) );
+ return Html::rawElement( 'h2', array(), Html::element( 'span', $spanAttribs, $header ) );
}
- public function onView() {
- global $wgDisableCounters;
-
- $title = $this->getTitle()->getSubjectPage();
-
- $pageInfo = self::pageCountInfo( $title );
- $talkInfo = self::pageCountInfo( $title->getTalkPage() );
-
- return Html::rawElement( 'table', array( 'class' => 'wikitable mw-page-info' ),
- Html::rawElement( 'tr', array(),
- Html::element( 'th', array(), '' ) .
- Html::element( 'th', array(), $this->msg( 'pageinfo-subjectpage' )->text() ) .
- Html::element( 'th', array(), $this->msg( 'pageinfo-talkpage' )->text() )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'th', array( 'colspan' => 3 ), $this->msg( 'pageinfo-header-edits' )->text() )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'td', array(), $this->msg( 'pageinfo-edits' )->text() ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $pageInfo['edits'] ) ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $talkInfo['edits'] ) )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'td', array(), $this->msg( 'pageinfo-authors' )->text() ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $pageInfo['authors'] ) ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $talkInfo['authors'] ) )
- ) .
- ( !$this->getUser()->isAllowed( 'unwatchedpages' ) ? '' :
- Html::rawElement( 'tr', array(),
- Html::element( 'th', array( 'colspan' => 3 ), $this->msg( 'pageinfo-header-watchlist' )->text() )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'td', array(), $this->msg( 'pageinfo-watchers' )->text() ) .
- Html::element( 'td', array( 'colspan' => 2 ), $this->getLanguage()->formatNum( $pageInfo['watchers'] ) )
- )
- ).
- ( $wgDisableCounters ? '' :
- Html::rawElement( 'tr', array(),
- Html::element( 'th', array( 'colspan' => 3 ), $this->msg( 'pageinfo-header-views' )->text() )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'td', array(), $this->msg( 'pageinfo-views' )->text() ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $pageInfo['views'] ) ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( $talkInfo['views'] ) )
- ) .
- Html::rawElement( 'tr', array(),
- Html::element( 'td', array(), $this->msg( 'pageinfo-viewsperedit' )->text() ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( sprintf( '%.2f', $pageInfo['edits'] ? $pageInfo['views'] / $pageInfo['edits'] : 0 ) ) ) .
- Html::element( 'td', array(), $this->getLanguage()->formatNum( sprintf( '%.2f', $talkInfo['edits'] ? $talkInfo['views'] / $talkInfo['edits'] : 0 ) ) )
- )
- )
+ /**
+ * Adds a row to a table that will be added to the content.
+ *
+ * @param $table string The table that will be added to the content
+ * @param $name string The name of the row
+ * @param $value string The value of the row
+ * @return string The table with the row added
+ */
+ protected function addRow( $table, $name, $value ) {
+ return $table . Html::rawElement( 'tr', array(),
+ Html::rawElement( 'td', array( 'style' => 'vertical-align: top;' ), $name ) .
+ Html::rawElement( 'td', array(), $value )
);
}
/**
- * Return the total number of edits and number of unique editors
- * on a given page. If page does not exist, returns false.
+ * Adds a table to the content that will be added to the output.
*
- * @param $title Title object
- * @return mixed array or boolean false
+ * @param $content string The content that will be added to the output
+ * @param $table string The table
+ * @return string The content with the table added
+ */
+ protected function addTable( $content, $table ) {
+ return $content . Html::rawElement( 'table', array( 'class' => 'wikitable mw-page-info' ),
+ $table );
+ }
+
+ /**
+ * Returns page information in an easily-manipulated format. Array keys are used so extensions
+ * may add additional information in arbitrary positions. Array values are arrays with one
+ * element to be rendered as a header, arrays with two elements to be rendered as a table row.
*/
- public static function pageCountInfo( $title ) {
- $id = $title->getArticleId();
+ protected function pageInfo() {
+ global $wgContLang, $wgRCMaxAge;
+
+ $user = $this->getUser();
+ $lang = $this->getLanguage();
+ $title = $this->getTitle();
+ $id = $title->getArticleID();
+
+ // Get page information that would be too "expensive" to retrieve by normal means
+ $pageCounts = self::pageCounts( $title, $user );
+
+ // Get page properties
$dbr = wfGetDB( DB_SLAVE );
+ $result = $dbr->select(
+ 'page_props',
+ array( 'pp_propname', 'pp_value' ),
+ array( 'pp_page' => $id ),
+ __METHOD__
+ );
- $watchers = (int)$dbr->selectField(
- 'watchlist',
- 'COUNT(*)',
- array(
- 'wl_title' => $title->getDBkey(),
- 'wl_namespace' => $title->getNamespace()
+ $pageProperties = array();
+ foreach ( $result as $row ) {
+ $pageProperties[$row->pp_propname] = $row->pp_value;
+ }
+
+ // Basic information
+ $pageInfo = array();
+ $pageInfo['header-basic'] = array();
+
+ // Display title
+ $displayTitle = $title->getPrefixedText();
+ if ( !empty( $pageProperties['displaytitle'] ) ) {
+ $displayTitle = $pageProperties['displaytitle'];
+ }
+
+ $pageInfo['header-basic'][] = array(
+ $this->msg( 'pageinfo-display-title' ), $displayTitle
+ );
+
+ // Default sort key
+ $sortKey = $title->getCategorySortKey();
+ if ( !empty( $pageProperties['defaultsort'] ) ) {
+ $sortKey = $pageProperties['defaultsort'];
+ }
+
+ $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-default-sort' ), $sortKey );
+
+ // Page length (in bytes)
+ $pageInfo['header-basic'][] = array(
+ $this->msg( 'pageinfo-length' ), $lang->formatNum( $title->getLength() )
+ );
+
+ // Page ID (number not localised, as it's a database ID)
+ $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-article-id' ), $id );
+
+ // Search engine status
+ $pOutput = new ParserOutput();
+ if ( isset( $pageProperties['noindex'] ) ) {
+ $pOutput->setIndexPolicy( 'noindex' );
+ }
+
+ // Use robot policy logic
+ $policy = $this->page->getRobotPolicy( 'view', $pOutput );
+ $pageInfo['header-basic'][] = array(
+ $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'] )
+ );
+ }
+
+ if ( isset( $pageCounts['watchers'] ) ) {
+ // Number of page watchers
+ $pageInfo['header-basic'][] = array(
+ $this->msg( 'pageinfo-watchers' ), $lang->formatNum( $pageCounts['watchers'] )
+ );
+ }
+
+ // Redirects to this page
+ $whatLinksHere = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
+ $pageInfo['header-basic'][] = array(
+ Linker::link(
+ $whatLinksHere,
+ $this->msg( 'pageinfo-redirects-name' )->escaped(),
+ array(),
+ array( 'hidelinks' => 1, 'hidetrans' => 1 )
),
- __METHOD__
+ $this->msg( 'pageinfo-redirects-value' )
+ ->numParams( count( $title->getRedirectsHere() ) )
);
- $edits = (int)$dbr->selectField(
+ // Subpages of this page, if subpages are enabled for the current NS
+ if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+ $prefixIndex = SpecialPage::getTitleFor( 'Prefixindex', $title->getPrefixedText() . '/' );
+ $pageInfo['header-basic'][] = array(
+ Linker::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ),
+ $this->msg( 'pageinfo-subpages-value' )
+ ->numParams(
+ $pageCounts['subpages']['total'],
+ $pageCounts['subpages']['redirects'],
+ $pageCounts['subpages']['nonredirects'] )
+ );
+ }
+
+ // Page protection
+ $pageInfo['header-restrictions'] = array();
+
+ // Page protection
+ foreach ( $title->getRestrictionTypes() as $restrictionType ) {
+ $protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) );
+
+ if ( $protectionLevel == '' ) {
+ // Allow all users
+ $message = $this->msg( 'protect-default' )->escaped();
+ } else {
+ // Administrators only
+ $message = $this->msg( "protect-level-$protectionLevel" );
+ if ( $message->isDisabled() ) {
+ // Require "$1" permission
+ $message = $this->msg( "protect-fallback", $protectionLevel )->parse();
+ } else {
+ $message = $message->escaped();
+ }
+ }
+
+ $pageInfo['header-restrictions'][] = array(
+ $this->msg( "restriction-$restrictionType" ), $message
+ );
+ }
+
+ if ( !$this->page->exists() ) {
+ return $pageInfo;
+ }
+
+ // Edit history
+ $pageInfo['header-edits'] = array();
+
+ $firstRev = $this->page->getOldestRevision();
+
+ // Page creator
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-firstuser' ),
+ Linker::revUserTools( $firstRev )
+ );
+
+ // Date of page creation
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-firsttime' ),
+ Linker::linkKnown(
+ $title,
+ $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ),
+ array(),
+ array( 'oldid' => $firstRev->getId() )
+ )
+ );
+
+ // Latest editor
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-lastuser' ),
+ Linker::revUserTools( $this->page->getRevision() )
+ );
+
+ // Date of latest edit
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-lasttime' ),
+ Linker::linkKnown(
+ $title,
+ $lang->userTimeAndDate( $this->page->getTimestamp(), $user ),
+ array(),
+ array( 'oldid' => $this->page->getLatest() )
+ )
+ );
+
+ // Total number of edits
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-edits' ), $lang->formatNum( $pageCounts['edits'] )
+ );
+
+ // Total number of distinct authors
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-authors' ), $lang->formatNum( $pageCounts['authors'] )
+ );
+
+ // Recent number of edits (within past 30 days)
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-recent-edits', $lang->formatDuration( $wgRCMaxAge ) ),
+ $lang->formatNum( $pageCounts['recent_edits'] )
+ );
+
+ // Recent number of distinct authors
+ $pageInfo['header-edits'][] = array(
+ $this->msg( 'pageinfo-recent-authors' ), $lang->formatNum( $pageCounts['recent_authors'] )
+ );
+
+ // Array of MagicWord objects
+ $magicWords = MagicWord::getDoubleUnderscoreArray();
+
+ // Array of magic word IDs
+ $wordIDs = $magicWords->names;
+
+ // Array of IDs => localized magic words
+ $localizedWords = $wgContLang->getMagicWords();
+
+ $listItems = array();
+ foreach ( $pageProperties as $property => $value ) {
+ if ( in_array( $property, $wordIDs ) ) {
+ $listItems[] = Html::element( 'li', array(), $localizedWords[$property][1] );
+ }
+ }
+
+ $localizedList = Html::rawElement( 'ul', array(), implode( '', $listItems ) );
+ $hiddenCategories = $this->page->getHiddenCategories();
+ $transcludedTemplates = $title->getTemplateLinksFrom();
+
+ if ( count( $listItems ) > 0
+ || count( $hiddenCategories ) > 0
+ || count( $transcludedTemplates ) > 0 ) {
+ // Page properties
+ $pageInfo['header-properties'] = array();
+
+ // Magic words
+ if ( count( $listItems ) > 0 ) {
+ $pageInfo['header-properties'][] = array(
+ $this->msg( 'pageinfo-magic-words' )->numParams( count( $listItems ) ),
+ $localizedList
+ );
+ }
+
+ // Hidden categories
+ if ( count( $hiddenCategories ) > 0 ) {
+ $pageInfo['header-properties'][] = array(
+ $this->msg( 'pageinfo-hidden-categories' )
+ ->numParams( count( $hiddenCategories ) ),
+ Linker::formatHiddenCategories( $hiddenCategories )
+ );
+ }
+
+ // Transcluded templates
+ if ( count( $transcludedTemplates ) > 0 ) {
+ $pageInfo['header-properties'][] = array(
+ $this->msg( 'pageinfo-templates' )
+ ->numParams( count( $transcludedTemplates ) ),
+ Linker::formatTemplates( $transcludedTemplates )
+ );
+ }
+ }
+
+ return $pageInfo;
+ }
+
+ /**
+ * Returns page counts that would be too "expensive" to retrieve by normal means.
+ *
+ * @param $title Title object
+ * @param $user User object
+ * @return array
+ */
+ protected static function pageCounts( $title, $user ) {
+ global $wgRCMaxAge, $wgDisableCounters;
+
+ wfProfileIn( __METHOD__ );
+ $id = $title->getArticleID();
+
+ $dbr = wfGetDB( DB_SLAVE );
+ $result = array();
+
+ if ( !$wgDisableCounters ) {
+ // Number of views
+ $views = (int) $dbr->selectField(
+ 'page',
+ 'page_counter',
+ array( 'page_id' => $id ),
+ __METHOD__
+ );
+ $result['views'] = $views;
+ }
+
+ if ( $user->isAllowed( 'unwatchedpages' ) ) {
+ // Number of page watchers
+ $watchers = (int) $dbr->selectField(
+ 'watchlist',
+ 'COUNT(*)',
+ array(
+ 'wl_namespace' => $title->getNamespace(),
+ 'wl_title' => $title->getDBkey(),
+ ),
+ __METHOD__
+ );
+ $result['watchers'] = $watchers;
+ }
+
+ // Total number of edits
+ $edits = (int) $dbr->selectField(
'revision',
'COUNT(rev_page)',
array( 'rev_page' => $id ),
__METHOD__
);
+ $result['edits'] = $edits;
- $authors = (int)$dbr->selectField(
+ // Total number of distinct authors
+ $authors = (int) $dbr->selectField(
'revision',
'COUNT(DISTINCT rev_user_text)',
array( 'rev_page' => $id ),
__METHOD__
);
+ $result['authors'] = $authors;
+
+ // "Recent" threshold defined by $wgRCMaxAge
+ $threshold = $dbr->timestamp( time() - $wgRCMaxAge );
+
+ // Recent number of edits
+ $edits = (int) $dbr->selectField(
+ 'revision',
+ 'COUNT(rev_page)',
+ array(
+ 'rev_page' => $id ,
+ "rev_timestamp >= $threshold"
+ ),
+ __METHOD__
+ );
+ $result['recent_edits'] = $edits;
- $views = (int)$dbr->selectField(
- 'page',
- 'page_counter',
- array( 'page_id' => $id ),
+ // Recent number of distinct authors
+ $authors = (int) $dbr->selectField(
+ 'revision',
+ 'COUNT(DISTINCT rev_user_text)',
+ array(
+ 'rev_page' => $id,
+ "rev_timestamp >= $threshold"
+ ),
__METHOD__
);
+ $result['recent_authors'] = $authors;
+
+ // Subpages (if enabled)
+ if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+ $conds = array( 'page_namespace' => $title->getNamespace() );
+ $conds[] = 'page_title ' . $dbr->buildLike( $title->getDBkey() . '/', $dbr->anyString() );
- return array( 'watchers' => $watchers, 'edits' => $edits,
- 'authors' => $authors, 'views' => $views );
+ // Subpages of this page (redirects)
+ $conds['page_is_redirect'] = 1;
+ $result['subpages']['redirects'] = (int) $dbr->selectField(
+ 'page',
+ 'COUNT(page_id)',
+ $conds,
+ __METHOD__ );
+
+ // Subpages of this page (non-redirects)
+ $conds['page_is_redirect'] = 0;
+ $result['subpages']['nonredirects'] = (int) $dbr->selectField(
+ 'page',
+ 'COUNT(page_id)',
+ $conds,
+ __METHOD__
+ );
+
+ // Subpages of this page (total)
+ $result['subpages']['total'] = $result['subpages']['redirects']
+ + $result['subpages']['nonredirects'];
+ }
+
+ wfProfileOut( __METHOD__ );
+ return $result;
+ }
+
+ /**
+ * Returns the name that goes in the <h1> page title.
+ *
+ * @return string
+ */
+ protected function getPageTitle() {
+ return $this->msg( 'pageinfo-title', $this->getTitle()->getPrefixedText() )->text();
+ }
+
+ /**
+ * Get a list of contributors of $article
+ * @return string: html
+ */
+ protected function getContributors() {
+ global $wgHiddenPrefs;
+
+ $contributors = $this->page->getContributors();
+ $real_names = array();
+ $user_names = array();
+ $anon_ips = array();
+
+ # Sift for real versus user names
+ foreach ( $contributors as $user ) {
+ $page = $user->isAnon()
+ ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
+ : $user->getUserPage();
+
+ if ( $user->getID() == 0 ) {
+ $anon_ips[] = Linker::link( $page, htmlspecialchars( $user->getName() ) );
+ } elseif ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
+ $real_names[] = Linker::link( $page, htmlspecialchars( $user->getRealName() ) );
+ } else {
+ $user_names[] = Linker::link( $page, htmlspecialchars( $user->getName() ) );
+ }
+ }
+
+ $lang = $this->getLanguage();
+
+ $real = $lang->listToText( $real_names );
+
+ # "ThisSite user(s) A, B and C"
+ if ( count( $user_names ) ) {
+ $user = $this->msg( 'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
+ count( $user_names ) )->escaped();
+ } else {
+ $user = false;
+ }
+
+ if ( count( $anon_ips ) ) {
+ $anon = $this->msg( 'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
+ count( $anon_ips ) )->escaped();
+ } else {
+ $anon = false;
+ }
+
+ # This is the big list, all mooshed together. We sift for blank strings
+ $fulllist = array();
+ foreach ( array( $real, $user, $anon ) as $s ) {
+ if ( $s !== '' ) {
+ array_push( $fulllist, $s );
+ }
+ }
+
+ $count = count( $fulllist );
+ # "Based on work by ..."
+ return $count
+ ? $this->msg( 'othercontribs' )->rawParams(
+ $lang->listToText( $fulllist ) )->params( $count )->escaped()
+ : '';
+ }
+
+ /**
+ * Returns the description that goes below the <h1> tag.
+ *
+ * @return string
+ */
+ protected function getDescription() {
+ return '';
}
}
diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php
index 21a6d904..cd58889d 100644
--- a/includes/actions/PurgeAction.php
+++ b/includes/actions/PurgeAction.php
@@ -79,15 +79,15 @@ class PurgeAction extends FormAction {
}
protected function alterForm( HTMLForm $form ) {
- $form->setSubmitText( wfMsg( 'confirm_purge_button' ) );
+ $form->setSubmitTextMsg( 'confirm_purge_button' );
}
protected function preText() {
- return wfMessage( 'confirm-purge-top' )->parse();
+ return $this->msg( 'confirm-purge-top' )->parse();
}
protected function postText() {
- return wfMessage( 'confirm-purge-bottom' )->parse();
+ return $this->msg( 'confirm-purge-bottom' )->parse();
}
public function onSuccess() {
diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php
index e4c6b3e0..174ca3f8 100644
--- a/includes/actions/RawAction.php
+++ b/includes/actions/RawAction.php
@@ -7,7 +7,20 @@
*
* Based on HistoryPage and SpecialExport
*
- * License: GPL (http://www.gnu.org/copyleft/gpl.html)
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
*
* @author Gabriel Wicke <wicke@wikidev.net>
* @file
@@ -120,10 +133,13 @@ class RawAction extends FormlessAction {
// If it's a MediaWiki message we can just hit the message cache
if ( $request->getBool( 'usemsgcache' ) && $title->getNamespace() == NS_MEDIAWIKI ) {
- $key = $title->getDBkey();
- $msg = wfMessage( $key )->inContentLanguage();
- # If the message doesn't exist, return a blank
- $text = !$msg->exists() ? '' : $msg->plain();
+ // The first "true" is to use the database, the second is to use the content langue
+ // and the last one is to specify the message key already contains the language in it ("/de", etc.)
+ $text = MessageCache::singleton()->get( $title->getDBkey(), true, true, true );
+ // If the message doesn't exist, return a blank
+ if ( $text === false ) {
+ $text = '';
+ }
} else {
// Get it from the DB
$rev = Revision::newFromTitle( $title, $this->getOldId() );
diff --git a/includes/actions/RevertAction.php b/includes/actions/RevertAction.php
index f9497f4b..77434384 100644
--- a/includes/actions/RevertAction.php
+++ b/includes/actions/RevertAction.php
@@ -75,8 +75,8 @@ class RevertFileAction extends FormAction {
}
protected function alterForm( HTMLForm $form ) {
- $form->setWrapperLegend( wfMsgHtml( 'filerevert-legend' ) );
- $form->setSubmitText( wfMsg( 'filerevert-submit' ) );
+ $form->setWrapperLegendMsg( 'filerevert-legend' );
+ $form->setSubmitTextMsg( 'filerevert-submit' );
$form->addHiddenField( 'oldimage', $this->getRequest()->getText( 'oldimage' ) );
}
@@ -85,22 +85,28 @@ class RevertFileAction extends FormAction {
$timestamp = $this->oldFile->getTimestamp();
+ $user = $this->getUser();
+ $lang = $this->getLanguage();
+ $userDate = $lang->userDate( $timestamp, $user );
+ $userTime = $lang->userTime( $timestamp, $user );
+ $siteDate = $wgContLang->date( $timestamp, false, false );
+ $siteTime = $wgContLang->time( $timestamp, false, false );
+
return array(
'intro' => array(
'type' => 'info',
'vertical-label' => true,
'raw' => true,
- 'default' => wfMsgExt( 'filerevert-intro', 'parse', $this->getTitle()->getText(),
- $this->getLanguage()->date( $timestamp, true ), $this->getLanguage()->time( $timestamp, true ),
+ 'default' => $this->msg( 'filerevert-intro',
+ $this->getTitle()->getText(), $userDate, $userTime,
wfExpandUrl( $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ),
- PROTO_CURRENT
- ) )
+ PROTO_CURRENT ) )->parseAsBlock()
),
'comment' => array(
'type' => 'text',
'label-message' => 'filerevert-comment',
- 'default' => wfMsgForContent( 'filerevert-defaultcomment',
- $wgContLang->date( $timestamp, false, false ), $wgContLang->time( $timestamp, false, false ) ),
+ 'default' => $this->msg( 'filerevert-defaultcomment', $siteDate, $siteTime
+ )->inContentLanguage()->text()
)
);
}
@@ -114,17 +120,21 @@ class RevertFileAction extends FormAction {
public function onSuccess() {
$timestamp = $this->oldFile->getTimestamp();
- $this->getOutput()->addHTML( wfMsgExt( 'filerevert-success', 'parse', $this->getTitle()->getText(),
- $this->getLanguage()->date( $timestamp, true ),
- $this->getLanguage()->time( $timestamp, true ),
+ $user = $this->getUser();
+ $lang = $this->getLanguage();
+ $userDate = $lang->userDate( $timestamp, $user );
+ $userTime = $lang->userTime( $timestamp, $user );
+
+ $this->getOutput()->addWikiMsg( 'filerevert-success', $this->getTitle()->getText(),
+ $userDate, $userTime,
wfExpandUrl( $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ),
PROTO_CURRENT
- ) ) );
+ ) );
$this->getOutput()->returnToMain( false, $this->getTitle() );
}
protected function getPageTitle() {
- return wfMsg( 'filerevert', $this->getTitle()->getText() );
+ return $this->msg( 'filerevert', $this->getTitle()->getText() );
}
protected function getDescription() {
diff --git a/includes/actions/RevisiondeleteAction.php b/includes/actions/RevisiondeleteAction.php
index f07e493d..14da2fcf 100644
--- a/includes/actions/RevisiondeleteAction.php
+++ b/includes/actions/RevisiondeleteAction.php
@@ -44,6 +44,6 @@ class RevisiondeleteAction extends FormlessAction {
public function show() {
$special = SpecialPageFactory::getPage( 'Revisiondelete' );
$special->setContext( $this->getContext() );
- $special->execute( '' );
+ $special->run( '' );
}
}
diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php
index ebb34c78..0d9a9027 100644
--- a/includes/actions/RollbackAction.php
+++ b/includes/actions/RollbackAction.php
@@ -63,7 +63,7 @@ class RollbackAction extends FormlessAction {
$current = $details['current'];
if ( $current->getComment() != '' ) {
- $this->getOutput()->addHTML( wfMessage( 'editcomment' )->rawParams(
+ $this->getOutput()->addHTML( $this->msg( 'editcomment' )->rawParams(
Linker::formatComment( $current->getComment() ) )->parse() );
}
}
@@ -97,7 +97,7 @@ class RollbackAction extends FormlessAction {
$this->getOutput()->setRobotPolicy( 'noindex,nofollow' );
if ( $current->getUserText() === '' ) {
- $old = wfMsg( 'rev-deleted-user' );
+ $old = $this->msg( 'rev-deleted-user' )->escaped();
} else {
$old = Linker::userLink( $current->getUser(), $current->getUserText() )
. Linker::userToolLinks( $current->getUser(), $current->getUserText() );
@@ -105,7 +105,7 @@ class RollbackAction extends FormlessAction {
$new = Linker::userLink( $target->getUser(), $target->getUserText() )
. Linker::userToolLinks( $target->getUser(), $target->getUserText() );
- $this->getOutput()->addHTML( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) );
+ $this->getOutput()->addHTML( $this->msg( 'rollback-success' )->rawParams( $old, $new )->parseAsBlock() );
$this->getOutput()->returnToMain( false, $this->getTitle() );
if ( !$request->getBool( 'hidediff', false ) && !$this->getUser()->getBoolOption( 'norollbackdiff', false ) ) {
diff --git a/includes/actions/ViewAction.php b/includes/actions/ViewAction.php
index 4e37381b..d57585ee 100644
--- a/includes/actions/ViewAction.php
+++ b/includes/actions/ViewAction.php
@@ -34,9 +34,6 @@ class ViewAction extends FormlessAction {
}
public function show(){
- global $wgSquidMaxage;
-
- $this->getOutput()->setSquidMaxage( $wgSquidMaxage );
$this->page->view();
}
diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php
index 63d9b151..e2636452 100644
--- a/includes/actions/WatchAction.php
+++ b/includes/actions/WatchAction.php
@@ -31,7 +31,7 @@ class WatchAction extends FormAction {
}
protected function getDescription() {
- return wfMsgHtml( 'addwatch' );
+ return $this->msg( 'addwatch' )->escaped();
}
/**
@@ -136,11 +136,11 @@ class WatchAction extends FormAction {
}
protected function alterForm( HTMLForm $form ) {
- $form->setSubmitText( wfMsg( 'confirm-watch-button' ) );
+ $form->setSubmitTextMsg( 'confirm-watch-button' );
}
protected function preText() {
- return wfMessage( 'confirm-watch-top' )->parse();
+ return $this->msg( 'confirm-watch-top' )->parse();
}
public function onSuccess() {
@@ -155,7 +155,7 @@ class UnwatchAction extends WatchAction {
}
protected function getDescription() {
- return wfMsg( 'removewatch' );
+ return $this->msg( 'removewatch' )->escaped();
}
public function onSubmit( $data ) {
@@ -166,11 +166,11 @@ class UnwatchAction extends WatchAction {
}
protected function alterForm( HTMLForm $form ) {
- $form->setSubmitText( wfMsg( 'confirm-unwatch-button' ) );
+ $form->setSubmitTextMsg( 'confirm-unwatch-button' );
}
protected function preText() {
- return wfMessage( 'confirm-unwatch-top' )->parse();
+ return $this->msg( 'confirm-unwatch-top' )->parse();
}
public function onSuccess() {