mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 09:26:05 +00:00
Merge "Convert gen-autoload.php to maintenance script to fix error"
This commit is contained in:
commit
90d627bbd6
|
@ -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'
|
||||
: __DIR__ . '/../../../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;
|
||||
|
|
Loading…
Reference in a new issue