Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Remove configuration of _resources path #10433

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/Core/Manifest/ManifestFileFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 0 additions & 14 deletions src/Core/Manifest/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
14 changes: 2 additions & 12 deletions src/includes/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
}
15 changes: 0 additions & 15 deletions tests/php/Core/Manifest/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

This file was deleted.

This file was deleted.