http://www.mediawiki.org/wiki/Special:Code/MediaWiki/98012
Revision: 98012
Author: ialex
Date: 2011-09-24 17:52:53 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
Allow LogEventsList::showLogExtract() to get a Title object instead of having
to do Title -> string -> Title conversion
Modified Paths:
--------------
trunk/phase3/includes/EditPage.php
trunk/phase3/includes/FileDeleteForm.php
trunk/phase3/includes/HistoryPage.php
trunk/phase3/includes/LogEventsList.php
trunk/phase3/includes/ProtectionForm.php
trunk/phase3/includes/specials/SpecialBlock.php
trunk/phase3/includes/specials/SpecialContributions.php
trunk/phase3/includes/specials/SpecialDeletedContributions.php
trunk/phase3/includes/specials/SpecialMergeHistory.php
trunk/phase3/includes/specials/SpecialMovepage.php
trunk/phase3/includes/specials/SpecialRevisiondelete.php
trunk/phase3/includes/specials/SpecialUndelete.php
trunk/phase3/includes/specials/SpecialUpload.php
trunk/phase3/includes/specials/SpecialUserrights.php
Modified: trunk/phase3/includes/EditPage.php
===================================================================
--- trunk/phase3/includes/EditPage.php 2011-09-24 17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/EditPage.php 2011-09-24 17:52:53 UTC (rev 98012)
@@ -807,7 +807,7 @@
LogEventsList::showLogExtract(
$wgOut,
'block',
- $user->getUserPage()->getPrefixedText(),
+ $user->getUserPage(),
'',
array(
'lim' => 1,
@@ -830,7 +830,7 @@
}
# Give a notice if the user is editing a deleted/moved page...
if ( !$this->mTitle->exists() ) {
- LogEventsList::showLogExtract( $wgOut, array( 'delete',
'move' ), $this->mTitle->getPrefixedText(),
+ LogEventsList::showLogExtract( $wgOut, array( 'delete',
'move' ), $this->mTitle,
'', array( 'lim' => 10,
'conds' => array( "log_action !=
'revision'" ),
'showIfEmpty' => false,
@@ -1649,7 +1649,7 @@
# Then it must be protected based on static
groups (regular)
$noticeMsg = 'protectedpagewarning';
}
- LogEventsList::showLogExtract( $wgOut, 'protect',
$this->mTitle->getPrefixedText(), '',
+ LogEventsList::showLogExtract( $wgOut, 'protect',
$this->mTitle, '',
array( 'lim' => 1, 'msgKey' => array(
$noticeMsg ) ) );
}
if ( $this->mTitle->isCascadeProtected() ) {
@@ -1667,7 +1667,7 @@
$wgOut->wrapWikiMsg( $notice, array(
'cascadeprotectedwarning', $cascadeSourcesCount ) );
}
if ( !$this->mTitle->exists() &&
$this->mTitle->getRestrictions( 'create' ) ) {
- LogEventsList::showLogExtract( $wgOut, 'protect',
$this->mTitle->getPrefixedText(), '',
+ LogEventsList::showLogExtract( $wgOut, 'protect',
$this->mTitle, '',
array( 'lim' => 1,
'showIfEmpty' => false,
'msgKey' => array(
'titleprotectedwarning' ),
Modified: trunk/phase3/includes/FileDeleteForm.php
===================================================================
--- trunk/phase3/includes/FileDeleteForm.php 2011-09-24 17:51:35 UTC (rev
98011)
+++ trunk/phase3/includes/FileDeleteForm.php 2011-09-24 17:52:53 UTC (rev
98012)
@@ -236,7 +236,7 @@
private function showLogEntries() {
global $wgOut;
$wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName(
'delete' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'delete',
$this->title->getPrefixedText() );
+ LogEventsList::showLogExtract( $wgOut, 'delete', $this->title );
}
/**
Modified: trunk/phase3/includes/HistoryPage.php
===================================================================
--- trunk/phase3/includes/HistoryPage.php 2011-09-24 17:51:35 UTC (rev
98011)
+++ trunk/phase3/includes/HistoryPage.php 2011-09-24 17:52:53 UTC (rev
98012)
@@ -117,7 +117,7 @@
LogEventsList::showLogExtract(
$wgOut,
array( 'delete', 'move' ),
- $this->title->getPrefixedText(),
+ $this->title,
'',
array( 'lim' => 10,
'conds' => array( "log_action !=
'revision'" ),
Modified: trunk/phase3/includes/LogEventsList.php
===================================================================
--- trunk/phase3/includes/LogEventsList.php 2011-09-24 17:51:35 UTC (rev
98011)
+++ trunk/phase3/includes/LogEventsList.php 2011-09-24 17:52:53 UTC (rev
98012)
@@ -789,7 +789,7 @@
* @param $list LogEventsList
* @param $types String or Array: log types to show
* @param $performer String: the user who made the log entries
- * @param $title String: the page title the log entries are for
+ * @param $title String or Title: the page title the log entries are for
* @param $pattern String: do a prefix search rather than an exact
title match
* @param $conds Array: extra conditions for the query
* @param $year Integer: the year to start from
@@ -909,15 +909,19 @@
* Set the log reader to return only entries affecting the given page.
* (For the block and rights logs, this is a user page.)
*
- * @param $page String: Title name as text
+ * @param $page String or Title object: Title name
* @param $pattern String
*/
private function limitTitle( $page, $pattern ) {
global $wgMiserMode;
- $title = Title::newFromText( $page );
- if( strlen( $page ) == 0 || !$title instanceof Title ) {
- return false;
+ if ( $page instanceof Title ) {
+ $title = $page;
+ } else {
+ $title = Title::newFromText( $page );
+ if( strlen( $page ) == 0 || !$title instanceof Title ) {
+ return false;
+ }
}
$this->title = $title->getPrefixedText();
Modified: trunk/phase3/includes/ProtectionForm.php
===================================================================
--- trunk/phase3/includes/ProtectionForm.php 2011-09-24 17:51:35 UTC (rev
98011)
+++ trunk/phase3/includes/ProtectionForm.php 2011-09-24 17:52:53 UTC (rev
98012)
@@ -606,7 +606,7 @@
function showLogExtract( &$out ) {
# Show relevant lines from the protection log:
$out->addHTML( Xml::element( 'h2', null, LogPage::logName(
'protect' ) ) );
- LogEventsList::showLogExtract( $out, 'protect',
$this->mTitle->getPrefixedText() );
+ LogEventsList::showLogExtract( $out, 'protect', $this->mTitle );
# Let extensions add other relevant log extracts
wfRunHooks( 'ProtectionForm::showLogExtract',
array($this->mArticle,$out) );
}
Modified: trunk/phase3/includes/specials/SpecialBlock.php
===================================================================
--- trunk/phase3/includes/specials/SpecialBlock.php 2011-09-24 17:51:35 UTC
(rev 98011)
+++ trunk/phase3/includes/specials/SpecialBlock.php 2011-09-24 17:52:53 UTC
(rev 98012)
@@ -404,7 +404,7 @@
LogEventsList::showLogExtract(
$out,
'block',
- $userpage->getPrefixedText(),
+ $userpage,
'',
array(
'lim' => 10,
@@ -419,7 +419,7 @@
LogEventsList::showLogExtract(
$out,
'suppress',
- $userpage->getPrefixedText(),
+ $userpage,
'',
array(
'lim' => 10,
Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php 2011-09-24
17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/specials/SpecialContributions.php 2011-09-24
17:52:53 UTC (rev 98012)
@@ -228,7 +228,7 @@
LogEventsList::showLogExtract(
$out,
'block',
- $nt->getPrefixedText(),
+ $nt,
'',
array(
'lim' => 1,
Modified: trunk/phase3/includes/specials/SpecialDeletedContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialDeletedContributions.php
2011-09-24 17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/specials/SpecialDeletedContributions.php
2011-09-24 17:52:53 UTC (rev 98012)
@@ -422,7 +422,7 @@
LogEventsList::showLogExtract(
$out,
'block',
- $nt->getPrefixedText(),
+ $nt,
'',
array(
'lim' => 1,
Modified: trunk/phase3/includes/specials/SpecialMergeHistory.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMergeHistory.php 2011-09-24
17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/specials/SpecialMergeHistory.php 2011-09-24
17:52:53 UTC (rev 98012)
@@ -236,7 +236,7 @@
# Show relevant lines from the deletion log:
$out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName(
'merge' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $out, 'merge',
$this->mTargetObj->getPrefixedText() );
+ LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj
);
# When we submit, go by page ID to avoid some nasty but
unlikely collisions.
# Such would happen if a page was renamed after the form
loaded, but before submit
Modified: trunk/phase3/includes/specials/SpecialMovepage.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMovepage.php 2011-09-24 17:51:35 UTC
(rev 98011)
+++ trunk/phase3/includes/specials/SpecialMovepage.php 2011-09-24 17:52:53 UTC
(rev 98012)
@@ -216,7 +216,7 @@
}
$out->addHTML( "<div
class='mw-warning-with-logexcerpt'>\n" );
$out->addWikiMsg( $noticeMsg );
- LogEventsList::showLogExtract( $out, 'protect',
$this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
+ LogEventsList::showLogExtract( $out, 'protect',
$this->oldTitle, '', array( 'lim' => 1 ) );
$out->addHTML( "</div>\n" );
}
@@ -580,7 +580,7 @@
function showLogFragment( $title ) {
$out = $this->getOutput();
$out->addHTML( Xml::element( 'h2', null, LogPage::logName(
'move' ) ) );
- LogEventsList::showLogExtract( $out, 'move',
$title->getPrefixedText() );
+ LogEventsList::showLogExtract( $out, 'move', $title );
}
function showSubpages( $title ) {
Modified: trunk/phase3/includes/specials/SpecialRevisiondelete.php
===================================================================
--- trunk/phase3/includes/specials/SpecialRevisiondelete.php 2011-09-24
17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/specials/SpecialRevisiondelete.php 2011-09-24
17:52:53 UTC (rev 98012)
@@ -208,12 +208,12 @@
# Show relevant lines from the deletion log
$output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName(
'delete' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $output, 'delete',
- $this->targetObj->getPrefixedText(), '', array( 'lim'
=> 25, 'conds' => $qc ) );
+ $this->targetObj, '', array( 'lim' => 25, 'conds' =>
$qc ) );
# Show relevant lines from the suppression log
if( $user->isAllowed( 'suppressionlog' ) ) {
$output->addHTML( "<h2>" . htmlspecialchars(
LogPage::logName( 'suppress' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $output, 'suppress',
- $this->targetObj->getPrefixedText(), '', array(
'lim' => 25, 'conds' => $qc ) );
+ $this->targetObj, '', array( 'lim' => 25,
'conds' => $qc ) );
}
}
Modified: trunk/phase3/includes/specials/SpecialUndelete.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUndelete.php 2011-09-24 17:51:35 UTC
(rev 98011)
+++ trunk/phase3/includes/specials/SpecialUndelete.php 2011-09-24 17:52:53 UTC
(rev 98012)
@@ -1076,11 +1076,11 @@
# Show relevant lines from the deletion log:
$out->addHTML( Xml::element( 'h2', null, LogPage::logName(
'delete' ) ) . "\n" );
- LogEventsList::showLogExtract( $out, 'delete',
$this->mTargetObj->getPrefixedText() );
+ LogEventsList::showLogExtract( $out, 'delete',
$this->mTargetObj );
# Show relevant lines from the suppression log:
if( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
$out->addHTML( Xml::element( 'h2', null,
LogPage::logName( 'suppress' ) ) . "\n" );
- LogEventsList::showLogExtract( $out, 'suppress',
$this->mTargetObj->getPrefixedText() );
+ LogEventsList::showLogExtract( $out, 'suppress',
$this->mTargetObj );
}
if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
Modified: trunk/phase3/includes/specials/SpecialUpload.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUpload.php 2011-09-24 17:51:35 UTC
(rev 98011)
+++ trunk/phase3/includes/specials/SpecialUpload.php 2011-09-24 17:52:53 UTC
(rev 98012)
@@ -266,7 +266,7 @@
$delNotice = ''; // empty by default
if ( $desiredTitleObj instanceof Title &&
!$desiredTitleObj->exists() ) {
LogEventsList::showLogExtract( $delNotice, array(
'delete', 'move' ),
- $desiredTitleObj->getPrefixedText(),
+ $desiredTitleObj,
'', array( 'lim' => 10,
'conds' => array( "log_action !=
'revision'" ),
'showIfEmpty' => false,
Modified: trunk/phase3/includes/specials/SpecialUserrights.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUserrights.php 2011-09-24
17:51:35 UTC (rev 98011)
+++ trunk/phase3/includes/specials/SpecialUserrights.php 2011-09-24
17:52:53 UTC (rev 98012)
@@ -606,6 +606,6 @@
*/
protected function showLogFragment( $user, $output ) {
$output->addHTML( Xml::element( 'h2', null, LogPage::logName(
'rights' ) . "\n" ) );
- LogEventsList::showLogExtract( $output, 'rights',
$user->getUserPage()->getPrefixedText() );
+ LogEventsList::showLogExtract( $output, 'rights',
$user->getUserPage() );
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs