Skip to content

Commit

Permalink
Remove the last autoload.php
Browse files Browse the repository at this point in the history
Two maintenance scripts must be autoloadable for DatabaseSchemaUpdater,
and are added to AutoloadClasses; however, we anticipate that they can
be removed soon, once we remove support for the wb_terms table.

Six maintenance scripts need to be loaded in some way in order for their
unit tests to work; however, we want to avoid any other code depending
on those maintenance scripts, so we only load them in the test files
themselves, using require_once.

Bug: T172368
Bug: T255108
Change-Id: I0f52629775144949eb8140619dc1e2f03f6f97cc
  • Loading branch information
tarrow authored and lucaswerkmeister committed Jun 15, 2020
1 parent 093c4de commit aa42baa
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 121 deletions.
4 changes: 0 additions & 4 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
<rule ref="Generic.Files.OneObjectStructurePerFile">
<exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase</exclude-pattern>
</rule>
<rule ref="MediaWiki.Files.ClassMatchesFilename">
<!-- FIXME: These files should be renamed to match their class name. -->
<exclude-pattern>build/generateAutoload\.php</exclude-pattern>
</rule>
<rule ref="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle">
<exclude-pattern>RepoHooks\.php</exclude-pattern>
</rule>
Expand Down
87 changes: 0 additions & 87 deletions build/generateAutoload.php

This file was deleted.

4 changes: 4 additions & 0 deletions extension-repo-wip.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"Wikibase\\Repo\\": "repo/includes/",
"Wikibase\\Repo\\Maintenance\\": "repo/maintenance/"
},
"AutoloadClasses": {
"Wikibase\\Repo\\Maintenance\\PopulateTermFullEntityId": "repo/maintenance/populateTermFullEntityId.php",
"Wikibase\\Repo\\Maintenance\\RebuildTermsSearchKey": "repo/maintenance/rebuildTermsSearchKey.php"
},
"TestAutoloadNamespaces": {
"Wikibase\\Repo\\Tests\\": "repo/tests/phpunit/includes/",
"Wikibase\\Repo\\Tests\\Maintenance\\": "repo/tests/phpunit/maintenance/"
Expand Down
3 changes: 0 additions & 3 deletions repo/Wikibase.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@
require_once __DIR__ . '/../lib/WikibaseLib.php';
require_once __DIR__ . '/../view/WikibaseView.php';

// Load autoload info as long as extension classes are not PSR-4-autoloaded
require_once __DIR__ . '/autoload.php';

call_user_func( function() {
global $wgAPIMetaModules,
$wgAPIListModules,
Expand Down
27 changes: 0 additions & 27 deletions repo/autoload.php

This file was deleted.

3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/DumpJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
use Wikibase\Repo\Store\Sql\SqlEntityIdPagerFactory;
use Wikibase\Repo\WikibaseRepo;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/dumpJson.php';

/**
* @covers \Wikibase\Repo\Maintenance\DumpJson
*
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/DumpRdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
use Wikibase\Repo\WikibaseRepo;
use Wikimedia\TestingAccessWrapper;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/dumpRdf.php';

/**
* @covers \Wikibase\Repo\Maintenance\DumpRdf
*
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/MockAddUnits.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Wikibase\Lib\Units\UnitConverter;
use Wikibase\Repo\Maintenance\AddUnitConversions;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/addUnitConversions.php';

/**
* @license GPL-2.0-or-later
* @author Stas Malyshev
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/PruneItemsPerSiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Wikibase\Repo\Maintenance\PruneItemsPerSite;
use Wikibase\Repo\WikibaseRepo;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/pruneItemsPerSite.php';

/**
* @covers \Wikibase\Repo\Maintenance\PruneItemsPerSite
*
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/RemoveTermsInLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Wikibase\Repo\Maintenance\RemoveTermsInLanguage;
use Wikibase\Repo\WikibaseRepo;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/removeTermsInLanguage.php';

/**
* @covers \Wikibase\Repo\Maintenance\RemoveTermsInLanguage
*
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/phpunit/maintenance/UpdateUnitsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use MediaWikiLangTestCase;
use Wikibase\Repo\Maintenance\UpdateUnits;

// files in maintenance/ are not autoloaded to avoid accidental usage, so load explicitly
require_once __DIR__ . '/../../../maintenance/updateUnits.php';

/**
* @covers \Wikibase\Repo\Maintenance\UpdateUnits
*
Expand Down

0 comments on commit aa42baa

Please sign in to comment.