-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Crm 18231 Create provision for testing environment variable #8132
Conversation
---------------------------------------- * CRM-18231: Create provision for testing environment variable https://issues.civicrm.org/jira/browse/CRM-18231
---------------------------------------- * CRM-18231: Create provision for testing environment variable https://issues.civicrm.org/jira/browse/CRM-18231
…ule job page ---------------------------------------- * CRM-18231: https://issues.civicrm.org/jira/browse/CRM-18231
… in civicrm.settings.php file ---------------------------------------- * CRM-18231: https://issues.civicrm.org/jira/browse/CRM-18231
…turned off ---------------------------------------- * CRM-18231: Create provision for testing environment variable https://issues.civicrm.org/jira/browse/CRM-18231
---------------------------------------- * CRM-18231: https://issues.civicrm.org/jira/browse/CRM-18231
---------------------------------------- * CRM-18231: Create provision for testing environment variable https://issues.civicrm.org/jira/browse/CRM-18231
---------------------------------------- * CRM-18231: Create provision for testing environment variable https://issues.civicrm.org/jira/browse/CRM-18231
test this please |
@eileenmcnaughton can you please review this for us? |
Hi Pradeep, I had hoped to bring it into this months QA cycle but there was too much to get through. I checked with Monish because if you had put in a lot of work already this month but he wasn't aware of you having done that so I decided it makes more sense to push it to next month than for me to stay up late to get it done |
public function postProcess() { | ||
$params = $this->controller->exportValues($this->_name); | ||
|
||
if ($params['isProductionEnvironment'] === FALSE) { |
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.
One thing I did notices is that this is happening in the form - which is not correct, it should work via the api too - take a look at how the logging setting works for how to not do it in the form layer.
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.
@eileenmcnaughton I'm not quite sure what you are getting at here: isn't Civi::settings()->set() merely a wrapper for functionality also exposed via API wrapper? Or is your concern that the success message should be bubbled up from something the API calls too?
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 mean - I wasn't expecting the call backs relevant to this setting to be doing any thing in the form layer. ie. this is setting a setting in the form post process hook - if you look at the logging setting, by contrast, disabling & enabling the field has a callback that does the needed, regardless where it is called from
NB - I don't have time to do a full QA but I think there is a lot to like here - it's well tested and I can see the idea is that if you want to test scheduled jobs etc you need to make sure it's set to production which definitely has merit. One hesitation I have is that it feels like it should be isDevelopment or even environment to allow for the possibility of more options, but I'm waivering a bit on that. I think equating isProduction unset with isProduction = FALSE would be flakey on 4.6 but it might not be on 4.7. A few things probably worth doing
|
👍 to Eileen's comments above - both that I love the direction, and that IMO Sorry for coming into the discussion a month later but hadn't had this appear on my radar until now! |
@@ -142,6 +142,10 @@ public function run() { | |||
* @param null $action | |||
*/ | |||
public function browse($action = NULL) { | |||
// check if non-prod mode is enabled. | |||
if (Civi::settings()->get('isProductionEnvironment') === FALSE) { | |||
CRM_Core_Session::setStatus(ts('Execution of scheduled jobs have been turned off.'), ts("Non-production Environment"), "warning", array('expires' => 0)); |
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.
Just to be precise about things: when production environment is toggled off, execution of scheduled jobs is turned off by default, BUT parameters on jobs can override this. So please change message to 'Execution of scheduled jobs has been turned off by default since this is a non-production environment. You can override this for particular jobs by adding runInNonProductionEnvironment=TRUE as a parameter.'
@eileenmcnaughton sorry I didn't see you comments till now. I think it is appropriate that when JMA didn't put in the volunteer time as promised in April that you didn't put in extra effort on this. Our bad. Would have been nice to see it included in list for May. @totten thank for putting on list for June. I think the default value for whatever the new setting is called should be production. I considered increasing scope to put in staging/dev/test, but a) could not see any differences for our current use cases amongst the non-production environments, and b) didn't want to gold-plate especially since this not fully funded by client (http://www.projectmanagementlearning.com/what-is-gold-plating-in-project-management.html). I'd be happy to see this develop in the future, but feel it addresses something useful as it is. I see @xurizaemon also agrees, so now I'm on the fence about refactoring to support more values than just true false.
|
|
||
if ($params['isProductionEnvironment'] === FALSE) { | ||
Civi::settings()->set('mailing_backend', array('outBound_option' => CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED)); | ||
CRM_Core_Session::setStatus(ts('Outbound emails have been disabled. Scheduled jobs have been prevented from being executed.'), ts("Non-production environment set"), "success"); |
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.
Please change message to ''Outbound emails have been disabled. Scheduled jobs will not run unless runInNonProductionEnvironment=TRUE is added as a parameter for a specific job"
Closing by request of @JoeMurray as spec is revised |
No description provided.