function __construct($create_tables = false) { $this->create_tables = $create_tables; // use another table prefix? if (file_exists(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json')) { $config = json_decode(file_get_contents(WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/config.json'), true); if (isset($config['table_prefix'])) { self::$table_prefix = $config['table_prefix']; } } parent::__construct(); $this->setTablePrefix(self::$table_prefix); $this->setTableName('mod_kit_newsletter_preview'); $this->addFieldDefinition(self::field_id, "INT NOT NULL AUTO_INCREMENT", true); $this->addFieldDefinition(self::field_view, "LONGTEXT NOT NULL DEFAULT ''", false, false, true); $this->addFieldDefinition(self::field_update_when, "TIMESTAMP"); // check field definitions $this->checkFieldDefinitions(); // create tables if ($this->create_tables) { if (!$this->sqlTableExists()) { if (!$this->sqlCreateTable()) { $this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $this->getError())); return false; } } } return true; }