content.install

  1. 7.x modules/content/content.install
  2. 6.x modules/content/content.install
  3. 4.x modules/content/content.install
  4. 5.x modules/content/content.install

File

modules/content/content.install
View source
  1. <?php
  2. /**
  3. * This file should contain only hooks relating to installing, enabling, disabling, and uninstalling this module.
  4. *
  5. */
  6. /**
  7. * Hook install. Called when the module is installed on the admin modules page.
  8. */
  9. function content_install() {
  10. // Create our tables
  11. $query = "
  12. CREATE TABLE `content` (
  13. `cid` int unsigned NOT NULL AUTO_INCREMENT,
  14. `vid` int unsigned NOT NULL DEFAULT '0',
  15. `user_id` int NOT NULL DEFAULT '0',
  16. `type` varchar(255) NOT NULL DEFAULT '',
  17. `title` varchar(1000) NOT NULL DEFAULT '',
  18. `posted` int unsigned NOT NULL DEFAULT '0',
  19. `updated` int unsigned NOT NULL DEFAULT '0',
  20. `published` tinyint DEFAULT NULL,
  21. `delete_flag` tinyint DEFAULT '0',
  22. `log` longtext DEFAULT NULL,
  23. PRIMARY KEY (`cid`),
  24. KEY `posted` (`posted`),
  25. KEY `updated` (`updated`),
  26. KEY `user_id` (`user_id`),
  27. KEY `type` (`type`),
  28. KEY `vid` (`vid`),
  29. KEY `delete_flag` (`delete_flag`)
  30. );";
  31. db_query($query);
  32. $query = "
  33. CREATE TABLE `content_versions` (
  34. `vid` int unsigned NOT NULL AUTO_INCREMENT,
  35. `cid` int unsigned NOT NULL,
  36. `user_id` int NOT NULL DEFAULT '0',
  37. PRIMARY KEY (`vid`) ,
  38. KEY `cid` (`cid`),
  39. KEY `user_id` (`user_id`)
  40. );";
  41. db_query($query);
  42. $query = "
  43. CREATE TABLE `content_last_access` (
  44. `cid` int unsigned NOT NULL,
  45. `user_id` int NOT NULL,
  46. `last_access` int unsigned DEFAULT NULL,
  47. PRIMARY KEY (`cid`,`user_id`)
  48. );";
  49. db_query($query);
  50. $query = "
  51. CREATE TABLE `content_files` (
  52. `fid` int unsigned NOT NULL AUTO_INCREMENT,
  53. `cid` int unsigned DEFAULT 0,
  54. `original_filename` varchar(255) DEFAULT NULL,
  55. `filename` varchar(255) DEFAULT NULL,
  56. `mimetype` varchar(255) DEFAULT NULL,
  57. `is_encrypted` tinyint(4) DEFAULT 0,
  58. `posted` int unsigned DEFAULT NULL,
  59. `attributes` tinyint(4) unsigned DEFAULT 0,
  60. PRIMARY KEY (`fid`),
  61. KEY `original_filename` (`original_filename`),
  62. KEY `filename` (`filename`),
  63. KEY `cid` (`cid`),
  64. KEY `mimetype` (`mimetype`),
  65. KEY `is_encrypted` (`is_encrypted`),
  66. KEY `attributes` (`attributes`),
  67. KEY `posted` (`posted`)
  68. );";
  69. db_query($query);
  70. $query = "
  71. CREATE TABLE `content__page` (
  72. `cid` int(10) unsigned NOT NULL,
  73. `vid` int(10) unsigned NOT NULL,
  74. `field__body` text DEFAULT NULL,
  75. PRIMARY KEY (`vid`),
  76. KEY `cid` (`cid`),
  77. KEY `field__body` (`field__body`(768))
  78. );
  79. ";
  80. db_query($query);
  81. if (!file_exists(fp_get_files_path() . '/content_uploads/')) {
  82. mkdir(fp_get_files_path() . '/content_uploads/');
  83. }
  84. if (!file_exists(fp_get_files_path() . '/content_uploads/public_uploads/')) {
  85. mkdir(fp_get_files_path() . '/content_uploads/public_uploads/');
  86. }
  87. }
  88. function content_update($old_schema, $new_schema) {
  89. }

Functions

Namesort descending Description
content_install Hook install. Called when the module is installed on the admin modules page.
content_update