Set MW_INSTALL_PATH in Maintenance.php
Otherwise, if running update.php, there are require_once failures from extensions (at least Echo and Flow) if they aren't inside extensions/ -- e.g., if they're just symlinked from there. Change-Id: Iaf4231abae1621627f01171f955b5bb7a0fa77d8
This commit is contained in:
parent
5dfedaeaa4
commit
b46a32c85f
1 changed files with 8 additions and 4 deletions
|
|
@ -42,6 +42,13 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
|
|||
|
||||
$maintClass = false;
|
||||
|
||||
// Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
|
||||
// if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
|
||||
// been run.
|
||||
if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) {
|
||||
putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/..' ) );
|
||||
}
|
||||
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
|
@ -171,11 +178,8 @@ abstract class Maintenance {
|
|||
* their own constructors
|
||||
*/
|
||||
public function __construct() {
|
||||
// Setup $IP, using MW_INSTALL_PATH if it exists
|
||||
global $IP;
|
||||
$IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== ''
|
||||
? getenv( 'MW_INSTALL_PATH' )
|
||||
: realpath( __DIR__ . '/..' );
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
|
||||
$this->addDefaultParams();
|
||||
register_shutdown_function( [ $this, 'outputChanneled' ], false );
|
||||
|
|
|
|||
Loading…
Reference in a new issue