X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2Fupdate.php;h=f8f5dcdd0b5b491986ada83e091bcce37df5bc13;hp=5e2947b2dbb5ea27db848f6bd0139f64ff271b5d;hb=417a83a1a3ddf374dff5a14d8a08cd4c6099d357;hpb=0392d9bb57d5663bcbb58ee03fcb01de9df53180 diff --git a/maintenance/update.php b/maintenance/update.php index 5e2947b2db..f8f5dcdd0b 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -145,6 +145,16 @@ class UpdateMediaWiki extends Maintenance { # This will vomit up an error if there are permissions problems $db = $this->getDB( DB_MASTER ); + # Check to see whether the database server meets the minimum requirements + /** @var DatabaseInstaller $dbInstallerClass */ + $dbInstallerClass = Installer::getDBInstallerClass( $db->getType() ); + $status = $dbInstallerClass::meetsMinimumRequirement( $db->getServerVersion() ); + if ( !$status->isOK() ) { + // This might output some wikitext like but it should be comprehensible + $text = $status->getWikiText(); + $this->error( $text, 1 ); + } + $this->output( "Going to run database updates for " . wfWikiID() . "\n" ); if ( $db->getType() === 'sqlite' ) { /** @var IMaintainableDatabase|DatabaseSqlite $db */ @@ -160,6 +170,26 @@ class UpdateMediaWiki extends Maintenance { $time1 = microtime( true ); + $badPhpUnit = dirname( __DIR__ ) . '/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php'; + if ( file_exists( $badPhpUnit ) ) { + // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong + // Bad versions of the file are: + // https://raw.githubusercontent.com/sebastianbergmann/phpunit/c820f915bfae34e5a836f94967a2a5ea5ef34f21/src/Util/PHP/eval-stdin.php + // https://raw.githubusercontent.com/sebastianbergmann/phpunit/3aaddb1c5bd9b9b8d070b4cf120e71c36fd08412/src/Util/PHP/eval-stdin.php + // @codingStandardsIgnoreEnd + $md5 = md5_file( $badPhpUnit ); + if ( $md5 === '120ac49800671dc383b6f3709c25c099' + || $md5 === '28af792cb38fc9a1b236b91c1aad2876' + ) { + $success = unlink( $badPhpUnit ); + if ( $success ) { + $this->output( "Removed PHPUnit eval-stdin.php to protect against CVE-2017-9841\n" ); + } else { + $this->error( "Unable to remove $badPhpUnit, you should manually. See CVE-2017-9841" ); + } + } + } + $shared = $this->hasOption( 'doshared' ); $updates = [ 'core', 'extensions' ];