DanielaWaranie DanielaWaranie - 1 year ago 55
PHP Question

Magento CLI install: in table "core_resource" column "data_version" remains null, why?

i try to install Magento 1.5.1 via cli.

As far as i can see all database tables are created with relevant content, but in table

core_resource
i can see the
data_version
comming from sql dir (mysql4-data-upgrade... files) is missing. At all rows in
core_resource
the column
data_version
is null. Why?

CLI is called according to the instructions here:
http://www.magentocommerce.com/wiki/groups/227/command_line_installation_wizard

A
Mage::app()->cleanCache();
after installation do not help.

I can fix this by do a login to the backend SYSTEM / CACHE MANAGEMENT and refreshing of CacheType=CONFIGURATION. But how to do that via cli?

Answer Source

The installer never calles the applyAllDataUpdates() to make the installation complete. Install.php trusts that the magento downloader was used before, which does a call to applyAllDataUpdates().

But in my case i did not use the magento downloader, because i installed a magento instance from a local git repository (for buildserver, dev machine, etc.) via my own ant script. I gussed that the cli install is independend from the downloader (by design) - but here a "hidden" dependency is discovered. Running cli installer alone, setup the extensions without upgrading "data_version".

Normally you can trust in the first http call to the magento frontend / backend, which calls the applyAllDUpdates() and applyAllDataUpdates() if there is a error with the config (in cache), but in this case the cache was created successfull (extension config) by the installer - so no applyAllDataUpdates() is triggered.

I am running unit tests, integration tests and function tests (in that chain) after a build of magento (without using the downloader). I get strange behaviours if "data_version" is not poluted. My solution is to add:

Mage_Core_Model_Resource_Setup::applyAllUpdates();
Mage_Core_Model_Resource_Setup::applyAllDataUpdates();

to the bootstrap of my unit tests.