1

With a current, vanilla Magento 1.9.1 (CE) or 1.14.1/1.14.2 (EE) what is the first event that can be observed?

  • for the frontend (via /index.php; when the installer did run already)
  • for the frontend, when the installer did not yet run (if it makes a difference)
  • for the adminhtml
  • in cron
  • in webservice API 1
  • in webservice API 2

(this question might be looking for pure facts, but more interesting in the scope of Magento 1 is how to find these events in code)


In process of finding out more, I've collect some web-resources:

2

1 Answer 1

3

It is possible to observe these events yourself as follows:

/app/Mage.php modify the dispatchEvent() function as below:

/**
 * Dispatch event
 *
 * Calls all observer callbacks registered for this event
 * and multiple observers matching event name pattern
 *
 * @param string $name
 * @param array $data
 * @return Mage_Core_Model_App
 */
public static function dispatchEvent($name, array $data = array())
{
    Mage::log($name, null, 'events.log', true); //add this line
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}

Now when you run the page, you'll notice that /var/log/events.log logs every event, in order, when loading whichever page you're interested in observing.

Make sure that this is performed in a staging environment where you are the only person using the site, to ensure you're logging the correct events.

Clean out the log file after observing each page individually so that the first event logged is always the first event fired.

5
  • Nice, I had a similar idea this morning, thanks for sharing the code. So +1 for the moment :) - an adoption could set a static flag and only log the first event into the log so it's easier to review across different requests.
    – hakre
    Commented Apr 28, 2015 at 8:22
  • This is also what Alan Storm suggested in an answer he also puts in there some findings. I'll ran this as well against the current versions later on.
    – hakre
    Commented Apr 29, 2015 at 8:05
  • Please consider accepting the answer if it solved your problem, or provide some further feedback.
    – Moose
    Commented Aug 19, 2015 at 8:22
  • Thanks for the ping. Does the first event differ on pages? Or is it more with cron, adminhtml or frontend?
    – hakre
    Commented Aug 19, 2015 at 10:16
  • After applying these code i got resource_get_tablename as my first event am i write or not?
    – Arjun
    Commented Sep 7, 2016 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.