ProfessionalWiki / chameleon

Provides a highly flexible and customizable skin using Bootstrap 4
https://www.mediawiki.org/wiki/Skin:Chameleon
Other
114 stars 62 forks source link

Add support for installing skin without composer #120

Closed JeroenDeDauw closed 4 years ago

JeroenDeDauw commented 4 years ago

Continuation of https://github.com/ProfessionalWiki/chameleon/pull/71

JeroenDeDauw commented 4 years ago

Otherwise "it is not as easy as that" because Chameleon relies on other extensions that need to be installed in the proper directory. No idea what happens if you just run composer locally.

Yeah OK, that indeed complicates things, especially if those extensions define web resources.

oetterer commented 4 years ago

Tried this "installing w/o composer" for BootstrapComponents. Back then, when it only relied on one other extension (Bootstrap) it was feasible. Now, that Bootstrap itself has multiple dependencies, BSC could still be installed w/o composer, but its dependency (Bootstrap) cannot.

Most important thing to allow for installation w/o composer is to migrate the class autoloading from composer.json to extension.json. This would have to be done in all extensions, chameleon requires to function and loads automatically (Bootstrap, SCSS), though.

reedy commented 4 years ago

I should note, composer can still be used for dependancies.. Just not be the only way installing the skin itself

So installing mediawiki/bootstrap and anything that depends on (recursively) using composer is fine

rcsilva83 commented 4 years ago

I'm not used to PHP (I'm a Java developer), but would it be possible to create a tar.gz with the dependencies bundled? In Java (using Maven) this is quite simple to do.

oetterer commented 4 years ago

I think not. For one, composer puts all the extension-type dependencies in MW's extension folder and the rest in MW's vendor folder. Also, composer creates a classmapping file for class autoloading.

I think the easiest solution, when you don't have access to composer on your wiki machine, is to install composer someplace else (like your PC at home), prepare the MW software (install core, add config, install all the extensions and skins) and then copy the result over to your wiki server.

reedy commented 4 years ago

I note, again, the problem is not installing the skins dependencies using composer, it's installing the skin itself

In theory, you could probably make a phar of the skin and extensions, but that doesn't solve the problem either

oetterer commented 4 years ago

@reedy then here is how I just installed chameleon w/o composer (except for dependencies):

  1. add "mediawiki/bootstrap": "~4.0" to your composer.local.json, run composer update -nodev
  2. venture in your skins directory
  3. get chameleon, e.g. via git: git clone https://github.com/ProfessionalWiki/chameleon.git
  4. venture in your chameleon directory
  5. edit skins.json, add the following (I inserted it before _"configprefix": "eg",; just adhere to json standard when you do):
    "AutoloadNamespaces": {
        "Skins\\Chameleon\\": "src"
    },
  6. enable chameleon in your LocalSettings.php:
    wfLoadSkin( 'chameleon' );
    $wgDefaultSkin = 'chameleon';
reedy commented 4 years ago

You shouldn't have to edit skin.json to make this work. That's part of the point for this request. While this is related to a skin, https://www.mediawiki.org/wiki/Do_not_hack_MediaWiki_core is very much still in play

Also, in this case, we don't use composer.local.json in Wikimedia production, so that doesn't help either. But the issues with mediawiki/bootstrap and the existence of mediawiki/mediawiki: >=1.27.0 are technically out of scope of this request

See https://phabricator.wikimedia.org/T246949#6041968 for the related issue

oetterer commented 4 years ago

@reedy seems, I missed the notion where this request wasn't about a specific wiki but a general request. @JeroenDeDauw, @kghbln, @s7eph4n: as I said above, if you want to support this request, we should try moving the autoloader from composer.json into skins.json. If not, say so. In my jury rigged case I described above, the unit tests all passed.

reedy commented 4 years ago

As per https://www.mediawiki.org/wiki/Composer/For_extensions this was never actually a supported way of installing skins/extensions