Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
GenerateAutoload
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 canExecuteWithoutLocalSettings
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDbType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3use MediaWiki\Maintenance\Maintenance;
4
5// @codeCoverageIgnoreStart
6require_once __DIR__ . '/Maintenance.php';
7// This maintenance script is run after renaming class files,
8// and is ideally standalone, invoking only a handful of classes.
9// Otherwise, it will crash and defeat its purpose for being when
10// it calls a class impacted by the renamed file.
11// The below skips SessionManager::singleton() in Setup.php, which
12// indirectly loads thousands of classes across the codebase.
13define( 'MW_NO_SESSION_HANDLER', 1 );
14// If something still tries to call it, fail hard.
15define( 'MW_NO_SESSION', 1 );
16// @codeCoverageIgnoreEnd
17
18/**
19 * @since 1.25
20 * @ingroup Autoload
21 * @ingroup Maintenance
22 */
23class GenerateAutoload extends Maintenance {
24
25    public function canExecuteWithoutLocalSettings(): bool {
26        return true;
27    }
28
29    /** @inheritDoc */
30    public function getDbType() {
31        return self::DB_NONE;
32    }
33
34    public function execute() {
35        $generator = new AutoloadGenerator( MW_INSTALL_PATH, 'local' );
36        $generator->initMediaWikiDefault();
37
38        // Write out the autoload
39        $fileinfo = $generator->getTargetFileinfo();
40        file_put_contents(
41            $fileinfo['filename'],
42            $generator->getAutoload( 'maintenance/generateLocalAutoload.php' )
43        );
44    }
45}
46
47// @codeCoverageIgnoreStart
48$maintClass = GenerateAutoload::class;
49require_once RUN_MAINTENANCE_IF_MAIN;
50// @codeCoverageIgnoreEnd