Of course one needs to install the new version next to the old one to migrate sub-themes and for theme testing. Error message:

Fatal error: Cannot redeclare path_to_subtheme() (previously declared in /srv/www/htdocs/web18/html/themes/zen/template.php:305) in /srv/www/htdocs/web18/html/themes/zen-5.x-0.8/template-subtheme.php on line 10

Even an emergency solution that allowed at least the main Zen theme without the subthemes to work would be a great step forward.

Comments

johnalbin’s picture

Status: Active » Closed (won't fix)

This is a problem with how themes work in Drupal. It can't be fixed from inside the Zen theme.

The only thing that might work is to change Zen 5.x-0.7's directory from the "zen" to "zen07". And then edit all the zen 5.x-0.7 files to change any function that starts with "zen_" to "zen07_".

Also, change Zen 5.x-0.8's folder back from "zen-5.x-0.8" to "zen".

hgmichna’s picture

Title: Installing 5.x-0.8 side by side with 5.x-0.7 produces PHP error » Installing two versions of a theme side by side produces PHP error
Project: Zen » Drupal core
Version: 5.x-0.8 » 5.3
Component: Code » theme system
Status: Closed (won't fix) » Active

Changed bug report accordingly. Since this is not documented or expected behavior and is a severe problem for everybody who upgrades a theme, this is a bug, not a feature request.

hgmichna’s picture

Thanks for the workaround proposal:

The only thing that might work is to change Zen 5.x-0.7's directory from the "zen" to "zen07". And then edit all the zen 5.x-0.7 files to change any function that starts with "zen_" to "zen07_".

It still has the problem that all users who have individually selected a non-default sub-theme would fall back to the default. It may be a good idea though to do the change on the new version under test, then revert and do a hard change-over after testing.

webernet’s picture

Status: Active » Closed (won't fix)

You cannot have two themes with the same name on the same site because there's no way for the system to tell them apart.

hgmichna’s picture

Status: Closed (won't fix) » Active

You cannot have two themes with the same name on the same site because there's no way for the system to tell them apart.

Now this is one of the most unimaginative postings I've seen in a while, essentially a repetition of the issue description.

Come on, do you really lack every trace of creativity and want to tell everybody that this is an absolutely unsolvable problem? I could tell you within seconds a number of different ways to solve it.

But they are all so simple that every programmer worth his salt will find them just as quickly. There is no need to explain.

stevenpatz’s picture

I'd be interested in hearing a solution.

chx’s picture

Status: Active » Closed (won't fix)

This is won't fix and not because of lack imagination. Berating webernet is just stupid. PHP lacks namespaces and we are not particularly interested in forcing a change in the name of every single theme function out there.

michelle’s picture

I could tell you within seconds a number of different ways to solve it.

Great, tell us in the form of a .patch file. Put your code where your mouth is and leave your insults at the door.

Michelle

hgmichna’s picture

I'm not a PHP programmer, so doing it myself is not in the cards.

Now for the proposals. Let me make the simplest first.

Add the version number to the theme name. Have zen07 and zen08. This alone already solves the problem.

A small remaining weakness is that, when, after testing, you make zen08 the default and pull zen07, users of sub-themes would fall back to the default theme.

This is a minor problem on most sites, because few users select a non-default theme in the first place. But it could also be solved in adding some code that makes sure that, for example, a user who runs the zen07-xyz sub-theme, automatically falls over to the next version with the corresponding name, zen08-xyz, if that exists. That's a pretty tiny piece of code to add.

This is just one of many possible solutions to the problem. I'm still surprised by the fact that somebody asked for possible solutions at all, because they are really not difficult to invent.

If somebody had replied, "no time to do it" or, "not worth the effort", that may be debatable, but "impossible" leads to instant berating. (:-)

Hans-Georg

johnalbin’s picture

The problem you describe is one of your own making. You are not following a best practice for web development: don’t do your development work on your production server.

If (for cost reasons) you need to develop your theme on the same webserver, Drupal easily allows you to create a multi-site setup so that you can have a separate development Drupal website on the same webserver. See the Handbook for more info: http://drupal.org/node/179162 What you want is listed under “Independent site at a sub URL”.

Finally, Microsoft doesn't allow you to run Internet Explorer 6 and Internet Explorer 7 at the same time. In fact, there are few pieces of software that allow you to run 2 versions of the same software on the same computer at the same time. And the reason for this is: 1. the programming to allow it is non-trivial to implement (see below), 2. the additional ”functionality” is minimal and won’t be used by 99.999% of the users, and 3. the work-around (just have 2 systems, 1 for each version) is trivial to implement.

And how you can state that you are not a programmer while simultaneously saying that your proposed solution would be a “tiny piece of code”? I invite you to take a look at the code in Drupal 6’s includes/theme.inc file (themes/engines/phptemplate/phptemplate.engine in D5) to see the truth of the situation.

hgmichna’s picture

John,

I'm already running a multi-site Drupal installation. Your recommendation not to do development work on a production server has its merit, but it can also have a big fault—it may not be optimal overall. In my situation installing a separate test system would waste far more time than it is worth, particularly when its only purpose is a theme update. I have, of course, weighed the risks and the effort against the advantages and came to the conclusion that in my case it is much better not to install and operate a separate test system.

As to using the multi-site installation to test a theme upgrade, are you forgetting that the themes are common to all sites in a multi-site installation? I haven't looked into this any further, but the themes I'm using are common to all sites, they are installed in the common themes folder.

I am a programmer. I am just not a PHP programmer. But anyway, the failover to a sub-theme is a quite unimportant side problem. Ignore it before the main problem is solved. And if there is no chance that it will be solved, then we may forget this whole discussion anyway.

The first and fundamental question is, would it be a great advantage to be able to install two versions of a theme side by side? I still think yes. If nobody agrees, this discussion is only a waste of time, except that it pointed out an omission in the documentation, namely to tell users that they can only install one version of each theme.

Let's not argue for the sake of arguing. My immediate problem was that I upgraded from Zen 0.7 to Zen 0.8, but 0.8 didn't work. I had to revert to 0.7 and tried to install 0.8 side by side for testing. As we now know, that didn't work either. Now I have no simple and quick way to test what's going on, short of opening up a separate virtual server, setting it up for Drupal (with a list of modifications), installing an entire Drupal, and copying at least one complete site into it, which is far too much effort for the purpose. This is why I was looking for a simpler, quicker way.

Hans-Georg

michelle’s picture

As to using the multi-site installation to test a theme upgrade, are you forgetting that the themes are common to all sites in a multi-site installation? I haven't looked into this any further, but the themes I'm using are common to all sites, they are installed in the common themes folder.

That's your choice to do it that way. I suspect most people put the theme just on the site that uses it, unless they use the same theme on multiple sites. At any rate, just put the theme you want to test on the test site and it will override the one in sites/all.

You already gave the solution to your problem anyway... Just rename one of the themes to zen8 and then you can have them both installed at the same time.

Michelle

johnalbin’s picture

Version: 5.3 » 5.x-dev

Since your original problem (http://drupal.org/node/199323) wasn’t in the Zen issue queue, I never saw it. It sounds like a duplicate of this issue: http://drupal.org/node/199362

are you forgetting that the themes are common to all sites in a multi-site installation?

No, I’m not “forgetting” that because it’s not true. If you have a test site at example.com/test/, you can install a theme for just that site by placing the settings.php file in /sites/example.com.test/ and the theme in /sites/example.com.test/themes/. And you can move the old version of Zen from /sites/all/themes to /sites/default/themes which will make the old Zen only available for the default site. Thus avoiding any conflicts. (This is what Michelle was referring to above.) See the handbook page I mentioned above or read the contents of /sites/default/settings.php.

Would it be a great advantage to be able to install two versions of a theme side by side?

No. Since you can run two Drupal sites side by side via a multi-site config (Yeah, Drupal!), there’s no need to install 2 versions of a theme on one Drupal site.

hgmichna’s picture

Since your original problem (http://drupal.org/node/199323) wasn’t in the Zen issue queue, I never saw it. It sounds like a duplicate of this issue: http://drupal.org/node/199362

John,

I didn't want to open a Zen issue, because I wasn't sure it was a Zen issue. I thought I had done something wrong.

Thanks for your good explanation. Since I'm running a globally installed Zen 0.7 in several sites on a multi-site installation, I guess the procedure for a parallel install of Zen 0.8 would be a bit convoluted. I would have to copy 0.7 into each site, remove the global installation of Zen 0.7, create a new site as a test site in the multi-site installation, copy one of the sites to be tested into it, and install Zen 0.8 into it. Then I would have to copy the next site into the test site and test, etc.

I won't find the time for such a procedure soon. It is more effort than I think it should be. A side-by-side installation of two versions would be very much easier, but it seems I'll never get that. My remaining recommendation is to write clearly into the documentation that two versions of one theme cannot be installed side by side. That would change this bug report into a feature request.

I'll probably do a hard switchover from 0.7 to 0.8, as soon as that other problem mentioned in http://drupal.org/node/199362 yields enough information. I'll see if I can contribute to that issue to help resolve it.

Hans-Georg

hgmichna’s picture

You already gave the solution to your problem anyway... Just rename one of the themes to zen8 and then you can have them both installed at the same time.

Michelle,

John already mentioned a rename procedure, involving renaming all functions (and all function calls, I presume). That sounded a bit like an untested procedure to me, which involves the risk that it doesn't work, that's why I didn't exactly jump on it. But I'll look at it again when I find the time.

Let me add a more general statement.

The problem of a busy drupal operator is to balance the minimization of effort against the minimization of downtime. Software developers can avoid that dilemma and all responsibility by shifting all the risk and extra effort onto the shoulders of the operator by insisting on the maximum effort way, an extra test installation. They will say, this is best practice, we recommend it, you have to do it, if you don't, it's all your fault, yada, yada, and if an update fails, "See, I told you so."

In practice, depending on downtime tolerance, many operators will, sensibly, not give in and will instead balance and bear risks, because they have the more difficult task of overall optimization.

The ultimate question is whether a Drupal operator is better off running 10 sites at "best practice" or a dozen with a risk of downtime due to update problems. Often the dozen is the better choice overall. I would like all Drupal developers to understand this dilemma and this optimization and take it into account when making design decisions. Making life easier for operators represents economic value. Merely shifting the blame does not.

Hans-Georg

Crell’s picture

Hans, you are also shifting blame. Running two versions of IE on the same computer is quite hard, for good technical reasons. Running two versions of Word on the same computer is quite hard, for good technical reasons. Running two versions of an operating system on one computer is quite hard, for good technical reasons.

Any IT department that manages desktops will have a test system or three for testing any updates extensively on before they even touch deployed desktops. The same logic applies to web sites, no matter how they're built or what software they have. If you don't have a dedicated computer to use for testing, fine. Install XAMPP on your desktop and you're good to go.

As for the oh-so-difficult process of setting up a test site, I recently setup a process for a client to clone a live site to a test install on the same computer (separate domain with different vhost). "Set up" is really a misnomer. It was a copy command and an SQL dump command. About 15 seconds and you have a clone of your live site on which you can test whatever you need. Really, you're overstating the difficulty here. 15 seconds is hardly "maximum effort". If you're a professional web server admin, you should be able to do a copy command and an SQL dump in your sleep. It takes less time than setting up a multi-site. (Having done both, I can say that with confidence.)

Please respect the "won't fix" status on this issue, which means "this is not a problem that is worth addressing because it is a non-issue." The reasons for that have already been extensively explained. Trying to guilt developers into telling you what you want to hear is a waste of your time and ours.

hgmichna’s picture

Crell,

don't worry, I had already accepted that the original issue is dead. My last statement on the tradeoff between developer effort and operator effort was a general one. It was only meant to illuminate that additional developer man-hours can save many operator man-days, when you consider that there are many more operators and installations than developers.

This discussion is now tapering off into an exchange of more general views. I have long accepted the won't fix status. There is no harm in exchanging a few more views here until we, soon, end this thread. Alternatively we could start a forum topic, but I guess there isn't that much more to say here.

Consider that many Drupal installations are not run by IT departments, but by a single operator. Many of these operators are not PHP programmers and have limited experience and knowledge. I am one example. To put it the other way around, the more Drupal is designed to be installed and updated very easily by less experienced operators, the more Drupal installations you will see around the world.

I'm far from being a professional server administrator. I barely know MySQL and know only traces of PHP. I have no IT department behind me. The good thing about Drupal is that I can still install and run even a multi-site installation with good success without the means of an IT department. Updating has now become my main worry of running Drupal.

In my situation, creating a test installation and finding and repairing the error that came with Zen 0.8 requires far more time than 15 seconds, most likely hours or a whole day. Add to that the time to transplant all modifications of sub-themes into the new Zen version. And add the risk that all this may be in vain if I cannot fix it.

I don't know if anybody has good statistics about Drupal installations. I'd be interested in knowing how many of them are run by single, non-professional operators. My guess is, quite a few. I also guess that many Drupal installations are still on version 4. Why is this so? Mainly because updating to 5 is not easy enough. I'm pretty sure, if there were a safe one-button upgrate path, every operator would press that button.

As to shifting the blame, yes, we have a conflict of interest here. The developer wants to implement nice new features and ignore all upgrade problems, because they would cost him extra effort, which is less visible and much less spectacular than new features. The operators have exactly the opposite interest. All I want now is that everybody understands the nature of this tradeoff.

The current developer strategy is to provide new versions and leave the update effort and problems almost entirely to the operators, except for update.php, which is one of the pieces of Drupal which I admire most (except for its strange threat of destruction if run twice in a row). I'm trying to explain that this may not be the optimal strategy, when you compare total developer effort to the overall worldwide success of Drupal. Let me give one example: If Zen had an automatic version upgrade ability with a high success rate, more operators would switch to Zen as their base theme, because it saves them time. And if the whole Drupal had an easy upgrade function, that would attract more CMS operators to Drupal. Upgrading is a major issue.

Hans-Georg

davidlark’s picture

Apologies for bumping a thread this old, and not dissecting the code first.

Wouldn't it be best to look for themes in sites/example.com/themes first, and if it exists, ignore the fact that a theme with the same name also exists in sites/all/themes? In other words, themes specific to a site override themes that are available to all sites. Could work for modules too.

I'm obviously working through a similar issue, although w/ D6.