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

Add documentation for adding extensions #807

Open
colinrobinsonuib opened this issue Dec 9, 2024 · 4 comments
Open

Add documentation for adding extensions #807

colinrobinsonuib opened this issue Dec 9, 2024 · 4 comments

Comments

@colinrobinsonuib
Copy link

In my deploy/ folder I created a folder called extensions/ where I put some extensions (e.g. WikibaseQualityConstraints).

I then created docker-compose.override.yml that looks like:

services:
  wikibase:
    volumes:
      - ./extensions:/extensions:ro
    entrypoint: >
      sh -c "cp -r /extensions/* /var/www/html/extensions/ && /bin/bash /entrypoint.sh"

I feel like this would be something nice to put in the README for new people.

Copy link

welcome bot commented Dec 9, 2024

Hi! 👋

Thank you so much for opening your first issue with us! 🎉 We are thrilled to have you here and really appreciate you taking the time to contribute.

Your input is valuable in making our project better for everyone. If you have any questions, do not hesitate to ask. We're here to help and support you along the way!

Here are a few links to get you started:

Looking forward to collaborating with you. We will get back to you on this issue within the next 14 days. 😊

Happy contributing! 🚀

@lucamauri
Copy link

Regarding extensions, I think that also the following configuration:

# Load extensions if present, alphabetically ordered by filename
foreach (glob("LocalSettings.d/*.php") as $filename)
{
        include $filename;
}

needs a bit of explanation in the documentation.

@rti
Copy link
Contributor

rti commented Jan 7, 2025

Hi @colinrobinsonuib,

Please excuse the long wait, we have been a bit under stuffed during the holiday season.

Thanks a lot for sharing your approach. This is definitely an option to add extensions to your Mediawiki.

The reason why we do not officially advertise such an approach at the moment is that the responsibility for updates is now split between you and us. We ship updates to Wikibase Suite (as updates to docker containers) including updates to the Mediawiki extensions we bundle. But we cannot update the extensions you add in such a way. We are even planning for auto updates in the future to keep your instance patched automatically. User added extensions could then still lead to bugs and security issues.

We still need to come up with a good solution here. Until then, your approach is definitely a good option.

Just to connect the dots... An alternative approach is to build your own wikibase container with your extensions added.

Best,
Robert

@rti
Copy link
Contributor

rti commented Jan 7, 2025

Regarding extensions, I think that also the following configuration:
[...]
needs a bit of explanation in the documentation.

Hi @lucamauri,

This is true.

This code will be put into your config/LocalSettings.php file on your host filesystem when you are using Wikibase Suite Deploy. When you are using the Wikibase container standalone, this file will be put into /config/LocalSettings.php in the container filesystem (but can have a volume mount).

# Load extensions if present, alphabetically ordered by filename
foreach (glob("LocalSettings.d/*.php") as $filename)
{
        include $filename;
}

This will include all php files from /var/www/html/LocalSettings.d/ in your container, effectively running the code stated in these files. Mediawiki needs to be instructed via php code to load an extension, these files contain this instruction along with any php based configuration the extension might need.

In simple cases this could just be one line to load the extension:

wfLoadExtension( 'Babel' );

In the wikibase case, the extension loading could require some more instructions:

# Wikibase Repository
wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";

# Wikibase Client
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";

I think at the moment we somehow consider this code "internal" and not an explicit interface to the user. This is related to the fact that we are still planning on a solid design to include user extensions (see above). Once we are there, we also plan to document all the steps required.

Best,
Robert

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

3 participants