diff --git a/src/Core/Manifest/ManifestFileFinder.php b/src/Core/Manifest/ManifestFileFinder.php index 75763e4ed65..f534469807c 100644 --- a/src/Core/Manifest/ManifestFileFinder.php +++ b/src/Core/Manifest/ManifestFileFinder.php @@ -25,11 +25,6 @@ class ManifestFileFinder extends FileFinder const TESTS_DIR = 'tests'; const VENDOR_DIR = 'vendor'; - /** - * @deprecated 4.4.0:5.0.0 Use global `RESOURCES_DIR` instead. - */ - const RESOURCES_DIR = RESOURCES_DIR; - protected static $default_options = [ 'include_themes' => false, 'ignore_tests' => true, diff --git a/src/Core/Manifest/Module.php b/src/Core/Manifest/Module.php index 1872c763747..bedc9a9b616 100644 --- a/src/Core/Manifest/Module.php +++ b/src/Core/Manifest/Module.php @@ -147,20 +147,6 @@ public function getShortName() return basename($this->path ?? ''); } - /** - * Name of the resource directory where vendor resources should be exposed as defined by the `extra.resources-dir` - * key in the composer file. A blank string will be returned if the key is undefined. - * - * Only applicable when reading the composer file for the main project. - * @return string - */ - public function getResourcesDir() - { - return isset($this->composerData['extra']['resources-dir']) - ? $this->composerData['extra']['resources-dir'] - : ''; - } - /** * Get base path for this module * diff --git a/src/includes/constants.php b/src/includes/constants.php index 24968564d93..7116fd828e3 100644 --- a/src/includes/constants.php +++ b/src/includes/constants.php @@ -28,7 +28,7 @@ * - PUBLIC_PATH: Absolute path to webroot, e.g. "/var/www/project/public" * - THIRDPARTY_DIR: Path relative to webroot, e.g. "framework/thirdparty" * - THIRDPARTY_PATH: Absolute filepath, e.g. "/var/www/my-webroot/framework/thirdparty" - * - RESOURCES_DIR: Name of the directory where vendor assets will be exposed, e.g. "_resources" + * - RESOURCES_DIR: Name of the directory where vendor assets will be exposed, i.e. "_resources" */ require_once __DIR__ . '/functions.php'; @@ -218,15 +218,5 @@ // Define the resource dir constant that will be use to exposed vendor assets if (!defined('RESOURCES_DIR')) { - $project = new SilverStripe\Core\Manifest\Module(BASE_PATH, BASE_PATH); - $resourcesDir = $project->getResourcesDir() ?: 'resources'; - if (preg_match('/^[_\-a-z0-9]+$/i', $resourcesDir ?? '')) { - define('RESOURCES_DIR', $resourcesDir); - } else { - throw new LogicException(sprintf( - 'Resources dir error: "%s" is not a valid resources directory name. Update the ' . - '`extra.resources-dir` key in your composer.json file', - $resourcesDir - )); - } + define('RESOURCES_DIR', '_resources'); } diff --git a/tests/php/Core/Manifest/ModuleTest.php b/tests/php/Core/Manifest/ModuleTest.php index f4ea2db5a97..36420c5202f 100644 --- a/tests/php/Core/Manifest/ModuleTest.php +++ b/tests/php/Core/Manifest/ModuleTest.php @@ -2,26 +2,11 @@ namespace SilverStripe\Core\Tests\Manifest; -use SilverStripe\Control\Director; use SilverStripe\Core\Manifest\Module; use SilverStripe\Dev\SapphireTest; class ModuleTest extends SapphireTest { - public function testUnsetResourcesDir() - { - $path = __DIR__ . '/fixtures/ss-projects/withoutCustomResourcesDir'; - $module = new Module($path, $path); - $this->assertEquals('', $module->getResourcesDir()); - } - - public function testResourcesDir() - { - $path = __DIR__ . '/fixtures/ss-projects/withCustomResourcesDir'; - $module = new Module($path, $path); - $this->assertEquals('customised-resources-dir', $module->getResourcesDir()); - } - /** * @dataProvider ciConfigProvider * @param string $fixture The folder containing our test composer file diff --git a/tests/php/Core/Manifest/fixtures/ss-projects/withCustomResourcesDir/composer.json b/tests/php/Core/Manifest/fixtures/ss-projects/withCustomResourcesDir/composer.json deleted file mode 100644 index ee9e3ac5f3a..00000000000 --- a/tests/php/Core/Manifest/fixtures/ss-projects/withCustomResourcesDir/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "silverstripe/ss44", - "type": "silverstripe-project", - "description": "Fake project using SS 4.4", - "homepage": "https://www.silverstripe.org", - "license": "BSD-3-Clause", - "require": { - "silverstripe/recipe-cms": "4.4.x-dev as 4.4.0" - }, - "extra": { - "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" - ], - "resources-dir": "customised-resources-dir" - }, - "prefer-stable": true, - "minimum-stability": "dev" -} diff --git a/tests/php/Core/Manifest/fixtures/ss-projects/withoutCustomResourcesDir/composer.json b/tests/php/Core/Manifest/fixtures/ss-projects/withoutCustomResourcesDir/composer.json deleted file mode 100644 index 7f9bd60a8d6..00000000000 --- a/tests/php/Core/Manifest/fixtures/ss-projects/withoutCustomResourcesDir/composer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "silverstripe/ss44", - "type": "silverstripe-project", - "description": "Fake project using SS 4.4", - "homepage": "https://www.silverstripe.org", - "license": "BSD-3-Clause", - "require": { - "silverstripe/recipe-cms": "4.4.x-dev as 4.4.0" - }, - "extra": { - "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" - ] - }, - "prefer-stable": true, - "minimum-stability": "dev" -}