Ejemplo n.º 1
0
 /**
  * If auditing is enabled, create the audit table.
  *
  * Function is used by the install scripts and a repair utility in the admin panel.
  *
  * Internal function, do not override.
  */
 function create_audit_table()
 {
     global $dictionary;
     $table_name = $this->get_audit_table_name();
     require 'metadata/audit_templateMetaData.php';
     // Bug: 52583 Need ability to customize template for audit tables
     $custom = 'custom/metadata/audit_templateMetaData_' . $this->getTableName() . '.php';
     if (file_exists($custom)) {
         require $custom;
     }
     $fieldDefs = $dictionary['audit']['fields'];
     $indices = $dictionary['audit']['indices'];
     // Renaming template indexes to fit the particular audit table (removed the brittle hard coding)
     foreach ($indices as $nr => $properties) {
         $indices[$nr]['name'] = 'idx_' . strtolower($this->getTableName()) . '_' . $properties['name'];
     }
     $engine = null;
     if (isset($dictionary['audit']['engine'])) {
         $engine = $dictionary['audit']['engine'];
     } else {
         if (isset($dictionary[$this->getObjectName()]['engine'])) {
             $engine = $dictionary[$this->getObjectName()]['engine'];
         }
     }
     $this->db->createTableParams($table_name, $fieldDefs, $indices, $engine);
 }
Ejemplo n.º 2
0
 /**
  * If auditing is enabled, create the audit table.
  *
  * Function is used by the install scripts and a repair utility in the admin panel.
  */
 public final function create_audit_table()
 {
     global $dictionary;
     $table_name = $this->get_audit_table_name();
     require DOCROOT . 'metadata/audit_templateMetaData.php';
     // Bug: 52583 Need ability to customize template for audit tables
     if (file_exists($custom = DOCROOT . 'custom/metadata/audit_templateMetaData_' . $this->getTableName() . '.php')) {
         require $custom;
     }
     $fieldDefs = (array) array_get($dictionary, 'audit.fields');
     $indices = (array) array_get($dictionary, 'audit.indices');
     // Renaming template indexes to fit the particular audit table (removed the brittle hard coding)
     foreach ($indices as $nr => $properties) {
         $indices[$nr]['name'] = 'idx_' . strtolower($this->getTableName()) . '_' . $properties['name'];
     }
     $engine = array_get($dictionary, 'audit.engine', array_get($dictionary, "{$this->getObjectName()}.engine"));
     $this->db->createTableParams($table_name, $fieldDefs, $indices, $engine);
 }
Ejemplo n.º 3
0
 protected function createTableParams($tablename, $fieldDefs, $indices)
 {
     $this->created[$tablename] = true;
     return $this->_db->createTableParams($tablename, $fieldDefs, $indices);
 }