jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399770 )

Change subject: [WikiImporter::notice] use wfDebug instead of echo in notice()
......................................................................


[WikiImporter::notice] use wfDebug instead of echo in notice()

Make the default notice implementation of notice() function to
send the notice to wfDebug() instead of simply echo to prevent XSS

Bug: T177997
Change-Id: I9ffb597e0642afc1603cdd15e2d09c6f2584b448
---
M includes/import/WikiImporter.php
M maintenance/dumpIterator.php
M maintenance/importDump.php
M maintenance/renderDump.php
M maintenance/storage/checkStorage.php
5 files changed, 15 insertions(+), 1 deletion(-)

Approvals:
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php
index 28f3f82..ed5ec1a 100644
--- a/includes/import/WikiImporter.php
+++ b/includes/import/WikiImporter.php
@@ -125,7 +125,9 @@
                if ( is_callable( $this->mNoticeCallback ) ) {
                        call_user_func( $this->mNoticeCallback, $msg, $params );
                } else { # No ImportReporter -> CLI
-                       echo wfMessage( $msg, $params )->text() . "\n";
+                       // T177997: the command line importers should call 
setNoticeCallback()
+                       // for their own custom callback to echo the notice
+                       wfDebug( wfMessage( $msg, $params )->text() . "\n" );
                }
        }
 
diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php
index 254f368..707f4b3 100644
--- a/maintenance/dumpIterator.php
+++ b/maintenance/dumpIterator.php
@@ -77,6 +77,9 @@
 
                $importer->setRevisionCallback(
                        [ $this, 'handleRevision' ] );
+               $importer->setNoticeCallback( function ( $msg, $params ) {
+                       echo wfMessage( $msg, $params )->text() . "\n";
+               } );
 
                $this->from = $this->getOption( 'from', null );
                $this->count = 0;
diff --git a/maintenance/importDump.php b/maintenance/importDump.php
index 2923b38..918c1ab 100644
--- a/maintenance/importDump.php
+++ b/maintenance/importDump.php
@@ -322,6 +322,9 @@
                        $this->pageCount = $nthPage - 1;
                }
                $importer->setPageCallback( [ $this, 'reportPage' ] );
+               $importer->setNoticeCallback( function ( $msg, $params ) {
+                       echo wfMessage( $msg, $params )->text() . "\n";
+               } );
                $this->importCallback = $importer->setRevisionCallback(
                        [ $this, 'handleRevision' ] );
                $this->uploadCallback = $importer->setUploadCallback(
diff --git a/maintenance/renderDump.php b/maintenance/renderDump.php
index 68a371c..458556f 100644
--- a/maintenance/renderDump.php
+++ b/maintenance/renderDump.php
@@ -66,6 +66,9 @@
 
                $importer->setRevisionCallback(
                        [ $this, 'handleRevision' ] );
+               $importer->setNoticeCallback( function ( $msg, $params ) {
+                       echo wfMessage( $msg, $params )->text() . "\n";
+               } );
 
                $importer->doImport();
 
diff --git a/maintenance/storage/checkStorage.php 
b/maintenance/storage/checkStorage.php
index 6348e96..8f55b88 100644
--- a/maintenance/storage/checkStorage.php
+++ b/maintenance/storage/checkStorage.php
@@ -493,6 +493,9 @@
                        MediaWikiServices::getInstance()->getMainConfig()
                );
                $importer->setRevisionCallback( [ $this, 'importRevision' ] );
+               $importer->setNoticeCallback( function ( $msg, $params ) {
+                       echo wfMessage( $msg, $params )->text() . "\n";
+               } );
                $importer->doImport();
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9ffb597e0642afc1603cdd15e2d09c6f2584b448
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Eflyjason <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Eflyjason <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to