diff --git a/src/Entries/Entry.php b/src/Entries/Entry.php index 3fce626f1e4..98fb411f775 100644 --- a/src/Entries/Entry.php +++ b/src/Entries/Entry.php @@ -821,14 +821,6 @@ public function existsIn($locale) return $this->in($locale) !== null; } - /** @deprecated */ - public function addLocalization($entry) - { - $entry->origin($this); - - return $this; - } - public function makeLocalization($site) { $localization = Facades\Entry::make() diff --git a/src/Http/Controllers/API/ApiController.php b/src/Http/Controllers/API/ApiController.php index dfd61b05fab..562c00842b5 100644 --- a/src/Http/Controllers/API/ApiController.php +++ b/src/Http/Controllers/API/ApiController.php @@ -77,19 +77,6 @@ protected function filterAllowedResources($items) return $items->filter(fn ($item) => in_array($item->handle(), $allowedResources)); } - /** - * Filter, sort, and paginate query for API resource output. - * - * @param \Statamic\Query\Builder $query - * @return \Statamic\Extensions\Pagination\LengthAwarePaginator - * - * @deprecated - */ - protected function filterSortAndPaginate($query) - { - return $this->updateAndPaginate($query); - } - /** * Filter, sort, scope, and paginate query for API resource output. * diff --git a/src/Providers/CacheServiceProvider.php b/src/Providers/CacheServiceProvider.php index 064d2b88126..8acd405e999 100644 --- a/src/Providers/CacheServiceProvider.php +++ b/src/Providers/CacheServiceProvider.php @@ -37,15 +37,6 @@ public function boot() private function extendFileStore() { $this->app->booting(function () { - /** @deprecated */ - Cache::extend('statamic', function () { - return Cache::repository(new FileStore( - $this->app['files'], - $this->app['config']['cache.stores.file']['path'], - $this->app['config']['cache.stores.file']['permission'] ?? null - ), $this->app['config']['cache.stores.file']); - }); - // Don't extend the file store if it's already being extended. $creators = (fn () => $this->customCreators)->call(Cache::getFacadeRoot()); if (isset($creators['file'])) { diff --git a/src/StarterKits/ExportableModule.php b/src/StarterKits/ExportableModule.php index 2f972d383fc..dc8d8c54df9 100644 --- a/src/StarterKits/ExportableModule.php +++ b/src/StarterKits/ExportableModule.php @@ -36,14 +36,6 @@ public function export(string $starterKitPath): void from: $path, starterKitPath: $starterKitPath, )); - - $this - ->exportAsPaths() - ->each(fn ($to, $from) => $this->exportRelativePath( - from: $from, - to: $to, - starterKitPath: $starterKitPath, - )); } public function versionDependencies(): self @@ -105,18 +97,13 @@ protected function exportDependenciesFromComposerRequire(string $requireKey, Col */ protected function ensureNotExportingComposerJson(): self { - // Here we'll ensure both `export_as` values and keys are included, - // because we want to make sure `composer.json` is referenced on either end. - $flattenedExportPaths = $this - ->exportPaths() - ->merge($this->exportAsPaths()) - ->merge($this->exportAsPaths()->keys()); + $paths = $this->exportPaths(); - if ($flattenedExportPaths->contains('starter-kit.yaml')) { + if ($paths->contains('starter-kit.yaml')) { throw new StarterKitException('Cannot export [starter-kit.yaml] config.'); } - if ($flattenedExportPaths->contains('composer.json')) { + if ($paths->contains('composer.json')) { throw new StarterKitException('Cannot export [composer.json]. Please use `dependencies` array.'); } @@ -132,7 +119,6 @@ protected function ensureExportablePathsExist(): self { $this ->exportPaths() - ->merge($this->exportAsPaths()->keys()) ->reject(fn ($path) => $this->files->exists(base_path($path))) ->each(function ($path) { throw new StarterKitException("Cannot export [{$path}], because it does not exist in your app."); diff --git a/src/StarterKits/Exporter.php b/src/StarterKits/Exporter.php index fd2bbf0d55e..91000875374 100644 --- a/src/StarterKits/Exporter.php +++ b/src/StarterKits/Exporter.php @@ -205,7 +205,6 @@ protected function syncConfigWithModules(): Collection $normalizedModuleKeyOrder = [ 'export_paths', - 'export_as', 'dependencies', 'dependencies_dev', 'modules', diff --git a/src/StarterKits/InstallableModule.php b/src/StarterKits/InstallableModule.php index c11923d76ba..fb42f5503b4 100644 --- a/src/StarterKits/InstallableModule.php +++ b/src/StarterKits/InstallableModule.php @@ -104,18 +104,9 @@ protected function installDependencies(): self */ protected function installableFiles(): Collection { - $installableFromExportPaths = $this + return $this ->exportPaths() ->flatMap(fn ($path) => $this->expandExportDirectoriesToFiles($path)); - - $installableFromExportAsPaths = $this - ->exportAsPaths() - ->flip() - ->flatMap(fn ($to, $from) => $this->expandExportDirectoriesToFiles($to, $from)); - - return collect() - ->merge($installableFromExportPaths) - ->merge($installableFromExportAsPaths); } /** @@ -196,7 +187,6 @@ protected function ensureInstallableFilesExist(): self { $this ->exportPaths() - ->merge($this->exportAsPaths()) ->reject(fn ($path) => $this->files->exists($this->installableFilesPath($path))) ->each(function ($path) { throw new StarterKitException("Starter kit path [{$path}] does not exist."); diff --git a/src/StarterKits/Module.php b/src/StarterKits/Module.php index 3959b34fb2e..51af069053d 100644 --- a/src/StarterKits/Module.php +++ b/src/StarterKits/Module.php @@ -62,18 +62,6 @@ protected function exportPaths(): Collection return collect($this->config('export_paths') ?? []); } - /** - * Get `export_as` paths (to be renamed on install) as collection from config. - * - * This is only here for backwards compatibility. Use new `export` folder convention instead. - * - * @deprecated - */ - protected function exportAsPaths(): Collection - { - return collect($this->config('export_as') ?? []); - } - /** * Ensure nested module config is not empty. * @@ -82,7 +70,6 @@ protected function exportAsPaths(): Collection protected function ensureModuleConfigNotEmpty(): self { $hasConfig = $this->config()->has('export_paths') - || $this->config()->has('export_as') || $this->config()->has('dependencies') || $this->config()->has('dependencies_dev') || $this->config()->has('modules'); diff --git a/tests/StarterKits/ExportTest.php b/tests/StarterKits/ExportTest.php index 6f51a373fad..e74952c2e36 100644 --- a/tests/StarterKits/ExportTest.php +++ b/tests/StarterKits/ExportTest.php @@ -129,42 +129,6 @@ public function it_can_export_folders() $this->assertFileDoesNotExist($this->exportPath('resources/js')); } - #[Test] - public function it_can_still_export_as_to_different_destination_path_for_backwards_compatibility() - { - $paths = $this->cleanPaths([ - base_path('README.md'), - base_path('test-folder'), - ]); - - $this->files->put(base_path('README.md'), 'This is readme for the new site!'); - $this->files->makeDirectory(base_path('test-folder')); - $this->files->put(base_path('test-folder/one.txt'), 'One.'); - $this->files->put(base_path('test-folder/two.txt'), 'Two.'); - - $this->setExportPaths([], [ - 'README.md' => 'README-new-site.md', - 'test-folder' => 'test-renamed-folder', - ]); - - $this->assertFileDoesNotExist($renamedFile = $this->exportPath('README-new-site.md')); - $this->assertFileDoesNotExist($renamedFolder = $this->exportPath('test-renamed-folder')); - - $this->exportCoolRunnings(); - - $this->assertFileExists($renamedFile); - $this->assertFileExists($renamedFolder); - - $this->assertFileDoesNotExist($this->exportPath('README.md')); // This got renamed above - $this->assertFileDoesNotExist($this->exportPath('test-folder')); // This got renamed above - - $this->assertFileHasContent('This is readme for the new site!', $renamedFile); - $this->assertFileHasContent('One.', $renamedFolder.'/one.txt'); - $this->assertFileHasContent('Two.', $renamedFolder.'/two.txt'); - - $this->cleanPaths($paths); - } - #[Test] public function it_can_clear_target_export_path_with_clear_option() { @@ -593,15 +557,15 @@ public function it_can_export_module_files() ], ], 'ssg' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'resources/views/you-are-so-welcome.blade.php', + 'export_paths' => [ + 'resources/views/welcome.blade.php', ], ], ], ]); $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); - $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/you-are-so-welcome.blade.php')); + $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/welcome.blade.php')); $this->exportCoolRunnings(); @@ -623,8 +587,8 @@ public function it_can_export_nested_module_files() ], 'modules' => [ 'ssg' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'resources/views/you-are-so-welcome.blade.php', + 'export_paths' => [ + 'resources/views/welcome.blade.php', ], ], ], @@ -633,7 +597,7 @@ public function it_can_export_nested_module_files() ]); $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); - $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/you-are-so-welcome.blade.php')); + $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/welcome.blade.php')); $this->exportCoolRunnings(); @@ -657,8 +621,8 @@ public function it_can_export_select_module_files() ], ], 'react' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'resources/views/you-are-so-welcome.blade.php', + 'export_paths' => [ + 'resources/views/welcome.blade.php', ], ], ], @@ -667,7 +631,7 @@ public function it_can_export_select_module_files() ]); $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); - $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/you-are-so-welcome.blade.php')); + $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/welcome.blade.php')); $this->exportCoolRunnings(); @@ -698,8 +662,8 @@ public function it_can_export_nested_select_module_files() ], ], 'react' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'resources/views/you-are-so-welcome.blade.php', + 'export_paths' => [ + 'resources/views/welcome.blade.php', ], ], ], @@ -709,7 +673,7 @@ public function it_can_export_nested_select_module_files() $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); $this->assertFileDoesNotExist($appConfig = $this->exportPath('config/app.php')); - $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/you-are-so-welcome.blade.php')); + $this->assertFileDoesNotExist($welcomeView = $this->exportPath('resources/views/welcome.blade.php')); $this->exportCoolRunnings(); @@ -1044,11 +1008,6 @@ public static function validModuleConfigs() 'resources/views/welcome.blade.php', ], ]], - 'export as paths' => [[ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'resources/js/vue.js', - ], - ]], 'dependencies' => [[ 'dependencies' => [ 'statamic/seo-pro' => '^1.0', @@ -1091,11 +1050,6 @@ public static function nonExistentExportPaths() 'non-existent.txt', ], ]], - 'top level export as from' => [[ - 'export_as' => [ - 'non-existent.txt' => 'resources/views/welcome.blade.php', - ], - ]], 'module export' => [[ 'modules' => [ 'seo' => [ @@ -1105,15 +1059,6 @@ public static function nonExistentExportPaths() ], ], ]], - 'module export as from' => [[ - 'modules' => [ - 'seo' => [ - 'export_as' => [ - 'non-existent.txt' => 'resources/views/welcome.blade.php', - ], - ], - ], - ]], 'select module export' => [[ 'modules' => [ 'js' => [ @@ -1127,19 +1072,6 @@ public static function nonExistentExportPaths() ], ], ]], - 'select module export as from' => [[ - 'modules' => [ - 'js' => [ - 'options' => [ - 'vue' => [ - 'export_as' => [ - 'non-existent.txt' => 'resources/views/welcome.blade.php', - ], - ], - ], - ], - ], - ]], ]; } @@ -1235,16 +1167,6 @@ public static function configsExportingStarterKitYaml() 'starter-kit.yaml', ], ]], - 'top level export as from' => [[ - 'export_as' => [ - 'starter-kit.yaml' => 'resources/views/welcome.blade.php', - ], - ]], - 'top level export as to' => [[ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'starter-kit.yaml', - ], - ]], 'module export' => [[ 'modules' => [ 'seo' => [ @@ -1254,24 +1176,6 @@ public static function configsExportingStarterKitYaml() ], ], ]], - 'module export as from' => [[ - 'modules' => [ - 'seo' => [ - 'export_as' => [ - 'starter-kit.yaml' => 'resources/views/welcome.blade.php', - ], - ], - ], - ]], - 'module export as to' => [[ - 'modules' => [ - 'seo' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'starter-kit.yaml', - ], - ], - ], - ]], 'select module export' => [[ 'modules' => [ 'js' => [ @@ -1285,32 +1189,6 @@ public static function configsExportingStarterKitYaml() ], ], ]], - 'select module export as from' => [[ - 'modules' => [ - 'js' => [ - 'options' => [ - 'vue' => [ - 'export_as' => [ - 'starter-kit.yaml' => 'resources/views/welcome.blade.php', - ], - ], - ], - ], - ], - ]], - 'select module export as to' => [[ - 'modules' => [ - 'js' => [ - 'options' => [ - 'vue' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'starter-kit.yaml', - ], - ], - ], - ], - ], - ]], ]; } @@ -1334,16 +1212,6 @@ public static function configsExportingComposerJson() 'composer.json', ], ]], - 'top level export as from' => [[ - 'export_as' => [ - 'composer.json' => 'resources/views/welcome.blade.php', - ], - ]], - 'top level export as to' => [[ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'composer.json', - ], - ]], 'module export' => [[ 'modules' => [ 'seo' => [ @@ -1353,24 +1221,6 @@ public static function configsExportingComposerJson() ], ], ]], - 'module export as from' => [[ - 'modules' => [ - 'seo' => [ - 'export_as' => [ - 'composer.json' => 'resources/views/welcome.blade.php', - ], - ], - ], - ]], - 'module export as to' => [[ - 'modules' => [ - 'seo' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'composer.json', - ], - ], - ], - ]], 'select module export' => [[ 'modules' => [ 'js' => [ @@ -1384,32 +1234,6 @@ public static function configsExportingComposerJson() ], ], ]], - 'select module export as from' => [[ - 'modules' => [ - 'js' => [ - 'options' => [ - 'vue' => [ - 'export_as' => [ - 'composer.json' => 'resources/views/welcome.blade.php', - ], - ], - ], - ], - ], - ]], - 'select module export as to' => [[ - 'modules' => [ - 'js' => [ - 'options' => [ - 'vue' => [ - 'export_as' => [ - 'resources/views/welcome.blade.php' => 'composer.json', - ], - ], - ], - ], - ], - ]], ]; } @@ -1455,14 +1279,12 @@ public function it_normalizes_module_key_order() 'statamic/ssg', ], 'prompt' => false, - 'export_as' => [ - 'README.md' => 'README-new-site.md', - ], 'dependencies' => [ 'statamic/seo-pro', ], 'export_paths' => [ 'resources/views', + 'README.md', ], ], 'js' => [ @@ -1491,14 +1313,12 @@ public function it_normalizes_module_key_order() ], ], ], - 'export_as' => [ - 'test-folder' => 'test-renamed-folder', - ], 'dependencies_dev' => [ 'statamic/ssg', ], 'export_paths' => [ 'config/filesystems.php', + 'test-folder', ], ]); @@ -1507,9 +1327,7 @@ public function it_normalizes_module_key_order() $this->assertConfigSameOrder([ 'export_paths' => [ 'config/filesystems.php', - ], - 'export_as' => [ - 'test-folder' => 'test-renamed-folder', + 'test-folder', ], 'dependencies_dev' => [ 'statamic/ssg' => '^0.4.0', @@ -1519,9 +1337,7 @@ public function it_normalizes_module_key_order() 'prompt' => false, 'export_paths' => [ 'resources/views', - ], - 'export_as' => [ - 'README.md' => 'README-new-site.md', + 'README.md', ], 'dependencies' => [ 'statamic/seo-pro' => '^2.2', @@ -1681,14 +1497,10 @@ private function setConfig($config) } } - private function setExportPaths($paths, $exportAs = null) + private function setExportPaths($paths) { $config['export_paths'] = $paths; - if ($exportAs) { - $config['export_as'] = $exportAs; - } - $this->setConfig($config); } diff --git a/tests/StarterKits/InstallTest.php b/tests/StarterKits/InstallTest.php index 9f4e8a83d98..31beabccd56 100644 --- a/tests/StarterKits/InstallTest.php +++ b/tests/StarterKits/InstallTest.php @@ -118,38 +118,6 @@ public function it_installs_from_export_paths() $this->assertFileHasContent('bobsled_pics', config_path('filesystems.php')); } - #[Test] - public function it_still_installs_from_export_as_paths_for_backwards_compatibility() - { - $this->setConfig([ - 'export_as' => [ - 'README.md' => 'README-for-new-site.md', - 'original-dir' => 'renamed-dir', - ], - ]); - - $this->assertFileDoesNotExist($this->kitVendorPath()); - $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileDoesNotExist($renamedFile = base_path('README.md')); - $this->assertFileDoesNotExist($renamedFolder = base_path('original-dir')); - - $this->installCoolRunnings(); - - $this->assertFalse(Blink::has('starter-kit-repository-added')); - $this->assertFileDoesNotExist($this->kitVendorPath()); - $this->assertFileDoesNotExist(base_path('composer.json.bak')); - $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileExists($renamedFile); - $this->assertFileExists($renamedFolder); - - $this->assertFileDoesNotExist(base_path('README-for-new-site.md')); // This was renamed back to original path on install - $this->assertFileDoesNotExist(base_path('renamed-dir')); // This was renamed back to original path on install - - $this->assertFileHasContent('This readme should get installed to README.md.', $renamedFile); - $this->assertFileHasContent('One.', $renamedFolder.'/one.txt'); - $this->assertFileHasContent('Two.', $renamedFolder.'/two.txt'); - } - #[Test] public function it_installs_from_github() { @@ -864,8 +832,8 @@ public function it_installs_no_modules_by_default_when_running_non_interactively ], ], 'jamaica' => [ - 'export_as' => [ - 'resources/css/theme.css' => 'resources/css/jamaica.css', + 'export_paths' => [ + 'resources/css/jamaica.css', ], ], ], @@ -874,7 +842,7 @@ public function it_installs_no_modules_by_default_when_running_non_interactively $this->assertFileDoesNotExist(base_path('copied.md')); $this->assertFileDoesNotExist(base_path('resources/css/seo.css')); $this->assertFileDoesNotExist(base_path('resources/css/bobsled.css')); - $this->assertFileDoesNotExist(base_path('resources/css/theme.css')); + $this->assertFileDoesNotExist(base_path('resources/css/jamaica.css')); $this->assertComposerJsonDoesntHave('statamic/seo-pro'); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); @@ -883,7 +851,7 @@ public function it_installs_no_modules_by_default_when_running_non_interactively $this->assertFileExists(base_path('copied.md')); $this->assertFileDoesNotExist(base_path('resources/css/seo.css')); $this->assertFileDoesNotExist(base_path('resources/css/bobsled.css')); - $this->assertFileDoesNotExist(base_path('resources/css/theme.css')); + $this->assertFileDoesNotExist(base_path('resources/css/jamaica.css')); $this->assertComposerJsonDoesntHave('statamic/seo-pro'); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); } @@ -921,8 +889,8 @@ public function it_can_still_install_modules_with_prompt_false_or_default_config ], 'jamaica' => [ 'prompt' => false, // Setting `prompt: false` normally skips confirmation and ensures it always gets installed - 'export_as' => [ - 'resources/css/theme.css' => 'resources/css/jamaica.css', + 'export_paths' => [ + 'resources/css/jamaica.css', ], ], 'js' => [ @@ -972,7 +940,7 @@ public function it_can_still_install_modules_with_prompt_false_or_default_config $this->assertFileExists(base_path('resources/css/seo.css')); $this->assertFileExists(base_path('resources/css/hockey.css')); $this->assertFileDoesNotExist(base_path('resources/css/bobsled.css')); - $this->assertFileExists(base_path('resources/css/theme.css')); + $this->assertFileExists(base_path('resources/css/jamaica.css')); $this->assertComposerJsonHasPackageVersion('require', 'statamic/seo-pro', '^0.2.0'); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); $this->assertFileDoesNotExist(base_path('resources/js/react.js')); @@ -1005,8 +973,8 @@ public function it_installs_only_the_modules_confirmed_interactively_via_prompt( ], ], 'jamaica' => [ - 'export_as' => [ - 'resources/css/theme.css' => 'resources/css/jamaica.css', + 'export_paths' => [ + 'resources/css/jamaica.css', ], ], 'js' => [ @@ -1051,7 +1019,7 @@ public function it_installs_only_the_modules_confirmed_interactively_via_prompt( $this->assertFileDoesNotExist(base_path('copied.md')); $this->assertFileDoesNotExist(base_path('resources/css/seo.css')); $this->assertFileDoesNotExist(base_path('resources/css/bobsled.css')); - $this->assertFileDoesNotExist(base_path('resources/css/theme.css')); + $this->assertFileDoesNotExist(base_path('resources/css/jamaica.css')); $this->assertFileDoesNotExist(base_path('resources/js/react.js')); $this->assertFileDoesNotExist(base_path('resources/js/vue.js')); $this->assertFileDoesNotExist(base_path('resources/js/svelte.js')); @@ -1072,7 +1040,7 @@ public function it_installs_only_the_modules_confirmed_interactively_via_prompt( $this->assertFileExists(base_path('copied.md')); $this->assertFileExists(base_path('resources/css/seo.css')); $this->assertFileDoesNotExist(base_path('resources/css/bobsled.css')); - $this->assertFileExists(base_path('resources/css/theme.css')); + $this->assertFileExists(base_path('resources/css/jamaica.css')); $this->assertFileDoesNotExist(base_path('resources/js/react.js')); $this->assertFileExists(base_path('resources/js/vue.js')); $this->assertFileDoesNotExist(base_path('resources/js/svelte.js')); @@ -1390,11 +1358,6 @@ public static function validModuleConfigs() 'copied.md', ], ]], - 'export as paths' => [[ - 'export_as' => [ - 'copied.md' => 'resources/js/vue.js', - ], - ]], 'dependencies' => [[ 'dependencies' => [ 'statamic/seo-pro' => '^1.0', @@ -1577,8 +1540,8 @@ public function it_installs_nested_modules_confirmed_interactively_via_prompt() ], ], 'jamaica' => [ - 'export_as' => [ - 'resources/css/theme.css' => 'resources/css/jamaica.css', + 'export_paths' => [ + 'resources/css/jamaica.css', ], 'modules' => [ 'bobsled' => [ @@ -1634,7 +1597,7 @@ public function it_installs_nested_modules_confirmed_interactively_via_prompt() $this->assertFileDoesNotExist(base_path('resources/js/mootools.js')); $this->assertFileDoesNotExist(base_path('resources/css/hockey.css')); $this->assertFileDoesNotExist(base_path('resources/dictionaries/players.yaml')); - $this->assertFileExists(base_path('resources/css/theme.css')); + $this->assertFileExists(base_path('resources/css/jamaica.css')); $this->assertFileExists(base_path('resources/css/bobsled.css')); $this->assertComposerJsonHasPackageVersion('require', 'bobsled/speed-calculator', '^1.0.0'); }