Mediawiki
Apparence
Links
debug
LocalSettings.php |
$wgShowExceptionDetails = true;
error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgDebugToolbar = true;
$wgShowDebug = true;
$wgDevelopmentWarnings = true;
$wgShowDBErrorBacktrace = true;
$wgShowSQLErrors = true;
$wgDebugLogFile = "/tmp/mediawiki-debug.log";
|
php maintenance/eval.php
> print $wgLocaltimezone
Europe/Paris
|
Job
By default, jobs are run at the end of a web request.
It is recommended that you instead schedule the running of jobs completely in the background via cron or a systemd service.
LocalSettings.php |
# sets to 0 to avoid jobs to run during ordinary requests.
$wgJobRunRate = 0;
|
Pour connaître le nombre de tâches dans la pile: api.php?action=query&meta=siteinfo&siprop=statistics&format=jsonfm |
# execute all jobs manually
cd /var/www/mediawiki
sudo -u www-data php maintenance/run.php --script runJobs.php --conf LocalSettings.php
|
Systemd service
/etc/systemd/system/mw-jobs-queue.service |
[Unit]
Description=Mediawiki jobs queue service
[Service]
ExecStartPre=/bin/sleep 60
ExecStart=/usr/local/bin/mw-jobs-runner
Nice=10
ProtectSystem=full
User=www-data
OOMScoreAdjust=200
StandardOutput=journal
[Install]
WantedBy=multi-user.target
|
/usr/local/bin/mwjobrunner |
Cron
# add a cron task to run all jobs periodically
# edit crontab for user www-data
sudo -u www-data crontab -e
# run runJobs.php every 5 minutes
*/5 * * * * php /var/www/mediawiki/maintenance/run.php --script runJobs.php --conf /var/www/mediawiki/LocalSettings.php
|
Forcer la mise à jour des catégories
sudo -u www-data php maintenance/run.php --script refreshLinks.php --conf LocalSettings.php |
Backup
Avant de réaliser un backup il faut geler le site afin que le backup soit cohérent.
Ensuite il faut réaliser un backup de la base de données et des fichiers.
Stopper les modifications du site
# Fichier LocalSettings.php
# Verrouille la base de données et affiche le message sur les pages d'édition
$wgReadOnly = 'Backup in progress, access will be restored shortly.';
|
Base de données
sudo mariadb-dump -x -e -B mediawiki -r mediawiki.sql |
Script
backup_mediawiki.sh |
Reduce size of the database
# Supprimer l'historique des pages supprimées
sudo -u www-data php maintenance/run.php --script deleteArchivedRevisions.php --delete --conf LocalSettings.php
# Supprimer l'historique des pages
sudo -u www-data php maintenance/run.php --script deleteOldRevisions.php --delete --conf LocalSettings.php
# sudo -u www-data php maintenance/run.php --script rebuildall.php --conf LocalSettings.php
|