MarkAHershberger has uploaded a new change for review.

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

Change subject: Address some lint issues
......................................................................

Address some lint issues

Change-Id: Ic322b0b31e9ac730dd7f7f24dcf0f2828bb32680
---
M WhoIsWatching_body.php
1 file changed, 19 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/40/290140/1

diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index 6d47f0f..aca0cab 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -12,8 +12,8 @@
                $conf = new GlobalVarConfig( "whoiswatching_" );
                $showWatchingUsers = $conf->get( "showwatchingusers" );
                $showIfZero = $conf->get( "showifzero" );
-               $ns = $template->getTitle()->getNamespace();
-               if ( $showWatchingUsers && $ns >= 0 ) {
+               $nameSpace = $template->getTitle()->getNamespace();
+               if ( $showWatchingUsers && $nameSpace >= 0 ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        $title = $template->getTitle();
                        $res = $dbr->select( 'watchlist', 'COUNT(*) n', [
@@ -35,7 +35,7 @@
                return true;
        }
 
-       function execute( $par ) {
+       public function execute( $par ) {
                global $wgRequest, $wgOut, $wgUser;
                global $whoiswatching_nametype, 
$whoiswatching_allowaddingpeople;
 
@@ -43,9 +43,9 @@
                $wgOut->setPagetitle( $this->msg( 'whoiswatching' ) );
 
                $title = $wgRequest->getVal( 'page' );
-               $ns = $wgRequest->getVal( 'ns', '' );
-               if ( $ns !== '' ) {
-                       $title = $ns.':'.$title;
+               $nameSpace = $wgRequest->getVal( 'ns', '' );
+               if ( $nameSpace !== '' ) {
+                       $title = $nameSpace.':'.$title;
                }
                $pageTitle = Title::newFromText( $title );
                if ( !$title || !$pageTitle ) {
@@ -58,24 +58,23 @@
                        $wgUser->matchEditToken( $wgRequest->getVal( 'token' ) 
) ) {
                        $idArray = $wgRequest->getArray( 'idArray' );
                        foreach ( $idArray as $name => $id ) {
-                               #$wgOut->addWikiText("* Adding name $name 
userid $id to watchlist\n");
                                $u = User::newFromId( $id );
                                $u->addWatch( $pageTitle );
                        }
                        $wgOut->redirect( Title::makeTitle( NS_SPECIAL, 
'WhoIsWatching' )->getLocalUrl(
-                               array( 'page' => $title )
+                               [ 'page' => $title ]
                        ) );
                        return;
                }
                $out->addWikiMsg( 'specialwhoiswatchingthepage', $title );
 
                $dbr = wfGetDB( DB_SLAVE );
-               $watchingusers = array();
+               $watchingusers = [];
                $res = $dbr->select(
-                       'watchlist', 'wl_user', array(
+                       'watchlist', 'wl_user', [
                                'wl_namespace' => $pageTitle->getNamespace(),
                                'wl_title' => $pageTitle->getDBkey(),
-                       ), __METHOD__ );
+                       ], __METHOD__ );
                foreach ( $res as $row ) {
                        $u = User::newFromID( $row->wl_user );
                        if ( ( $whoiswatching_nametype == 'UserName' ) || 
!$u->getRealName() ) {
@@ -93,14 +92,16 @@
                $wgOut->addWikiText( $out );
 
                if ( $whoiswatching_allowaddingpeople ) {
-                       $wgOut->addWikiText( "== ".$this->msg( 
'specialwhoiswatchingaddusers')->text()." ==" );
+                       $wgOut->addWikiText( "== ".$this->msg( 
'specialwhoiswatchingaddusers' )->text()." ==" );
                        $wgOut->addHTML( "<form method=\"post\">" );
-                       $wgOut->addHTML( "<input type=\"hidden\" 
value=\"".$wgUser->getEditToken()."\" name=\"token\" />" );
-                       $wgOut->addHTML( "<div style=\"border: thin solid 
#000000\"><table cellpadding=\"15\" cellspacing=\"0\" border=\"0\">" );
+                       $wgOut->addHTML( "<input type=\"hidden\" value=\"" . 
$wgUser->getEditToken() .
+                                                        "\" name=\"token\" />" 
);
+                       $wgOut->addHTML( "<div style=\"border: thin solid 
#000000\">" );
+                       $wgOut->addHTML( "<table cellpadding=\"15\" 
cellspacing=\"0\" border=\"0\">" );
                        $wgOut->addHTML( "<tr><td>" );
                        $wgOut->addHTML( '<select name="idArray[]" size="12" 
multiple="multiple">' );
-                       $users = array();
-                       $res = $dbr->select( 'user', 'user_name', '', 
__METHOD__);
+                       $users = [];
+                       $res = $dbr->select( 'user', 'user_name', '', 
__METHOD__ );
                        foreach ( $res as $row ) {
                                $u = User::newFromName( $row->user_name );
                                if ( !array_key_exists( $u->getID(), 
$watchingusers ) &&
@@ -113,7 +114,8 @@
                                $wgOut->addHTML( "<option 
value=\"".$id."\">".$name."</option>" );
                        }
                        $wgOut->addHTML( '</select></td><td>' );
-                       $wgOut->addHTML( "<input type=\"submit\" 
value=\"".$this->msg( 'specialwhoiswatchingaddbtn' )->escaped()."\" />" );
+                       $wgOut->addHTML( "<input type=\"submit\" value=\"" .
+                                                        $this->msg( 
'specialwhoiswatchingaddbtn' )->escaped() . "\" />" );
                        $wgOut->addHTML( "</td></tr></table></div></form>" );
                }
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic322b0b31e9ac730dd7f7f24dcf0f2828bb32680
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to