-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYNC] [FAU-405] feat: flush rewrite rules after cache warming for th…
…e consuming website (#139) Co-authored-by: Philipp Bammes <[email protected]>
- Loading branch information
1 parent
d213525
commit 3c4226d
Showing
7 changed files
with
112 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fau\DegreeProgram\Output\Infrastructure\Rewrite; | ||
|
||
use Fau\DegreeProgram\Common\Application\Queue\Message; | ||
|
||
final class FlushRewriteRulesMessage implements Message | ||
{ | ||
private function __construct() | ||
{ | ||
} | ||
|
||
public static function new(): self | ||
{ | ||
return new self(); | ||
} | ||
|
||
public static function fromArray(array $array): static | ||
{ | ||
return new self(); | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
return []; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Infrastructure/Rewrite/FlushRewriteRulesMessageHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fau\DegreeProgram\Output\Infrastructure\Rewrite; | ||
|
||
use Psr\Log\LoggerInterface; | ||
|
||
final class FlushRewriteRulesMessageHandler | ||
{ | ||
public function __construct( | ||
private LoggerInterface $logger, | ||
) { | ||
} | ||
|
||
public function __invoke(): void | ||
{ | ||
flush_rewrite_rules(); | ||
|
||
$this->logger->info('Rewrite rules flushed.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fau\DegreeProgram\Output\Infrastructure\Rewrite; | ||
|
||
use Fau\DegreeProgram\Common\Application\Queue\MessageBus; | ||
|
||
final class WhenCacheWarmed | ||
{ | ||
public function __construct( | ||
private MessageBus $messageBus, | ||
) { | ||
} | ||
|
||
public function scheduleFlushRewriting(): void | ||
{ | ||
$this->messageBus->dispatch( | ||
FlushRewriteRulesMessage::new(), | ||
); | ||
} | ||
} |