Problem/Motivation

I got this error after I click the button of "clear all caches" in the config/performance page :

Fatal error: Cannot redeclare statistics_help() (previously declared in /home/abc/123/web/core/modules/statistics/statistics.module:19) in /home/abc/123/web/modules/contrib/statistics/statistics.module on line 17

Steps to reproduce

Proposed resolution

Document how to switch from core to contrib Statistics module in the README, and link to it from the project page.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork statistics-3555899

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

freelylw created an issue. See original summary.

fgm’s picture

This shows you have both the current contrib and legacy core modules enabled.

The fix is disable either or both, then only re-enable the current contrib version. Can you confirm you were able to do that and it fixed your problem ?

fgm’s picture

Category: Bug report » Support request

Also, not a module bug: it's Drupal standard behavior to not allow identically named modules to be enabled.

ressa’s picture

Thanks for maintaining this former Drupal core module @fgm.

I added a new section How to replace a deprecated core module with its contrib version a while ago, to help users transition from Drupal core to the contrib version.

Perhaps modules such as Statistics, Ban, Forum etc. could mention something like this at the top of the project page, and in their README?

How to replace Drupal core Statistic module with this version

After downloading the contrib version of a deprecated core module with Composer, Drupal will automatically use the contrib version. You do not need to delete the deprecated core module. It's because module discovery looks for modules in core/modules last, after all the other possible places that modules can live.

See How to replace a deprecated core module with its contrib version for more details.

Post-Installation

[...]

fgm changed the visibility of the branch 3555899-fatal-error to hidden.

fgm changed the visibility of the branch 3555899-fatal-error to active.

  • fgm committed 9ac77292 on 1.x
    Issue #3555899 by fgm,ressa: Document configuration.
    
fgm’s picture

Title: Fatal error » Fatal error: Cannot redeclare statistics_help()
fgm’s picture

Version: 1.0.0 » 1.x-dev
Status: Active » Fixed

Added a README with the details and updated the help topics page.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ressa’s picture

Thanks @fgm, that will surely help users in the future. Should it be briefly mentioned on the Statistics project page as well, with a link to more details in the README?

Post-Installation

If you are already using the Drupal core Statistics module, please see Replacing the Core Statistics Module.

Once the module is installed, counting is made available to Views, but [...]

fgm’s picture

Good idea, done.

ressa’s picture

Title: Fatal error: Cannot redeclare statistics_help() » Document how to install the Statistics contrib module, and change from core
Component: Miscellaneous » Documentation
Issue summary: View changes

Status: Fixed » Closed (fixed)

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

rajab natshah’s picture

Thank you for this fix.
Hoping for a release

rajab natshah’s picture

Hopping for a tag release.
Thank you :)