Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Upgrade problem with core.init listeners #523

phaidon opened this Issue · 11 comments

3 participants


How to reproduce it:

  1. Install a module module with a core.init listener e.g. Scribite.

  2. Upgrade the module to a new version.

If the new version has a new column in a database and this database is used in the core.init the page wont load anymore:

Uncaught exception SQLSTATE[42S22]: Column not found: 1054 Unknown column ...

The solution is not to load core.init listeners of modules with has the state "New version available".


Are you sure this isnt an implementation issue in Scribite?


You can also do it in a core.listener. For example:

class LuMicuLa_Listeners
     * Event listener for 'core.postinit' event.
     * @param Zikula_Event $event
     * @return void
    public static function coreinit(Zikula_Event $event)
        $modinfo1 = ModUtil::getInfoFromName('LuMicuLa');
        $modinfo2 = LuMicuLa_Version::getMetaData();

        if ($modinfo1['version'] != $modinfo2['version']) {

But it is not a very elegant solution to put this code in every core listener.


By the way why doctrine errors have always to break the homepage. If it would just send an error message this issue would not be a big deal.



What should be do with that? I see different possibilities:

  1. We let the this in the modules. This means, that all modules with this problem need their own workaround.

  2. We add a check in the lister loader, which just loads listeners if the hard coded module version (e.g. 1.2.2) number and the installed module version number in the database are identical.

  3. Or we disable in the admin area, that Zikula "dies" if there is a doctrine error. (but I am not sure if this is possible)


@drak ping

@phaidon phaidon was assigned

This is probably a wider issue with all event listeners that would eventually be solved by Dependency Injection (if I understand it correctly). But currently, since the event listeners are stored in the database, they are called regardless of the status of the module. This is obviously flawed logic - if the module status is 'unavailable' then the related listeners should not be processed. a simple ModUtil::available() call in the right place should solve this right?

ping @drak

@craigh craigh referenced this issue

1.4.0 Release task list #1540

16 of 23 tasks complete

in the loadPersistentEvents() method does check for ModUtil::available()... so it seems that is not the problem....


I guess the listeners are executed before the extensions module can update the module's state to unavailable, then the page breaks.

@craigh craigh referenced this issue from a commit in craigh/core
@craigh craigh check for callable on event listeners. refs #523 863de0e

The commit there refs my amended issue to this ticket, but doesn't really solve the problem as originally stated in the ticket.

I guess the listeners are executed before the extensions module can update the module's state to unavailable, then the page breaks.

@cmfcmf - can you track down where that happens?


After some discussion with @drak, this issue is not solvable at the core level. The module must solve this on it's own. So @phaidon , this means solution 1 for you. The problem is that module state is not modified every page load. So, checking for ModUtil::available() will return STATUS_ACTIVE even when it is not. At least that's what happens as far as I can see.

The real solution is to convert the module to use Dependency Injection instead of the current (admittedly flawed) system. But you could hack around it using your solution 1 above.

ftr, Scribite eliminated the use of this event in the current version, so it is no longer an issue there.

If you have ideas for a better solution, feel free to reopen the ticket.

@craigh craigh closed this
@shefik shefik referenced this issue from a commit
@shefik shefik Merge branch '1.3' of into 1.3
# By Craig Heydenburg (37) and others
# Via Drak (33) and Shefik (1)
* '1.3' of (77 commits)
  Correcting comments.
  Switching to “AccessDeniedException”.
  Added legacy layer to ModuleStateEvent.
  Correcting typo and setting NULL value.
  Default date should be NULL, to avoid having the end user submit unintended value.
  Migrating from core.
  Make controller resolving working for old base classes, added example routes to Users and Acme modules.
  Fix constructor
  Allow modules to upgrade from old style to ns-style modules using 'oldnames' array key. Correct querymanager build and format.
  add class_exists check also
  don't show fieldset if there are no contents.
  check for proper inheritance before attaching event listener class
  check for callable on event listeners. refs #523
  improve dependency injection doc
  accomodate "international" input. refs craigh/Tag#19
  update all the timepicker files and adjust template plugin to match
  more fix for the form category selector
  Longer length fields
  Remove unnecessary comment.
  Fix search replace error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.