Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opensourcelib/eef98634ea73f33e559f to your computer and use it in GitHub Desktop.
Save opensourcelib/eef98634ea73f33e559f to your computer and use it in GitHub Desktop.
Running a Magento Dataflow profile manually
<?php
/*
Author: Tegan Snyder <tsnyder@tegdesign.com>
Example of running a Dataflow profile via command line
you can change the profile_id to the one you want to
run and issue:
time php manual-dataflow-profile.php
note you may need to increase the memory_limit in php cli's php_cli.ini
RHEL linux copy /etc/php.ini to /etc/php_cli.ini and make changes there then restart Apache.
*/
require_once('app/Mage.php');
umask(0);
Mage::app('admin');
$log_file = 'my-manual-run.log'
Mage::log('Dataflow Started', null, $log_file);
$profileId = 21;
Mage::log('profile started: ' . $profileId . ' at ' . date('Y-m-d H:i:s'), null, $log_file);
$profile = Mage::getModel('dataflow/profile');
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
Mage::getSingleton('admin/session')->setUser($userModel);
$profile->load($profileId);
if (!$profile->getId()) {
Mage::log('error: ' . $profileId . ' - incorrect profile id', null, $log_file);
return;
}
Mage::register('current_convert_profile', $profile);
$profile->run();
Mage::log('profile ended: ' . $profileId . ' at ' . date('Y-m-d H:i:s'), null, $log_file);
Mage::log('-----------------------------------', null, $log_file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment