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

Change subject: Convert gen-autoload.php to maintenance script to fix error
......................................................................

Convert gen-autoload.php to maintenance script to fix error

Same solution I used for Flow.

See Ibbc95c2bdd0e7012cf05a6c9196869aed1e99989

Change-Id: Id0a99b61226faee63d5e655a816b687747c7e671
---
M scripts/gen-autoload.php
1 file changed, 36 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/75/359375/1

diff --git a/scripts/gen-autoload.php b/scripts/gen-autoload.php
index 8b3421d..cd472b3 100644
--- a/scripts/gen-autoload.php
+++ b/scripts/gen-autoload.php
@@ -1,32 +1,45 @@
 <?php
 
-require_once __DIR__ . '/../../../includes/utils/AutoloadGenerator.php';
+// Keep in sync with same script in Flow.
 
-// @codingStandardsIgnoreStart
-function main() {
-// @codingStandardsIgnoreEnd
-       $base = dirname( __DIR__ );
-       $generator = new AutoloadGenerator( $base );
-       $dirs = [
-               'includes',
-               'tests',
-               'maintenance',
-       ];
-       foreach ( $dirs as $dir ) {
-               $generator->readDir( $base . '/' . $dir );
-       }
-       foreach ( glob( $base . '/*.php' ) as $file ) {
-               $generator->readFile( $file );
+require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
+       ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
+       : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
+
+/**
+ * Generates Echo autoload info
+ */
+
+class GenerateEchoAutoload extends Maintenance {
+       public function __construct() {
+               $this->mDescription = 'Generates Echo autoload data';
        }
 
-       $target = $generator->getTargetFileInfo();
+       public function execute() {
+               $base = dirname( __DIR__ );
+               $generator = new AutoloadGenerator( $base );
+               $dirs = [
+                       'includes',
+                       'tests',
+                       'maintenance',
+               ];
+               foreach ( $dirs as $dir ) {
+                       $generator->readDir( $base . '/' . $dir );
+               }
+               foreach ( glob( $base . '/*.php' ) as $file ) {
+                       $generator->readFile( $file );
+               }
 
-       file_put_contents(
-               $target['filename'],
-               $generator->getAutoload( basename( __DIR__ ) . '/' . basename( 
__FILE__ ) )
-       );
+               $target = $generator->getTargetFileInfo();
 
-       echo "Done.\n\n";
+               file_put_contents(
+                       $target['filename'],
+                       $generator->getAutoload( basename( __DIR__ ) . '/' . 
basename( __FILE__ ) )
+               );
+
+               echo "Done.\n\n";
+       }
 }
 
-main();
+$maintClass = "GenerateEchoAutoload";
+require_once ( RUN_MAINTENANCE_IF_MAIN );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0a99b61226faee63d5e655a816b687747c7e671
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to