mediawiki-extensions-Echo/scripts/gen-autoload.php
Roan Kattouw 34d9ecf876 Follow-up 2dfb4511e9: call parent constructor in gen-autoload.php
And also actually run the script.

Change-Id: I60cd1b745bf3b399b6709c2a3036fff590401e35
2017-06-26 11:03:04 -07:00

47 lines
1 KiB
PHP

<?php
// Keep in sync with same script in Flow.
require_once getenv( 'MW_INSTALL_PATH' ) !== false
? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
: __DIR__ . '/../../../maintenance/Maintenance.php';
/**
* Generates Echo autoload info
*/
class GenerateEchoAutoload extends Maintenance {
public function __construct() {
parent::__construct();
$this->mDescription = 'Generates Echo autoload data';
}
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 );
}
$target = $generator->getTargetFileInfo();
file_put_contents(
$target['filename'],
$generator->getAutoload( basename( __DIR__ ) . '/' . basename( __FILE__ ) )
);
echo "Done.\n\n";
}
}
$maintClass = "GenerateEchoAutoload";
require_once RUN_MAINTENANCE_IF_MAIN;