Initial commit

This commit is contained in:
paul 2021-01-12 08:49:20 +01:00
commit 2eff037f6b
16 changed files with 431 additions and 0 deletions

View file

@ -0,0 +1,4 @@
#!/bin/bash
set -e
cron -f -L 15

39
scripts/db-setup.sh Normal file
View file

@ -0,0 +1,39 @@
#!/bin/bash
set -euo pipefail
cd /var/www/html/
# The install script doesn't want there to be a LocalSettings.php file
echo Killing LocalSettings.php
echo
rm /var/www/html/LocalSettings.php
echo Install.php
echo
php maintenance/install.php --dbtype "${MEDIAWIKI_DB_TYPE}" --dbname "${MEDIAWIKI_DB_NAME}" --dbuser "${MEDIAWIKI_DB_USER}" --dbport "${MEDIAWIKI_DB_PORT}" --dbpass "${MEDIAWIKI_DB_PASSWORD}" --scriptpath "/var/www/html/" --dbserver "${MEDIAWIKI_DB_HOST}" --pass "${MEDIAWIKI_ADMIN_PASS}" --dbpath "${MEDIAWIKI_DATABASE_DIR}" "${MEDIAWIKI_SITE_NAME}" "${MEDIAWIKI_ADMIN_USER}"
# Now, we're going to replace the LocalSettings.php file that install.php just generated with ours
# This way, update.php will work.
rm /var/www/html/LocalSettings.php
ln -s /var/www/conf/LocalSettings.php /var/www/html/LocalSettings.php
echo LocalSettings.php restored
echo
echo Creating localstore
echo
# Copy the htaccess file
mkdir -p /var/www/localstore/images
mkdir -p /var/www/localstore/smwconfig
cp /var/www/html/images/* /var/www/localstore/images
chown -R www-data:www-data /var/www/localstore
# Run update.php, to set up all of the extensions
echo update.php
echo
php maintenance/update.php --quick

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
# Copy the htaccess file
mkdir -p /var/www/localstore/images
mkdir -p /var/www/localstore/smwconfig
cp /var/www/html/images/* /var/www/localstore/images
chown -R www-data:www-data /var/www/localstore
chown -R www-data:www-data /var/www/data

23
scripts/mwjobrunner Normal file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
# From https://www.mediawiki.org/wiki/Manual:Job_queue
IP=/var/www/html
RJ=$IP/maintenance/runJobs.php
echo Starting job service...
# Wait a minute after the server starts up to give other processes time to get started
sleep 60
echo Started.
while true; do
# Job types that need to be run ASAP mo matter how many of them are in the queue
# Those jobs should be very "cheap" to run
php $RJ --type="enotifNotify"
php $RJ --type="htmlCacheUpdate" --maxjobs=50
# Everything else, limit the number of jobs on each batch
# The --wait parameter will pause the execution here until new jobs are added,
# to avoid running the loop without anything to do
php $RJ --wait --maxjobs=10
# Wait some seconds to let the CPU do other things, like handling web requests, etc
echo Waiting for 10 seconds...
sleep 10
done

8
scripts/rebuildData.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
echo rebuildData
echo
php /var/www/html/extensions/SemanticMediaWiki/maintenance/rebuildData.php -d 100
echo rebuildData finished

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
echo removeDuplicateEntities
echo
/usr/local/bin/php /var/www/html/extensions/SemanticMediaWiki/maintenance/removeDuplicateEntities.php
echo removeDuplicateEntities finished

4
scripts/run-update.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
/usr/local/bin/php maintenance/update.php

8
scripts/setupStore.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
echo setupStore
echo
/usr/local/bin/php /var/www/html/extensions/SemanticMediaWiki/maintenance/setupStore.php --skip-import
echo setupStore finished

View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
echo updateEntityCollation
echo
/usr/local/bin/php /var/www/html/extensions/SemanticMediaWiki/maintenance/updateEntityCollation.php
echo updateEntityCollation finished

View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
echo updateSpecialPages
echo
/usr/local/bin/php /var/www/html/maintenance/updateSpecialPages.php
echo updateSpecialPages finished