-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add cache warmup #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| "runLocally", | ||
| "set", | ||
| "task", | ||
| "test" | ||
| "test", | ||
| "has" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| namespace Deployer; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // cache warmup | ||||||||||||||||||||||||||||||
| task('cache:warmup', function () { | ||||||||||||||||||||||||||||||
| $siteConfig = has('site_config') ? get('site_config') : 'main'; | ||||||||||||||||||||||||||||||
| $activeDir = test('[ -e {{deploy_path}}/release ]') ? | ||||||||||||||||||||||||||||||
| get('deploy_path') . '/release' : | ||||||||||||||||||||||||||||||
| get('deploy_path') . '/current'; | ||||||||||||||||||||||||||||||
| runExtended('cd ' . $activeDir . ' && {{bin/php}} {{bin/typo3cms}} warming:cachewarmup -s ' . $siteConfig); | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add validation for the typo3-warming extension dependency. The task uses the - runExtended('cd ' . $activeDir . ' && {{bin/php}} {{bin/typo3cms}} warming:cachewarmup -s ' . $siteConfig);
+ // Check if typo3-warming extension is available
+ $extensionCheck = runExtended('cd ' . $activeDir . ' && {{bin/php}} {{bin/typo3cms}} extension:list --raw | grep -q "^warming"', ['no_throw' => true]);
+ if ($extensionCheck === '') {
+ throw new \Exception('EXT:typo3-warming extension is required for cache warmup but not found.');
+ }
+ runExtended('cd ' . $activeDir . ' && {{bin/php}} {{bin/typo3cms}} warming:cachewarmup -s ' . $siteConfig);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| before('cache:warmup', 'feature:init'); | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the hook direction - this runs feature:init before cache:warmup, not after. The current hook -before('cache:warmup', 'feature:init');
+before('feature:init', 'cache:warmup');🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider validating site_config parameter.
The site config parameter should be validated or escaped to prevent potential command injection issues.
🤖 Prompt for AI Agents