summaryrefslogtreecommitdiff
path: root/bin/wiki/vendor/addwiki/mediawiki-api-base/build/travis/run-webserver.sh
blob: 2412031c84b2c78d02672e0c8a68e883915e2a04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash

set -x

# HHVM doesn't have a built in web server
# We can't guarantee any single PHP version is always installed on Travis hosts
# So list the versions and try to pick the latest PHP version
# Also the web server on 7.1 seems to have issues, so don't use that?
if [[ $TRAVIS_PHP_VERSION == *"hhvm"* ]] || [[ $TRAVIS_PHP_VERSION == *"7.1"* ]]
then
	WEBSERVERPHPVERSION=`phpenv versions | grep -v system | grep -v hhvm | grep -v 7.1 | tail -n 1 | xargs`
	phpenv global $WEBSERVERPHPVERSION
	php --version
fi

# Run a web server for MediaWiki and wait until it is up
nohup php -S 0.0.0.0:8080 -t ./../web > /dev/null 2>&1 &
until curl -s localhost:8080; do true; done > /dev/null 2>&1

# Switch back to the actual php version requested for this build if needed
if [ -v $WEBSERVERPHPVERSION ]
then
	phpenv global $TRAVIS_PHP_VERSION
	php --version
fi