Lucas_Werkmeister_WMDE added a comment.
Remaining uses of the constants: - To check whether Repo or Client are enabled, in `WikibaseSettings`. Can be removed once I15020f34b2 <https://gerrit.wikimedia.org/r/607785> has rolled out with the train and we haven’t seen any “used during early initialization” warnings in logstash. (When doing that, also change the comments in `WikibaseClient.default.php` and `ClientDefaultsTest.php`, for the `thisWikiIsTheRepo` setting, to mention `ExtensionRegistry` rather than `WB_VERSION`.) - To check whether the main PHP entry point was loaded correctly, in `Wikibase.example.php` and `WikibaseClient.example.php` – they `die()` with a message to load the PHP entry point first if the constant isn’t defined. I think this can be replaced with a more general check for the `MEDIAWIKI` constant (the standard “not an entry point” error pattern in PHP entry points, back before `extension.json` was a thing): I don’t think it’s necessary to check the Wikibase-specific constants. (Historical note: the first check of a Wikibase-specific constant, rather than the general `MEDIAWIKI` constant, was added in Iee722e1425 <https://gerrit.wikimedia.org/r/36183>, November 2012. Prior to that change, `Wikibase.experimental.php` had been an alternative entry point that could be used instead of `Wikibase.php`; with that change, `Wikibase.php` was the only entry point, and experimental features were enabled with `define( 'WB_EXPERIMENTAL_FEATURES', true )` instead. (The whole concept of experimental features was then later dropped in favor of more specific feature flags, in I5fd3c44cc4 <https://gerrit.wikimedia.org/r/250035>, October 2015.) So at that point, it actually made sense to check the Wikibase-specific constant and tell users to use the correct PHP entry point instead, because previously they had been told to use `Wikibase.experimental.php` as the entry point and now they needed to update their `LocalSettings.php`. Shortly afterwards, in I8313756e94 <https://gerrit.wikimedia.org/r/48024>, February 2013, more PHP entry points were added, and they also checked Wikibase-specific constants – here, I assume, this was more or less copy+pasted from the `Wikibase.experimental.php` check, but I don’t think it was really necessary, since the files in question were completely new, and there was no reason to expect anybody to load them directly without first loading the correct entry points. And now, over seven years later, I think the risk of anybody directly loading the wrong entry point, and therefore needing the detailed error message “you should load this other entry point instead”, is nil.) - To check whether an example repository should be configured, in `WikibaseClient.example.php`. If the current wiki is also a repo, then WikibaseClient uses it by default and needs to special configuration, but if the current wiki is not a repo, then those example settings will configure an example repo (database `repo`, URL http://repo.example.org, etc.). At some point during the extension registration work, we’ll have to think about the whole settings business anyways; but for now, just to resolve this task and get rid of the `WB[CL]?_VERSION` constants, I propose to introduce a new constant just for this one use case, which will not be used anywhere else, especially not in other extensions – something like `WB_NO_CONFIGURE_EXAMPLE_REPO`, defined in the Repo PHP entry point and checked in `WikibaseClient.example.php`. TASK DETAIL https://phabricator.wikimedia.org/T256238 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Lucas_Werkmeister_WMDE Cc: Aklapper, Lucas_Werkmeister_WMDE, darthmon_wmde, DannyS712, Nandana, Lahi, Gq86, Pablo-WMDE, GoranSMilovanovic, Jayprakash12345, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Izno, Wikidata-bugs, aude, Dinoguy1000, Lydia_Pintscher, Mbch331, Jay8g
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs