File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Run this script from the root directory of your WebEngine project.
4+ * e.g. php vendor/phpgt/webengine/setup.php
5+ *
6+ * The purpose of this script is to make sure that the project is set up
7+ * correctly, if it has been installed manually, rather than via the composer
8+ * create-project command.
9+ */
10+ $ error = null ;
11+ if (!is_dir ("vendor " )) {
12+ if (!is_file ("composer.json " )) {
13+ $ error = "The current directory is not a WebEngine project. " ;
14+ }
15+ $ error = "No vendor directory found - do you need to run `composer install`? " ;
16+ }
17+ if (is_file ("build.default.json " )) {
18+ $ error = "Please run this script from your project's root directory. " ;
19+ }
20+ if ($ error ) {
21+ echo "$ error See https://www.php.gt/webengine/setup for more information. " , PHP_EOL ;
22+ exit (1 );
23+ }
24+ $ indexPhpContents = <<<PHP
25+ <?php
26+ require(__DIR__ . "/../vendor/phpgt/webengine/go.php");
27+ PHP ;
28+
29+ if (!is_dir ("www " )) {
30+ mkdir ("www " );
31+ }
32+ file_put_contents ("www/index.php " , $ indexPhpContents );
Original file line number Diff line number Diff line change @@ -270,7 +270,8 @@ protected function handleCsrf(ServerRequestInterface $request):void {
270270 );
271271 $ tokens = $ protector ->protect ($ sharing );
272272 $ this ->response = $ this ->response ->withHeader ($ this ->config ->getString ("security.csrf_header " ), $ tokens );
273- }
273+ }
274+
274275 }
275276
276277 protected function handleProtectedGlobals ():void {
You can’t perform that action at this time.
0 commit comments