IAlex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/151086

Change subject: Factorise $this->getTitle() call in Article::confirmDelete()
......................................................................

Factorise $this->getTitle() call in Article::confirmDelete()

Call it once instead of seven times.

Change-Id: I2f4d298a15046c4dc02afbf7582c90a1f17ea4cb
---
M includes/page/Article.php
1 file changed, 8 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/151086/1

diff --git a/includes/page/Article.php b/includes/page/Article.php
index a189c2e..436f148 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1657,11 +1657,12 @@
        public function confirmDelete( $reason ) {
                wfDebug( "Article::confirmDelete\n" );
 
+               $title = $this->getTitle();
                $outputPage = $this->getContext()->getOutput();
-               $outputPage->setPageTitle( wfMessage( 'delete-confirm', 
$this->getTitle()->getPrefixedText() ) );
-               $outputPage->addBacklinkSubtitle( $this->getTitle() );
+               $outputPage->setPageTitle( wfMessage( 'delete-confirm', 
$title->getPrefixedText() ) );
+               $outputPage->addBacklinkSubtitle( $title );
                $outputPage->setRobotPolicy( 'noindex,nofollow' );
-               $backlinkCache = $this->getTitle()->getBacklinkCache();
+               $backlinkCache = $title->getBacklinkCache();
                if ( $backlinkCache->hasLinks( 'pagelinks' ) || 
$backlinkCache->hasLinks( 'templatelinks' ) ) {
                        $outputPage->wrapWikiMsg( "<div class='mw-warning 
plainlinks'>\n$1\n</div>\n",
                                'deleting-backlinks-warning' );
@@ -1683,10 +1684,10 @@
                } else {
                        $suppress = '';
                }
-               $checkWatch = $user->getBoolOption( 'watchdeletion' ) || 
$user->isWatched( $this->getTitle() );
+               $checkWatch = $user->getBoolOption( 'watchdeletion' ) || 
$user->isWatched( $title );
 
                $form = Xml::openElement( 'form', array( 'method' => 'post',
-                       'action' => $this->getTitle()->getLocalURL( 
'action=delete' ), 'id' => 'deleteconfirm' ) ) .
+                       'action' => $title->getLocalURL( 'action=delete' ), 
'id' => 'deleteconfirm' ) ) .
                        Xml::openElement( 'fieldset', array( 'id' => 
'mw-delete-table' ) ) .
                        Xml::tags( 'legend', null, wfMessage( 'delete-legend' 
)->escaped() ) .
                        Xml::openElement( 'table', array( 'id' => 
'mw-deleteconfirm-table' ) ) .
@@ -1745,7 +1746,7 @@
                        Xml::closeElement( 'fieldset' ) .
                        Html::hidden(
                                'wpEditToken',
-                               $user->getEditToken( array( 'delete', 
$this->getTitle()->getPrefixedText() ) )
+                               $user->getEditToken( array( 'delete', 
$title->getPrefixedText() ) )
                        ) .
                        Xml::closeElement( 'form' );
 
@@ -1764,9 +1765,7 @@
 
                $deleteLogPage = new LogPage( 'delete' );
                $outputPage->addHTML( Xml::element( 'h2', null, 
$deleteLogPage->getName()->text() ) );
-               LogEventsList::showLogExtract( $outputPage, 'delete',
-                       $this->getTitle()
-               );
+               LogEventsList::showLogExtract( $outputPage, 'delete', $title );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/151086
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f4d298a15046c4dc02afbf7582c90a1f17ea4cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <coderev...@emsenhuber.ch>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to