file_styles.install 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. /**
  3. * @file styles/contrib/file_styles/file_styles.install
  4. * Install, update and uninstall functions for the file styles module.
  5. */
  6. /**
  7. * Implement hook_install().
  8. */
  9. function file_styles_install() {
  10. // Create the styles directory and ensure it's writable.
  11. $path = 'temporary://file-styles';
  12. file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
  13. }
  14. /**
  15. * Implement hook_uninstall().
  16. */
  17. function file_styles_uninstall() {
  18. // Remove the styles directory and generated images.
  19. $path = 'temporary://file-styles';
  20. file_unmanaged_delete_recursive($path);
  21. }
  22. /**
  23. * Implement hook_schema().
  24. */
  25. function file_styles_schema() {
  26. $schema = array();
  27. $schema['cache_file_styles'] = drupal_get_schema_unprocessed('system', 'cache');
  28. $schema['cache_file_styles']['description'] = 'Cache table used to store information file manipulations that are in-progress.';
  29. $schema['file_styles'] = array(
  30. 'description' => 'Stores configuration options for file styles.',
  31. 'fields' => array(
  32. 'msid' => array(
  33. 'description' => 'The primary identifier for a file style.',
  34. 'type' => 'serial',
  35. 'unsigned' => TRUE,
  36. 'not null' => TRUE,
  37. ),
  38. 'name' => array(
  39. 'description' => 'The style name.',
  40. 'type' => 'varchar',
  41. 'length' => 255,
  42. 'not null' => TRUE,
  43. ),
  44. ),
  45. 'primary key' => array('msid'),
  46. 'indexes' => array(
  47. 'name' => array('name'),
  48. ),
  49. );
  50. $schema['file_effects'] = array(
  51. 'description' => 'Stores configuration options for file effects.',
  52. 'fields' => array(
  53. 'meid' => array(
  54. 'description' => 'The primary identifier for an file effect.',
  55. 'type' => 'serial',
  56. 'unsigned' => TRUE,
  57. 'not null' => TRUE,
  58. ),
  59. 'msid' => array(
  60. 'description' => 'The {file_styles}.isid for a file style.',
  61. 'type' => 'int',
  62. 'unsigned' => TRUE,
  63. 'not null' => TRUE,
  64. 'default' => 0,
  65. ),
  66. 'weight' => array(
  67. 'description' => 'The weight of the effect in the style.',
  68. 'type' => 'int',
  69. 'unsigned' => FALSE,
  70. 'not null' => TRUE,
  71. 'default' => 0,
  72. ),
  73. 'name' => array(
  74. 'description' => 'The unique name of the effect to be executed.',
  75. 'type' => 'varchar',
  76. 'length' => 255,
  77. 'not null' => TRUE,
  78. ),
  79. 'data' => array(
  80. 'description' => 'The configuration data for the effect.',
  81. 'type' => 'text',
  82. 'not null' => TRUE,
  83. 'size' => 'big',
  84. 'serialize' => TRUE,
  85. ),
  86. ),
  87. 'primary key' => array('meid'),
  88. 'indexes' => array(
  89. 'msid' => array('msid'),
  90. 'weight' => array('weight'),
  91. ),
  92. 'foreign keys' => array(
  93. 'msid' => array('file_styles' => 'msid'),
  94. ),
  95. );
  96. return $schema;
  97. }
  98. /**
  99. * Add labels to file styles.
  100. */
  101. function file_styles_update_7202() {
  102. return array();
  103. }
  104. /**
  105. * Rebuild themes.
  106. */
  107. function file_styles_update_7203() {
  108. drupal_theme_rebuild();
  109. return array();
  110. }
  111. /**
  112. * Add new presets.
  113. */
  114. function file_styles_update_7206() {
  115. return array();
  116. }
  117. /**
  118. * Fix presets to use camelCase and honor links to media.
  119. */
  120. function file_styles_update_7207() {
  121. return array();
  122. }
  123. /**
  124. * Fetch any image styles for use as new presets and register new hooks.
  125. */
  126. function file_styles_update_7208() {
  127. return array();
  128. }
  129. /**
  130. * Fix any broken custom image styles.
  131. */
  132. function file_styles_update_7209() {
  133. return array();
  134. }
  135. /**
  136. * Add support for media objects.
  137. */
  138. function file_styles_update_7210() {
  139. return array();
  140. }