Initialize a silverstripe-website for testing
This commit is contained in:
parent
2b347775c4
commit
7718b1dad7
18 changed files with 4312 additions and 6 deletions
|
@ -2,6 +2,5 @@
|
||||||
"name": "SilverStripe Environment",
|
"name": "SilverStripe Environment",
|
||||||
"dockerComposeFile": "docker-compose.yml",
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
"service": "silverstripe",
|
"service": "silverstripe",
|
||||||
"workspaceFolder": "/vscode/src/mantra",
|
"workspaceFolder": "/vscode/src/mantra"
|
||||||
"postCreateCommand": "rm -rf /var/www/html && ln -fs ${workspaceFolder}/test/website -t /var/www html"
|
|
||||||
}
|
}
|
|
@ -40,7 +40,8 @@
|
||||||
"gulpfile.ts",
|
"gulpfile.ts",
|
||||||
"node_modules/",
|
"node_modules/",
|
||||||
"package-lock.json",
|
"package-lock.json",
|
||||||
"package.json"
|
"package.json",
|
||||||
|
"test/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
|
6
test/website/.gitignore
vendored
Normal file
6
test/website/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/silverstripe-cache/
|
||||||
|
/.env
|
||||||
|
/vendor/
|
||||||
|
/themes/simple/
|
||||||
|
/_resources/
|
||||||
|
/public/_resources/
|
2
test/website/.htaccess
Normal file
2
test/website/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule ^(.*)$ public/$1
|
3
test/website/app/.htaccess
Normal file
3
test/website/app/.htaccess
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
|
||||||
|
Deny from all
|
||||||
|
</FilesMatch>
|
9
test/website/app/_config.php
Normal file
9
test/website/app/_config.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Security\PasswordValidator;
|
||||||
|
use SilverStripe\Security\Member;
|
||||||
|
|
||||||
|
// remove PasswordValidator for SilverStripe 5.0
|
||||||
|
$validator = PasswordValidator::create();
|
||||||
|
// Settings are registered via Injector configuration - see passwords.yml in framework
|
||||||
|
Member::set_password_validator($validator);
|
5
test/website/app/_config/mysite.yml
Normal file
5
test/website/app/_config/mysite.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
Name: myproject
|
||||||
|
---
|
||||||
|
SilverStripe\Core\Manifest\ModuleManifest:
|
||||||
|
project: app
|
8
test/website/app/_config/theme.yml
Normal file
8
test/website/app/_config/theme.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
Name: mytheme
|
||||||
|
---
|
||||||
|
SilverStripe\View\SSViewer:
|
||||||
|
themes:
|
||||||
|
- '$public'
|
||||||
|
- 'simple'
|
||||||
|
- '$default'
|
13
test/website/app/src/Page.php
Normal file
13
test/website/app/src/Page.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
|
||||||
|
class Page extends SiteTree
|
||||||
|
{
|
||||||
|
private static $db = [];
|
||||||
|
|
||||||
|
private static $has_one = [];
|
||||||
|
}
|
||||||
|
}
|
33
test/website/app/src/PageController.php
Normal file
33
test/website/app/src/PageController.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
|
|
||||||
|
class PageController extends ContentController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
|
||||||
|
* permissions or conditions required to allow the user to access it.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* [
|
||||||
|
* 'action', // anyone can access this action
|
||||||
|
* 'action' => true, // same as above
|
||||||
|
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
||||||
|
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
||||||
|
* ];
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private static $allowed_actions = [];
|
||||||
|
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
// You can include any CSS or JS required by your project here.
|
||||||
|
// See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
test/website/composer.json
Normal file
36
test/website/composer.json
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"name": "silverstripe/installer",
|
||||||
|
"type": "silverstripe-recipe",
|
||||||
|
"description": "The SilverStripe Framework Installer",
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.6.0",
|
||||||
|
"silverstripe/recipe-plugin": "^1.2",
|
||||||
|
"silverstripe/recipe-cms": "4.4.4@stable",
|
||||||
|
"silverstripe-themes/simple": "~3.2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"resources-dir": "_resources",
|
||||||
|
"project-files-installed": [
|
||||||
|
"app/.htaccess",
|
||||||
|
"app/_config.php",
|
||||||
|
"app/_config/mysite.yml",
|
||||||
|
"app/src/Page.php",
|
||||||
|
"app/src/PageController.php"
|
||||||
|
],
|
||||||
|
"public-files-installed": [
|
||||||
|
".htaccess",
|
||||||
|
"index.php",
|
||||||
|
"install-frameworkmissing.html",
|
||||||
|
"install.php",
|
||||||
|
"web.config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"process-timeout": 600
|
||||||
|
},
|
||||||
|
"prefer-stable": true,
|
||||||
|
"minimum-stability": "dev"
|
||||||
|
}
|
4076
test/website/composer.lock
generated
Normal file
4076
test/website/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,3 +0,0 @@
|
||||||
<h1>
|
|
||||||
Hello World
|
|
||||||
</h1>
|
|
54
test/website/public/.htaccess
Normal file
54
test/website/public/.htaccess
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
### SILVERSTRIPE START ###
|
||||||
|
|
||||||
|
# Deny access to templates (but allow from localhost)
|
||||||
|
<Files *.ss>
|
||||||
|
Order deny,allow
|
||||||
|
Deny from all
|
||||||
|
Allow from 127.0.0.1
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
# Deny access to IIS configuration
|
||||||
|
<Files web.config>
|
||||||
|
Order deny,allow
|
||||||
|
Deny from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
# Deny access to YAML configuration files which might include sensitive information
|
||||||
|
<Files ~ "\.ya?ml$">
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
# Route errors to static pages automatically generated by SilverStripe
|
||||||
|
ErrorDocument 404 /assets/error-404.html
|
||||||
|
ErrorDocument 500 /assets/error-500.html
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
|
||||||
|
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
|
||||||
|
<IfModule mod_dir.c>
|
||||||
|
DirectoryIndex disabled
|
||||||
|
DirectorySlash On
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
SetEnv HTTP_MOD_REWRITE On
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Enable HTTP Basic authentication workaround for PHP running in CGI mode
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
|
||||||
|
# Deny access to potentially sensitive files and folders
|
||||||
|
RewriteRule ^vendor(/|$) - [F,L,NC]
|
||||||
|
RewriteRule ^\.env - [F,L,NC]
|
||||||
|
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
|
||||||
|
RewriteRule composer\.(json|lock) - [F,L,NC]
|
||||||
|
RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]
|
||||||
|
|
||||||
|
# Process through SilverStripe if no file with the requested name exists.
|
||||||
|
# Pass through the original path as a query parameter, and retain the existing parameters.
|
||||||
|
# Try finding framework in the vendor folder first
|
||||||
|
RewriteCond %{REQUEST_URI} ^(.*)$
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule .* index.php
|
||||||
|
</IfModule>
|
||||||
|
### SILVERSTRIPE END ###
|
4
test/website/public/assets/.gitignore
vendored
Normal file
4
test/website/public/assets/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/**/*
|
||||||
|
!.gitignore
|
||||||
|
!.htaccess
|
||||||
|
!web.config
|
35
test/website/public/assets/.htaccess
Normal file
35
test/website/public/assets/.htaccess
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#
|
||||||
|
# Whitelist appropriate assets files.
|
||||||
|
# This file is automatically generated via File.allowed_extensions configuration
|
||||||
|
# See AssetAdapter::renderTemplate() for reference.
|
||||||
|
#
|
||||||
|
|
||||||
|
# We disable PHP via several methods
|
||||||
|
# Replace the handler with the default plaintext handler
|
||||||
|
AddHandler default-handler php phtml php3 php4 php5 inc
|
||||||
|
|
||||||
|
<IfModule mod_php5.c>
|
||||||
|
# Turn the PHP engine off
|
||||||
|
php_flag engine off
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
<IfModule mod_env.c>
|
||||||
|
SetEnv HTTP_MOD_REWRITE On
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Allow error pages
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -f
|
||||||
|
RewriteRule error[^\\/]*\.html$ - [L]
|
||||||
|
|
||||||
|
# Block invalid file extensions
|
||||||
|
RewriteCond %{REQUEST_URI} !^[^.]*[^\/]*\.(?i:css|js|ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|csv|dmg|doc|docx|dotx|flv|gif|gpx|gz|hqx|ico|jpeg|jpg|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|zip|zipx|graphql)$
|
||||||
|
RewriteRule .* - [F]
|
||||||
|
|
||||||
|
# Non existant files passed to requesthandler
|
||||||
|
RewriteCond %{REQUEST_URI} ^(.*)$
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule .* ../index.php [QSA]
|
||||||
|
</IfModule>
|
BIN
test/website/public/favicon.ico
Normal file
BIN
test/website/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
25
test/website/public/index.php
Normal file
25
test/website/public/index.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Control\HTTPApplication;
|
||||||
|
use SilverStripe\Control\HTTPRequestBuilder;
|
||||||
|
use SilverStripe\Core\CoreKernel;
|
||||||
|
|
||||||
|
// Find autoload.php
|
||||||
|
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||||
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
} elseif (file_exists(__DIR__ . '/vendor/autoload.php')) {
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
} else {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
echo "autoload.php not found";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build request and detect flush
|
||||||
|
$request = HTTPRequestBuilder::createFromEnvironment();
|
||||||
|
|
||||||
|
// Default application
|
||||||
|
$kernel = new CoreKernel(BASE_PATH);
|
||||||
|
$app = new HTTPApplication($kernel);
|
||||||
|
$response = $app->handle($request);
|
||||||
|
$response->output();
|
Loading…
Reference in a new issue