mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-11 17:00:10 +00:00
Convert gen-autoload.php to maintenance script to fix error
Same solution I used for Flow. See Ibbc95c2bdd0e7012cf05a6c9196869aed1e99989 Change-Id: Id0a99b61226faee63d5e655a816b687747c7e671
This commit is contained in:
parent
12327e0cb3
commit
2dfb4511e9
|
@ -1,32 +1,45 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../includes/utils/AutoloadGenerator.php';
|
// Keep in sync with same script in Flow.
|
||||||
|
|
||||||
// @codingStandardsIgnoreStart
|
require_once getenv( 'MW_INSTALL_PATH' ) !== false
|
||||||
function main() {
|
? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
|
||||||
// @codingStandardsIgnoreEnd
|
: __DIR__ . '/../../../maintenance/Maintenance.php';
|
||||||
$base = dirname( __DIR__ );
|
|
||||||
$generator = new AutoloadGenerator( $base );
|
/**
|
||||||
$dirs = [
|
* Generates Echo autoload info
|
||||||
'includes',
|
*/
|
||||||
'tests',
|
|
||||||
'maintenance',
|
class GenerateEchoAutoload extends Maintenance {
|
||||||
];
|
public function __construct() {
|
||||||
foreach ( $dirs as $dir ) {
|
$this->mDescription = 'Generates Echo autoload data';
|
||||||
$generator->readDir( $base . '/' . $dir );
|
|
||||||
}
|
|
||||||
foreach ( glob( $base . '/*.php' ) as $file ) {
|
|
||||||
$generator->readFile( $file );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$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 = $generator->getTargetFileInfo();
|
||||||
$target['filename'],
|
|
||||||
$generator->getAutoload( basename( __DIR__ ) . '/' . basename( __FILE__ ) )
|
|
||||||
);
|
|
||||||
|
|
||||||
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