Skip to content
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

Conversation

aweingarten
Copy link
Contributor

See issue: #16

Will probably bite the bullet and add automated tests here before merging.

@aweingarten aweingarten force-pushed the cloudflare-service-aw1 branch 7 times, most recently from 08c352b to 17bac23 Compare September 29, 2015 10:07
@@ -11,3 +11,8 @@ services:
arguments: ['%cloudflare.cache_tag_header_limit%']
tags:
- { name: event_subscriber }
cloudflare:
Copy link
Contributor

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

Copy link
Contributor Author

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

@@ -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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

@aweingarten aweingarten force-pushed the cloudflare-service-aw1 branch 18 times, most recently from 7e5bc57 to 8b9c159 Compare October 16, 2015 13:37

catch (CloudFlareHttpException $e) {
drupal_set_message("Unable to clear zone cache." . $e->getMessage(), 'error');
\Drupal::logger('cloudflare')->error($e->getMessage());
Copy link
Contributor Author

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.

// 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');
Copy link
Contributor

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.

@wimleers
Copy link
Contributor

I think it may be helpful for us to get on an architecture call, perhaps with @nielsvm as well.

@aweingarten
Copy link
Contributor Author

closing in favor of #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants