diff --git a/batchAntiSpoof.php b/batchAntiSpoof.php
index <HASH>..<HASH> 100644
--- a/batchAntiSpoof.php
+++ b/batchAntiSpoof.php
@@ -1,8 +1,9 @@
 <?php
 // Go through all usernames and calculate and record spoof thingies
 
-$base = dirname( dirname( dirname( __FILE__ ) ) );
-require $base . '/maintenance/commandLine.inc';
+require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
+	? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
+	: dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
 
 $dbw = wfGetDB( DB_MASTER );
Bug <I> - AntiSpoof: `batchAntiSpoof.php' does not respect `MW_INSTALL_PATH' environment variable.