From 37b2791837425be17bb0703df900bc428a4fbb4b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 25 Feb 2016 15:34:32 +0100 Subject: [ticket/14497] Support second app.php script in install folder PHPBB3-14497 --- phpBB/docs/nginx.sample.conf | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf index 2ead3552fd..c415720e9c 100644 --- a/phpBB/docs/nginx.sample.conf +++ b/phpBB/docs/nginx.sample.conf @@ -62,7 +62,7 @@ http { root /path/to/phpbb; location / { - # phpbb uses index.htm + # phpBB uses index.htm index index.php index.html index.htm; try_files $uri $uri/ @rewriteapp; } @@ -92,6 +92,29 @@ http { fastcgi_pass php; } + # Correctly pass scripts for installer + location /install/ { + # phpBB uses index.htm + try_files $uri $uri/ @rewrite_installapp; + + # Pass the php scripts to fastcgi server specified in upstream declaration. + location ~ \.php(/|$) { + # Unmodified fastcgi_params from nginx distribution. + include fastcgi_params; + # Necessary for php. + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + try_files $uri $uri/ /install/app.php$is_args$args; + fastcgi_pass php; + } + } + + location @rewrite_installapp { + rewrite ^(.*)$ /install/app.php/$1 last; + } + # Deny access to version control system directories. location ~ /\.svn|/\.git { deny all; -- cgit v1.2.1 From 293a42e7c552346b1b9b13b6f4e6e050ce219408 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Mar 2016 12:45:25 +0100 Subject: [ticket/14497] Use nginx sample config in travis tests PHPBB3-14497 --- travis/setup-webserver.sh | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 911ba12f3c..3369d740fe 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -57,20 +57,12 @@ else fi # nginx -echo " - server { - listen 80; - root $PHPBB_ROOT_PATH/; - index index.php index.html; - - location ~ \.php { - include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - fastcgi_param PATH_INFO \$fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; - fastcgi_pass unix:$APP_SOCK; - } - } -" | sudo tee $NGINX_CONF > /dev/null +cat $DIR/../phpBB/docs/nginx.sample.conf \ +| sed "s/root \/path\/to\/phpbb/root $(echo $PHPBB_ROOT_PATH | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/g" \ +| sed -e '1,/The actual board domain/d' \ +| sed -e '/If running php as fastcgi/,$d' \ +| sed -e "s/fastcgi_pass php;/fastcgi_pass unix:$(echo $APP_SOCK | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g');/g" \ +| sed -e 's/#listen 80/listen 80/' \ +| sudo tee $NGINX_CONF sudo service nginx start -- cgit v1.2.1 From 5fc3177395a6fb2981110fea4d39e422a8b318e3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Mar 2016 21:23:24 +0100 Subject: [ticket/14497] Add test for visiting installer PHPBB3-14497 --- tests/functional/visit_installer_test.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/functional/visit_installer_test.php diff --git a/tests/functional/visit_installer_test.php b/tests/functional/visit_installer_test.php new file mode 100644 index 0000000000..80336bd410 --- /dev/null +++ b/tests/functional/visit_installer_test.php @@ -0,0 +1,30 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_visit_installer_test extends phpbb_functional_test_case +{ + public function test_visit_installer() + { + self::request('GET', 'install/'); + $this->assertContains('installation system', $this->get_content()); + + self::request('GET', 'install/index.html'); + $this->assertContains('installation system', $this->get_content()); + + self::request('GET', 'install/app.php'); + $this->assertContains('installation system', $this->get_content()); + } +} -- cgit v1.2.1 From 4e717c1725474265a694bd300b024030769dbd85 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Mar 2016 22:19:03 +0100 Subject: [ticket/14497] Do not check for doctype on index and use correct return PHPBB3-14497 --- tests/functional/visit_installer_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/functional/visit_installer_test.php b/tests/functional/visit_installer_test.php index 80336bd410..b4a75c0b51 100644 --- a/tests/functional/visit_installer_test.php +++ b/tests/functional/visit_installer_test.php @@ -18,11 +18,11 @@ class phpbb_functional_visit_installer_test extends phpbb_functional_test_case { public function test_visit_installer() { - self::request('GET', 'install/'); - $this->assertContains('installation system', $this->get_content()); + self::request('GET', 'install/', [], false); + $this->assertContains('', $this->get_content()); - self::request('GET', 'install/index.html'); - $this->assertContains('installation system', $this->get_content()); + self::request('GET', 'install/index.html', [], false); + $this->assertContains('', $this->get_content()); self::request('GET', 'install/app.php'); $this->assertContains('installation system', $this->get_content()); -- cgit v1.2.1