Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377367 )

Change subject: Fix finding autoloader in minus-x.php
......................................................................

Fix finding autoloader in minus-x.php

When installed as a package, the autoloader is in a different location
relative to minus-x.php.

Change-Id: I294e39274f7aeaf59f73525f871978a3968533ee
---
M bin/minus-x.php
1 file changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/minus-x 
refs/changes/67/377367/1

diff --git a/bin/minus-x.php b/bin/minus-x.php
index 946464e..b5a6fe3 100755
--- a/bin/minus-x.php
+++ b/bin/minus-x.php
@@ -20,7 +20,25 @@
  * @file
  */
 
-require_once __DIR__ . '/../vendor/autoload.php';
+// This file can be located in ./bin/minus-x.php
+// or ./vendor/mediawiki/minus-x/bin/minus-x.php
+$autoload = [
+       __DIR__ . '/../../../../vendor/autoload.php',
+       __DIR__ . '/../vendor/autoload.php',
+];
+$found = false;
+foreach ( $autoload as $file ) {
+       if ( file_exists( $file ) ) {
+               require_once $file;
+               $found = true;
+               break;
+       }
+}
+
+if ( !$found ) {
+       echo "Error, unable to find composer autoloader.\n";
+       die( 1 );
+}
 
 use MediaWiki\MinusX\CheckCommand;
 use MediaWiki\MinusX\FixCommand;

-- 
To view, visit https://gerrit.wikimedia.org/r/377367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I294e39274f7aeaf59f73525f871978a3968533ee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/minus-x
Gerrit-Branch: master
Gerrit-Owner: Legoktm <lego...@member.fsf.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to