private function InstapageCmsPluginDBModel::initPagesTable in Instapage plugin 8.3
Same name and namespace in other branches
- 7.3 core/models/InstapageCmsPluginDBModel.php \InstapageCmsPluginDBModel::initPagesTable()
Initiates Instapage plugin's DB structure for pages table.
1 call to InstapageCmsPluginDBModel::initPagesTable()
- InstapageCmsPluginDBModel::initPluginTables in core/
models/ InstapageCmsPluginDBModel.php - Initiates Instapage plugin's DB structure.
File
- core/
models/ InstapageCmsPluginDBModel.php, line 158
Class
- InstapageCmsPluginDBModel
- Class responsible for communication with DB.
Code
private function initPagesTable() {
$sql = sprintf('SHOW TABLES LIKE \'%s\'', $this->pagesTable);
$result = $this
->getRow($sql);
if ($result) {
return true;
}
$sql = sprintf('CREATE TABLE IF NOT EXISTS %s(' . 'id MEDIUMINT(9) UNSIGNED NOT NULL AUTO_INCREMENT, ' . 'instapage_id INT UNSIGNED NOT NULL, ' . 'slug VARCHAR(255) DEFAULT \'\' NOT NULL, ' . 'type VARCHAR(4) DEFAULT \'page\' NOT NULL, ' . 'time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, ' . 'stats_cache TEXT NULL, ' . 'stats_cache_expires INT UNSIGNED, ' . 'enterprise_url VARCHAR(255) DEFAULT \'\' NOT NULL, ' . 'UNIQUE KEY id (id)) %s', $this->pagesTable, $this->charsetCollate);
$this
->query($sql);
}