Page MenuHomePhabricator

Build: Handle extensions autoloading entry point from composer.json
Closed, ResolvedPublic

Description

Some extensions, like GraphViz[1], have a "autoload" key with "files" in composer.json.
The file there is the entry point for the extension, which is automatically loaded on each request.

The entry point checks for defined( 'MEDIAWIKI' ) and die when it is not set.

It is not set when running parallel-lint or phpcs over "composer test".

Needs some ideas to find more of this extensions and find a way to handle this. phpcs should run on all repository where it is set in composer.json

[1] https://gerrit.wikimedia.org/r/#/c/360188/

Event Timeline

Change 368252 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/WikimediaBadges@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368252

Change 368245 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/GraphViz@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368245

Change 368239 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/AdminLinks@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368239

Change 368253 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/ImageMap@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368253

Change 368252 merged by jenkins-bot:
[mediawiki/extensions/WikimediaBadges@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368252

Change 368253 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368253

Change 368239 merged by jenkins-bot:
[mediawiki/extensions/AdminLinks@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368239

Change 368245 merged by jenkins-bot:
[mediawiki/extensions/GraphViz@master] Do not die on phpcs run

https://gerrit.wikimedia.org/r/368245

Umherirrender claimed this task.

Hopefully found all extensions with this issue yet

Note that now "ImageMap" has to be invoked with wfLoadExtension( 'ImageMap' ); so no autoloading. Interestingly "GraphViz" is still automatically loading though it may be that this is done as a dependency for "Semantic Result Formats".

Interestingly "GraphViz" is still automatically loading though it may be that this is done as a dependency for "Semantic Result Formats".

Ah I know the reason: GraphViz is an extension following a release process using tags. Since no release was made for this yet it did not get the changed code.

Interestingly "GraphViz" is still automatically loading though it may be that this is done as a dependency for "Semantic Result Formats".

Ah I know the reason: GraphViz is an extension following a release process using tags. Since no release was made for this yet it did not get the changed code.

Hmm, after having looked at the code more intensely I believe that "GraphViz" will continue to load automatically. It is organized differently in comparison to "ImageMap".

Interestingly "GraphViz" is still automatically loading though it may be that this is done as a dependency for "Semantic Result Formats".

Ah I know the reason: GraphViz is an extension following a release process using tags. Since no release was made for this yet it did not get the changed code.

Hmm, after having looked at the code more intensely I believe that "GraphViz" will continue to load automatically. It is organized differently in comparison to "ImageMap".

Yes, that is true, the fix on https://gerrit.wikimedia.org/r/#/c/368245/2/GraphViz.php only avoid the "die" in the entry point. It is still autoloaded from composer.json. This avoids a breaking change, but allows to run the test jobs. The fix does not fix a bug in the software or add a new feature and therefor does not need a new release.

The autoloading could break when the extension is converted to use extension.json, but that is out of scope here.

The autoloading could break when the extension is converted to use extension.json, but that is out of scope here.

Thanks for the further insight. Yeah, this will break. However future versioning will at least indicate this.