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_process'); $this->addFieldDefinition(self::field_id, "INT NOT NULL AUTO_INCREMENT", true); $this->addFieldDefinition(self::field_archiv_id, "INT(11) NOT NULL DEFAULT '-1'"); $this->addFieldDefinition(self::field_register_ids, "TEXT NOT NULL DEFAULT ''"); $this->addFieldDefinition(self::field_distribution_ids, "TEXT NOT NULL DEFAULT ''"); $this->addFieldDefinition(self::field_count, "INT(11) NOT NULL DEFAULT '0'"); $this->addFieldDefinition(self::field_send, "INT(11) NOT NULL DEFAULT '0'"); $this->addFieldDefinition(self::field_simulate, "TINYINT NOT NULL DEFAULT '0'"); $this->addFieldDefinition(self::field_job_created_dt, "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"); $this->addFieldDefinition(self::field_job_done_dt, "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"); $this->addFieldDefinition(self::field_job_process_time, "FLOAT NOT NULL DEFAULT '0'"); $this->addFieldDefinition(self::field_is_done, "TINYINT NOT NULL DEFAULT '0'"); $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; }
$error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterCfg->getError()); } } $dbKITnewsletterArchive = new dbKITnewsletterArchive(); if (!$dbKITnewsletterArchive->sqlTableExists()) { if (!$dbKITnewsletterArchive->sqlCreateTable()) { $error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterArchive->getError()); } } // check support for distributions --> #0.29 if (!$dbKITnewsletterArchive->sqlFieldExists(dbKITnewsletterArchive::field_distributions)) { if (!$dbKITnewsletterArchive->sqlAlterTableAddField(dbKITnewsletterArchive::field_distributions, "VARCHAR(255) NOT NULL DEFAULT ''", dbKITnewsletterArchive::field_groups)) { $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITnewsletterArchive->getError()); } } $dbKITnewsletterProcess = new dbKITnewsletterProcess(); if (!$dbKITnewsletterProcess->sqlTableExists()) { if (!$dbKITnewsletterProcess->sqlCreateTable()) { $error .= sprintf('<p>[Upgrade] %s</p>', $dbKITnewsletterProcess->getError()); } } // check process for distributions --> #0.29 if (!$dbKITnewsletterProcess->sqlFieldExists(dbKITnewsletterProcess::field_distribution_ids)) { if (!$dbKITnewsletterProcess->sqlAlterTableAddField(dbKITnewsletterProcess::field_distribution_ids, "VARCHAR(255) NOT NULL DEFAULT ''", dbKITnewsletterProcess::field_register_ids)) { $error .= sprintf('<p>[Upgrade] %s </p>', $dbKITnewsletterProcess->getError()); } } $dbCronjobData = new dbCronjobData(); if (!$dbCronjobData->sqlTableExists()) { if (!$dbCronjobData->sqlCreateTable()) { $error .= sprintf('<p>[Upgrade] %s</p>', $dbCronjobData->getError());
if ($dbKITnewsletterTemplates->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterTemplates->getError()); } $dbKITnewsletterPreview = new dbKITnewsletterPreview(true); if ($dbKITnewsletterPreview->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterPreview->getError()); } $dbKITnewsletterCfg = new dbKITnewsletterCfg(true); if ($dbKITnewsletterCfg->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterCfg->getError()); } $dbKITnewsletterArchive = new dbKITnewsletterArchive(true); if ($dbKITnewsletterArchive->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterArchive->getError()); } $dbKITnewsletterProcess = new dbKITnewsletterProcess(true); if ($dbKITnewsletterProcess->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbKITnewsletterProcess->getError()); } $dbCronjobData = new dbCronjobData(true); if ($dbCronjobData->isError()) { $error .= sprintf('<p>[Installation] %s</p>', $dbCronjobData->getError()); } // Blindwerte eintragen $datas = array(array(dbCronjobData::field_item => dbCronjobData::item_last_call, dbCronjobData::field_value => ''), array(dbCronjobData::field_item => dbCronjobData::item_last_job, dbCronjobData::field_value => ''), array(dbCronjobData::field_item => dbCronjobData::item_last_nl_id, dbCronjobData::field_value => '')); foreach ($datas as $data) { if (!$dbCronjobData->sqlInsertRecord($data)) { $error .= sprintf('<p>[Installation] %s</p>', $dbCronjobData->getError()); } } $dbCronjobNewsletterLog = new dbCronjobNewsletterLog(true);
$error .= sprintf('<p>[Delete Table] %s</p>', $dbKITnewsletterPreview->getError()); } } $dbKITnewsletterTemplates = new dbKITnewsletterTemplates(); if ($dbKITnewsletterTemplates->sqlTableExists()) { if (!$dbKITnewsletterTemplates->sqlDeleteTable()) { $error .= sprintf('<p>[Delete Table] %s</p>', $dbKITnewsletterTemplates->getError()); } } $dbKITnewsletterArchive = new dbKITnewsletterArchive(); if ($dbKITnewsletterArchive->sqlTableExists()) { if (!$dbKITnewsletterArchive->sqlDeleteTable()) { $error .= sprintf('<p>[Delete Table] %s</p>', $dbKITnewsletterArchive->getError()); } } $dbKITnewsletterProcess = new dbKITnewsletterProcess(); if ($dbKITnewsletterProcess->sqlTableExists()) { if (!$dbKITnewsletterProcess->sqlDeleteTable()) { $error .= sprintf('<p>[Delete Table] %s</p>', $dbKITnewsletterProcess->getError()); } } $dbCronjobData = new dbCronjobData(); if ($dbCronjobData->sqlTableExists()) { if (!$dbCronjobData->sqlDeleteTable()) { $error .= sprintf('<p>[Delete Table] %s</p>', $dbCronjobData->getError()); } } $dbCronjobNewsletterLog = new dbCronjobNewsletterLog(); if ($dbCronjobNewsletterLog->sqlTableExists()) { if (!$dbCronjobNewsletterLog->sqlDeleteTable()) { $error .= sprintf('<p>[Delete Table] %s</p>', $dbCronjobNewsletterLog->getError());