We work within multiple Drupal dev/staging/production environments in which we sync the dev and staging databases to prod quite often. This brings up an issue where the Optimizely ID number that's set on prod can be back-ported to these other environments, messing with test results. Would you be open to a drush command that would set the ID? This would allow us to throw it into the shell file that we run for sync'ing environments. I'd be willing to take a crack at the code for such.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | optimizely-drush-2569691-8.patch | 3.4 KB | SeeWatson |
Comments
Comment #2
DeeZone commentedSounds great, a patch for review would be fantastic.
Comment #3
SeeWatson commentedI see two approaches:
Thoughts? The first seems more sustainable long term, but the second would be more isolated in its changes.
Comment #4
DeeZone commentedI vote for #1, nobody wants DRY in the code :)
Comment #5
DeeZone commentedComment #6
DeeZone commented@SeeWatson Do you plan to submit a patch to add the Drush functionality you're requesting? Otherwise I can add it to the 2.18 maintenance release.
Comment #7
SeeWatson commentedYeah, I'm finishing it up now. I'll post it by tomorrow.
Comment #8
SeeWatson commentedPatch attached.
Comment #9
SeeWatson commentedComment #10
DeeZone commentedComment #11
DeeZone commented@SeeWatcon, looking at optimizely_set_id() in your patch.
What are your use cases? The few that I can think of are:
- set Optimizely ID via Drush when the default project is not enabled. This would require manually enabling the default project via the admin UI. I'm not sure there's value in this considering the need for the manual step.
- set Optimizely ID via Drush when the default project is enabled. This would require clearing a cache_clear_all('*', 'cache_page', TRUE) to apply the change to the site.
Would there be value in a Drush command that enabled/ disables projects by Optimizely project ID? In the case of an initial project this would be the first oid entry but could also support additional project IDs enabled/ disable as well as updating the actual ID?
I've added you patch changes to the dev branch of 7.x-3.x. Depending on your response above I might adjust / expand before releasing.
Thanks for your contribution. Looking forward to your thoughts.
Comment #12
DeeZone commentedComment #13
DeeZone commentedComment #14
SeeWatson commentedOur use case is that we are using Optimizely across dev/staging/production environments and want to be able to swap out the Optimizely project ID for one targeting the environment as we're building the fresh environment. As we're back-syncing the database from prod, the default project will always be enabled with the prod ID, and so we're just looking to swap that ID out. For us, as the environments are built out using a shell file, it would be really helpful to be able to swap that default ID via a Drush terminal command.
I don't ever see us using any custom projects beyond the default as we're using a single project ID across the site, so the ability to enable a project by ID wouldn't be particularly helpful for me in particular. I suppose we could have one project set up for each environment and then disable/enable the one we wanted, but it seems to me that swapping the default ID would be a more efficient solution for that.
I could potentially see an enable/disable by ID being helpful to someone running a domain access multisite setup with different project IDs or for a large organization with different projects with different users or something similar, but I don't think it's core functionality.
Comment #15
DeeZone commented