Tech/OSS/Mediawiki

From lathama
< Tech‎ | OSS
Jump to navigation Jump to search

Howtos

Security

If you use the SQLite database then make sure to block raw downloads of your database which are in an easy to guess location. Add the following to your .htaccess for Apache or configure your webserver to not serve files with extension .sqlite

RewriteRule .*\.(sqlite)$ - [F,NC]

In theory https://github.com/wikimedia/mediawiki/blob/6c5bdf5ace775f97294de596288cb9b6868dd4d1/includes/installer/SqliteInstaller.php#L170 should add a blocking .htaccess but my install lacked the file. I will investigate

Code Review

wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.0.tar.gz
tar -xf mediawiki-1.31.0.tar.gz
git clone git@github.com:PHPCheckstyle/phpcheckstyle.git
cd phpcheckstyle
php run.php --src ../mediawiki --outdir ./checkstyle_result --config default.cfg.xml --format html,xml --linecount --debug

Debug was maybe not needed but I enjoy the scroll, the result is:

Summary
=======

Errors:   2527
Ignores:  0
Infos:    319398
Warnings: 108314
=======

Reporting Completed.

The HTML report is, large...

ls -lha ../mediawiki_checkstyle/
total 143M
drwxr-xr-x  2 lathama lathama 4.0K Aug 15 10:38 .
drwxr-xr-x 23 lathama lathama 4.0K Aug 15 10:38 ..
-rw-r--r--  1 lathama lathama 1.4K Aug 15 10:38 global.css
-rw-r--r--  1 lathama lathama  93M Aug 15 10:38 index.html
-rw-r--r--  1 lathama lathama 4.6K Aug 15 10:38 Logo_phpcheckstyle.png
-rw-r--r--  1 lathama lathama  50M Aug 15 10:38 style-report.xml


Issues with password change

If using the cli command fails check the PHP versions that ansible is using vs the system

System
update-alternatives --display php
php - auto mode
link best version is /usr/bin/php7.3
link currently points to /usr/bin/php7.3
link php is /usr/bin/php
slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php7.0 - priority 70
slave php.1.gz: /usr/share/man/man1/php7.0.1.gz
/usr/bin/php7.3 - priority 73
slave php.1.gz: /usr/share/man/man1/php7.3.1.gz
Apache
ls -lha /etc/apache2/mods-enabled/php*
lrwxrwxrwx 1 root root 29 Jan  9  2018 /etc/apache2/mods-enabled/php7.0.conf -> ../mods-available/php7.0.conf
lrwxrwxrwx 1 root root 29 Jan  9  2018 /etc/apache2/mods-enabled/php7.0.load -> ../mods-available/php7.0.load


So use 7.0 in this example
php7.0 maintenance/changePassword.php --user=Susan --password=T0pS3cr3t

TOC position

Example of how to position the Table of Contents on a page.

<div style="float: right;" >__TOC__</div>