Drupal 7 在drupal 7中为多站点共享来自不同数据库的表
我正在建立一个drupal多站点,比如childone和childtwo。两者都有各自的数据库。现在需要共享一些表,例如,在site childone中创建的用户也必须在site childtwo中具有相同的访问权限。 有人能给我推荐合适的逐步解决方案吗Drupal 7 在drupal 7中为多站点共享来自不同数据库的表,drupal-7,Drupal 7,我正在建立一个drupal多站点,比如childone和childtwo。两者都有各自的数据库。现在需要共享一些表,例如,在site childone中创建的用户也必须在site childtwo中具有相同的访问权限。 有人能给我推荐合适的逐步解决方案吗 关于您需要使用表前缀,settings.php解释了如何实现这一点: * You can optionally set prefixes for some or all database table names * by using the
关于您需要使用表前缀,settings.php解释了如何实现这一点:
* You can optionally set prefixes for some or all database table names
* by using the 'prefix' setting. If a prefix is specified, the table
* name will be prepended with its value. Be sure to use valid database
* characters only, usually alphanumeric and underscore. If no prefixes
* are desired, leave it as an empty string ''.
*
* To have all database names prefixed, set 'prefix' as a string:
* @code
* 'prefix' => 'main_',
* @endcode
* To provide prefixes for specific tables, set 'prefix' as an array.
* The array's keys are the table names and the values are the prefixes.
* The 'default' element is mandatory and holds the prefix for any tables
* not specified elsewhere in the array. Example:
* @code
* 'prefix' => array(
* 'default' => 'main_',
* 'users' => 'shared_',
* 'sessions' => 'shared_',
* 'role' => 'shared_',
* 'authmap' => 'shared_',
* ),
* @endcode
因此,对于您的示例,对于childone站点的settings.php,您将有如下内容:
'prefix' => array(
'default' => 'childone_',
'user' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'permission' => 'shared_',
);
对于childtwo的settings.php,它非常类似:
'prefix' => array(
'default' => 'childtwo_',
'user' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'permission' => 'shared_',
);
所有表都将以childone_uuuu或childtwo_uu作为前缀,但共享表除外,在运行安装后,共享表将以shared_uuuuu(或任何您想要的)作为前缀。非常感谢web drics Webdrips,我尝试实现了相同的功能,但每次刷新网页时都会调用错误。该错误与未找到文件或与.inc文件相关的错误有关。childone和childtwo的settings.php文件看起来与您发布的完全相同,可能还有其他设置需要执行。如果可以的话,请逐步详细说明。提前一吨谢谢。你可以看看这里:你能发布实际的错误消息吗?要让多站点运行,还有很多其他步骤;你以前做过多站点吗?或者你只是在为共享的桌子而挣扎?