Skip to content

Updated namespace references #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

theMadness
Copy link

No description provided.

@theMadness
Copy link
Author

Alright, I'm starting to understand why this is failing, but then again, this CI should be testing other versions of MW too, namely, the ones wikimedia actually recommends using.

@theMadness
Copy link
Author

theMadness commented Jul 20, 2025

Going to try and verify that this works (and it should) in 1.44, then will try to figure out how to implement a polyfill class like this (rough idea, will refine once infrastructure is in place)

<?php
if ( !defined( 'MEDIAWIKI' ) ) {
    die( 'This is not a valid entry point.' );
}

if ( version_compare( MW_VERSION, '1.40.0-alpha', '<' ) ) {
    $classAliases = [
        [ 'ApiBase', 'MediaWiki\\Api\\ApiBase' ],
        [ 'ApiUsageException', 'MediaWiki\\Api\\ApiUsageException' ],
        [ 'ApiTestCase', 'MediaWiki\\Tests\\Api\\ApiTestCase' ],
        [ 'Config', 'MediaWiki\\Config\\Config' ],
        [ 'ConfigException', 'MediaWiki\\Config\\ConfigException' ],
        [ 'ConfigFactory', 'MediaWiki\\Config\\ConfigFactory' ],
        [ 'Html', 'MediaWiki\\Html\\Html' ],
        [ 'File', 'MediaWiki\\FileRepo\\File\\File' ],
        [ 'LocalFile', 'MediaWiki\\FileRepo\\File\\LocalFile' ],
        [ 'UnregisteredLocalFile', 'MediaWiki\\FileRepo\\File\\UnregisteredLocalFile' ],
        [ 'RepoGroup', 'MediaWiki\\FileRepo\\RepoGroup' ],
        [ 'Message', 'MediaWiki\\Message\\Message' ],
        [ 'Parser', 'MediaWiki\\Parser\\Parser' ],
        [ 'ParserOptions', 'MediaWiki\\Parser\\ParserOptions' ],
        [ 'PPFrame', 'MediaWiki\\Parser\\PPFrame' ],
        [ 'PPCustomFrame_Hash', 'MediaWiki\\Parser\\PPCustomFrame_Hash' ],
        [ 'PPFrame_Hash', 'MediaWiki\\Parser\\PPFrame_Hash' ],
        [ 'RequestContext', 'MediaWiki\\Context\\RequestContext' ],
        [ 'MWException', 'MediaWiki\\Exception\\MWException' ],
        [ 'WANObjectCache', 'MediaWiki\\ObjectCache\\WANObjectCache' ],
        [ 'OutputPage', 'MediaWiki\\Output\\OutputPage' ],
        [ 'WikiPage', 'MediaWiki\\Page\\WikiPage' ],
        [ 'Skin', 'MediaWiki\\Skin\\Skin' ],
        [ 'FSFile', 'Wikimedia\\FileBackend\\FSFile\\FSFile' ],
        [ 'HashBagOStuff', 'Wikimedia\\ObjectCache\\HashBagOStuff' ],
    ];

    foreach ( $classAliases as $classAlias ) {
        if ( !class_exists( $classAlias[0] ) && class_exists( $classAlias[1] ) ) {
            class_alias( $classAlias[0], $classAlias[1] );
        }
    }
}

@octfx
Copy link
Member

octfx commented Jul 20, 2025

Alright, I'm starting to understand why this is failing, but then again, this CI should be testing other versions of MW too, namely, the ones wikimedia actually recommends using.

Thailand for the PR!
You are definitely right, I’ll update the CI soon

@theMadness
Copy link
Author

Alright, I'm starting to understand why this is failing, but then again, this CI should be testing other versions of MW too, namely, the ones wikimedia actually recommends using.

Thailand for the PR! You are definitely right, I’ll update the CI soon

I've tried a few other things on my fork, but I am still getting errors, I'm unclear on why they are occurring, and honestly, the nature of this test suite, is there anything you would recommend for me to try?

@theMadness
Copy link
Author

theMadness commented Jul 21, 2025

Okay, running tests just for new version support, exposes errors, which is likely why 1.42 was commented out

https://github.com/theMadness/mediawiki-extensions-EmbedVideo/actions/runs/16410851642/job/46365293794

P.S.: Some things I am noticing is that there's a difference in the phpunit version being used, 1.42 uses 9.6 for the first time, trying to understand which ci step procures phpunit.

P.P.S.: It's apparently dictated by the MW distribution composer.json, and something in this CI setup is such that the command this project uses to run the tests, doesn't work.

P.P.P.S.: This is likely related to this change to the phpunit behavior in MW wikimedia/mediawiki@a69c57b

@theMadness
Copy link
Author

Alright, after many tests, I think the issue is that when the phpunit test configuration changed, it went from explicitly bootstrapping through tests/phpunit/phpunit.php, to implicitly bootstrapping through phpunit.xml.dist in the root directory. However, that file is not available in the https://github.com/wikimedia/mediawiki/archive/$MW_BRANCH.tar.gz archives.

Which means either pulling from the git to get the actual full project, or some other type of approach.

@theMadness
Copy link
Author

I made huge progress, and apparently the breakage only occurs in version 1.44, the changes I have are pretty solid and in keeping with the ways in which the star citizen skin is tested.

I just need to re-add the namespace changes, and the compatibility layer.

https://github.com/theMadness/mediawiki-extensions-EmbedVideo/actions/runs/16423948160/job/46409405529

@theMadness
Copy link
Author

https://github.com/theMadness/mediawiki-extensions-EmbedVideo/actions/runs/16424438165/job/46411059574 okay, finally working on 1.44 and master, but broken everywhere else, I just need to figure out where to bootstrap a bunch of class_alias rules.

@theMadness
Copy link
Author

I'm running out of ideas for how to implement a compatibility layer, at this point I'd recommend adopting a different branching strategy, with a REL1_44 branch that doesn't need to concern itself with backwards compatibility, and a 1.39 branch that supports the legacy versions. I can set up the necessary PRs.

@octfx
Copy link
Member

octfx commented Jul 21, 2025

Thanks for all this work!

I also think that different branches make the most sense here, I’ll happily accept your PR.

updating the ci is also on my shortlist

@theMadness
Copy link
Author

So, closing this PR for now, will work on opening 2 (possibly 3) separate PRs, as described in #131

@theMadness theMadness closed this Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants