r95241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95240‎ | r95241 | r95242 >
Date:20:27, 22 August 2011
Author:reedy
Status:resolved
Tags:
Comment:
Subclass ApiBase

Create a temporary variable for result
Modified paths:
  • /trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php
@@ -27,10 +27,8 @@
2828 * @ingroup API
2929 * @ingroup Extensions
3030 */
 31+class ApiQueryTitleBlacklist extends ApiBase {
3132
32 -
33 -class ApiQueryTitleBlacklist extends ApiQueryBase {
34 -
3533 public function __construct( $query, $moduleName ) {
3634 parent::__construct( $query, $moduleName, 'tb' );
3735 }
@@ -39,7 +37,7 @@
4038 # get the current user.
4139 $context = $this->createContext();
4240 $user = $context->getUser();
43 -
 41+
4442 $params = $this->extractRequestParams();
4543 $action = $params['action'];
4644
@@ -59,13 +57,14 @@
6058 htmlspecialchars( $blacklisted->getRaw() ),
6159 htmlspecialchars( $params['title'] ),
6260 );
63 -
64 - $this->getResult()->addValue( 'titleblacklist', 'result', 'blacklisted' );
 61+
 62+ $result = $this->getResult();
 63+ $result->addValue( 'titleblacklist', 'result', 'blacklisted' );
6564 // this is hardcoded to 'edit' in Titleblacklist.hooks.php, duplicating that.
6665 $message = $blacklisted->getErrorMessage( 'edit' );
67 - $this->getResult()->addValue( 'titleblacklist', 'reason', wfMessage( $message, $result )->text() );
68 - $this->getResult()->addValue( 'titleblacklist', 'message', $message );
69 - $this->getResult()->addValue( 'titleblacklist', 'line', htmlspecialchars( $blacklisted->getRaw() ) );
 66+ $result->addValue( 'titleblacklist', 'reason', wfMessage( $message, $result )->text() );
 67+ $result->addValue( 'titleblacklist', 'message', $message );
 68+ $result->addValue( 'titleblacklist', 'line', htmlspecialchars( $blacklisted->getRaw() ) );
7069 } else {
7170 // not blacklisted
7271 $this->getResult()->addValue( 'titleblacklist', 'result', 'ok' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r95243$result is already used...reedy20:29, 22 August 2011

Status & tagging log