Skip to content

Commit

Permalink
[4.x] Ability to provide additional urls for static:warm (#9303)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
ryanmitchell and jasonvarga authored Mar 22, 2024
1 parent 7de4b4a commit f127b50
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Console/Commands/StaticWarm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
use Statamic\Http\Controllers\FrontendController;
use Statamic\StaticCaching\Cacher as StaticCacher;
use Statamic\Support\Str;
use Statamic\Support\Traits\Hookable;
use Statamic\Taxonomies\LocalizedTerm;
use Statamic\Taxonomies\Taxonomy;

class StaticWarm extends Command
{
use EnhancesCommands;
use Hookable;
use RunsInPlease;

protected $signature = 'statamic:static:warm
Expand Down Expand Up @@ -163,6 +165,7 @@ private function uris(): Collection
->merge($this->taxonomyUris())
->merge($this->termUris())
->merge($this->customRouteUris())
->merge($this->additionalUris())
->unique()
->reject(function ($uri) use ($cacher) {
return $cacher->isExcluded($uri);
Expand Down Expand Up @@ -279,4 +282,15 @@ protected function customRouteUris(): Collection

return $routes;
}

protected function additionalUris(): Collection
{
$this->line('[ ] Additional...');

$uris = $this->runHooks('additional', collect());

$this->line("\x1B[1A\x1B[2K<info>[✔]</info> Additional");

return $uris->map(fn ($uri) => URL::makeAbsolute($uri));
}
}

0 comments on commit f127b50

Please sign in to comment.