}
parent::buildQuickForm();
-
- if (defined('CIVICRM_ENVIRONMENT')) {
+ if (Civi::settings()->getMandatory('environment') !== NULL) {
$element = $this->getElement('environment');
$element->freeze();
CRM_Core_Session::setStatus(ts('The environment settings have been disabled because it has been overridden in the settings file.'), ts('Environment settings'), 'info');
$environment = $env;
}
if ($reset || empty($environment)) {
- if (defined('CIVICRM_ENVIRONMENT')) {
- $environment = CIVICRM_ENVIRONMENT;
- global $civicrm_setting;
- $civicrm_setting[CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME]['environment'] = $environment;
- }
- else {
- $environment = Civi::settings()->get('environment');
- }
+ $environment = Civi::settings()->get('environment');
}
if (!$environment) {
$environment = 'Production';
* Note the setting here must be value from the option group 'Environment',
* (see Administration > System Settings > Option Groups, Options beside Environment)
* which by default has three option values: 'Production', 'Staging', 'Development'.
- * NB: defining a value from CIVICRM_ENVIRONMENT here prevents it from being set
+ * NB: defining a value for environment here prevents it from being set
* via the browser.
*/
-
-// define( 'CIVICRM_ENVIRONMENT', 'Production' );
+// $civicrm_setting[CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME]['environment'] = 'Production';
/**
* Settings to enable external caching using a cache server. This is an
CRM_Core_BAO_Setting::setItem('Staging', CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, 'environment');
$values = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, 'environment');
$this->assertEquals('Staging', $values);
-
- define('CIVICRM_ENVIRONMENT', 'Development');
+ global $civicrm_setting;
+ $civicrm_setting[CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME]['environment'] = 'Development';
+ Civi::service('settings_manager')->useMandatory();
$environment = CRM_Core_Config::environment();
$this->assertEquals('Development', $environment);
}