Question

Currently working on a localization project. I would like to make it easier for the backend developer I'm working with to deploy to staging/production. Thinking about just writing a simple php script to set all the necessary db values via Magento core write method (instead of the traditional adminhtml drudgery)...

Something like:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once('../magento/app/Mage.php');

Mage::app();

$write = Mage::getSingleton('core/resource')->getConnection('core_write');

$write->query(" INSERT INTO table_name (`whatever`, `columns`, `required`)
VALUES  ( 'corresponding', 'db', 'values')" );
?>

Any compelling reason I shouldn't localize a site via this method?

Thanks in advance for any help!

Was it helpful?

Solution

There is one I can think of: Portability.
What if version your code?
Then you have to version this script also, you have to make it not accessible for everyone (except you) so you won't have people finding your script name and calling it from time to time.
If you make a clone of the website you have to run this again, or you have to migrate the db also.

Even if your approach works in the end, having it in a standard install/upgrade script will save you the trouble of checking if the values in your table are there and are correct.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top