Hello!

I installed omega on a clean fresh installed drupal and made a subtheme:

drush omega-wizard
Please enter the name of the new sub-theme [Omega Subtheme]: test
Please enter a machine-readable name for your new theme [test]: test
Please choose a base theme for your new theme
[0]  :  Cancel
[1]  :  Omega 
1
Please choose a starterkit for your new theme
[0]  :  Cancel
[1]  :  Extended: This is a short description for the Extended starterkit. (Provided by Omega)
[2]  :  Default: This is a short description for the Default starterkit. (Provided by Omega)  
1
Please choose a destination. This is where your sub-theme will be placed
Please choose a destination type.
[0]  :  Cancel
[1]  :  Site (e.g. 'all' or 'example.com')
[2]  :  Installation profile
[3]  :  Parent theme                      
1
Please choose a site.
[0]  :  Cancel
[1]  :  all   
1
Do you want to keep the starterkit's readme files? (y/n): y
Do you want to enable your new theme? (y/n): y
Do you want to make your new theme the default theme? (y/n): y
You have successfully created the theme test (test) in sites/all/themes. 

When I try to execute some drush commands after setting the newly build omegasubtheme as default I get

drush cc
Drush command terminated abnormally due to an unrecoverable error.                                                                                      [error]
Error: Cannot redeclare omega_theme_get_setting() (previously declared in
.../sites/all/themes/omega/includes/omega.inc:35) in
.../sites/all/themes/omega/includes/omega.inc, line 59
Fatal error: Cannot redeclare omega_theme_get_setting() (previously declared in .../sites/all/themes/omega/includes/omega.inc:35) in .../sites/all/themes/omega/includes/omega.inc on line 59

Any idea to solve that problem would be great.

Thanks, Marc

Files: 
CommentFileSizeAuthor
#20 1993202-20.patch19.67 KBfubhy
Test request sent.
[ View ]

Comments

Status:Active» Postponed (maintainer needs more info)

Do you have Omega Tools or a stale Omega 3.x lying around somewhere?

Hello!

There is no Omega Tools or Omega 3.x in that installation.
I just made a clean installation, because I read about problems with Omega 4.x and Omega Tools
Something like "can't find Omega basetheme" happened, as I tried to install Omega 4.x in my Development installation with Omega Tools and many other modules enabled.
Therefor I tried Omega 4.x in a clean installation, just to exclude incompatibilities with other modules.

Version:7.x-4.0-beta4» 7.x-4.x-dev

Do you have some sort of APC caching installed on your server that might be causing this? Also, please always test with Omega 4.x-dev at this point in the release cycle. That version has the latest fixes. Although this does not seem to be Omega but some other code trying to include Omega twice for some reason.

Try "drush cc drush" to clear your drush cache. Maybe Omega Tools/Omega 3.x is still in there.

APC or any other caching is turned off.

The latest dev is 7.x-4.0-beta3+16-dev dated from 2013-Jun-07, while 7.x-4.0-beta4 is from 2013-Jun-09. So the beta might be newer, I think.

I also tried git clone and the newest core dev.

drush cc drush brings the error above, with omega or subtheme set as default theme.
I switched back to bartik and the cleaned caches. After switching back to any omega 4 theme, the error is the same, when I try to execute some drush.

Fatal error: Cannot redeclare omega_theme_get_setting() (previously declared in /Users/marc/Sites/localhost/omegatest/sites/all/themes/omega/includes/omega.inc:35) in /users/marc/sites/localhost/omegatest/sites/all/themes/omega/includes/omega.inc on line 59

It's exactly the same file....

line 35 is:

<?php
function omega_theme_get_setting($setting_name, $default = NULL, $theme = NULL) {
?>

and line 59 is the closing bracket for exactly the same function.

What version of drush are you using? Does the subtheme work in the browser or does it lead to the same error? Try to upgrade to the latest drush version.

I used drush 5.8 and updated to 5.9
It's exactly the same error.

In the browser, there are no errors. It's also possible to clean caches from there.

I just testet omega 4 and drush 5.8 on my prod. server and I had no problems and errors.

So the problem must be on my local server.

Status:Postponed (maintainer needs more info)» Closed (cannot reproduce)

Yeah. Has to be. I really don't know what's wrong then. But I've not seen this error with 4.x so far I think. Please check your local setup for any odd things going on. Sorry

Thanks a lot!
I need to investigate what's wrong on my local system.

I am also getting this error.

Under sites/all/themes/, I have omega-7.x-4.0-beta4.

Under sites/mysite/themes/, I have an older omega sub-theme along with its parent theme, omega-7.x-3.1. When I am in this site folder, I can't use any drush commands without getting this error:

PHP Fatal error: Cannot redeclare omega_theme_get_setting() (previously declared in /home/drupal/7/sites/all/themes/omega/includes/omega.inc:35) in /home/drupal/7/sites/mysite.org/themes/omega/omega/includes/omega.inc on line 29
Drush command terminated abnormally due to an unrecoverable error.
Error: Cannot redeclare omega_theme_get_setting() (previously declared in /home/drupal/7/sites/all/themes/omega/includes/omega.inc:35) in /home/drupal/drupal7/sites/mysite.org/themes/omega/omega/includes/omega.inc, line 29

The v3 & v4 versions have got to be able to co-exist because it's not a simple matter to upgrade my v3 sites. For now, I'm renaming omega_theme_get_setting() to omega3_theme_get_setting() in the v3 versions. This fixes the problem.

Thanks for your comment!

In my case there is no Omega 3.x in any subsite, because it's a clean installation with only Omega 4.x and a Omega subtheme installed at site/all/themes.

But in my local environment are other drupal installations with omega 3.x installed, but that installations should not have any influence on the clean drupal with omega 4.x installed.

So, that error is absolutely confusing to me. :(

I am also receiving this error after cloning a site from Pantheon and then using the wizard to create a sub theme.

I am using MAMP

I'm using MAMP, too.

So, what's your Version of MAMP and PHP?
The solution might be to change MAMP version.
On my ubuntu prod. Server I don't have that error and I can't remember that error before updating MAMP.

I fixed it! :D

The solution was simple but absolutely stupid and has nothing to do with Omega.

The solution:
I'm on OSX and the path to my drupal installations is Users/name/Sites/...
In OSX Terminal the path was users/name/sites/... when I executed any drush commands.

So... for everyone who is on OSX and gets some kind of "Can not redeclare" errors when trying to use drush commands, check your path.

Thanks for your helps!
I'm happy now :)

What did u do to fix this ?

If your drupal installations are in a path like /Users/name/Sites you just need to check if you payed attention for case sensitive letters when you navigate to that path in the OSX terminal.

e.g. cd /Users/name/Sites with upper case U and S
instead of cd users/name/sites

For OSX it seems to be the same, but not for drush.

I resolved it by disabling omega theme

Status:Closed (cannot reproduce)» Active

Someone else has been posting about the same problem over at #2034527: Omega 4 breaks Drush... Wondering where this problem comes from. It must be something with the system setup / php-cli / drush version, whatever. I can't reproduce it at all.

I resolved it by disabling omega theme

Yeah, umh, that's not a solution :P

I can confirm this bug and also that the solution provided by dasmoermel in #15 works.

When navigating to my sites root in terminal like: cd ~/sites/omega-testing I get the error (actual path is ~/Sites/omega-testing)

If I use my drush alias which has the path with correct capitalisations the errors don't output.

Priority:Normal» Major

This is a Bug somewhere outside omega and probalbly even something outside of Drupal related to CLI. We can add a wirkaround here though.

Status:Active» Needs review
StatusFileSize
new19.67 KB
Test request sent.
[ View ]

Does this work for you guys?

Status:Needs review» Fixed

Verified that this works at least for my co-worker.

Committed to 4.x-dev

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

I am finding this problem with the full release 7.x-4.0.

Likewise using OSX and workaround at #15 works for me. Is the commit at #21 in the full release or should I check dev?

The patch you see in #21 is from Drupal 8 Core and was just accidently uploaded to this issue :P.

We can't do anything about this on the Omega side though. Repeat: This is not a Omega bug! Please file an Issue for Drush if you keep getting this error or changing your directory names.

#15 fixes it for me too, thanks. I had one capital letter in path that I missed out.

Title:Error: Cannot redeclare omega_theme_get_setting()Error: Cannot redeclare omega_theme_get_setting()-Resolution
Version:7.x-4.x-dev» 7.x-4.0
Component:Code» Drush Integration

Thanks--
This (#15) resolved the issue for me. Since Fubhy had suggested reporting the bug to Drush, I already submitted a bug ticket regarding this in their GitHub repository.

Using Mac OSX too, #15 didn't make any difference for me, disabling my subtheme to use drush currently.

fubhy,
I just received this error tonight while setting up a fresh drupal install.

At first I used the recommended "drush dl omega" while in /sites/all/themes folder. Omega wasn't there. I then manually placed omega (and ohm) in the folder, owiz'ed my sub-theme, set it up and tried to "omega-export" and received this error.

I looked for a reason for a while until finally I went to home/.drush. Omega and Ohm folders were there (I assume from my original drush attempt). I deleted these folders and the error disappeared.
There may be another issue why "drush dl omega" didn't work. (I haven't looked here). But is it possible there's a problem with that command and that's what caused the error?

Cheers
Michael

This might very well be related to the latest drupal.org changes (Upgrade to D7). Some drush dl weirdness has been reported since. Thanks for mentioning and posting this here. Might be helpful for others who encounter the same problem.

I'm experiencing the same problem on osX.

I made an omega sub theme and enabled it. Tried to drush dl module and got the same error.

However, when I disable my omega sub theme and omega, the error disappears! Re-enable the sub theme gives me the same error again.

@Rodge
I apologize if you already knew this but...
I had a similar issue unrelated to Omega trying to use the dl command. I instead used: drush en foo-module -y
Since it doesn't find the module locally (duh) it it then asks if you want to dl and enable it. Fixed my issue.
One of the many benefits of sitting through Fuhby's 3 hour Omega4 video. ;-)

I am experiencing this issue also. I have verified that my path is correct so this does not seem to be a case sensitive issue. This appears to be an issue when you have two copies of the omega theme. I have the omega base theme in 2 locations. e.g. site/all/themes/omega and also in sites/mysite/themes/omega. I don't even have my subtheme enabled and I am still getting this error when attempting to clear my site's cache using drush.

Issue summary:View changes
Status:Closed (fixed)» Active

Priority:Major» Minor
Status:Active» Closed (won't fix)

Possibly, yes. At least that sounds like a good explanation for the problem you are having (Omega in two directories). In that case, this is a Drush bug. Please file a bug report against the Drush github issue queue: https://github.com/drush-ops/drush/issues

I can't do anything (legit, as in "non-hacky") to fix this on the side of Omega so the only thing I can do at this point is to direct you to the Drush issue queue, sorry.

I don't even have my subtheme enabled and I am still getting this error when attempting to clear my site's cache using drush.

Yeah. The enabled/disabled states for themes is a lie. It has 0 effect in Drupal 7. And neither Drupal, nor Drush care for it. Which (in Drush's case makes sense, because... Why would it care if even Drupal core itself doesn't?). I hope that this will get fixed in D8, however, in D7 we have to live with the fact that Enabling/Disabling themes essentially makes no difference. The only two settings that matter really are "Which theme is the default theme?" and "Which theme is the admin theme?".

So... Yeah, => Drush issue queue :(.

Im experiencing the same issue. I believe I have set up everything according to the guidelines in Omega 4 and have downloaded the latest version of drush from github. I have managed to create a new subtheme using the drush-owiz command which worked but cannot get any further due to the error below:

I am trying to use drush omega-guard to set up the correct updating of scss files into css files for a drush/Omega 4 installation but receive the following errors:

Error: Cannot redeclare omega_theme_get_setting() (previously
declared in
.../master/sites/all/themes/omega/omega/includes/omega.inc:35)
in
.../master/sites/all/themes/omega/omega/includes/omega.inc,
line 60

I want to use Omega as I like the structure but without this resolution, I will need to find another responsive theme. Any help much appreciated. Is there any workaround to this while a longer term fix is put in place.

Martin

This error only occurs if you have Omega Tools installed which you shouldn't (if you are using Omega 4). Omega itself *never* loads the file (omega.inc) more than once as it exclusively uses 'require_once' to load it whenever needed (making it so that it would never trigger this error).

The other case where this happens is when using Drush with Omega set up in multiple directories (e.g. multisite with Omega 3 and Omega 4 side-by-side). In that case we really can't do anything because that is simply not supported (or it has to be fixed in Drush, not Omega).

To work around it, though, you could simply avoid "drush omega-guard" and instead directly "bundle exec guard" directly (omega-guard is just a wrapper for that command but pipes it through drush so you don't have to navigate to the theme directory.. that's about it). So: Use "bundle exec guard" in your theme's directory instead.

My situation is your second use case: omega 3 and 4 set up in multiple directories. However, just tried your suggestion and it works. Many thanks for your prompt response.

Hi fubhy. Re: #36

I still have the issue that drush is not working at all with Omega enabled but

- Haven't been using Omega Tools
- Do not have more than one instance of Omega, not using multisite either
- Already using bundle exec guard

Wow, yeah, #15 worked for me. That's dumb.

same issues as #9.