Jump to content

Topic on Extension talk:UserFunctions

Summary by GregRundlett

The failure was related to a poorly structured composer.json which automatically loaded the 'php entry point' file all the time - even when running scripts like PHPCS which wouldn't have a defined "MediaWiki". Fixed in the most current branch (and possibly in the REL1_35 branch). There is no PHP entry point file anymore, and the class code is in a new file.

Note: the correct way to remove a dependency in Composer is to delete the requirement in composer(.local).json and then regenerate the autoload files with composer dumpautoload

The correct way to autoload files in general is to structure your code for PSR4 autoloading and only specify your classes for autoloading (do not autoload settings non-class code).

GregRundlett (talkcontribs)

From the $IP of my mediawiki installation, running composer test fails with a message originating from UserFunctions:

This file is a MediaWiki extension, it is not a valid entry point

Is there a way to exclude the offending file (./extensions/UserFunctions/UserFunctions.php); or is there a technique that would make this file compatible with composer test?

Note: This is using the REL_1_35 branch with

Product Version
MediaWiki 1.35.4 (87ad58f)

14:19, 22 October 2021

PHP 7.4.24 (apache2handler)
MariaDB 10.4.21-MariaDB-log
ICU 67.1
Elasticsearch 6.7.2

If I checkout 'master' of UserFunctions, I get "This version of the UserFunctions extension requires MediaWiki 1.35+" from the same file.

Cavila (talkcontribs)

Your issue appears to have been fixed with this commit, although I'm not sure if the necessary commits are included in the REL_1_35 branch.

It's a highly annoying issue though, which I ran into myself and made it impossible for me to continue using Composer until I dug into the /vendor/composer folder and manually deleted a couple of lines from various autoload files - not usually the way to go, but Composer got stuck.

GregRundlett (talkcontribs)

Interesting, I think I took the same approach as you - manually inspecting/editing the autoload of Composer. It looks like the UserFunctions extension has gotten some recent love ❤️


Nice!