Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After updating to Google Analytics 6.x-2.3 through Drush I got this error:
Fatal error: Cannot redeclare googleanalytics_requirements() (previously declared in /path-to-drupal/sites/all/modules/google_analytics/googleanalytics.module:219) in /path-to-drupal/sites/all/modules/google_analytics/googleanalytics.install on line 74
Don't know if it's an isolated error in my installation or a bug, just wanted to share this.
Comment | File | Size | Author |
---|---|---|---|
#25 | drush-921116.patch | 3.31 KB | jonhattan |
Comments
Comment #1
JWinTX CreditAttribution: JWinTX commentedI am getting the exact same error on all 3 of my sites.
Comment #2
dmjossel CreditAttribution: dmjossel commentedSame here.
Comment #3
hass CreditAttribution: hass commentedI will look into it later, but please use 3.0.
Comment #4
hass CreditAttribution: hass commentedThis is a Drush bug. It complains that the hook_requirement function is declared in line 219 and this was the case in GA 2.2, but I have moved the requirement hook in 2.3 to .install file as it need to be. This was not an important GA bug, but it was a minor code change that has been made.
Please change the version number of Drush to your version. I'm only changing the queue now. Also higher the priority as I do not like to get my GA queue flodded with this Drush issue.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedLooks to me like this site has copies of both the old and new code. how could it be drush's fault if a site has duplicate functions?
Comment #6
AdrianB CreditAttribution: AdrianB commentedI had no intention to flood the wrong issue queue, I assumed it was an error in the GA module code and just wanted to report it. Since the error didn't effect anything (afaik) I set it to "minor".
Comment #7
jmuessig CreditAttribution: jmuessig commentedsubscribe
Comment #8
hass CreditAttribution: hass commentedIf 3 people have the same issue I would really wonder if they all have the module twice on their box. I thought that Drush may load the .install before removing the old module directory. Does it really delete the old version and copy than the new version on the box?
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commentedI see what you are saying. There are a lot of permutations for updating modules using drush (i.e. different version control strategies). I do think we have open bugs already here.
Comment #10
Daniel Norton CreditAttribution: Daniel Norton commentedIf you would like to close this as a duplicate, please identify the original.
Comment #11
hass CreditAttribution: hass commentedI've found #781040: Drush is not removing old files when updating modules with svnsync, but i'd like to remark that filenames have not changed in GA 3.0 nor have files removed. I have only moved a few functions from the .module into .install file. To clarify - this cannot be a "leave behind" issue!
Comment #12
jsibley CreditAttribution: jsibley commentedI am by no means an expert, but I solved the problem for my site by:
- checking and saving my google analytics key
- disabling and removing the google analytics module
- downloading the module again using drush
- updating the site using drush (no errors this time)
- enabling the module
- putting back in the correct google analytics key
I have no idea what the cause of the problem is but I had the same error (fatal, in my case) when updating my site and this seems to have taken care of things.
Comment #13
hass CreditAttribution: hass commentedDeleting the old directory and uploading the new version is enough. NO need to disable the module.
Comment #14
selfuntitled CreditAttribution: selfuntitled commentedI can confirm the same problem has consistently come up on all 5 of the sites I manage. Each is a different Drupal install with dramatically different sets of modules on two different web servers.
Initially saw this problem with Drush 3.0rc4 so updated to 3.3 and symptoms didn't change.
I tried deleting the google_analytics folder as suggested above and it did solve the problem... sortof...
Instead I had error come up with the forum_access module - Cannot redeclare forum_access_enable()
I can say for sure that this is not a duplicate of #781040 as none of these sites are managed under SVN Control.
I will test to see if I can reproduce consistently on a clean install using out of date versions of both of these two modules.
Update - just tested on a clean install with only google analytics installed - could not reproduce. I'll keep poking around, see if I can track down some further specifics about what is creating the problem.
Comment #15
hass CreditAttribution: hass commentedMarked #926024: Error updating via Drush as a duplicate. Hell - could not someone of the maintainers repro and FIX this issue, please?
Comment #16
jfine CreditAttribution: jfine commentedSame issue, Drush 3.3. It does appear to be a Drush issue because a quick grep shows the function is only in the install file.
$ grep -ri googleanalytics_requirements httpdocs/
httpdocs/sites/all/modules/google_analytics/googleanalytics.install:function googleanalytics_requirements($phase) {
Drush must load up something prior to updating and somehow it stays in memory when the files are replaced.
If it helps I'm running it via FastCGI on Apache 2.2, PHP 5.2.4.
Comment #17
Cyberwolf CreditAttribution: Cyberwolf commentedSame problem here.
Comment #18
jonhattanProblem is that in the same process updatecode does a full bootstrap (loading .module of 2.2), then download 2.3 and then load .install of 2.3. To avoid this the upgrading should be invoked in a backend process.
Comment #19
moshe weitzman CreditAttribution: moshe weitzman commentedoh damn, this sucks. the backend process is easy to implement but so many people forget to do --php and their systems are setup strangely. This is going to cause even more bug reports.
i do agree that backend is the way to go here.
Comment #20
greg.1.anderson CreditAttribution: greg.1.anderson commentedTo solve #19, please review and commit #918468: drush.ini or php.ini? [Drush should use php.ini files in drush conf folders + some fixes for drush paths that contain spaces], which correctly handles --php for Linux and greatly reduces the need to run drush via an alias. Windows users will need a similar patch for drush.bat.
Comment #21
DamienMcKennaThis would make #855860: Option for pm-update/pm-updatecode to remove existing files before installing new ones easier to implement too.
Comment #22
bjcool CreditAttribution: bjcool commented+
Comment #23
xjmTracking.
Comment #24
moshe weitzman CreditAttribution: moshe weitzman commented#18 is correct. patch welcome.
Comment #25
jonhattanIt was easier than what I figured out at a first glance.
Comment #26
moshe weitzman CreditAttribution: moshe weitzman commentedLooks good to me. If you have tested this, then feel free to commit.
Comment #27
jonhattancommited.
Comment #28
hass CreditAttribution: hass commentedWhen are you going to create a new release?