Debian Codegraph @

extensions/Echo/scripts/gen-autoload.php

raw symbols SCIP
1 <?php
2
3 // Keep in sync with same script in Flow.
4
5 use MediaWiki\Maintenance\Maintenance;
6
7 require_once getenv( 'MW_INSTALL_PATH' ) !== false
8 ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
9 : __DIR__ . '/../../../maintenance/Maintenance.php';
10
11 /**
12 * Generates Echo autoload info
13 */
14
15 class GenerateEchoAutoload extends Maintenance {
16 public function __construct() {
17 parent::__construct();
18 $this->addDescription( 'Generates Echo autoload data' );
19 }
20
21 public function execute() {
22 $base = dirname( __DIR__ );
23 $generator = new AutoloadGenerator( $base );
24 $dirs = [
25 'includes',
26 'tests',
27 'maintenance',
28 ];
29 foreach ( $dirs as $dir ) {
30 $generator->readDir( $base . '/' . $dir );
31 }
32 foreach ( glob( $base . '/*.php' ) as $file ) {
33 $generator->readFile( $file );
34 }
35
36 $target = $generator->getTargetFileInfo();
37
38 file_put_contents(
39 $target['filename'],
40 $generator->getAutoload( basename( __DIR__ ) . '/' . basename( __FILE__ ) )
41 );
42
43 echo "Done.\n\n";
44 }
45 }
46
47 $maintClass = GenerateEchoAutoload::class;
48 require_once RUN_MAINTENANCE_IF_MAIN;