/** * Test creating logging schema when database is in multilingual mode. * Also test altering a multilingual table. */ public function testMultilingualAlterSchemaLogging() { CRM_Core_I18n_Schema::makeMultilingual('en_US'); $logging = new CRM_Logging_Schema(); $logging->enableLogging(); $value = CRM_Core_DAO::singleValueQuery("SELECT id FROM log_civicrm_contact LIMIT 1", array(), FALSE, FALSE); $this->assertNotNull($value, 'Logging not enabled successfully'); $logging->disableLogging(); CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` ADD COLUMN `logging_test` INT DEFAULT NULL", array(), FALSE, NULL, FALSE, TRUE); CRM_Core_I18n_Schema::rebuildMultilingualSchema(array('en_US')); $logging->enableLogging(); $query = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE `log_civicrm_option_value`", array(), TRUE, NULL, FALSE, FALSE); $query->fetch(); $create = explode("\n", $query->Create_Table); CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` DROP COLUMN `logging_test`", array(), FALSE, NULL, FALSE, TRUE); $this->assertTrue(in_array(" `logging_test` int(11) DEFAULT NULL", $create)); $logging->disableLogging(); }
public function postProcess() { parent::postProcess(); // handle logging // FIXME: do it only if the setting changed require_once 'CRM/Logging/Schema.php'; $values = $this->exportValues(); $logging = new CRM_Logging_Schema(); $values['logging'] ? $logging->enableLogging() : $logging->disableLogging(); }
/** * Setting Callback - On Change. * * Respond to changes in the "logging" setting. Set up or destroy * triggers, etal. * * @param array $oldValue * List of component names. * @param array $newValue * List of component names. * @param array $metadata * Specification of the setting (per *.settings.php). */ public static function onToggle($oldValue, $newValue, $metadata) { if ($oldValue == $newValue) { return; } $logging = new CRM_Logging_Schema(); if ($newValue) { $logging->enableLogging(); } else { $logging->disableLogging(); } }
public function postProcess() { // store the submitted values in an array $config = CRM_Core_Config::singleton(); $params = $this->controller->exportValues($this->_name); // get current logging status $values = $this->exportValues(); parent::postProcess(); if ($config->logging != $values['logging']) { $logging = new CRM_Logging_Schema(); if ($values['logging']) { $logging->enableLogging(); } else { $logging->disableLogging(); } } }
public function postProcess() { // store the submitted values in an array $config = CRM_Core_Config::singleton(); $params = $this->controller->exportValues($this->_name); // update upload max size in DB $params['maxImportFileSize'] = CRM_Core_Config_Defaults::formatUnitSize(ini_get('upload_max_filesize')); CRM_Core_BAO_ConfigSetting::create($params); // get current logging status $values = $this->exportValues(); parent::postProcess(); if ($config->logging != $values['logging']) { $logging = new CRM_Logging_Schema(); if ($values['logging']) { $logging->enableLogging(); } else { $logging->disableLogging(); } } }