Glaisher has uploaded a new change for review.

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

Change subject: Migrate local-block logging in GlobalBlock to new system
......................................................................

Migrate local-block logging in GlobalBlock to new system

* Also make logging more consistent with core
** flag parameters order consistent with SpecialBlock (T91884#1521506)
** add 'nousertalk' if $wgBlockAllowsUTEdit is true

Bug: T92719
Change-Id: Ia31396e5b7a7e742217f7314039e3b23b5b350fe
---
M includes/specials/SpecialGlobalBlock.php
1 file changed, 16 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalBlocking 
refs/changes/09/230409/1

diff --git a/includes/specials/SpecialGlobalBlock.php 
b/includes/specials/SpecialGlobalBlock.php
index 1112e32..b9dacaa 100644
--- a/includes/specials/SpecialGlobalBlock.php
+++ b/includes/specials/SpecialGlobalBlock.php
@@ -168,25 +168,27 @@
                        $blockSuccess = $block->insert();
 
                        if ( $blockSuccess ) {
-                               $log = new LogPage( 'block' );
-                               $flags = array( 'nocreate', 'nousertalk' );
-
+                               $flags = array(); // keep the flag order 
consistent with SpecialBlock
                                if ( $this->mAnonOnly ) {
                                        $flags[] = 'anononly';
                                }
+                               $flags[] = 'nocreate';
+                               if ( 
$this->getConfig()->get('BlockAllowsUTEdit') ) { // for consistency with core
+                                       $flags[] = 'nousertalk';
+                               }
 
-                               $logParams = implode( ',', $flags );
+                               $logParams = array();
+                               $logParams['5::duration'] = $this->mExpiry;
+                               $logParams['6::flags'] = implode( ',', $flags );
 
-                               $log_id = $log->addEntry(
-                                       'block',
-                                       Title::makeTitle( NS_USER, 
$this->mAddress ),
-                                       $reasonstr,
-                                       array( $this->mExpiry, $logParams ),
-                                       $this->getUser()
-                               );
-
-                               $log->addRelations( 'ipb_id', array( 
$blockSuccess['id'] ), $log_id );
-                       }
+                               $log = new ManualLogEntry( 'block', 'block' );
+                               $log->setTarget( Title::makeTitle( NS_USER, 
$this->mAddress ) );
+                               $log->setComment( $reasonstr );
+                               $log->setPerformer( $this->getUser() );
+                               $log->setParameters( $logParams );
+                               $log->setRelations( array( 'ipb_id' => array( 
$blockSuccess['id'] ) ) );
+                               $logId = $log->insert();
+                               $log->publish( $logId );
                }
 
                if ( $this->mModify ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia31396e5b7a7e742217f7314039e3b23b5b350fe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalBlocking
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

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

Reply via email to