Skip to content
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

mediawiki-skin should install in CamelCase name directory #523

Open
hurohukidaikon opened this issue Jul 28, 2023 · 0 comments
Open

mediawiki-skin should install in CamelCase name directory #523

hurohukidaikon opened this issue Jul 28, 2023 · 0 comments

Comments

@hurohukidaikon
Copy link

Hi, I'm using Composer for my wiki project.
Now, I just started developing my MediaWiki skin and want to load it as package from my Github repo.
I'm trying but it doesn't work fine.

This is my composer.local.json. (In normally, MediaWiki uses this json for dependency.)

{
  "repositories": [
		{
			"type": "package",
			"package": {
				"name": "extensions/upload-wizard",
				"type": "mediawiki-extension",
				"version": "1.40.0",
				"source": {
					"type": "git",
					"url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/UploadWizard.git",
					"reference": "REL1_40"
				}
			}
		},
    {
			"type": "package",
			"package": {
				"name": "skins/example",
        "type": "mediawiki-skin",
				"version": "1.0.0",
				"source": {
					"type": "git",
					"url": "https://github.com/hurohukidaikon/mediawiki-skins-Kagaga.git",
					"reference": "REL1_40"
				}
			}
		}
	],
  "require": {
    "mediawiki/simple-batch-upload": "^2.0",
    "extensions/upload-wizard": "^1.40.0",
    "skins/example": "*"
  },
  "extra": {
    "merge-plugin": {
      "include": [
        "extensions/*/composer.json",
        "skins/*/composer.json"
      ]
    }
  }
}

On my environment, the result is bellow.

    1. When I set package type "mediawiki-skin", the skin was installed on "/skins/example".
    1. When I set package type "mediawiki-extension", the skin was installed on "/extensions/Example".
    1. When I set package type "mediawiki-skin" and package name "Example", installation stopped by error. "A repository of type "package" contains an invalid package definition: Invalid package information: name : skins/Example is invalid, it should not contain uppercase characters. We suggest using skins/example instead."
    1. Do result 1, then rename from "/skins/example" to "/skins/Example". It works fine!

Therefore, I learn the skin directory's name needs CamelCase and it sould place in skins directory.
https://www.mediawiki.org/wiki/Manual:How_to_make_a_MediaWiki_skin

So, how about change this function (

protected function inflectSkinVars(array $vars): array
{
$vars['name'] = $this->pregReplace('/-skin$/', '', $vars['name']);
return $vars;
}
) to like bellow?

    protected function inflectSkinVars(array $vars): array
    {
        $vars['name'] = $this->pregReplace('/-skin$/', '', $vars['name']);
        $vars['name'] = str_replace('-', ' ', $vars['name']);
        $vars['name'] = str_replace(' ', '', ucwords($vars['name']));

        return $vars;
    }

Unfortunately I don't test this code yet, because I haven't enough skills.
I hope to test it and make a pull request, but probably your fixing is faster than me.

Thank you for reading!
If you need additional info, let me know!

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

No branches or pull requests

1 participant