Merge "MultiUsernameFilter: Don't try to split ids if they're not a string"
[mediawiki.git] / maintenance / findClasses.php
blob0dcff5c971d3b3ebd76c12c5d7a31e143b337ba7
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
19 * @ingroup Maintenance
22 use MediaWiki\Maintenance\Maintenance;
24 // @codeCoverageIgnoreStart
25 require_once __DIR__ . '/Maintenance.php';
26 // @codeCoverageIgnoreEnd
28 /**
29 * Maintenance script for finding the files that contain classes
31 * @ingroup Maintenance
32 * @since 1.37
34 class FindClasses extends Maintenance {
36 public function __construct() {
37 parent::__construct();
38 $this->addDescription( 'Finds the files containing classes via the autoloader.' );
41 public function execute() {
42 $stdin = $this->getStdin();
44 while ( !feof( $stdin ) ) {
45 $line = fgets( $stdin );
46 if ( $line === false ) {
47 break;
49 $class = trim( $line );
50 $filename = AutoLoader::find( $class );
51 if ( $filename ) {
52 $this->output( "$filename\n" );
53 } elseif ( $class ) {
54 $this->output( "#$class\n" );
60 // @codeCoverageIgnoreStart
61 $maintClass = FindClasses::class;
62 require_once RUN_MAINTENANCE_IF_MAIN;
63 // @codeCoverageIgnoreEnd