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

Cache Library Clean-up #3804

Merged
merged 6 commits into from
Apr 29, 2015
Merged

Cache Library Clean-up #3804

merged 6 commits into from
Apr 29, 2015

Conversation

refringe
Copy link
Contributor

Continuation of #3800. I accidentally deleted the branch and GitHub won't update the old PR anymore.

This reverts the previous variable renaming and removes the foreach loop in favour of an if condition.

Tyler Brownell and others added 4 commits April 23, 2015 15:11
- Comments!
- Updates the cache library to validate *both* adapters.
- No longer attempts to set an undefined "memcached" class variable.
- $key variable renamed to $driver_type (more descriptive).
);

foreach ($default_config as $key)
if (isset($config['adapter']) && in_array($config['adapter'], $this->valid_drivers))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will silently ignore any invalid driver and keep the library working with the 'dummy' one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added an "error" level log_message call for invalid adapters, both primary and back-up. Let me know if you had something else in mind.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did ... you shouldn't have added the in_array() condition in the first place. Validation of the driver is done later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already there for the back-up adapter, I just added it for the primary adapter as well.

Validation of the driver is done later.

I assume by that you mean the is_supported function? That doesn't currently validate that the user has set a valid adapter, just that the adapter that's set is usable; is memcached actually installed? Taking the in_array() checks against the $valid_drivers array out would allow a user to set the adapter to one that doesn't exist causing an error when the is_supported adapter function is called on L266.

What are your thoughts on scrapping the $valid_drivers array and rewriting the is_supported function to fail gracefully if the adapter doesn't exist? These conditions would give the user fair warning that something is not correct. It's simple and arguably easier to add a custom written adapter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditions that you linked in your last paragraph are what makes the validity checks ... the logic that you're now introducing already exists in there - that's what I meant with my previous comment.

As for the $valid_drivers array ... maybe, I'm not really happy with it being user-configurable.

@refringe
Copy link
Contributor Author

I'm still getting accustomed to the CI core... I can see now that the driver validation is already happening (for both primary and back-up drivers) in the system Driver library.

This pull:

  • Removes the for loop that attempted to set an invalid _memcached variable.
  • Removes the extra validation on the back-up driver.

Let me know if there's anything else needed.

@refringe
Copy link
Contributor Author

@narfbg Any idea why the build is failing?

@narfbg
Copy link
Contributor

narfbg commented Apr 29, 2015

Unrelated ... Travis is having some issues with MySQL.

narfbg added a commit that referenced this pull request Apr 29, 2015
@narfbg narfbg merged commit b938f94 into bcit-ci:develop Apr 29, 2015
@narfbg narfbg added this to the 3.0.1 milestone Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants