简体   繁体   English

Joomla插件覆盖表前缀

[英]Joomla plugin to override table prefix

Overview: I have a single Joomla website that have various copies of the database tables all in the same database, but with different table prefixes. 概述:我有一个Joomla网站,该网站在同一数据库中具有数据库表的各种副本,但是具有不同的表前缀。

Depending on which user is accessing the site, i need to alter which joomla table prefix is used in order to display the relevant tables. 根据要访问该网站的用户,我需要更改使用哪个joomla表前缀才能显示相关表。

This has to be site wide. 这必须在整个站点范围内。

Problem: with a core code hack i can alter the prefix as needed, but would prefer this as a plugin. 问题:使用核心代码破解,我可以根据需要更改前缀,但希望将此作为插件。

With the plugin i can get the prefix, using $db->getPrefix(), and i can set an immediate instance of the connection using $db = JDatabaseDriver::getInstance( $option ). 使用插件,我可以使用$ db-> getPrefix()获取前缀,并且可以使用$ db = JDatabaseDriver :: getInstance($ option)设置连接的立即实例。 But this is not site wide and is overwritten by the standard $db = JFactory::getDbo(). 但这不是站点范围内的,并由标准$ db = JFactory :: getDbo()覆盖。

So i need a system plugin that will repalce every instance of a table prefix as it is run. 因此,我需要一个系统插件,该插件将在运行时重新分配表前缀的每个实例。

Any ideas? 有任何想法吗?

Sorry but if you install a new component or module you have many problem to synchronize this changes on all DB. 抱歉,如果您安装新的组件或模块,则在同步所有数据库上的更改时会遇到很多问题。 I think the best for you is to redirect each user to his real site (many joomla file with many db). 我认为最适合您的是将每个用户重定向到他的真实站点(许多具有许多数据库的joomla文件)。 Otherwise you can create a personal component and read table prefix of that user and display only date that you want, in this way just duplicate the tables you need and not all the joomla structure. 否则,您可以创建一个个人组件并读取该用户的表前缀并仅显示所需的日期,以这种方式,只需复制所需的表即可,而不是所有的joomla结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM