-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#2745) Cache clear when redirect is created
Closes #2745
- Loading branch information
1 parent
66f8121
commit 40773e6
Showing
8 changed files
with
217 additions
and
5 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,57 @@ | ||
diff --git a/src/Drush/Commands/QueueCommands.php b/src/Drush/Commands/QueueCommands.php | ||
index 38e64bc..604bb6b 100644 | ||
--- a/src/Drush/Commands/QueueCommands.php | ||
+++ b/src/Drush/Commands/QueueCommands.php | ||
@@ -123,6 +123,12 @@ class QueueCommands extends DrushCommands implements SiteAliasManagerAwareInterf | ||
* @hook init p:queue-add | ||
*/ | ||
public function queueAddParseExpressions(InputInterface $input, AnnotationData $annotationData) { | ||
+ // This hook is run twice for some reason, so skip if we have already run. | ||
+ $hasinitHookRunAlready = static::initHookStaticVariable(); | ||
+ if ($hasinitHookRunAlready) { | ||
+ // Already run. | ||
+ return; | ||
+ } | ||
$raw = trim(implode(" ", $input->getArguments()['expressions'])); | ||
$expressions = []; | ||
if ($raw) { | ||
@@ -147,6 +153,15 @@ class QueueCommands extends DrushCommands implements SiteAliasManagerAwareInterf | ||
$input->setArgument('expressions', $expressions); | ||
} | ||
|
||
+ /** | ||
+ * Reset static varaible so command can be called again in same request. | ||
+ * | ||
+ * @hook post-init p:queue-add | ||
+ */ | ||
+ public function queueAddParseExpressionsPostRun(InputInterface $input, AnnotationData $annotationData) { | ||
+ static::initHookStaticVariable(TRUE); | ||
+ } | ||
+ | ||
/** | ||
* Add one or more items to the queue for later processing. | ||
* | ||
@@ -635,4 +650,23 @@ class QueueCommands extends DrushCommands implements SiteAliasManagerAwareInterf | ||
return $result; | ||
} | ||
|
||
+ /** | ||
+ * Provide a init hook static variable tracker. Default return is FALSE. | ||
+ * | ||
+ * @param bool $reset | ||
+ * Reset the staic varibale back to TRUE. Return is unaffected. | ||
+ * | ||
+ * @return bool | ||
+ * The previous static, regardless if reset. | ||
+ */ | ||
+ protected static function initHookStaticVariable($reset = FALSE) { | ||
+ static $hasInitHookRun = FALSE; | ||
+ $old_state = $hasInitHookRun; | ||
+ $hasInitHookRun = TRUE; | ||
+ if ($reset) { | ||
+ $hasInitHookRun = FALSE; | ||
+ } | ||
+ return $old_state; | ||
+ } | ||
+ | ||
} |
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,63 @@ | ||
diff --git a/composer.json b/composer.json | ||
index 08b04a8..3d2a947 100644 | ||
--- a/composer.json | ||
+++ b/composer.json | ||
@@ -12,11 +12,6 @@ | ||
"extra": { | ||
"branch-alias": { | ||
"dev-8.x-3.x": "3.x-dev" | ||
- }, | ||
- "drush": { | ||
- "services": { | ||
- "drush.services.yml": ">=10" | ||
- } | ||
} | ||
} | ||
} | ||
diff --git a/drush.services.yml b/drush.services.yml | ||
deleted file mode 100644 | ||
index f026873..0000000 | ||
--- a/drush.services.yml | ||
+++ /dev/null | ||
@@ -1,41 +0,0 @@ | ||
-services: | ||
- purge_drush.debug_commands: | ||
- class: Drupal\purge\Drush\Commands\DebugCommands | ||
- arguments: ['@purge.logger'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.diagnostics_command: | ||
- class: Drupal\purge\Drush\Commands\DiagnosticsCommand | ||
- arguments: ['@purge.diagnostics'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.invalidate_command: | ||
- class: Drupal\purge\Drush\Commands\InvalidateCommand | ||
- arguments: ['@purge.invalidation.factory', '@purge.processors', '@purge.purgers'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.processor_commands: | ||
- class: Drupal\purge\Drush\Commands\ProcessorCommands | ||
- arguments: ['@purge.processors'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.purger_commands: | ||
- class: Drupal\purge\Drush\Commands\PurgerCommands | ||
- arguments: ['@purge.purgers'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.queue_commands: | ||
- class: Drupal\purge\Drush\Commands\QueueCommands | ||
- arguments: ['@purge.processors', '@purge.purgers', '@purge.invalidation.factory', '@purge.queue', '@purge.queue.stats', '@purge.queuers'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.queuer_commands: | ||
- class: Drupal\purge\Drush\Commands\QueuerCommands | ||
- arguments: ['@purge.queuers'] | ||
- tags: | ||
- - { name: drush.command } | ||
- purge_drush.types_command: | ||
- class: Drupal\purge\Drush\Commands\TypesCommand | ||
- arguments: ['@purge.invalidation.factory', '@purge.purgers'] | ||
- tags: | ||
- - { name: drush.command } |