Seb35 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/342620 )
Change subject: Add a logging infrastructure ...................................................................... Add a logging infrastructure Some errors and exceptions were already collected but not logged; now all these errors are logged with syslog with a syslog tag to be defined (by default logging is activated with the tag 'mediawikifarm'). The logging code is splitted in two methods for testing purposes since the second is harly testable. I chose not to use PSR-3 infrastructure to keep code as small as possible and avoid dependencies; and syslog messages can be redirected to a specific destination with appropriate system syslog configuration. Improved some messages with some additionnal informations and added two messages. “Errors” (e.g. unreadable files) are registered in the same internal variable, but possibly a specific internal variable will be created in the future. Change-Id: I30601fba0eb9ba11433f59a58b947a57c59b581b --- M docs/config/MediaWikiFarmDirectories.php M extension.json M src/MediaWikiFarm.php M src/Yaml.php M tests/phpunit/ConstructionTest.php M tests/phpunit/InstallationIndependantTest.php M tests/phpunit/LoadingTest.php A tests/phpunit/LoggingTest.php M tests/phpunit/MediaWikiFarmComposerScriptTest.php M tests/phpunit/MediaWikiFarmScriptTest.php 10 files changed, 237 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiFarm refs/changes/20/342620/1 diff --git a/docs/config/MediaWikiFarmDirectories.php b/docs/config/MediaWikiFarmDirectories.php index 506fd43..77b28a1 100644 --- a/docs/config/MediaWikiFarmDirectories.php +++ b/docs/config/MediaWikiFarmDirectories.php @@ -64,3 +64,14 @@ */ $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +/** + * Syslog tag. + * + * Type: string|false. + * + * If false, no logging will be issued at all. If string, syslog is used and casual log messages + * will be issued in the facility 'USER', with the criticity level 'ERROR', and the tag defined + * by this configuration parameter. + */ +$wgMediaWikiFarmSyslog = 'mediawikifarm'; diff --git a/extension.json b/extension.json index c3c85c8..3304cf7 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "MediaWikiFarm", - "version": "0.3.0", + "version": "0.4.0", "author": [ "[https://www.mediawiki.org/wiki/User:Seb35 Seb35]" ], diff --git a/src/MediaWikiFarm.php b/src/MediaWikiFarm.php index 6b9def9..00cc059 100644 --- a/src/MediaWikiFarm.php +++ b/src/MediaWikiFarm.php @@ -83,8 +83,8 @@ 'composer' => array(), ); - /** @var array Errors */ - protected $errors = array(); + /** @var array Logs. */ + public $log = array(); @@ -223,7 +223,8 @@ */ static function load( $entryPoint = '', $host = null, $state = array(), $environment = array() ) { - global $wgMediaWikiFarm, $wgMediaWikiFarmConfigDir, $wgMediaWikiFarmCodeDir, $wgMediaWikiFarmCacheDir; + global $wgMediaWikiFarm; + global $wgMediaWikiFarmConfigDir, $wgMediaWikiFarmCodeDir, $wgMediaWikiFarmCacheDir, $wgMediaWikiFarmSyslog; try { # Initialise object @@ -239,12 +240,14 @@ # Compile configuration $wgMediaWikiFarm->compileConfiguration(); } - catch( Exception $e ) { + catch( Exception $exception ) { if( !headers_sent() ) { $httpProto = array_key_exists( 'SERVER_PROTOCOL', $_SERVER ) && $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1' ? 'HTTP/1.1' : 'HTTP/1.0'; // @codeCoverageIgnore header( "$httpProto 500 Internal Server Error" ); // @codeCoverageIgnore } + + self::issueLog( self::prepareLog( $wgMediaWikiFarmSyslog, $wgMediaWikiFarm, $exception ) ); return 500; } @@ -261,6 +264,8 @@ include $file404; } } + + self::issueLog( self::prepareLog( $wgMediaWikiFarmSyslog, $wgMediaWikiFarm ) ); return 404; } @@ -280,6 +285,7 @@ # Define we are now inside MediaWiki $wgMediaWikiFarm->state['InnerMediaWiki'] = true; + self::issueLog( self::prepareLog( $wgMediaWikiFarmSyslog, $wgMediaWikiFarm ) ); return 200; } @@ -363,7 +369,7 @@ $this->activateExtensions(); # Save Composer key if available - if( $this->cacheDir && !count( $this->errors ) ) { + if( $this->cacheDir && !array_key_exists( 'unreadable-file', $this->log ) ) { self::cacheFile( $this->configuration['composer'], $this->variables['$SERVER'] . '.php', $this->cacheDir . '/composer' @@ -378,7 +384,7 @@ $this->activateExtensions(); # Create the final LocalSettings.php - if( $this->cacheDir && !count( $this->errors ) ) { + if( $this->cacheDir && !array_key_exists( 'unreadable-file', $this->log ) ) { self::cacheFile( $this->createLocalSettings( $this->configuration ), $this->variables['$SERVER'] . '.php', $this->cacheDir . '/LocalSettings' @@ -450,7 +456,7 @@ $GLOBALS['wgExtensionCredits']['other'][] = array( 'path' => $this->farmDir . '/MediaWikiFarm.php', 'name' => 'MediaWikiFarm', - 'version' => '0.3.0', + 'version' => '0.4.0', 'author' => '[https://www.mediawiki.org/wiki/User:Seb35 Seb35]', 'url' => 'https://www.mediawiki.org/wiki/Extension:MediaWikiFarm', 'descriptionmsg' => 'mediawikifarm-desc', @@ -503,7 +509,68 @@ return $this->cacheDir . '/LocalSettings/' . $this->variables['$SERVER'] . '.php'; } + /** + * Prepare log messages and open syslog channel. + * + * @param string|false $wgMediaWikiFarmSyslog Syslog tag or deactivate logging. + * @param MediaWikiFarm|null $wgMediaWikiFarm MediaWikiFarm object if any, in order to retrieve existing log messages. + * @param Exception|Throwable|null $exception Caught exception if any. + * @return string[] All log messages ready to be sent to syslog. + */ + static function prepareLog( $wgMediaWikiFarmSyslog, $wgMediaWikiFarm, $exception = null ) { + $log = array(); + if( $wgMediaWikiFarmSyslog === false ) { + return $log; + } + + if( ( $wgMediaWikiFarm instanceof MediaWikiFarm && count( $wgMediaWikiFarm->log ) ) || $exception instanceof Exception || $exception instanceof Throwable ) { + + # Init logging + if( !is_string( $wgMediaWikiFarmSyslog ) ) { + $wgMediaWikiFarmSyslog = 'mediawikifarm'; + $log[] = 'Logging parameter must be false or a string'; + } + if( !openlog( $wgMediaWikiFarmSyslog, LOG_CONS, LOG_USER ) ) { + $log[] = 'Unable to initialise logging'; // @codeCoverageIgnore + } + + # Log exception + if( $exception instanceof Exception || $exception instanceof Throwable ) { + $log[] = $exception->getMessage(); + } + + # Add logging issues + if( $wgMediaWikiFarm instanceof MediaWikiFarm ) { + $wgMediaWikiFarm->log = array_merge( $log, $wgMediaWikiFarm->log ); + $log = $wgMediaWikiFarm->log; + } + + } + + return $log; + } + + /** + * Issue log messages to syslog. + * + * @codeCoverageIgnore + * + * @param string[] $log Log messages. + * @return void + */ + static function issueLog( $log ) { + + foreach( $log as $id => $error ) { + if( is_numeric( $id ) ) { + syslog( LOG_ERR, $error ); + } + } + + if( count( $log ) ) { + closelog(); + } + } /* * Internals @@ -628,9 +695,9 @@ throw new MWFConfigurationException( 'No configuration file found' ); } elseif( $result['redirects'] <= 0 ) { - throw new MWFConfigurationException( 'Infinite or too long redirect detected' ); + throw new MWFConfigurationException( 'Infinite or too long redirect detected (host=\'' . $host . '\')' ); } - throw new MWFConfigurationException( 'No farm corresponding to this host' ); + throw new MWFConfigurationException( 'No farm corresponding to this host (host=\'' . $host . '\')' ); } /** @@ -1273,6 +1340,7 @@ } elseif( $key != 'ExtensionMediaWikiFarm' ) { $value = false; unset( $this->configuration['extensions'][$key] ); + $this->log[] = "Requested but missing $type $name for wiki {$this->variables['$WIKIID']} in version {$this->variables['$VERSION']}"; } else { $status = $ExtensionRegistry ? 'wfLoadExtension' : 'require_once'; } @@ -1581,6 +1649,7 @@ $files[] = $dir . 'FunctionsTest.php'; $files[] = $dir . 'InstallationIndependantTest.php'; $files[] = $dir . 'LoadingTest.php'; + $files[] = $dir . 'LoggingTest.php'; $files[] = $dir . 'MediaWikiFarmComposerScriptTest.php'; $files[] = $dir . 'MediaWikiFarmScriptTest.php'; $files[] = $dir . 'MonoversionInstallationTest.php'; @@ -1667,6 +1736,8 @@ $array = wfMediaWikiFarm_readYAML( $prefixedFile ); } catch( RuntimeException $e ) { + $this->log[] = $e->getMessage(); + $this->log['unreadable-file'] = true; $array = false; } } @@ -1707,7 +1778,8 @@ # A null value is an empty file or value 'null' if( ( is_null( $array ) || $array === false ) && $cachedFile && is_file( $cachedFile ) ) { - $this->errors[] = 'Unreadable file ' . $filename; + $this->log[] = 'Unreadable file \'' . $filename . '\''; + $this->log['unreadable-file'] = true; return $this->readFile( $filename . '.php', $this->cacheDir . '/config', false ); } diff --git a/src/Yaml.php b/src/Yaml.php index 4fc4a8f..9ee730c 100644 --- a/src/Yaml.php +++ b/src/Yaml.php @@ -29,7 +29,7 @@ function wfMediaWikiFarm_readYAML( $filename ) { if( !is_file( $filename ) ) { - throw new RuntimeException( 'Missing file' ); + throw new RuntimeException( 'Missing file \'' . $filename . '\'' ); } # Check YAML library was loaded @@ -42,7 +42,7 @@ try { return Symfony\Component\Yaml\Yaml::parse( file_get_contents( $filename ) ); } - catch( Symfony\Component\Yaml\Exception\ParseException $e ) {} - - throw new RuntimeException( 'Badly-formatted YAML file' ); + catch( Symfony\Component\Yaml\Exception\ParseException $e ) { + throw new RuntimeException( 'Badly-formatted YAML file \'' . $filename . '\': ' . $e->getMessage() ); + } } diff --git a/tests/phpunit/ConstructionTest.php b/tests/phpunit/ConstructionTest.php index 23dd029..9f670b3 100644 --- a/tests/phpunit/ConstructionTest.php +++ b/tests/phpunit/ConstructionTest.php @@ -603,6 +603,8 @@ * @uses MediaWikiFarm::sortExtensions * @uses MediaWikiFarm::setEnvironment * @uses MediaWikiFarm::arrayMerge + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testLoadingCorrect() { @@ -610,6 +612,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', self::$wgMediaWikiFarmCodeDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupAndSetGlobalSubvariable( '_SERVER', 'HTTP_HOST', 'a.testfarm-multiversion.example.org' ); chdir( self::$wgMediaWikiFarmCodeDir ); @@ -640,6 +643,8 @@ * @uses MediaWikiFarm::detectComposer * @uses MediaWikiFarm::sortExtensions * @uses MediaWikiFarm::setEnvironment + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testLoadingSoftMissingError() { @@ -647,6 +652,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupAndSetGlobalSubvariable( '_SERVER', 'HTTP_HOST', null ); $this->backupAndSetGlobalSubvariable( '_SERVER', 'SERVER_NAME', 'z.testfarm-monoversion-with-file-variable-without-version.example.org' ); $this->backupAndUnsetGlobalVariable( 'wgMediaWikiFarmHTTP404Executed' ); @@ -668,6 +674,8 @@ * @uses MediaWikiFarm::__construct * @uses MediaWikiFarm::selectFarm * @uses MediaWikiFarm::readFile + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testLoadingHardMissingError() { @@ -675,6 +683,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupAndSetGlobalSubvariable( '_SERVER', 'HTTP_HOST', 'a.testfarm-nonexistant.example.org' ); $code = MediaWikiFarm::load( 'index.php' ); diff --git a/tests/phpunit/InstallationIndependantTest.php b/tests/phpunit/InstallationIndependantTest.php index d3298f5..5733d3e 100644 --- a/tests/phpunit/InstallationIndependantTest.php +++ b/tests/phpunit/InstallationIndependantTest.php @@ -16,6 +16,9 @@ /** @var MediaWikiFarm|null Test object. */ protected $farm = null; + /** @var boolean Assert the object was not modified. */ + protected $shouldBeConstant = true; + /** @var MediaWikiFarm|null Control object, must never be modified by tests, should always be identical to $farm after the tests. */ private $control = null; @@ -42,6 +45,7 @@ if( is_null( $this->farm ) ) { $this->farm = self::constructMediaWikiFarm( 'a.testfarm-monoversion.example.org' ); } + $this->shouldBeConstant = true; $this->control = clone $this->farm; } @@ -204,6 +208,7 @@ $result = $this->farm->readFile( 'badsyntax.yaml', dirname( __FILE__ ) . '/data/config' ); $this->assertFalse( $result ); + $this->shouldBeConstant = false; } /** @@ -512,6 +517,8 @@ */ function assertPostConditions() { - $this->assertEquals( $this->control, $this->farm, 'Methods tested in InstallationIndependantTest are supposed to be constant.' ); + if( $this->shouldBeConstant ) { + $this->assertEquals( $this->control, $this->farm, 'Methods tested in InstallationIndependantTest are supposed to be constant.' ); + } } } diff --git a/tests/phpunit/LoadingTest.php b/tests/phpunit/LoadingTest.php index 8d985ce..e009b5b 100644 --- a/tests/phpunit/LoadingTest.php +++ b/tests/phpunit/LoadingTest.php @@ -71,6 +71,8 @@ * @uses MediaWikiFarm::getConfiguration * @uses MediaWikiFarm::getVariable * @uses MediaWikiFarm::composerKey + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testAllLoadingMechanisms() { @@ -230,6 +232,8 @@ * @uses MediaWikiFarm::arrayMerge * @uses MediaWikiFarm::getConfiguration * @uses MediaWikiFarm::getVariable + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testExceptionsLoadingMechanisms() { diff --git a/tests/phpunit/LoggingTest.php b/tests/phpunit/LoggingTest.php new file mode 100644 index 0000000..49c1c5b --- /dev/null +++ b/tests/phpunit/LoggingTest.php @@ -0,0 +1,94 @@ +<?php + +require_once 'MediaWikiFarmTestCase.php'; +require_once dirname( dirname( dirname( __FILE__ ) ) ) . '/src/MediaWikiFarm.php'; + +/** + * Logging-related tests. + * + * @group MediaWikiFarm + */ +class LoggingTest extends MediaWikiFarmTestCase { + + /** + * Test when logging is deactivated. + * + * @covers MediaWikiFarm::prepareLog + */ + function testNoLogging() { + + # Check no log message is issued + $this->assertEmpty( MediaWikiFarm::prepareLog( false, null, new Exception( 'test exception' ) ) ); + } + + /** + * Test when the configuration parameter has a wrong type. + * + * @covers MediaWikiFarm::prepareLog + */ + function testBadLoggingConfigurationParameter() { + + $this->assertEquals( array( 'Logging parameter must be false or a string', 'test exception' ), + MediaWikiFarm::prepareLog( 0, null, new Exception( 'test exception' ) ) ); + + closelog(); + } + + /** + * Test logging an exception. + * + * @covers MediaWikiFarm::prepareLog + */ + function testLoggingAnException() { + + $this->assertEquals( array( 'test exception' ), MediaWikiFarm::prepareLog( 'mediawikifarmtest', null, new Exception( 'test exception' ) ) ); + + closelog(); + } + + /** + * Test logging a normal message. + * + * @covers MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::__construct + * @uses MediaWikiFarm::selectFarm + * @uses MediaWikiFarm::readFile + */ + function testLoggingAMessage() { + + $farm = new MediaWikiFarm( + 'a.testfarm-multiversion.example.org', + self::$wgMediaWikiFarmConfigDir, + self::$wgMediaWikiFarmCodeDir, + false, + array( 'EntryPoint' => 'index.php' ) ); + $farm->log = array( 'test message' ); + + $this->assertEquals( array( 'test message' ), MediaWikiFarm::prepareLog( 'mediawikifarmtest', $farm ) ); + + closelog(); + } + + /** + * Test logging a normal message and an exception. + * + * @covers MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::__construct + * @uses MediaWikiFarm::selectFarm + * @uses MediaWikiFarm::readFile + */ + function testLoggingAMessageAndAnException() { + + $farm = new MediaWikiFarm( + 'a.testfarm-multiversion.example.org', + self::$wgMediaWikiFarmConfigDir, + self::$wgMediaWikiFarmCodeDir, + false, + array( 'EntryPoint' => 'index.php' ) ); + $farm->log = array( 'test message' ); + + $this->assertEquals( array( 'test exception', 'test message' ), MediaWikiFarm::prepareLog( 'mediawikifarmtest', $farm, new Exception( 'test exception' ) ) ); + + closelog(); + } +} diff --git a/tests/phpunit/MediaWikiFarmComposerScriptTest.php b/tests/phpunit/MediaWikiFarmComposerScriptTest.php index 4c842eb..7325b60 100644 --- a/tests/phpunit/MediaWikiFarmComposerScriptTest.php +++ b/tests/phpunit/MediaWikiFarmComposerScriptTest.php @@ -142,6 +142,8 @@ * @uses MediaWikiFarm::setVariable * @uses MediaWikiFarm::replaceVariables * @uses MediaWikiFarm::readFile + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testMissingHost() { @@ -149,6 +151,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $wgMediaWikiFarmComposerScript = new MediaWikiFarmComposerScript( 2, array( self::$mwcomposerPath, '--wiki=c.testfarm-monoversion-with-file-variable-without-version.example.org' ) @@ -179,6 +182,8 @@ * @uses MediaWikiFarm::setVariable * @uses MediaWikiFarm::replaceVariables * @uses MediaWikiFarm::readFile + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testInternalProblem() { @@ -186,6 +191,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $wgMediaWikiFarmComposerScript = new MediaWikiFarmComposerScript( 2, array( self::$mwcomposerPath, '--wiki=a.testfarm-with-badly-formatted-file-variable.example.org' ) @@ -236,6 +242,8 @@ * @uses MediaWikiFarm::arrayMerge * @uses MediaWikiFarm::composerKey * @uses MediaWikiFarm::isMediaWiki + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testSuccessfulLoading() { @@ -243,6 +251,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', dirname( __FILE__ ) . '/data/mediawiki' ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupGlobalVariable( 'argc' ); $this->backupGlobalVariable( 'argv' ); diff --git a/tests/phpunit/MediaWikiFarmScriptTest.php b/tests/phpunit/MediaWikiFarmScriptTest.php index 8d3cf6e..1088960 100644 --- a/tests/phpunit/MediaWikiFarmScriptTest.php +++ b/tests/phpunit/MediaWikiFarmScriptTest.php @@ -309,6 +309,8 @@ * @uses MediaWikiFarm::setVariable * @uses MediaWikiFarm::replaceVariables * @uses MediaWikiFarm::readFile + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testMissingHost() { @@ -316,6 +318,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $wgMediaWikiFarmScript = new MediaWikiFarmScript( 3, array( self::$mwscriptPath, '--wiki=c.testfarm-monoversion-with-file-variable-without-version.example.org', 'showJobs' ) @@ -347,6 +350,8 @@ * @uses MediaWikiFarm::setVariable * @uses MediaWikiFarm::replaceVariables * @uses MediaWikiFarm::readFile + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testInternalProblem() { @@ -354,6 +359,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $wgMediaWikiFarmScript = new MediaWikiFarmScript( 3, array( self::$mwscriptPath, '--wiki=a.testfarm-with-badly-formatted-file-variable.example.org', 'showJobs' ) @@ -395,6 +401,8 @@ * @uses MediaWikiFarm::replaceVariables * @uses MediaWikiFarm::readFile * @uses MediaWikiFarm::arrayMerge + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testMissingScript() { @@ -402,6 +410,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupAndSetGlobalVariable( 'IP', self::$wgMediaWikiFarmCodeDir . '/vstub' ); chdir( self::$wgMediaWikiFarmCodeDir . '/vstub' ); @@ -447,6 +456,8 @@ * @uses MediaWikiFarm::getVariable * @uses MediaWikiFarm::readFile * @uses MediaWikiFarm::arrayMerge + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testSuccessfulLoading() { @@ -456,6 +467,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupGlobalVariable( 'argc' ); $this->backupGlobalVariable( 'argv' ); $this->backupGlobalSubvariable( '_SERVER', 'argc' ); @@ -516,6 +528,8 @@ * @uses MediaWikiFarm::getVariable * @uses MediaWikiFarm::readFile * @uses MediaWikiFarm::arrayMerge + * @uses MediaWikiFarm::prepareLog + * @uses MediaWikiFarm::issueLog */ function testRestInPeace() { @@ -525,6 +539,7 @@ $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmConfigDir', self::$wgMediaWikiFarmConfigDir ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCodeDir', null ); $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmCacheDir', false ); + $this->backupAndSetGlobalVariable( 'wgMediaWikiFarmSyslog', false ); $this->backupGlobalVariable( 'argc' ); $this->backupGlobalVariable( 'argv' ); $this->backupGlobalSubvariable( '_SERVER', 'argc' ); -- To view, visit https://gerrit.wikimedia.org/r/342620 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I30601fba0eb9ba11433f59a58b947a57c59b581b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MediaWikiFarm Gerrit-Branch: master Gerrit-Owner: Seb35 <se...@seb35.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits