partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5962d0f567e4e57765275fe5e00084ffe2f5b21e
parent 161745dc8ae07d43e8c1e5a01a7c3a6eb50de3e2
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun, 15 Nov 2015 19:10:41 +0100

Added web server checking, fixes #479

Diffstat:
Msrc/PartKeepr/SetupBundle/Controller/SetupController.php | 14++++++++++++++
Mweb/setup/index.html | 1+
Mweb/setup/js/Cards/PrerequisitesTestCard.js | 1+
Aweb/setup/js/SetupTests/WebserverTest.js | 22++++++++++++++++++++++
4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/PartKeepr/SetupBundle/Controller/SetupController.php b/src/PartKeepr/SetupBundle/Controller/SetupController.php @@ -67,6 +67,20 @@ class SetupController extends Controller } /** + * @Route("/setup/webserverTest") + */ + public function webserverTestAction() + { + $response = array( + "success" => true, + "message" => "Web Server configuration OK", + "errors" => array() + ); + + return new JsonResponse($response); + } + + /** * @Route("/setup/generateAuthKey") */ public function generateAuthKeyAction() diff --git a/web/setup/index.html b/web/setup/index.html @@ -35,6 +35,7 @@ <script type="text/javascript" src="js/SetupTests/AbstractTest.js"></script> <script type="text/javascript" src="js/SetupTests/GenerateAuthKey.js"></script> <script type="text/javascript" src="js/SetupTests/PHPTest.js"></script> + <script type="text/javascript" src="js/SetupTests/WebserverTest.js"></script> <script type="text/javascript" src="js/SetupTests/PHPPrerequisitesTest.js"></script> <script type="text/javascript" src="js/SetupTests/DatabaseConnectivityTest.js"></script> <script type="text/javascript" src="js/SetupTests/PHPSettingsTest.js"></script> diff --git a/web/setup/js/Cards/PrerequisitesTestCard.js b/web/setup/js/Cards/PrerequisitesTestCard.js @@ -14,6 +14,7 @@ Ext.define('PartKeeprSetup.PrerequisitesTestCard', { this.tests.push(new PartKeeprSetup.PHPTest()); this.tests.push(new PartKeeprSetup.PHPPrerequisitesTest()); this.tests.push(new PartKeeprSetup.PHPSettingsTest()); + this.tests.push(new PartKeeprSetup.WebserverTest()); this.tests.push(new PartKeeprSetup.GenerateAuthKey()); } }); diff --git a/web/setup/js/SetupTests/WebserverTest.js b/web/setup/js/SetupTests/WebserverTest.js @@ -0,0 +1,22 @@ +/** + * Tests if the most important PHP prerequisites are met (e.g. json_encode). + */ +Ext.define('PartKeeprSetup.WebserverTest', { + extend: 'PartKeeprSetup.AbstractTest', + action: 'webserverTest', + name: "PHP", + message: "Testing webserver settings", + onFailure: function (response) { + this.success = false; + this.resultMessage = "Web Server misconfiguration"; + this.errors = ['Web Server Configuration error. Please read our <a href="https://wiki.partkeepr.org/wiki/KB00005:Web_Server_Configuration" target="_blank">wiki about the proper web server configuration</a>', response.responseText]; + + if (this.callback) { + this.callback.appendTestResult(this); + } + + if (this.success) { + this.fireEvent("complete", this); + } + } +});