From 50be088143516c738c5b000aa4583df84f5fa3ee Mon Sep 17 00:00:00 2001 From: Evgeny Golyshev Date: Sat, 13 Jul 2024 19:53:43 +0300 Subject: [PATCH] mediawiki: fix specifying logo for wiki --- .gitignore | 2 +- mediawiki/Dockerfile | 4 ++-- mediawiki/README.md | 17 +++++++++++++++-- mediawiki/config/LocalSettings.php | 4 ---- mediawiki/docker-entrypoint.sh | 4 ++++ mediawiki/logos/README.md | 1 + 6 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 mediawiki/logos/README.md diff --git a/.gitignore b/.gitignore index 9d127570..6a78f387 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ baseimages/stretch_chroot baseimages/alpine_chroot hubot-rocketchat/packages/* hubot-rocketchat/redis-dump +mediawiki/config/logos.php mediawiki/config/namespaces.php -mediawiki/kblogo.png mediawiki/_db mediawiki/_deleted mediawiki/_images diff --git a/mediawiki/Dockerfile b/mediawiki/Dockerfile index 81394077..9bcec51a 100644 --- a/mediawiki/Dockerfile +++ b/mediawiki/Dockerfile @@ -65,7 +65,7 @@ RUN echo http://mirror.yandex.ru/mirrors/alpine/v3.20/community >> /etc/apk/repo git \ && rm -rf /var/cache/apk/* -COPY ./config/LocalSettings.php ./config/namespaces.ph[p] /var/www/w/ +COPY ./config/LocalSettings.php ./config/logos.ph[p] ./config/namespaces.ph[p] /var/www/w/ COPY ./config/default /etc/nginx/http.d/default.conf @@ -75,7 +75,7 @@ COPY ./rollout_fixes.sh /usr/bin/rollout_fixes.sh COPY ./docker-entrypoint.sh /usr/bin/docker-entrypoint.sh -COPY ./logo.svg ./kblogo.pn[g] /var/www/w/resources/assets/ +COPY ./logos/ /var/www/w/resources/assets/ RUN /usr/bin/rollout_fixes.sh diff --git a/mediawiki/README.md b/mediawiki/README.md index de4803a4..44023bd4 100644 --- a/mediawiki/README.md +++ b/mediawiki/README.md @@ -168,9 +168,22 @@ Then, rebuild the Docker image and re-run the container. After this you will get In order to modify a [php.ini](https://php.net/manual/en/configuration.file.php) parameter, use the environment variable the name of which consists of `PHP_INI_` and the name of the parameter. For example, to change the [post_max_size](https://php.net/manual/en/ini.core.php#ini.post-max-size) parameter, pass the `PHP_INI_post_max_size` environment variable to the container. -## How to change logo +## How to change logos -Provide a square logo named `kblogo.png` which is 135x135px or 150x150px. +Place all the logos in the `logos` directory, they can be accessed using the path `$wgResourceBasePath/resources/assets`. For example, you have placed `cusdeb.svg` and `cusdeb-wordmark.svg` in this directory. Next, create a file `config/logos.php` with the following content: + +```php +$wgLogos = [ + 'icon' => "$wgResourceBasePath/resources/assets/cusdeb.svg", + 'tagline' => [ + 'src' => "$wgResourceBasePath/resources/assets/cusdeb-wordmark.svg", + 'width' => 135, + 'height' => 15, + ], +]; +``` + +and rebuild the image. See [$wgLogos](https://mediawiki.org/wiki/Manual:$wgLogos) for details. ## How to upgrade from MariaDB 10.5 to MariaDB 10.6 diff --git a/mediawiki/config/LocalSettings.php b/mediawiki/config/LocalSettings.php index 0646197f..42546505 100644 --- a/mediawiki/config/LocalSettings.php +++ b/mediawiki/config/LocalSettings.php @@ -36,10 +36,6 @@ ## The URL path to static resources (images, scripts, etc.) $wgResourceBasePath = $wgScriptPath; -## The URL path to the logo. Make sure you change this from the default, -## or else you'll overwrite your logo when you upgrade! -$wgLogo = "$wgResourceBasePath/resources/assets/wiki.png"; - ## UPO means: this is also a user preference option $wgEnableEmail = false; diff --git a/mediawiki/docker-entrypoint.sh b/mediawiki/docker-entrypoint.sh index 09359f81..9cd4fdb4 100755 --- a/mediawiki/docker-entrypoint.sh +++ b/mediawiki/docker-entrypoint.sh @@ -66,6 +66,10 @@ substitute() { sed -i -e "s#${var_name}#${!var_name}#" /var/www/w/LocalSettings.php } +if [[ -f /var/www/w/logos.php ]]; then + cat /var/www/w/logos.php >> /var/www/w/LocalSettings.php +fi + if [[ -f /var/www/w/namespaces.php ]]; then cat /var/www/w/namespaces.php >> /var/www/w/LocalSettings.php fi diff --git a/mediawiki/logos/README.md b/mediawiki/logos/README.md new file mode 100644 index 00000000..aa8c4b27 --- /dev/null +++ b/mediawiki/logos/README.md @@ -0,0 +1 @@ +The directory contains logos for this wiki.