jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/398641 )
Change subject: Move GlobalBlockListPager to own file
......................................................................
Move GlobalBlockListPager to own file
Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass
Change-Id: I802c0fe46765613519ee172b6c5ebc0ed7c0a63b
---
M .phpcs.xml
M extension.json
A includes/specials/GlobalBlockListPager.php
M includes/specials/SpecialGlobalBlockList.php
4 files changed, 112 insertions(+), 110 deletions(-)
Approvals:
Addshore: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.phpcs.xml b/.phpcs.xml
index 57b3f85..8a4cc26 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -3,12 +3,13 @@
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude
name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
- <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase"
/>
- <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
<exclude
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
</rule>
+ <rule ref="MediaWiki.Files.ClassMatchesFilename.WrongCase">
+ <exclude-pattern>*/maintenance/*</exclude-pattern>
+ </rule>
<rule ref="Generic.Files.LineLength">
<exclude-pattern>GlobalBlocking\.alias\.php</exclude-pattern>
</rule>
diff --git a/extension.json b/extension.json
index d5b16fd..fcf19a0 100644
--- a/extension.json
+++ b/extension.json
@@ -86,7 +86,7 @@
"AutoloadClasses": {
"SpecialGlobalBlock":
"includes/specials/SpecialGlobalBlock.php",
"SpecialGlobalBlockList":
"includes/specials/SpecialGlobalBlockList.php",
- "GlobalBlockListPager":
"includes/specials/SpecialGlobalBlockList.php",
+ "GlobalBlockListPager":
"includes/specials/GlobalBlockListPager.php",
"SpecialGlobalBlockStatus":
"includes/specials/SpecialGlobalBlockStatus.php",
"SpecialRemoveGlobalBlock":
"includes/specials/SpecialRemoveGlobalBlock.php",
"ApiQueryGlobalBlocks": "includes/api/ApiQueryGlobalBlocks.php",
diff --git a/includes/specials/GlobalBlockListPager.php
b/includes/specials/GlobalBlockListPager.php
new file mode 100644
index 0000000..dacb30c
--- /dev/null
+++ b/includes/specials/GlobalBlockListPager.php
@@ -0,0 +1,108 @@
+<?php
+
+class GlobalBlockListPager extends ReverseChronologicalPager {
+ /** @var array */
+ private $queryConds;
+
+ public function __construct( IContextSource $context, array $conds ) {
+ parent::__construct( $context );
+ $this->queryConds = $conds;
+ $this->mDb = GlobalBlocking::getGlobalBlockingDatabase(
DB_REPLICA );
+ }
+
+ public function formatRow( $row ) {
+ global $wgApplyGlobalBlocks;
+
+ $lang = $this->getLanguage();
+ $options = [];
+
+ $expiry = $lang->formatExpiry( $row->gb_expiry, TS_MW );
+ if ( $expiry == 'infinity' ) {
+ $options[] = $this->msg( 'infiniteblock' )->parse();
+ } else {
+ $options[] = $this->msg(
+ 'expiringblock',
+ $lang->date( $expiry ),
+ $lang->time( $expiry )
+ )->parse();
+ }
+
+ // Check for whitelisting.
+ $wlinfo = GlobalBlocking::getWhitelistInfo( $row->gb_id );
+ if ( $wlinfo ) {
+ $options[] = $this->msg(
+ 'globalblocking-list-whitelisted',
+ User::whois( $wlinfo['user'] ),
$wlinfo['reason']
+ )->text();
+ }
+
+ if ( $row->gb_anon_only ) {
+ $options[] = $this->msg( 'globalblocking-list-anononly'
)->text();
+ }
+
+ // Do afterthoughts (comment, links for admins)
+ $info = [];
+ $user = $this->getUser();
+ $canBlock = $user->isAllowed( 'globalblock' );
+ if ( $canBlock ) {
+ $info[] = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'RemoveGlobalBlock' ),
+ $this->msg( 'globalblocking-list-unblock'
)->parse(),
+ [],
+ [ 'address' => $row->gb_address ]
+ );
+ }
+
+ if ( $wgApplyGlobalBlocks && $user->isAllowed(
'globalblock-whitelist' ) ) {
+ $info[] = Linker::link(
+ SpecialPage::getTitleFor( 'GlobalBlockStatus' ),
+ $this->msg( 'globalblocking-list-whitelist'
)->parse(),
+ [],
+ [ 'address' => $row->gb_address ]
+ );
+ }
+
+ if ( $canBlock ) {
+ $info[] = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'GlobalBlock' ),
+ $this->msg( 'globalblocking-list-modify'
)->parse(),
+ [],
+ [ 'wpAddress' => $row->gb_address ]
+ );
+ }
+
+ $timestamp = $row->gb_timestamp;
+ $timestamp = $lang->timeanddate( wfTimestamp( TS_MW, $timestamp
), true );
+ // Userpage link / Info on originating wiki
+ $displayWiki = WikiMap::getWikiName( $row->gb_by_wiki );
+ $userDisplay = GlobalBlocking::maybeLinkUserpage(
$row->gb_by_wiki, $row->gb_by );
+ $infoItems = count( $info )
+ ? $this->msg( 'parentheses', $lang->pipeList( $info )
)->text()
+ : '';
+
+ // Put it all together.
+ return Html::rawElement( 'li', [],
+ $this->msg( 'globalblocking-list-blockitem',
+ $timestamp,
+ $userDisplay,
+ $displayWiki,
+ $row->gb_address,
+ $lang->commaList( $options )
+ )->parse() . ' ' .
+ Linker::commentBlock( $row->gb_reason ) . ' ' .
+ $infoItems
+ );
+ }
+
+ public function getQueryInfo() {
+ return [
+ 'tables' => 'globalblocks',
+ 'fields' => '*',
+ 'conds' => $this->queryConds,
+ ];
+ }
+
+ public function getIndexField() {
+ return 'gb_timestamp';
+ }
+}
diff --git a/includes/specials/SpecialGlobalBlockList.php
b/includes/specials/SpecialGlobalBlockList.php
index beca1fd..5746a53 100644
--- a/includes/specials/SpecialGlobalBlockList.php
+++ b/includes/specials/SpecialGlobalBlockList.php
@@ -107,110 +107,3 @@
return 'users';
}
}
-
-class GlobalBlockListPager extends ReverseChronologicalPager {
- /** @var array */
- private $queryConds;
-
- public function __construct( IContextSource $context, array $conds ) {
- parent::__construct( $context );
- $this->queryConds = $conds;
- $this->mDb = GlobalBlocking::getGlobalBlockingDatabase(
DB_REPLICA );
- }
-
- public function formatRow( $row ) {
- global $wgApplyGlobalBlocks;
-
- $lang = $this->getLanguage();
- $options = [];
-
- $expiry = $lang->formatExpiry( $row->gb_expiry, TS_MW );
- if ( $expiry == 'infinity' ) {
- $options[] = $this->msg( 'infiniteblock' )->parse();
- } else {
- $options[] = $this->msg(
- 'expiringblock',
- $lang->date( $expiry ),
- $lang->time( $expiry )
- )->parse();
- }
-
- // Check for whitelisting.
- $wlinfo = GlobalBlocking::getWhitelistInfo( $row->gb_id );
- if ( $wlinfo ) {
- $options[] = $this->msg(
- 'globalblocking-list-whitelisted',
- User::whois( $wlinfo['user'] ),
$wlinfo['reason']
- )->text();
- }
-
- if ( $row->gb_anon_only ) {
- $options[] = $this->msg( 'globalblocking-list-anononly'
)->text();
- }
-
- // Do afterthoughts (comment, links for admins)
- $info = [];
- $user = $this->getUser();
- $canBlock = $user->isAllowed( 'globalblock' );
- if ( $canBlock ) {
- $info[] = Linker::linkKnown(
- SpecialPage::getTitleFor( 'RemoveGlobalBlock' ),
- $this->msg( 'globalblocking-list-unblock'
)->parse(),
- [],
- [ 'address' => $row->gb_address ]
- );
- }
-
- if ( $wgApplyGlobalBlocks && $user->isAllowed(
'globalblock-whitelist' ) ) {
- $info[] = Linker::link(
- SpecialPage::getTitleFor( 'GlobalBlockStatus' ),
- $this->msg( 'globalblocking-list-whitelist'
)->parse(),
- [],
- [ 'address' => $row->gb_address ]
- );
- }
-
- if ( $canBlock ) {
- $info[] = Linker::linkKnown(
- SpecialPage::getTitleFor( 'GlobalBlock' ),
- $this->msg( 'globalblocking-list-modify'
)->parse(),
- [],
- [ 'wpAddress' => $row->gb_address ]
- );
- }
-
- $timestamp = $row->gb_timestamp;
- $timestamp = $lang->timeanddate( wfTimestamp( TS_MW, $timestamp
), true );
- // Userpage link / Info on originating wiki
- $displayWiki = WikiMap::getWikiName( $row->gb_by_wiki );
- $userDisplay = GlobalBlocking::maybeLinkUserpage(
$row->gb_by_wiki, $row->gb_by );
- $infoItems = count( $info )
- ? $this->msg( 'parentheses', $lang->pipeList( $info )
)->text()
- : '';
-
- // Put it all together.
- return Html::rawElement( 'li', [],
- $this->msg( 'globalblocking-list-blockitem',
- $timestamp,
- $userDisplay,
- $displayWiki,
- $row->gb_address,
- $lang->commaList( $options )
- )->parse() . ' ' .
- Linker::commentBlock( $row->gb_reason ) . ' ' .
- $infoItems
- );
- }
-
- public function getQueryInfo() {
- return [
- 'tables' => 'globalblocks',
- 'fields' => '*',
- 'conds' => $this->queryConds,
- ];
- }
-
- public function getIndexField() {
- return 'gb_timestamp';
- }
-}
--
To view, visit https://gerrit.wikimedia.org/r/398641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I802c0fe46765613519ee172b6c5ebc0ed7c0a63b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalBlocking
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits