getType(); if ( $patchDir === null ) { $patchDir = $GLOBALS['IP'] . '/maintenance'; } $paths = [ // For a small number of patch files, closely associated with code, // e.g. for unit tests: "$patchDir/$name.$dbType.sql", // For a large number of patch files, e.g. for schema updates of extensions: "$patchDir/$dbType/$name.sql", // For MediaWiki core schema update patches: "$patchDir/$dbType/archives/$name.sql", // Database-agnostic fallback: "$patchDir/$name.sql", // Database-agnostic fallback for MediaWiki core schema update patches: "$patchDir/archives/$name.sql" ]; foreach ( $paths as $p ) { if ( file_exists( $p ) ) { return $p; } } throw new RuntimeException( "No SQL script matching $name could be found in $patchDir" ); } }