function content_install
Search API
7.x content.install | content_install() |
6.x content.install | content_install() |
4.x content.install | content_install() |
5.x content.install | content_install() |
Hook install. Called when the module is installed on the admin modules page.
File
- modules/
content/ content.install, line 15
Code
function content_install() {
// Create our tables
$query = "
CREATE TABLE `content` (
`cid` int unsigned NOT NULL AUTO_INCREMENT,
`vid` int unsigned NOT NULL DEFAULT '0',
`user_id` int NOT NULL DEFAULT '0',
`type` varchar(255) NOT NULL DEFAULT '',
`title` varchar(1000) NOT NULL DEFAULT '',
`posted` int unsigned NOT NULL DEFAULT '0',
`updated` int unsigned NOT NULL DEFAULT '0',
`published` tinyint DEFAULT NULL,
`delete_flag` tinyint DEFAULT '0',
`log` longtext DEFAULT NULL,
PRIMARY KEY (`cid`),
KEY `posted` (`posted`),
KEY `updated` (`updated`),
KEY `user_id` (`user_id`),
KEY `type` (`type`),
KEY `vid` (`vid`),
KEY `delete_flag` (`delete_flag`)
);";
db_query($query);
$query = "
CREATE TABLE `content_versions` (
`vid` int unsigned NOT NULL AUTO_INCREMENT,
`cid` int unsigned NOT NULL,
`user_id` int NOT NULL DEFAULT '0',
PRIMARY KEY (`vid`) ,
KEY `cid` (`cid`),
KEY `user_id` (`user_id`)
);";
db_query($query);
$query = "
CREATE TABLE `content_last_access` (
`cid` int unsigned NOT NULL,
`user_id` int NOT NULL,
`last_access` int unsigned DEFAULT NULL,
PRIMARY KEY (`cid`,`user_id`)
);";
db_query($query);
$query = "
CREATE TABLE `content_files` (
`fid` int unsigned NOT NULL AUTO_INCREMENT,
`cid` int unsigned DEFAULT 0,
`original_filename` varchar(255) DEFAULT NULL,
`filename` varchar(255) DEFAULT NULL,
`mimetype` varchar(255) DEFAULT NULL,
`is_encrypted` tinyint(4) DEFAULT 0,
`posted` int unsigned DEFAULT NULL,
`attributes` tinyint(4) unsigned DEFAULT 0,
PRIMARY KEY (`fid`),
KEY `original_filename` (`original_filename`),
KEY `filename` (`filename`),
KEY `cid` (`cid`),
KEY `mimetype` (`mimetype`),
KEY `is_encrypted` (`is_encrypted`),
KEY `attributes` (`attributes`),
KEY `posted` (`posted`)
);";
db_query($query);
$query = "
CREATE TABLE `content__page` (
`cid` int(10) unsigned NOT NULL,
`vid` int(10) unsigned NOT NULL,
`field__body` text DEFAULT NULL,
PRIMARY KEY (`vid`),
KEY `cid` (`cid`),
KEY `field__body` (`field__body`(768))
);
";
db_query($query);
if (!file_exists(fp_get_files_path() . '/content_uploads/')) {
mkdir(fp_get_files_path() . '/content_uploads/');
}
if (!file_exists(fp_get_files_path() . '/content_uploads/public_uploads/')) {
mkdir(fp_get_files_path() . '/content_uploads/public_uploads/');
}
}