@@ -18,34 +18,46 @@ export_env_dir $3
18
18
19
19
# START CONFIG
20
20
21
- # Support end-user configured NGINX_VERSION, PHP_VERSION, WORDPRESS_VERSION ,
22
- # S3_BUCKET environment variables. This way, end-users
21
+ # Support end-user configured BUILDPACK_NGINX_VERSION, BUILDPACK_PHP_VERSION, BUILDPACK_WORDPRESS_VERSION ,
22
+ # BUILDPACK_S3_BUCKET, BUILDPACK_WORDPRESS_DIR environment variables. This way, end-users
23
23
# can choose exactly which versions to run with. Requires user-env-compile for now,
24
24
# but will continue to work when Heroku deprecates user-env-compile and ENV_DIR
25
25
# appears to this script as a parameter.
26
26
27
- if [ -z " $NGINX_VERSION " ]; then
28
- NGINX_VERSION =1.4.2
27
+ if [ -z " $BUILDPACK_NGINX_VERSION " ]; then
28
+ BUILDPACK_NGINX_VERSION =1.4.2
29
29
fi
30
30
31
- if [ -z " $PHP_VERSION " ]; then
32
- PHP_VERSION =5.5.2
31
+ if [ -z " $BUILDPACK_PHP_VERSION " ]; then
32
+ BUILDPACK_PHP_VERSION =5.5.2
33
33
fi
34
34
35
- if [ -z " $WORDPRESS_VERSION " ]; then
36
- WORDPRESS_VERSION =3.9.1
35
+ if [ -z " $BUILDPACK_WORDPRESS_VERSION " ]; then
36
+ BUILDPACK_WORDPRESS_VERSION =3.9.1
37
37
fi
38
38
39
- if [ -z " $S3_BUCKET " ]; then
40
- S3_BUCKET=heroku-buildpack-wordpress
39
+ if [ -z " $BUILDPACK_S3_BUCKET " ]; then
40
+ BUILDPACK_S3_BUCKET=heroku-buildpack-wordpress
41
+ fi
42
+
43
+
44
+ # Prevent publishing if old environment variables set. This feature will be removed in the future
45
+ # and thus the "global names" used before will be for application use.
46
+ if [ -z " $NGINX_VERSION " || -z " $PHP_VERSION " || -z " $WORDPRESS_VERSION " || -z " $S3_BUCKET " || -z " $WORDPRESS_DIR " ]; then
47
+ echo " Aborting. Env variables controlling buildpack should be prefixed with \" BUILDPACK_\" ."
48
+ echo " Rename the variables and push again. For example:"
49
+ echo " "
50
+ echo " heroku config:set BUILDPACK_WORDPRESS_VERSION"
51
+ echo " heroku config:unset WORDPRESS_VERSION=x.x.x"
52
+ exit 250
41
53
fi
42
54
43
55
# END CONFIG
44
56
45
57
#
46
- NGINX_URL=" https://s3.amazonaws.com/${S3_BUCKET } /nginx-${NGINX_VERSION } -heroku.tar.gz"
47
- PHP_URL=" https://s3.amazonaws.com/${S3_BUCKET } /php-${PHP_VERSION } -with-fpm-heroku.tar.gz"
48
- WORDPRESS_URL=" http://wordpress.org/wordpress-${WORDPRESS_VERSION } .tar.gz"
58
+ NGINX_URL=" https://s3.amazonaws.com/${BUILDPACK_S3_BUCKET } /nginx-${BUILDPACK_NGINX_VERSION } -heroku.tar.gz"
59
+ PHP_URL=" https://s3.amazonaws.com/${BUILDPACK_S3_BUCKET } /php-${BUILDPACK_PHP_VERSION } -with-fpm-heroku.tar.gz"
60
+ WORDPRESS_URL=" http://wordpress.org/wordpress-${BUILDPACK_WORDPRESS_VERSION } .tar.gz"
49
61
50
62
function indent() {
51
63
c=' s/^/ /'
@@ -62,32 +74,32 @@ mkdir -p $BUILD_DIR $CACHE_DIR
62
74
# Nginx
63
75
cd ${BUILD_DIR}
64
76
if [ ! -d ./vendor/nginx ]; then
65
- echo " -----> Installing Nginx v${NGINX_VERSION } "
77
+ echo " -----> Installing Nginx v${BUILDPACK_NGINX_VERSION } "
66
78
mkdir -p ./vendor/nginx && cd ./vendor/nginx
67
79
curl --silent --max-time 60 --location $NGINX_URL | tar xz
68
80
fi
69
81
70
82
# PHP
71
83
cd ${BUILD_DIR}
72
84
if [ ! -d ./vendor/php ]; then
73
- echo " -----> Installing PHP v${PHP_VERSION } "
85
+ echo " -----> Installing PHP v${BUILDPACK_PHP_VERSION } "
74
86
mkdir -p ./vendor/php && cd ./vendor/php
75
87
curl --silent --max-time 60 --location $PHP_URL | tar xz
76
88
fi
77
89
78
90
# WordPress
79
- echo " -----> Installing WordPress v${WORDPRESS_VERSION } "
91
+ echo " -----> Installing Wordpress v${BUILDPACK_WORDPRESS_VERSION } "
80
92
cd ${BUILD_DIR}
81
93
curl --silent --max-time 60 --location $WORDPRESS_URL | tar xz
82
94
83
95
# Support installation of WordPress into a subdirectory instead of the docroot
84
- if [ -n " $WORDPRESS_DIR " ]; then
85
- echo " Installing to subdirectory ${WORDPRESS_DIR }"
96
+ if [ -n " $BUILDPACK_WORDPRESS_DIR " ]; then
97
+ echo " -----> BUILDPACK_WORDPRESS_DIR is set to ${BUILDPACK_WORDPRESS_DIR }"
86
98
mkdir " public"
87
- mv wordpress " public/$WORDPRESS_DIR "
88
- WORDPRESS_INSTALLATION_DIR=" public/$WORDPRESS_DIR "
99
+ mv wordpress " public/$BUILDPACK_WORDPRESS_DIR "
100
+ WORDPRESS_INSTALLATION_DIR=" public/$BUILDPACK_WORDPRESS_DIR "
89
101
else
90
- echo " WORDPRESS_DIR not set. Installing WordPress to /"
102
+ echo " -----> BUILDPACK_WORDPRESS_DIR not set. Installing WordPress to /"
91
103
mv wordpress public
92
104
WORDPRESS_INSTALLATION_DIR=" public"
93
105
fi
0 commit comments