Debian Codegraph @

debian/tests/install-mysql

raw
1 #!/bin/sh
2 # Install MediaWiki on the MySQL backend
3 # and then verify the installation was successful.
4 set -e
5
6 mkdir /tmp/mw-install
7 mysql_version=`sudo mysql -NBe 'SELECT @@version;'`
8 if ! echo "$mysql_version" | grep -q MariaDB && dpkg --compare-versions "$mysql_version" ge 8; then
9 # MySQL >= 8 uses caching_sha256_password by default which is not currently
10 # supported by PHP's MySQL connector
11 echo "CREATE USER 'wikidebadmin'@'localhost' IDENTIFIED WITH 'sha256_password' BY 'DebianIsTheBest';" > /tmp/mw-install/db_setup.sql
12 else
13 echo "CREATE USER 'wikidebadmin'@'localhost' IDENTIFIED BY 'DebianIsTheBest';" > /tmp/mw-install/db_setup.sql
14 fi
15 echo "GRANT ALL PRIVILEGES ON * . * TO 'wikidebadmin'@'localhost';" >> /tmp/mw-install/db_setup.sql
16 sudo mysql < /tmp/mw-install/db_setup.sql
17 rm /tmp/mw-install/db_setup.sql
18 php /var/lib/mediawiki/maintenance/install.php --scriptpath /mediawiki --confpath /tmp/mw-install --dbname autopkgtestwiki --dbtype mysql --dbuser wikidebadmin --dbpass DebianIsTheBest --pass DebianIsTheBest Debian-Autopkgtest Administrator
19 sudo cat >> /tmp/mw-install/LocalSettings.php <<EOF
20 \$wgShowExceptionDetails = true;
21 \$wgShowDBErrorBacktrace = true;
22 ini_set( 'max_execution_time', 300 );
23 EOF
24 sudo mv /tmp/mw-install/LocalSettings.php /etc/mediawiki/LocalSettings.php
25
26 if [ -f ./debian/tests/install-thing ]; then
27 ./debian/tests/install-thing
28 fi
29
30 # Force clearing of PHP caches, etc.
31 sudo systemctl restart apache2
32
33 # Run tests
34 ./debian/tests/assert-cli
35 ./debian/tests/assert-http
36 if [ -f ./debian/tests/assert-thing ]; then
37 ./debian/tests/assert-thing
38 fi
39