-
Notifications
You must be signed in to change notification settings - Fork 14
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
CloudFlare Added Drupal Service Container #26
CloudFlare Added Drupal Service Container #26
Conversation
08c352b
to
17bac23
Compare
@@ -11,3 +11,8 @@ services: | |||
arguments: ['%cloudflare.cache_tag_header_limit%'] | |||
tags: | |||
- { name: event_subscriber } | |||
cloudflare: |
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.
i'd rename this cloudflare.service
One think you can think of is "what" the service is doing. Maybe its a manager or maybe its an engine or something. But, you may have a better term for this than service which is generic
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.
I buy into the namespacing in the name. Is .service any better than no namespace? If this is the paradigm we are buying into it probably needs to be a little more descriptive. cloudflare.basicsettings
and cloudflare.invalidator
17bac23
to
a6bedd0
Compare
@@ -102,37 +102,7 @@ public function validatePathClear(array &$form, FormStateInterface $form_state) | |||
* The current state of the form. | |||
*/ | |||
public function purgeEntireZone(array &$form, FormStateInterface $form_state) { |
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.
This seems odd to me... a function with a one line call back?
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.
yes! This is actually legit
7e5bc57
to
8b9c159
Compare
|
||
catch (CloudFlareHttpException $e) { | ||
drupal_set_message("Unable to clear zone cache." . $e->getMessage(), 'error'); | ||
\Drupal::logger('cloudflare')->error($e->getMessage()); |
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.
Need to use the injected logger.
…ction. Purge functionality was deliberately not made into a service, as this should only be used via the purge module which will access that functionality via plugins.
8b9c159
to
4b586f9
Compare
|
||
// If no exceptions have been thrown then the request has been successful. | ||
drupal_set_message("The zone: $zone was successfully cleared."); | ||
$cloudflare_config = \Drupal::service('cloudflare.config'); |
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.
This service should be injected.
I think it may be helpful for us to get on an architecture call, perhaps with @nielsvm as well. |
closing in favor of #26 |
See issue: #16
Will probably bite the bullet and add automated tests here before merging.