mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I30daab715920757ec96350c9933fc18c887972c4
This commit is contained in:
parent
c26ed13636
commit
54d1b77401
|
@ -106,7 +106,7 @@ class MathLaTeXML extends MathMathML {
|
||||||
$post = $this->getLaTeXMLPostData();
|
$post = $this->getLaTeXMLPostData();
|
||||||
// There is an API-inconsistency between different versions of the LaTeXML daemon
|
// There is an API-inconsistency between different versions of the LaTeXML daemon
|
||||||
// some versions require the literal prefix other don't allow it.
|
// some versions require the literal prefix other don't allow it.
|
||||||
if ( ! strpos( $host, '/convert' ) ) {
|
if ( !strpos( $host, '/convert' ) ) {
|
||||||
$post = preg_replace( '/&tex=/', '&tex=literal:', $post, 1 );
|
$post = preg_replace( '/&tex=/', '&tex=literal:', $post, 1 );
|
||||||
}
|
}
|
||||||
$this->lastError = '';
|
$this->lastError = '';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||||
"mediawiki/mediawiki-codesniffer": "23.0.0",
|
"mediawiki/mediawiki-codesniffer": "24.0.0",
|
||||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||||
"mediawiki/minus-x": "0.3.1"
|
"mediawiki/minus-x": "0.3.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -203,7 +203,7 @@ class MathHooks {
|
||||||
if ( $mode == 'mathml' ) {
|
if ( $mode == 'mathml' ) {
|
||||||
$parser->getOutput()->addModules( [ 'ext.math.scripts' ] );
|
$parser->getOutput()->addModules( [ 'ext.math.scripts' ] );
|
||||||
$marker = Parser::MARKER_PREFIX .
|
$marker = Parser::MARKER_PREFIX .
|
||||||
'-postMath-' . sprintf( '%08X', $n ++ ) .
|
'-postMath-' . sprintf( '%08X', $n++ ) .
|
||||||
Parser::MARKER_SUFFIX;
|
Parser::MARKER_SUFFIX;
|
||||||
self::$tags[$marker] = [ $renderer, $parser ];
|
self::$tags[$marker] = [ $renderer, $parser ];
|
||||||
return $marker;
|
return $marker;
|
||||||
|
@ -268,7 +268,7 @@ class MathHooks {
|
||||||
// If the default option is not in the valid options the
|
// If the default option is not in the valid options the
|
||||||
// user interface throws an exception (BUG 64844)
|
// user interface throws an exception (BUG 64844)
|
||||||
$mode = self::mathModeToString( $wgDefaultUserOptions['math'] );
|
$mode = self::mathModeToString( $wgDefaultUserOptions['math'] );
|
||||||
if ( ! in_array( $mode, MathRenderer::getValidModes() ) ) {
|
if ( !in_array( $mode, MathRenderer::getValidModes() ) ) {
|
||||||
LoggerFactory::getInstance( 'Math' )->error( 'Misconfiguration: ' .
|
LoggerFactory::getInstance( 'Math' )->error( 'Misconfiguration: ' .
|
||||||
"\$wgDefaultUserOptions['math'] is not in " . MathRenderer::getValidModes() . ".\n" .
|
"\$wgDefaultUserOptions['math'] is not in " . MathRenderer::getValidModes() . ".\n" .
|
||||||
"Please check your LocalSetting.php file." );
|
"Please check your LocalSetting.php file." );
|
||||||
|
|
|
@ -426,7 +426,7 @@ class MathMathML extends MathRenderer {
|
||||||
} else {
|
} else {
|
||||||
$class = $classOverride;
|
$class = $classOverride;
|
||||||
}
|
}
|
||||||
if ( ! $this->mathoidStyle ) {
|
if ( !$this->mathoidStyle ) {
|
||||||
$this->correctSvgStyle( $this->mathoidStyle );
|
$this->correctSvgStyle( $this->mathoidStyle );
|
||||||
}
|
}
|
||||||
if ( $class ) {
|
if ( $class ) {
|
||||||
|
@ -522,7 +522,7 @@ class MathMathML extends MathRenderer {
|
||||||
protected function initializeFromDatabaseRow( $rpage ) {
|
protected function initializeFromDatabaseRow( $rpage ) {
|
||||||
// mathoid allows different input formats
|
// mathoid allows different input formats
|
||||||
// therefore the column name math_inputtex was changed to math_input
|
// therefore the column name math_inputtex was changed to math_input
|
||||||
if ( $this->getMathTableName() == 'mathoid' && ! empty( $rpage->math_input ) ) {
|
if ( $this->getMathTableName() == 'mathoid' && !empty( $rpage->math_input ) ) {
|
||||||
$this->userInputTex = $rpage->math_input;
|
$this->userInputTex = $rpage->math_input;
|
||||||
}
|
}
|
||||||
parent::initializeFromDatabaseRow( $rpage );
|
parent::initializeFromDatabaseRow( $rpage );
|
||||||
|
|
|
@ -225,7 +225,7 @@ abstract class MathRenderer {
|
||||||
* @return string hash
|
* @return string hash
|
||||||
*/
|
*/
|
||||||
public function getMd5() {
|
public function getMd5() {
|
||||||
if ( ! $this->md5 ) {
|
if ( !$this->md5 ) {
|
||||||
$this->md5 = md5( $this->userInputTex );
|
$this->md5 = md5( $this->userInputTex );
|
||||||
}
|
}
|
||||||
return $this->md5;
|
return $this->md5;
|
||||||
|
@ -306,17 +306,17 @@ abstract class MathRenderer {
|
||||||
protected function initializeFromDatabaseRow( $rpage ) {
|
protected function initializeFromDatabaseRow( $rpage ) {
|
||||||
$this->inputHash = $rpage->math_inputhash; // MUST NOT BE NULL
|
$this->inputHash = $rpage->math_inputhash; // MUST NOT BE NULL
|
||||||
$this->md5 = self::dbHash2md5( $this->inputHash );
|
$this->md5 = self::dbHash2md5( $this->inputHash );
|
||||||
if ( ! empty( $rpage->math_mathml ) ) {
|
if ( !empty( $rpage->math_mathml ) ) {
|
||||||
$this->mathml = utf8_decode( $rpage->math_mathml );
|
$this->mathml = utf8_decode( $rpage->math_mathml );
|
||||||
}
|
}
|
||||||
if ( ! empty( $rpage->math_inputtex ) ) {
|
if ( !empty( $rpage->math_inputtex ) ) {
|
||||||
// in the current database the field is probably not set.
|
// in the current database the field is probably not set.
|
||||||
$this->userInputTex = $rpage->math_inputtex;
|
$this->userInputTex = $rpage->math_inputtex;
|
||||||
}
|
}
|
||||||
if ( ! empty( $rpage->math_tex ) ) {
|
if ( !empty( $rpage->math_tex ) ) {
|
||||||
$this->tex = $rpage->math_tex;
|
$this->tex = $rpage->math_tex;
|
||||||
}
|
}
|
||||||
if ( ! empty( $rpage->math_svg ) ) {
|
if ( !empty( $rpage->math_svg ) ) {
|
||||||
$this->svg = $rpage->math_svg;
|
$this->svg = $rpage->math_svg;
|
||||||
}
|
}
|
||||||
$this->changed = false;
|
$this->changed = false;
|
||||||
|
|
|
@ -48,12 +48,12 @@ class MathRestbaseInterface {
|
||||||
} else {
|
} else {
|
||||||
$skips[] = $i;
|
$skips[] = $i;
|
||||||
}
|
}
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
$results = $serviceClient->runMulti( $requests );
|
$results = $serviceClient->runMulti( $requests );
|
||||||
$lenRbis = count( $rbis );
|
$lenRbis = count( $rbis );
|
||||||
$j = 0;
|
$j = 0;
|
||||||
for ( $i = 0; $i < $lenRbis; $i ++ ) {
|
for ( $i = 0; $i < $lenRbis; $i++ ) {
|
||||||
if ( !in_array( $i, $skips ) ) {
|
if ( !in_array( $i, $skips ) ) {
|
||||||
/** @var MathRestbaseInterface $rbi */
|
/** @var MathRestbaseInterface $rbi */
|
||||||
$rbi = $rbis[$i];
|
$rbi = $rbis[$i];
|
||||||
|
@ -63,7 +63,7 @@ class MathRestbaseInterface {
|
||||||
}
|
}
|
||||||
catch ( Exception $e ) {
|
catch ( Exception $e ) {
|
||||||
}
|
}
|
||||||
$j ++;
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ class MathRestbaseInterface {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $results as $response ) {
|
foreach ( $results as $response ) {
|
||||||
/** @var MathRestbaseInterface $rbi */
|
/** @var MathRestbaseInterface $rbi */
|
||||||
$rbi = $rbis[$i ++];
|
$rbi = $rbis[$i++];
|
||||||
try {
|
try {
|
||||||
$rbi->evaluateRestbaseCheckResponse( $response );
|
$rbi->evaluateRestbaseCheckResponse( $response );
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
|
@ -261,7 +261,7 @@ class MathRestbaseInterface {
|
||||||
// Generates a TeX string that probably has not been generated before
|
// Generates a TeX string that probably has not been generated before
|
||||||
$uniqueTeX = uniqid( 't=', true );
|
$uniqueTeX = uniqid( 't=', true );
|
||||||
$testInterface = new MathRestbaseInterface( $uniqueTeX );
|
$testInterface = new MathRestbaseInterface( $uniqueTeX );
|
||||||
if ( ! $testInterface->checkTeX() ) {
|
if ( !$testInterface->checkTeX() ) {
|
||||||
$this->log()->warning( 'Config check failed, since test expression was considered as invalid.',
|
$this->log()->warning( 'Config check failed, since test expression was considered as invalid.',
|
||||||
[ 'uniqueTeX' => $uniqueTeX ] );
|
[ 'uniqueTeX' => $uniqueTeX ] );
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,7 +24,7 @@ class SpecialMathStatus extends SpecialPage {
|
||||||
*/
|
*/
|
||||||
public function execute( $query ) {
|
public function execute( $query ) {
|
||||||
$this->setHeaders();
|
$this->setHeaders();
|
||||||
if ( ! ( $this->getUser()->isAllowed( 'purge' ) ) ) {
|
if ( !( $this->getUser()->isAllowed( 'purge' ) ) ) {
|
||||||
// The effect of loading this page is comparable to purge a page.
|
// The effect of loading this page is comparable to purge a page.
|
||||||
// If desired a dedicated right e.g. "viewmathstatus" could be used instead.
|
// If desired a dedicated right e.g. "viewmathstatus" could be used instead.
|
||||||
throw new PermissionsError( 'purge' );
|
throw new PermissionsError( 'purge' );
|
||||||
|
@ -153,7 +153,7 @@ class SpecialMathStatus extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assertContains( $expected, $real, $message = '' ) {
|
private function assertContains( $expected, $real, $message = '' ) {
|
||||||
if ( ! $this->assertTrue( strpos( $real, $expected ) !== false, $message ) ) {
|
if ( !$this->assertTrue( strpos( $real, $expected ) !== false, $message ) ) {
|
||||||
$this->printDiff( $expected, $real, 'math-test-contains-diff' );
|
$this->printDiff( $expected, $real, 'math-test-contains-diff' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class DummyTest extends Maintenance {
|
||||||
$rend[] = [ MathRenderer::getRenderer( $input[1], $input[2], 'mathml' ), $input ];
|
$rend[] = [ MathRenderer::getRenderer( $input[1], $input[2], 'mathml' ), $input ];
|
||||||
$output = preg_replace( '#src="(.*?)/(([a-f]|\d)*).png"#', 'src="\2.png"', $output );
|
$output = preg_replace( '#src="(.*?)/(([a-f]|\d)*).png"#', 'src="\2.png"', $output );
|
||||||
$parserTests[] = [ (string)$input[1], $output ];
|
$parserTests[] = [ (string)$input[1], $output ];
|
||||||
$i ++;
|
$i++;
|
||||||
echo '.';
|
echo '.';
|
||||||
}
|
}
|
||||||
echo "Generated $i tests\n";
|
echo "Generated $i tests\n";
|
||||||
|
|
Loading…
Reference in a new issue