Skip to content

Instantly share code, notes, and snippets.

@davefreiman
Last active August 29, 2015 14:14
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 davefreiman/dde46d26644472a432a4 to your computer and use it in GitHub Desktop.
Save davefreiman/dde46d26644472a432a4 to your computer and use it in GitHub Desktop.
public function run()
{
if ($this->getArg(0)) {
$profileId = $this->getArg(0);
}
if (isset($profileId)){
$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::getSingleton('adminhtml/session')->addError('ERROR: Incorrect profile id');
}
Mage::register('current_convert_profile', $profile);
$profile->run();
$batchModel = Mage::getSingleton('dataflow/batch');
echo "EXPORT COMPLETE. BATCHID: " . $batchModel->getId();
}
else {
echo $this->usageHelp();
}
}
/**
* Retrieve Usage Help Message
*
*/
public function usageHelp()
{
return <<<USAGE
Usage: php dataflow_export.php -- [profile_id]
profile_id Specified dataflow profile to run
USAGE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment