You are here

README.txt in Domain Access 6.2

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 Example
  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 Known Issues
  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 domains.
  37. ----
  38. 1.2 Use-Case
  39. For affiliated sites, there are times when you want to use a different
  40. configuration or data set for each site (or for a select site).
  41. In the original use-case, we needed to have different block settings for each
  42. affiliate.
  43. ----
  44. 1.3 Example
  45. To have different block settings for each affiliate, you would set the following
  46. tables to 'copy':
  47. - blocks
  48. - blocks_roles
  49. - boxes
  50. When you create a new domain, these root tables will be copied, using the
  51. pattern:
  52. - domain_ID_tablename
  53. In the Domain Prefix UI, tables are grouped by module (or by default function).
  54. This grouping should help you decide which tables must be kept together to
  55. ensure proper functionality.
  56. ----
  57. 2. Installation
  58. The Domain Prefix module is included in the Domain Access download. To install,
  59. untar the domain package and place the entire folder in your modules directory.
  60. When you enable the module, it will create a {domain_prefix} table in your
  61. Drupal database.
  62. ----
  63. 2.1 Dependencies
  64. Domain Prefix requires the Domain Access module be installed and active.
  65. Domain Prefix requires a change to your settings.php file, as indicated by the
  66. directions in INSTALL.txt
  67. ----
  68. 2.2 Configuration Options
  69. Clicking on the 'Table prefixing' tab takes you to a screen with configuration
  70. options:
  71. Domain creation options: *
  72. [] Generate tables as defined below
  73. [] Do not generate any tables
  74. Determines what actions to take when creating new domain records.
  75. This setting controls the behavior of newly created domain records. If set to
  76. 'Generate', then the module will attempt to create prefixed tables as defined.
  77. When selecting options for table prefixing, you can now select which data source
  78. to use when copying tables. Use the select list to determine the source for
  79. data.
  80. ----
  81. 3. Table Prefix Options
  82. When using Domain Prefix, you have the following options for table creation.
  83. - Source
  84. Indicates the origin of the table structure and data. This element defaults
  85. to your primary domain. After you have prefixed tables for additional
  86. domains, you may choose a different source domain to use.
  87. - Ignore
  88. If selected, no table prefix actions will be taken for the specified table.
  89. - Create
  90. If selected, a prefixed table will be created for the active domain if none
  91. exists. The new table will copy the schema from its designated source table.
  92. If a table has been created, this field will be selected by default. When a
  93. table is created, no data is copied from the source table to the new table.
  94. - Copy
  95. If selected, a prefixed table will be created for the active domain if none
  96. exists. The new table will copy the schema from its designated source
  97. table. Data from the source table will also be copied to the new table. If
  98. a table has been copied, this field will be selected by default.
  99. - Drop
  100. If a table has been created or copied, a "Drop" option appears. Selecting
  101. this option will cause the selected table to be dropped (deleted) from the
  102. database. This action only affects the prefixed table, not its source.
  103. - Update
  104. If a table has been created or copied, an "Update" option appears. Selecting
  105. this option will cause the selected table to be truncated (emptied) and the
  106. current data from the source table will be copied into the now-empty table.
  107. This action is useful for re-synchronizing tables with the primary domain.
  108. If a table has been updated, the "copy" option will be selected by default.
  109. ----
  110. 4. Drupal Upgrades
  111. Running Drupal's upgrade script [update.php] respects the table prefixing provided
  112. by Domain Prefix. That is, if you run the script from one.example.com, it will update
  113. tables prefixed for that domain.
  114. However, without hacking the update script, we cannot force ths script to update tables
  115. for all domains. In order to update you site correctly you must follow these steps.
  116. - Go to update.php on your root domain [example.com].
  117. - Click 'run the database upgrade script'
  118. - Expand the 'Select versions' fieldset.
  119. - Make a record of each update to be performed. That is:
  120. - If a module indicates "no updates available", ingore it.
  121. - If a module indicates a number, write down the module name and the number.
  122. - Run the update script.
  123. - Check for errors.
  124. Then you must follow these instructions for _each_ domain that uses table prefixing.
  125. - Go to update.php on that domain [one.example.com]
  126. - Click 'run the database upgrade script'
  127. - Expand the 'Select versions' fieldset.
  128. - Select the appropriate updates that you wrote down.
  129. - Run the update script.
  130. - Check for errors.
  131. There does not appear to be an automated way of doing this process.
  132. ----
  133. 5. Developer Notes
  134. Some issues:
  135. - I have not found a way to run a function any time hook_uninstall() is run.
  136. Attempts to add a #submit handler using hook_form_alter() failed. As a result
  137. I may have to create an admin page for uninstalling domain_prefix tables.
  138. - I also failed to find a way to automate the update.php process -- hook_form_alter()
  139. also fails to add a #submit handler in that case.
  140. ----
  141. 5.1 Database Schema
  142. Installing the module creates a {domain_prefix} table that contains:
  143. - domain_id
  144. Integer, unique
  145. The lookup key for this record, foreign key to the {domain} table.
  146. - status
  147. Small integer
  148. The status of this row. Values are:
  149. 1 == No table created.
  150. 2 == Table created, structure only.
  151. 4 == Table created and data copied from source table.
  152. - tablename
  153. Varchar (80)
  154. The name of the root table -- e.g. 'cache' or 'watchdog'.
  155. - module
  156. Varchar (80)
  157. The name of the module that "owns" the root table.
  158. - source
  159. Small integer
  160. Indicates the source of data copied for this domain. This value is
  161. the domain_id of the source domain.
  162. ----
  163. 5.2 Known Issues
  164. If you are running MySQL in STRICT mode, then you may run into
  165. an error if you try to COPY the {users} table. This occurs because
  166. MySQL STRICT does not allow autoincrement columns to be inserted
  167. with a value of zero (0).
  168. See http://drupal.org/node/445386 for information.