dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Do not output wikitext in maintenance script"
[lhc/web/wiklou.git]
/
maintenance
/
formatInstallDoc.php
diff --git
a/maintenance/formatInstallDoc.php
b/maintenance/formatInstallDoc.php
index
fe547e7
..
160a20d
100644
(file)
--- a/
maintenance/formatInstallDoc.php
+++ b/
maintenance/formatInstallDoc.php
@@
-21,14
+21,16
@@
* @ingroup Maintenance
*/
* @ingroup Maintenance
*/
-require_once( __DIR__ . '/Maintenance.php' );
+use MediaWiki\MediaWikiServices;
+
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script that formats RELEASE-NOTE file to wiki text or HTML markup.
*
* @ingroup Maintenance
*/
/**
* Maintenance script that formats RELEASE-NOTE file to wiki text or HTML markup.
*
* @ingroup Maintenance
*/
-class
Maintenance
FormatInstallDoc extends Maintenance {
+class FormatInstallDoc extends Maintenance {
function __construct() {
parent::__construct();
$this->addArg( 'path', 'The file name to format', false );
function __construct() {
parent::__construct();
$this->addArg( 'path', 'The file name to format', false );
@@
-41,8
+43,7
@@
class MaintenanceFormatInstallDoc extends Maintenance {
$fileName = $this->getArg( 0 );
$inFile = fopen( $fileName, 'r' );
if ( !$inFile ) {
$fileName = $this->getArg( 0 );
$inFile = fopen( $fileName, 'r' );
if ( !$inFile ) {
- $this->error( "Unable to open input file \"$fileName\"" );
- exit( 1 );
+ $this->fatalError( "Unable to open input file \"$fileName\"" );
}
} else {
$inFile = STDIN;
}
} else {
$inFile = STDIN;
@@
-52,8
+53,7
@@
class MaintenanceFormatInstallDoc extends Maintenance {
$fileName = $this->getOption( 'outfile' );
$outFile = fopen( $fileName, 'w' );
if ( !$outFile ) {
$fileName = $this->getOption( 'outfile' );
$outFile = fopen( $fileName, 'w' );
if ( !$outFile ) {
- $this->error( "Unable to open output file \"$fileName\"" );
- exit( 1 );
+ $this->fatalError( "Unable to open output file \"$fileName\"" );
}
} else {
$outFile = STDOUT;
}
} else {
$outFile = STDOUT;
@@
-63,10
+63,10
@@
class MaintenanceFormatInstallDoc extends Maintenance {
$outText = InstallDocFormatter::format( $inText );
if ( $this->hasOption( 'html' ) ) {
$outText = InstallDocFormatter::format( $inText );
if ( $this->hasOption( 'html' ) ) {
-
global $wgParser
;
+
$parser = MediaWikiServices::getInstance()->getParser()
;
$opt = new ParserOptions;
$title = Title::newFromText( 'Text file' );
$opt = new ParserOptions;
$title = Title::newFromText( 'Text file' );
- $out = $
wgP
arser->parse( $outText, $title, $opt );
+ $out = $
p
arser->parse( $outText, $title, $opt );
$outText = "<html><body>\n" . $out->getText() . "\n</body></html>\n";
}
$outText = "<html><body>\n" . $out->getText() . "\n</body></html>\n";
}
@@
-74,5
+74,5
@@
class MaintenanceFormatInstallDoc extends Maintenance {
}
}
}
}
-$maintClass =
'MaintenanceFormatInstallDoc'
;
+$maintClass =
FormatInstallDoc::class
;
require_once RUN_MAINTENANCE_IF_MAIN;
require_once RUN_MAINTENANCE_IF_MAIN;