hydroshare / hydroshare_drupal

Hydroshare is an online collaboration environment for sharing data, models, and code related to hydrology and water sciences
beta.hydroshare.org
GNU General Public License v2.0
7 stars 2 forks source link

Exception raised when importing content type using Features module #90

Open Castronova opened 10 years ago

Castronova commented 10 years ago

When importing a content type using the Features module, an exception is raised if a datatable already exists. Would it be better to just ignore these instead of raising an exception. I found a potential solution at https://drupal.org/node/1551132.

Below is the code in question: /incudes/database/schema.inc


Current code

public function createTable($name, $table) { if ($this->tableExists($name)) { throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name))); } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { $this->connection->query($statement); } }


Proposed Solution

//https://drupal.org/node/1551132 public function createTable($name, $table) { if ($this->tableExists($name)) { drupal_set_message(t('table already existed: ' . $name)); return; //throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name))); } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { $this->connection->query($statement); } }