wiki.techinc.nl/maintenance/generateLocalAutoload.php
Brad Jorsch ca3789a271 AutoloadGenerator: Filter PSR4-compliant classes instead of ignoring directories
Per discussion in T166010, we're going to handle class aliases (e.g. for
BC) by including the class_alias() call in the same file as the target
class. When the target class is a PSR4-compliant class, we still need to
pick up that alias for inclusion in autoload.php.

Thus, instead of excluding whole directories, we need to process the
files and filter out only those found classes that are PSR4 compliant.

Bug: T204983
Change-Id: I1c516998df368531c90ea54acc5be8be96e1db6c
2018-09-20 15:15:27 -04:00

22 lines
658 B
PHP

<?php
if ( PHP_SAPI != 'cli' && PHP_SAPI != 'phpdbg' ) {
die( "This script can only be run from the command line.\n" );
}
require_once __DIR__ . '/../includes/AutoLoader.php';
require_once __DIR__ . '/../includes/utils/AutoloadGenerator.php';
// Mediawiki installation directory
$base = dirname( __DIR__ );
$generator = new AutoloadGenerator( $base, 'local' );
$generator->setPsr4Namespaces( AutoLoader::getAutoloadNamespaces() );
$generator->initMediaWikiDefault();
// Write out the autoload
$fileinfo = $generator->getTargetFileinfo();
file_put_contents(
$fileinfo['filename'],
$generator->getAutoload( 'maintenance/generateLocalAutoload.php' )
);