You are here

README.txt in Domain Access 5

README file for Domain Prefix

File

domain_prefix/README.txt
View source
  1. /**
  2. * @file
  3. * README file for Domain Prefix
  4. */
  5. Domain Access: Table Prefixing
  6. Dynamic table prefixing for Domain Access.
  7. CONTENTS
  8. --------
  9. 1. Introduction
  10. 1.1 WARNING!
  11. 1.2 Use-Case
  12. 1.3 Sponsors
  13. 2. Installation
  14. 2.1 Dependencies
  15. 2.2 Configuration Options
  16. 3. Table Prefix Options
  17. 4. Drupal Upgrades
  18. 5. Developer Notes
  19. 5.1 Database Schema
  20. 5.2 PostgreSQL Users
  21. ----
  22. 1. Introduction
  23. The Domain Access: Table Prefixing module (called Domain Prefix), is an
  24. optional extension of the Domain Access module. Domain Prefix provides options
  25. for dynamically creating and selecting different database tables for affiliate sites.
  26. The Domain Prefix module allows you to create, copy, and drop tables that are
  27. used by a specific domain. These tables are dynamically selected inside your
  28. site's settings.php file.
  29. ----
  30. 1.1 WARNING!
  31. Table prefixing is an advanced Drupal option; it should only be performed by
  32. experienced admins or by those willing to learn how table prefixing functions.
  33. This module may cause unexpected behavior. Test any changes to your database
  34. carefully.
  35. To test basic functionality, I recommend prefixing the 'watchdog' table. Then
  36. test Drupal's error logging on variuous subdomains.
  37. THIS MODULE WILL NOT WORK CORRECTLY ON pgSQL. See 4.2 for details.
  38. ----
  39. 1.2 Use-Case
  40. For affiliated sites, there are times when you want to use a different
  41. configuration or data set for each site (or for a select site).
  42. In the original use-case, we needed to have different block settings for each
  43. affiliate.
  44. ----
  45. 1.3 Example
  46. To have different block settings for each affiliate, you would set the following
  47. tables to 'copy':
  48. - blocks
  49. - blocks_roles
  50. - boxes
  51. When you create a new domain, these root tables will be copied, using the
  52. pattern:
  53. - domain_ID_tablename
  54. In the Domain Prefix UI, tables are grouped by module (or by default function).
  55. This grouping should help you decide which tables must be kept together to
  56. ensure proper functionality.
  57. ----
  58. 1.3 Sponsors
  59. Domain Prefix is sponsored by Morris DigitalWorks.
  60. http://morrisdigitalworks.com
  61. ----
  62. 2. Installation
  63. The Domain Prefix module is included in the Domain Access download. To install,
  64. untar the domain package and place the entire folder in your modules directory.
  65. When you enable the module, it will create a {domain_prefix} table in your
  66. Drupal database.
  67. For the module to function correctly, you must follow the instructions in
  68. INSTALL.txt.
  69. ----
  70. 2.1 Dependencies
  71. Domain Prefix requires the Domain Access module be installed and active.
  72. Domain Prefix requires a change to your settings.php file, as indicated by the
  73. directions in INSTALL.txt
  74. ----
  75. 2.2 Configuration Options
  76. Clicking on the 'Table prefixing' tab takes you to a screen with configuration
  77. options:
  78. Domain creation options: *
  79. [] Generate tables as defined below
  80. [] Do not generate any tables
  81. Determines what actions to take when creating new domain records.
  82. This setting controls the behavior of newly created domain records. If set to
  83. 'Generate', then the module will attempt to create prefixed tables as defined.
  84. When selecting options for table prefixing, you can now select which data source
  85. to use when copying tables. Use the select list to determine the source for
  86. data.
  87. ----
  88. 3. Table Prefix Options
  89. When using Domain Prefix, you have the following options for table creation.
  90. - Source
  91. Indicates the origin of the table structure and data. This element defaults
  92. to your primary domain. After you have prefixed tables for additional
  93. domains, you may choose a different source domain to use.
  94. - Ignore
  95. If selected, no table prefix actions will be taken for the specified table.
  96. - Create
  97. If selected, a prefixed table will be created for the active domain if none
  98. exists. The new table will copy the schema from its designated source table.
  99. If a table has been created, this field will be selected by default. When a
  100. table is created, no data is copied from the source table to the new table.
  101. - Copy
  102. If selected, a prefixed table will be created for the active domain if none
  103. exists. The new table will copy the schema from its designated source
  104. table. Data from the source table will also be copied to the new table. If
  105. a table has been copied, this field will be selected by default.
  106. - Drop
  107. If a table has been created or copied, a "Drop" option appears. Selecting
  108. this option will cause the selected table to be dropped (deleted) from the
  109. database. This action only affects the prefixed table, not its source.
  110. - Update
  111. If a table has been created or copied, an "Update" option appears. Selecting
  112. this option will cause the selected table to be truncated (emptied) and the
  113. current data from the source table will be copied into the now-empty table.
  114. This action is useful for re-synchronizing tables with the primary domain.
  115. If a table has been updated, the "copy" option will be selected by default.
  116. ----
  117. 4. Drupal Upgrades
  118. Running Drupal's upgrade script [update.php] respects the table prefixing provided
  119. by Domain Prefix. That is, if you run the script from one.example.com, it will update
  120. tables prefixed for that domain.
  121. However, without hacking the update script, we cannot force ths script to update tables
  122. for all domains. In order to update you site correctly you must follow these steps.
  123. - Go to update.php on your root domain [example.com].
  124. - Click 'run the database upgrade script'
  125. - Expand the 'Select versions' fieldset.
  126. - Make a record of each update to be performed. That is:
  127. - If a module indicates "no updates available", ingore it.
  128. - If a module indicates a number, write down the module name and the number.
  129. - Run the update script.
  130. - Check for errors.
  131. Then you must follow these instructions for _each_ domain that uses table prefixing.
  132. - Go to update.php on that domain [one.example.com]
  133. - Click 'run the database upgrade script'
  134. - Expand the 'Select versions' fieldset.
  135. - Select the appropriate updates that you wrote down.
  136. - Run the update script.
  137. - Check for errors.
  138. There does not appear to be an automated way of doing this process.
  139. ----
  140. 5. Developer Notes
  141. Some issues:
  142. - I have not found a way to run a function any time hook_uninstall() is run.
  143. Attempts to add a #submit handler using hook_form_alter() failed. As a result
  144. I may have to create an admin page for uninstalling domain_prefix tables.
  145. - I also failed to find a way to automate the update.php process -- hook_form_alter()
  146. also fails to add a #submit handler in that case.
  147. ----
  148. 5.1 Database Schema
  149. Installing the module creates a {domain_prefix} table that contains:
  150. - domain_id
  151. Integer, unique
  152. The lookup key for this record, foreign key to the {domain} table.
  153. - status
  154. Small integer
  155. The status of this row. Values are:
  156. 1 == No table created.
  157. 2 == Table created, structure only.
  158. 4 == Table created and data copied from source table.
  159. - tablename
  160. Varchar (80)
  161. The name of the root table -- e.g. 'cache' or 'watchdog'.
  162. - module
  163. Varchar (80)
  164. The name of the module that "owns" the root table.
  165. - source
  166. Small integer
  167. Indicates the source of data copied for this domain. This value is
  168. the domain_id of the source domain.
  169. ----
  170. 5.2 PostgreSQL Users
  171. Apologies. This module is not fully functional on pgSQL. Here are the
  172. features that work, and the issues that remain.
  173. -- Table creation works.
  174. -- Table data copying works.
  175. -- Table dropping works.
  176. However, the following issues make the above functions useless:
  177. -- Copying table definitions (such as default values, NOT NULL)
  178. does not work.
  179. -- Creating indexes does not work.
  180. -- Creating sequences (and copying sequence values when necessary)
  181. does not work.
  182. I did research these issues and, frankly, they are delaying the release of the
  183. module. I would love to support these features fully, but I suspect that it
  184. will have to wait for Drupal 6, when we can simply use the information
  185. contained in schema files.
  186. To contribute, see http://drupal.org/node/200279