Skip to content

Commit

Permalink
Merge branch 'hotfix-osx-installer-ports'
Browse files Browse the repository at this point in the history
  • Loading branch information
gav- committed Nov 7, 2016
2 parents 7b279f9 + 453990f commit baa0d45
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 37 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 4.0.8 (Released 2016-11-07) ###
- Update Mac OS X installer to handle alternate web ports.

### 4.0.7 (Released 2016-08-31) ###
- Update diagnostic report page to handle OS X Secure Transport incompatibility
bug exposed by FileMaker Sever 15 setting curl.cainfo in php.ini by default.
Expand Down
92 changes: 56 additions & 36 deletions contrib/install-RESTfm.OSX/shared-functions
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,36 @@ check_FMSVersion() {
esac
}

##
# Check:
# - that the Apache version is supported.
#
# Initialises global variables:
# APACHE_VERSION - x.y Apache version.
# APACHE_CONF - Full path to Apache conf file with version suffix for FMS13+.
# APACHE_LISTEN - Port that Apache is listening on.
#
function check_ApacheVersion() {
local MSGPREFIX='Check Apache version: '

# Match usage in FMS /Library/FileMaker Server/HTTPServer/bin/httpdctl
APACHE_VERSION=$(/usr/sbin/httpd -version | head -1 | cut -d "/" -f 2 | cut -d "." -f 1,2)

APACHE_CONF="/Library/FileMaker Server/HTTPServer/conf/httpd.conf.${APACHE_VERSION}"

APACHE_LISTEN=$(grep '^Listen' "${APACHE_CONF}" | head -1 | sed -E 's/Listen[[:space:]]+([0-9]+)/\1/')

case "$APACHE_VERSION" in
'2.2'|'2.4')
log_success_msg "$MSGPREFIX $APACHE_VERSION (Listen port: ${APACHE_LISTEN})"
;;
*)
log_failure_msg "$MSGPREFIX $APACHE_VERSION, unsupported"
exit 1
;;
esac
}

##
# Check:
# - that FMS has both WPE and PHP enabled.
Expand All @@ -205,13 +235,13 @@ check_FMS_WPE_PHP() {
#fi

# Check PHP technology test:
curl -s "http://localhost/fmi-test/phptest.php?lang=en" | grep -q "PHP connection to the FMServer_Sample database appears successful"
curl -s "http://localhost:${APACHE_LISTEN}/fmi-test/phptest.php?lang=en" | grep -q "PHP connection to the FMServer_Sample database appears successful"
local RET=$?

if [ $RET != 0 ]; then
# Second chance, WPE and PHP might be up but the sample DB is closed,
# which is good enough for this test.
curl -s "http://localhost/fmi-test/phptest.php?lang=en" | grep -q "FMServer_Sample database is not open"
curl -s "http://localhost:${APACHE_LISTEN}/fmi-test/phptest.php?lang=en" | grep -q "FMServer_Sample database is not open"
RET=$?
fi

Expand All @@ -226,34 +256,6 @@ check_FMS_WPE_PHP() {
log_success_msg "$MSGPREFIX success"
}

##
# Check:
# - that the Apache version is supported.
#
# Initialises global variables:
# APACHE_VERSION - x.y Apache version.
# APACHE_CONF - Full path to Apache conf file with version suffix for FMS13+.
#
function check_ApacheVersion() {
local MSGPREFIX='Check Apache version: '

# Match usage in FMS /Library/FileMaker Server/HTTPServer/bin/httpdctl
APACHE_VERSION=$(/usr/sbin/httpd -version | head -1 | cut -d "/" -f 2 | cut -d "." -f 1,2)

case "$APACHE_VERSION" in
'2.2'|'2.4')
log_success_msg "$MSGPREFIX $APACHE_VERSION"
;;
*)
log_failure_msg "$MSGPREFIX $APACHE_VERSION, unsupported"
exit 1
;;
esac

APACHE_CONF="/Library/FileMaker Server/HTTPServer/conf/httpd.conf.${APACHE_VERSION}"
}


##
# Check that we are in the correct location. i.e. in an immediate subdirectory
# to /Library/FileMaker Server/HTTPServer/htdocs
Expand Down Expand Up @@ -387,7 +389,7 @@ check_RESTfmReport() {
local MSGPREFIX='Check RESTfm report'
log_daemon_msg "${MSGPREFIX}"

local URL="http://localhost/${RESTFM_BASENAME_URLENCODED}/report.php"
local URL="http://localhost:${APACHE_LISTEN}/${RESTFM_BASENAME_URLENCODED}/report.php"
log_progress_msg "${URL}"

curl -s -L "${URL}" | grep -q "RESTfm is working"
Expand Down Expand Up @@ -588,7 +590,7 @@ restart_FMS() {
while [ $RET -eq 1 ]; do
sleep 2
log_progress_msg "."
curl -s --connect-timeout 2 --max-time 4 "http://localhost/fmi/xml/fmresultset.xml" | grep -q "FileMaker"
curl -s --connect-timeout 2 --max-time 4 "http://localhost:${APACHE_LISTEN}/fmi/xml/fmresultset.xml" | grep -q "FileMaker"
RET=$?
if [ $RET -eq 1 ]; then
# Check that Apache httpd is actually in process list, as
Expand Down Expand Up @@ -659,22 +661,40 @@ update_RESTfmHtaccess() {
}

##
# Update RESTfm.ini.php to set baseURI.
# Update RESTfm.ini.php
# - set baseURI.
# - set hostspec.
#
update_RESTfmIni() {
local MSGPREFIX="Update RESTfm.ini.php:"
local MSGPREFIX="Update RESTfm.ini.php"
local RESTFMINI="${RESTFM_DIRNAME}/${RESTFM_BASENAME}/RESTfm.ini.php"

log_daemon_msg "${MSGPREFIX}"

# Use sed to update baseURI.
log_progress_msg "baseURI,"
sed -i.bak -E "s/^([[:space:]]*\'baseURI\'[[:space:]]*\=\>[[:space:]]*\')(.*)(\'[,[:space:]]*)/\1\/${RESTFM_BASENAME_URLENCODED}\3/" "${RESTFMINI}"
local RET=$?

if [ "$RET" != "0" ]; then
log_failure_msg "${MSGPREFIX} error updating baseURI"
# fail
log_end_msg 1
exit 1
fi

log_success_msg "${MSGPREFIX} success"
# Use sed to update hostspec.
log_progress_msg "hostspec"
sed -i.bak -E "s/^([[:space:]]*\'hostspec\'[[:space:]]*\=\>[[:space:]]*\')(.*)(\'[,[:space:]]*)/\1http:\/\/127.0.0.1:${APACHE_LISTEN}\3/" "${RESTFMINI}"
local RET=$?

if [ "$RET" != "0" ]; then
# fail
log_end_msg 1
exit 1
fi

# OK
log_end_msg 0

}

Expand Down
2 changes: 1 addition & 1 deletion lib/RESTfm/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Version static class to hold release version.
*/
class Version {
private static $_release = '4.0.7';
private static $_release = '4.0.8';
private static $_revision = '%%REVISION%%';
private static $_protocol = '5'; // Bump this when REST API changes.

Expand Down

0 comments on commit baa0d45

Please sign in to comment.