2

I am running Drupal 6, in a multisite installation. While I fully understand the problems with having varying versions of the same modules running concurrently, I guess I want to know if there's a way to match a specified version of one module to only process requests, or handle calls made by another module?

I currently have Views 2.x in sites/all/modules. It doesn't work w/ Views Slideshow: Cycle 3.x. I want a way to also have Views 3.x in sites/www.mysite.com/modules, and force it to only process requests that would normally be made by Views Slideshow: Cycle 3.x - but nothing else, as Views 2.x would pick up the rest.

I sort of envision it in the same way Blocks work - where you may have regular expression matching for specified URLS. Thanks for any help in advance.

2
  • I agree that it's not worth the effort, but here's an (untested) approach that might be possible (even though a horrible idea). You have two servers behind (e.g.) HAProxy. One server is running Views 3, and the other Views 2. HAProxy directs certain requests to one, and all other requests to the other. (You'd have to figure out how to tell the requests apart.) Because I assume Views 2 & 3 are not db-compatible, you'd presumably need 2 databases, and have some sort of data syncing (which you'd need to figure out) to keep the data in sync between two different dbs with different schemas.
    – iconoclast
    Commented Oct 15, 2012 at 15:17
  • All in all it sounds MUCH easier to just upgrade everything to Views 3 for the site that needs it, and leave things at Views 2 for sites that don't. Take all views modules out of sites/all/modules and only install in sites/<your_site_name>/modules.
    – iconoclast
    Commented Oct 15, 2012 at 15:19

3 Answers 3

2

I'm afraid this simply isn't possible without hacking at Drupal core and the Views module(s) in ways I can't even imagine.

As you know Drupal will only ever let you have one version of a module installed at any one time, and there's no mechanism to 'swap' a module based on a condition (such as the current URL).

Conceptually this would be almost impossible for quite a lot of reasons; the most obvious that jumps to mind is the fact that one version would have to be uninstalled before the other could be enabled, thus destroying all of the data that exists for the first version. By the time you 'swap' back to the other version, you've lost all of your original Views data.

1
  • Thanks for the quick response, and yes - hacking core is bad.
    – Robbase
    Commented Apr 16, 2012 at 18:21
2

In short, there's no reasonable way you could do this, so don't even try.

That said, I found the question interesting so I gave it some thought. In theory, you could abuse Drupal's table prefix, to create a completely separate system table and views table setup.

On this particular URL, you swap the system table, rebuild the modules list, execute your Views, and swap the data back.

Could possibly work, even witout actually hacking Core, but I imagine it's going to require a lot of research on how Core works.

A more long term approach that I've actually considered investigaing myself, is implementing module "slots". One could allow each module to declare a "version slot", much like Views internally separates API 2 from 3, allowing Drupal to keep two versions installed at once. This however would probably require some serious refactoring of both Core, and any modules that want to support this.

1

No.

It really would not work. With some simpler modules you might be able to make it work by renaming one version's folder, file, function and database schema names from " mymodule_" to " mymodule_v2_" before enabling it, and then changing code in the modules that may integrate with it from using the module_invoke hook functions to explicitly calling the mymodule_v2_ function...

but hopefully you see that it's probably not going to work with any module, especially not with Views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.