From 14da371cedd708a0e20c9fa65106a53ca83f3064 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 5 Apr 2018 15:27:04 +1200 Subject: [PATCH 1/5] Shift code into app/src Add autoloading bootstrapping --- app/src/Page.php | 13 +++++++++++++ app/src/PageController.php | 33 +++++++++++++++++++++++++++++++++ composer.json | 9 ++++++++- mysite/code/Page.php | 10 ---------- mysite/code/PageController.php | 30 ------------------------------ 5 files changed, 54 insertions(+), 41 deletions(-) create mode 100755 app/src/Page.php create mode 100644 app/src/PageController.php delete mode 100755 mysite/code/Page.php delete mode 100644 mysite/code/PageController.php diff --git a/app/src/Page.php b/app/src/Page.php new file mode 100755 index 0000000..d5d11e7 --- /dev/null +++ b/app/src/Page.php @@ -0,0 +1,13 @@ + + * [ + * '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 + * ]; + * + * + * @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/ + } + } +} diff --git a/composer.json b/composer.json index b3f398b..61e4a93 100644 --- a/composer.json +++ b/composer.json @@ -20,9 +20,16 @@ "require-dev": { "phpunit/PHPUnit": "^5.7" }, + "autoload": { + "psr-4": {}, + "classmap": [ + "app/src/Page.php", + "app/src/PageController.php" + ] + }, "extra": { "project-files": [ - "mysite/code/*" + "app/src/*" ], "branch-alias": { "1.x-dev": "1.2.x-dev" diff --git a/mysite/code/Page.php b/mysite/code/Page.php deleted file mode 100755 index 6300926..0000000 --- a/mysite/code/Page.php +++ /dev/null @@ -1,10 +0,0 @@ - - * [ - * '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 - * ]; - * - * - * @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/ - } -} From baa8f47c5b7f1de68614b01a25d5f234dfebd099 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 5 Apr 2018 16:42:17 +1200 Subject: [PATCH 2/5] Bump recipe plugin dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 61e4a93..23f38dd 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "http://silverstripe.org", "license": "BSD-3-Clause", "require": { - "silverstripe/recipe-plugin": "^1", + "silverstripe/recipe-plugin": "^1.2", "silverstripe/recipe-core": "1.2.x-dev", "silverstripe/admin": "1.2.x-dev", "silverstripe/asset-admin": "1.2.x-dev", From 659c3212db429cb22fe4b900c81091f7ce139af4 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 13 Apr 2018 10:16:37 +1200 Subject: [PATCH 3/5] Remove empty psr-4 --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 23f38dd..176e013 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ "phpunit/PHPUnit": "^5.7" }, "autoload": { - "psr-4": {}, "classmap": [ "app/src/Page.php", "app/src/PageController.php" From 22843c2ba5dbf7cd4055419aa3d06552f24609a3 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 13 Apr 2018 10:23:23 +1200 Subject: [PATCH 4/5] Remove autoload classmap which clashes with installer --- composer.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/composer.json b/composer.json index 176e013..96f75ed 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,6 @@ "require-dev": { "phpunit/PHPUnit": "^5.7" }, - "autoload": { - "classmap": [ - "app/src/Page.php", - "app/src/PageController.php" - ] - }, "extra": { "project-files": [ "app/src/*" From 478e5dc84021d45e9abc06747ab81e98d8062b89 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 13 Apr 2018 14:41:20 +1200 Subject: [PATCH 5/5] Fix invalid htaccess See https://github.com/silverstripe/recipe-core/pull/14 --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index fdecdd0..adbd7c8 100644 --- a/.htaccess +++ b/.htaccess @@ -1,2 +1,2 @@ RewriteEngine On -RewriteRule .* public/%1 +RewriteRule ^(.*)$ public/$1