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
if ( is_callable( $this->mNoticeCallback ) ) {
call_user_func( $this->mNoticeCallback, $msg, $params );
} else { # No ImportReporter -> CLI
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" );
$importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
$importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
+ $importer->setNoticeCallback( function ( $msg, $params ) {
+ echo wfMessage( $msg, $params )->text() . "\n";
+ } );
$this->from = $this->getOption( 'from', null );
$this->count = 0;
$this->from = $this->getOption( 'from', null );
$this->count = 0;
$this->pageCount = $nthPage - 1;
}
$importer->setPageCallback( [ $this, 'reportPage' ] );
$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(
$this->importCallback = $importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
$this->uploadCallback = $importer->setUploadCallback(
$importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
$importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
+ $importer->setNoticeCallback( function ( $msg, $params ) {
+ echo wfMessage( $msg, $params )->text() . "\n";
+ } );
MediaWikiServices::getInstance()->getMainConfig()
);
$importer->setRevisionCallback( [ $this, 'importRevision' ] );
MediaWikiServices::getInstance()->getMainConfig()
);
$importer->setRevisionCallback( [ $this, 'importRevision' ] );
+ $importer->setNoticeCallback( function ( $msg, $params ) {
+ echo wfMessage( $msg, $params )->text() . "\n";
+ } );