简体   繁体   English

多租户数据库和一种模型-MVC和Joomla

[英]Multi-Tenant Database & One Model - MVC & Joomla

I'm developing a component which has the below structure. 我正在开发具有以下结构的组件。 This system is developed under Multi-Tenant concept. 该系统是在多租户概念下开发的。

在此处输入图片说明

www.a.com, www.b.com, www.c.com are web sites which are in different domains but they run the same system . www.a.com,www.b.com,www.c.com是位于不同域中但运行相同系统的网站 Each website have their own template and web pages in their local database . 每个网站在其本地数据库中都有自己的模板和网页 That's doable. 那是可行的。

The system which is ran on these three sites are independent from the mentioned above(templates etc). 在这三个站点上运行的系统独立于上述(模板等)。 www.a.com, www.b.com, www.c.com have a one large database where all the system data is maintained . www.a.com,www.b.com,www.c.com 有一个大型数据库用于维护所有系统数据 Since the system is developed according to MVC what I want to do is have a single model(multiple models) where all the logic is contained. 由于系统是根据MVC开发的,因此我想要做的是拥有一个包含所有逻辑的单个模型(多个模型)。 So if I make a single change in the model it affects the 3 sites. 因此, 如果我对模型进行一次更改,则会影响3个站点。

According to my research, model should be maintained in the cloud. 根据我的研究,模型应该在云中维护。 How can I implement such a requirement with MVC(Given I'm using Joomla as my CMS, MySQL as DBs) ? 如何使用MVC(鉴于我将Joomla作为CMS,将MySQL作为DB)实现了这样的要求? How can I have a single model for all the 3 sites ? 如何为这三个站点提供一个模型?

You can put more than one domain on the very same joomla installation without any changes, just add a plugin that's called virtualdomains which will allow you (for free) to choose template and - thus - menus, extensions and available pages for each domain; 您可以在同一joomla安装中放置多个域,而无需进行任何更改,只需添加一个名为virtualdomains的插件,即可(免费)选择模板,从而可以选择每个域的模板,扩展名和可用页面; Maintenance-wise this will be easy since all is in one box; 在维护方面,这很容易,因为所有组件都在一个盒子中。 but the users will see three sites with different content, layout and urls. 但用户将看到三个内容,布局和网址不同的网站。

Just a couple of warnings: 1) make sure no scripts or css or other local resources are invoked with the url (http://www.a.com/template/xxx/js/jquery.autocomplete.js) vs /template/xxx/js/jquery.autocomplete.js, the first will work badly with cache. 仅有几点警告:1)确保没有使用url(http://www.a.com/template/xxx/js/jquery.autocomplete.js)vs / template /调用脚本或CSS或其他本地资源xxx / js / jquery.autocomplete.js,第一个将无法与缓存配合使用。 2) handle any intricacies such as same-url on different domains with .htaccess; 2)使用.htaccess处理任何复杂情况,例如不同域上的相同URL; use a sh404 or similar component to manage the SEF urls. 使用sh404或类似组件来管理SEF网址。

This model looks quite complicated to me. 这个模型对我来说看起来很复杂。

It depends what the main goal of this? 这取决于主要目的是什么? Its just fetching all articles/users together? 它只是一起获取所有文章/用户? But why? 但为什么?

If you are dealing with problem of running one project on multiple Joomla installations I can advise you to put them on single Joomla and than using Virtual Domains ( http://extensions.joomla.org/extensions/core-enhancements/multiple-sites/7557 ) for "copying" the website on other domains. 如果您要解决在多个Joomla安装上运行一个项目的问题,我建议您将它们放在单个Joomla上,而不要使用虚拟域( http://extensions.joomla.org/extensions/core-enhancements/multiple-sites/ 7557 )用于“复制”其他域上的网站。 Then you will one database for all your project. 然后,您将为所有项目创建一个数据库。

One downside of this is that its mainly suitable for the projects with same component and article structure. 缺点之一是它主要适用于具有相同组件和文章结构的项目。 Meaning for example local news divided by regions under different domains etc. 意思是例如本地新闻除以不同域下的区域等。

For the reference: the solution is really working fast on Joomla 2.5 latest update. 供参考:该解决方案在Joomla 2.5最新更新中确实可以快速运行。

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

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