rset(1) : Formulas

Configuring MediaWiki

PHP on OpenBSD

execute_with=doas

www_php:
    pkg_add php-gd%7.0 php-pgsql%7.0
    ln -sf /usr/local/share/examples/php-7.0/php.ini-development /etc/php-7.0.ini
    ln -sf /usr/local/share/examples/php-7.0/pgsql.ini /etc/php-7.0/pgsql.ini
    ln -sf /etc/php-7.0.sample/gd.ini /etc/php-7.0/gd.ini
    rcctl enable php70_fpm httpd
    rcctl start php70_fpm
    ./rinstall wiki/httpd.conf /etc/httpd.conf && rcctl restart httpd

chroot:
    [ -f /var/www/etc/resolv.conf ] || {
        install -d -o www -g www /var/www/etc/
        install -m 644 -o www -g www /etc/resolv.conf /var/www/etc/
    }

Adding resolv.conf is not always necessary, but it enables many functions to operate correctly in a chroot.

Unpacking Sources

Now that PHP is configured we can unpack the source files

mediawiki:
    dst=/var/www/mediawiki
    [ -d $dst ] && exit
    pkg_add femail femail-chroot php%7.0 php-gd%7.0 unzip--
    ./rinstall wiki/mediawiki-1.31.0.tar.gz wikimedia.tgz
    tar -zxf wikimedia.tgz -C /var/www
    mv /var/www/mediawiki-1.31.0 $dst

    ./rinstall wiki/Tweeki.zip Tweeki.zip
    unzip -q -d $dst/skins Tweeki.zip
    mv $dst/skins/{Tweeki-master,Tweeki}

In the previous script we bail out if the destination exists because it is already unpacked. We do want to maintain updates to certain files, most importantly LocalSettings.php

auto_configure:
    dst=/var/www/mediawiki
    ./rinstall -o www:www wiki/LocalSettings.php $dst/LocalSettings.php

Now that special we havef the wiki and a custom extension installed we can navigate to wiki/index.php?title=Special:Version to see the install options

For the Tweeki skin the top menu can be edited by navigating to wiki/index.php?title=MediaWiki:Tweeki-navbar-left.

Last updated on September 12, 2018