+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Logging_Schema {
private $logs = array();
}
\Civi::$statics[__CLASS__]['columnsOf'][$table] = array();
while ($dao->fetch()) {
- \Civi::$statics[__CLASS__]['columnsOf'][$table][] = $dao->Field;
+ \Civi::$statics[__CLASS__]['columnsOf'][$table][] = CRM_Utils_type::escape($dao->Field, 'MysqlColumnNameOrAlias');
}
}
return \Civi::$statics[__CLASS__]['columnsOf'][$table];
* Predicate whether logging is enabled.
*/
public function isEnabled() {
- if (CRM_Core_Config::singleton()->logging) {
- return $this->tablesExist() and $this->triggersExist();
+ if (\Civi::settings()->get('logging')) {
+ return ($this->tablesExist() && (\Civi::settings()->get('logging_no_trigger_permission') || $this->triggersExist()));
}
return FALSE;
}
return array_intersect($tables, $this->tables);
}
+ /**
+ * Retrieve missing log tables.
+ *
+ * @return array
+ */
+ public function getMissingLogTables() {
+ if ($this->tablesExist()) {
+ return array_diff($this->tables, array_keys($this->logs));
+ }
+ return array();
+ }
+
}